diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-05-02 10:50:00 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-05-06 20:02:35 +0200 |
commit | 60d1aac8d225e844e68ae48e8f3d58802e635fbe (patch) | |
tree | 922f347dd054db18d88666fad7181e5a777f4022 /deps/v8/test/cctest | |
parent | 73d9c0f903ae371cd5011af64c3a6f69a1bda978 (diff) | |
download | node-new-60d1aac8d225e844e68ae48e8f3d58802e635fbe.tar.gz |
deps: update V8 to 5.8.283.38
PR-URL: https://github.com/nodejs/node/pull/12784
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest')
185 files changed, 11173 insertions, 4880 deletions
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index 54e733c2dc..1cc0f84167 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -60,6 +60,7 @@ v8_executable("cctest") { "compiler/test-run-wasm-machops.cc", "compiler/value-helper.h", "expression-type-collector-macros.h", + "ffi/test-ffi.cc", "gay-fixed.cc", "gay-fixed.h", "gay-precision.cc", @@ -91,12 +92,14 @@ v8_executable("cctest") { "libplatform/test-tracing.cc", "libsampler/test-sampler.cc", "parsing/test-parse-decision.cc", + "parsing/test-preparser.cc", "parsing/test-scanner-streams.cc", "parsing/test-scanner.cc", "print-extension.cc", "print-extension.h", "profiler-extension.cc", "profiler-extension.h", + "scope-test-helper.h", "test-access-checks.cc", "test-accessor-assembler.cc", "test-accessors.cc", @@ -148,6 +151,7 @@ v8_executable("cctest") { "test-liveedit.cc", "test-lockers.cc", "test-log.cc", + "test-managed.cc", "test-mementos.cc", "test-modules.cc", "test-object.cc", @@ -160,7 +164,6 @@ v8_executable("cctest") { "test-representation.cc", "test-sampler-api.cc", "test-serialize.cc", - "test-simd.cc", "test-strings.cc", "test-strtod.cc", "test-symbols.cc", @@ -183,7 +186,7 @@ v8_executable("cctest") { "trace-extension.cc", "trace-extension.h", "types-fuzz.h", - "wasm/test-managed.cc", + "unicode-helpers.h", "wasm/test-run-wasm-64.cc", "wasm/test-run-wasm-asmjs.cc", "wasm/test-run-wasm-interpreter.cc", @@ -192,6 +195,7 @@ v8_executable("cctest") { "wasm/test-run-wasm-relocation.cc", "wasm/test-run-wasm.cc", "wasm/test-wasm-breakpoints.cc", + "wasm/test-wasm-interpreter-entry.cc", "wasm/test-wasm-stack.cc", "wasm/test-wasm-trap-position.cc", "wasm/wasm-run-utils.h", @@ -206,6 +210,7 @@ v8_executable("cctest") { "test-disasm-arm.cc", "test-macro-assembler-arm.cc", "test-run-wasm-relocation-arm.cc", + "test-simulator-arm.cc", "wasm/test-run-wasm-simd.cc", ] } else if (v8_current_cpu == "arm64") { @@ -360,7 +365,12 @@ v8_executable("cctest") { # crbug.com/676417: Suppress symbol import warning from linker. if (is_win && is_component_build) { - ldflags = [ "/ignore:4217" ] + ldflags += [ + "/ignore:4217", + "/ignore:4049", + ] + remove_configs = [ "//build/config/win:default_incremental_linking" ] + configs += [ "//build/config/win:no_incremental_linking" ] } if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" || diff --git a/deps/v8/test/cctest/asmjs/test-asm-typer.cc b/deps/v8/test/cctest/asmjs/test-asm-typer.cc index 892c968d1d..d01260fac2 100644 --- a/deps/v8/test/cctest/asmjs/test-asm-typer.cc +++ b/deps/v8/test/cctest/asmjs/test-asm-typer.cc @@ -45,33 +45,32 @@ class AsmTyperHarnessBuilder { : source_(source), validation_type_(type), handles_(), - zone_(handles_.main_zone()), isolate_(CcTest::i_isolate()), - ast_value_factory_(zone_, isolate_->ast_string_constants(), - isolate_->heap()->HashSeed()), factory_(isolate_->factory()), source_code_( factory_->NewStringFromUtf8(CStrVector(source)).ToHandleChecked()), - script_(factory_->NewScript(source_code_)) { - ParseInfo info(zone_, script_); - info.set_allow_lazy_parsing(false); - info.set_toplevel(true); - info.set_ast_value_factory(&ast_value_factory_); - info.set_ast_value_factory_owned(false); - Parser parser(&info); - - if (!Compiler::ParseAndAnalyze(&info)) { + script_(factory_->NewScript(source_code_)), + info_(script_), + ast_value_factory_(info_.zone(), isolate_->ast_string_constants(), + isolate_->heap()->HashSeed()) { + info_.set_allow_lazy_parsing(false); + info_.set_toplevel(true); + info_.set_ast_value_factory(&ast_value_factory_); + info_.set_ast_value_factory_owned(false); + Parser parser(&info_); + + if (!Compiler::ParseAndAnalyze(&info_)) { std::cerr << "Failed to parse:\n" << source_ << "\n"; CHECK(false); } - outer_scope_ = info.script_scope(); - module_ = info.scope() + outer_scope_ = info_.script_scope(); + module_ = info_.scope() ->declarations() ->AtForTest(0) ->AsFunctionDeclaration() ->fun(); - typer_.reset(new AsmTyper(isolate_, zone_, script_, module_)); + typer_.reset(new AsmTyper(isolate_, zone(), script_, module_)); if (validation_type_ == ValidateStatement || validation_type_ == ValidateExpression) { @@ -104,7 +103,7 @@ class AsmTyperHarnessBuilder { if (var->IsUnallocated()) { var->AllocateTo(VariableLocation::LOCAL, -1); } - auto* var_info = new (zone_) AsmTyper::VariableInfo(type); + auto* var_info = new (zone()) AsmTyper::VariableInfo(type); var_info->set_mutability(AsmTyper::VariableInfo::kLocal); CHECK(typer_->AddLocal(var, var_info)); return this; @@ -116,7 +115,7 @@ class AsmTyperHarnessBuilder { var->AllocateTo(VariableLocation::MODULE, -1); } if (type != nullptr) { - auto* var_info = new (zone_) AsmTyper::VariableInfo(type); + auto* var_info = new (zone()) AsmTyper::VariableInfo(type); var_info->set_mutability(AsmTyper::VariableInfo::kMutableGlobal); CHECK(typer_->AddGlobal(var, var_info)); } @@ -125,12 +124,12 @@ class AsmTyperHarnessBuilder { AsmTyperHarnessBuilder* WithGlobal( VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { - return WithGlobal(var_name, type_creator(zone_)); + return WithGlobal(var_name, type_creator(zone())); } AsmTyperHarnessBuilder* WithUndefinedGlobal( VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { - auto* type = type_creator(zone_); + auto* type = type_creator(zone()); CHECK(type->AsFunctionType() != nullptr || type->AsFunctionTableType() != nullptr); WithGlobal(var_name, type); @@ -157,7 +156,8 @@ class AsmTyperHarnessBuilder { CHECK(false); case AsmTyper::kFFI: stdlib_map = nullptr; - var_info = new (zone_) AsmTyper::VariableInfo(AsmType::FFIType(zone_)); + var_info = + new (zone()) AsmTyper::VariableInfo(AsmType::FFIType(zone())); var_info->set_mutability(AsmTyper::VariableInfo::kImmutableGlobal); break; case AsmTyper::kInfinity: @@ -176,7 +176,7 @@ class AsmTyperHarnessBuilder { } CHECK(var_info != nullptr); - var_info = var_info->Clone(zone_); + var_info = var_info->Clone(zone()); } CHECK(typer_->AddGlobal(var, var_info)); @@ -193,7 +193,7 @@ class AsmTyperHarnessBuilder { AsmTyperHarnessBuilder* WithStdlib(VariableName var_name) { auto* var = DeclareVariable(var_name); auto* var_info = - AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kStdlib); + AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kStdlib); CHECK(typer_->AddGlobal(var, var_info)); return this; } @@ -201,7 +201,7 @@ class AsmTyperHarnessBuilder { AsmTyperHarnessBuilder* WithHeap(VariableName var_name) { auto* var = DeclareVariable(var_name); auto* var_info = - AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kHeap); + AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kHeap); CHECK(typer_->AddGlobal(var, var_info)); return this; } @@ -209,7 +209,7 @@ class AsmTyperHarnessBuilder { AsmTyperHarnessBuilder* WithFFI(VariableName var_name) { auto* var = DeclareVariable(var_name); auto* var_info = - AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kFFI); + AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kFFI); CHECK(typer_->AddGlobal(var, var_info)); return this; } @@ -305,7 +305,7 @@ class AsmTyperHarnessBuilder { } bool ValidateAllStatements(FunctionDeclaration* fun_decl) { - AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); + AsmTyper::FlattenedStatements iter(zone(), fun_decl->fun()->body()); while (auto* curr = iter.Next()) { if (typer_->ValidateStatement(curr) == AsmType::None()) { return false; @@ -315,7 +315,7 @@ class AsmTyperHarnessBuilder { } AsmType* ValidateExpressionStatment(FunctionDeclaration* fun_decl) { - AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); + AsmTyper::FlattenedStatements iter(zone(), fun_decl->fun()->body()); AsmType* ret = AsmType::None(); bool last_was_expression_statement = false; while (auto* curr = iter.Next()) { @@ -337,15 +337,17 @@ class AsmTyperHarnessBuilder { return ret; } + Zone* zone() { return info_.zone(); } + std::string source_; ValidationType validation_type_; HandleAndZoneScope handles_; - Zone* zone_; Isolate* isolate_; - AstValueFactory ast_value_factory_; Factory* factory_; Handle<String> source_code_; Handle<Script> script_; + ParseInfo info_; + AstValueFactory ast_value_factory_; DeclarationScope* outer_scope_; FunctionLiteral* module_; @@ -856,9 +858,10 @@ TEST(ErrorsInFunction) { "}\n", "Undeclared identifier in return statement"}, {"function f() {\n" + " var i = 0;\n" " return i?0:1;\n" "}\n", - "Invalid return type expression"}, + "Type mismatch in return statement"}, {"function f() {\n" " return stdlib.Math.E;" "}\n", diff --git a/deps/v8/test/cctest/ast-types-fuzz.h b/deps/v8/test/cctest/ast-types-fuzz.h index ba6286d54a..c156ec5c75 100644 --- a/deps/v8/test/cctest/ast-types-fuzz.h +++ b/deps/v8/test/cctest/ast-types-fuzz.h @@ -116,6 +116,7 @@ class AstTypes { for (int i = 0; i < 30; ++i) { types.push_back(Fuzz()); } + USE(isolate_); // Currently unused. } Handle<i::Map> object_map; @@ -287,19 +288,6 @@ class AstTypes { } return type; } - case 8: { // simd - static const int num_simd_types = -#define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) +1 - SIMD128_TYPES(COUNT_SIMD_TYPE); -#undef COUNT_SIMD_TYPE - AstType* (*simd_constructors[num_simd_types])(Isolate*, Zone*) = { -#define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) &AstType::Name, - SIMD128_TYPES(COUNT_SIMD_TYPE) -#undef COUNT_SIMD_TYPE - }; - return simd_constructors[rng_->NextInt(num_simd_types)](isolate_, - zone_); - } default: { // union int n = rng_->NextInt(10); AstType* type = None; diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index c987d8d375..e578a7a141 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -30,6 +30,7 @@ #include "include/libplatform/libplatform.h" #include "src/debug/debug.h" +#include "src/objects-inl.h" #include "test/cctest/print-extension.h" #include "test/cctest/profiler-extension.h" #include "test/cctest/trace-extension.h" diff --git a/deps/v8/test/cctest/cctest.gyp b/deps/v8/test/cctest/cctest.gyp index 1eff6c0c6d..93cbf9edcb 100644 --- a/deps/v8/test/cctest/cctest.gyp +++ b/deps/v8/test/cctest/cctest.gyp @@ -81,6 +81,7 @@ 'cctest.cc', 'cctest.h', 'expression-type-collector-macros.h', + 'ffi/test-ffi.cc', 'interpreter/interpreter-tester.cc', 'interpreter/interpreter-tester.h', 'interpreter/source-position-matcher.cc', @@ -112,12 +113,14 @@ 'libplatform/test-tracing.cc', 'libsampler/test-sampler.cc', 'parsing/test-parse-decision.cc', + 'parsing/test-preparser.cc', 'parsing/test-scanner-streams.cc', 'parsing/test-scanner.cc', 'print-extension.cc', 'print-extension.h', 'profiler-extension.cc', 'profiler-extension.h', + 'scope-test-helper.h', 'test-access-checks.cc', 'test-accessor-assembler.cc', 'test-accessors.cc', @@ -168,6 +171,7 @@ 'test-liveedit.cc', 'test-lockers.cc', 'test-log.cc', + 'test-managed.cc', 'test-mementos.cc', 'test-modules.cc', 'test-object.cc', @@ -180,7 +184,6 @@ 'test-representation.cc', 'test-sampler-api.cc', 'test-serialize.cc', - 'test-simd.cc', 'test-strings.cc', 'test-symbols.cc', 'test-strtod.cc', @@ -204,7 +207,7 @@ 'trace-extension.cc', 'trace-extension.h', 'types-fuzz.h', - 'wasm/test-managed.cc', + 'unicode-helpers.h', 'wasm/test-run-wasm.cc', 'wasm/test-run-wasm-64.cc', 'wasm/test-run-wasm-asmjs.cc', @@ -213,6 +216,7 @@ 'wasm/test-run-wasm-module.cc', 'wasm/test-run-wasm-relocation.cc', 'wasm/test-wasm-breakpoints.cc', + 'wasm/test-wasm-interpreter-entry.cc', 'wasm/test-wasm-stack.cc', 'wasm/test-wasm-trap-position.cc', 'wasm/wasm-run-utils.h', @@ -247,6 +251,7 @@ 'test-disasm-arm.cc', 'test-macro-assembler-arm.cc', 'test-run-wasm-relocation-arm.cc', + 'test-simulator-arm.cc', 'wasm/test-run-wasm-simd-lowering.cc' ], 'cctest_sources_arm64': [ ### gcmole(arch:arm64) ### diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index e5ac07cd0e..6994888d73 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -32,6 +32,10 @@ ############################################################################## + # This test is so detailed in it's look at the literals array, I can't + # maintain it until the CL is done. + 'test-heap-profiler/AllocationSitesAreVisible': [FAIL], + # BUG(382): Weird test. Can't guarantee that it never times out. 'test-api/ApplyInterruption': [PASS, TIMEOUT], @@ -102,6 +106,7 @@ 'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]], 'test-strings/StringOOM*': [PASS, ['mode == debug', SKIP]], 'test-serialize/CustomSnapshotDataBlobImmortalImmovableRoots': [PASS, ['mode == debug', SKIP]], + 'test-parsing/ObjectRestNegativeTestSlow': [PASS, ['mode == debug', SKIP]], }], # ALWAYS ############################################################################## @@ -146,6 +151,9 @@ 'test-api/ExternalFloatArray': [SKIP], 'test-api/Float32Array': [SKIP], 'test-api/Float64Array': [SKIP], + + # BUG(v8:5193): Flaky crash. + 'test-sampler/LibSamplerCollectSample': [SKIP], }], # 'arch == arm64 and mode == debug and simulator_run == True' ############################################################################## @@ -210,9 +218,20 @@ # BUG(5193): Flaky timeout. 'test-sampler/LibSamplerCollectSample': [PASS, ['arch == x64', SKIP]], + + # BUG(5920): Flaky crash. + 'test-serialize/PartialSerializerContext': [PASS, ['arch == x64 and mode == debug', SKIP]], }], # 'system == windows' ############################################################################## +['system == macos', { + # BUG(v8:5193) Flaky failures. + 'test-cpu-profiler/FunctionApplySample': [SKIP], + 'test-cpu-profiler/JsNativeJsSample': [SKIP], + 'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [SKIP], +}], # 'system == macos' + +############################################################################## ['arch == arm', { 'test-cpu-profiler/CollectDeoptEvents': [PASS, FAIL], @@ -296,6 +315,10 @@ 'test-gap-resolver/FuzzResolver': [SKIP], 'test-run-wasm/RunWasmCompiled_MultiReturnSelect_f32': [SKIP], 'test-run-wasm/RunWasmCompiled_MultiReturnSelect_f64': [SKIP], + 'test-run-wasm/RunWasmCompiled_SignallingNanSurvivesI32ReinterpretF32': [SKIP], + 'test-run-wasm-64/RunWasmCompiled_SignallingNanSurvivesI64ReinterpretF64': [SKIP], + 'test-run-wasm/RunWasmInterpreted_SignallingNanSurvivesI32ReinterpretF32': [SKIP], + 'test-run-wasm-64/RunWasmInterpreted_SignallingNanSurvivesI64ReinterpretF64': [SKIP], }], # 'arch == x87' ############################################################################## @@ -345,9 +368,6 @@ ['variant == turbofan or variant == ignition_turbofan', { # BUG(4751). Flaky with Ignition. 'test-cpu-profiler/JsNativeJsSample': [SKIP], - - # TODO(vogelheim,5548): Turbofan does support cached accessors. - 'test-api-accessors/CachedAccessorCrankshaft': [FAIL], }], # variant == turbofan or variant == ignition_turbofan ############################################################################## diff --git a/deps/v8/test/cctest/compiler/codegen-tester.cc b/deps/v8/test/cctest/compiler/codegen-tester.cc index 9b5a9d90a2..63b3a3dc64 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.cc +++ b/deps/v8/test/cctest/compiler/codegen-tester.cc @@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" +#include "src/objects-inl.h" +#include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h index 90c32ce99e..ca20e6fb6d 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.h +++ b/deps/v8/test/cctest/compiler/codegen-tester.h @@ -10,6 +10,7 @@ #include "src/compiler/pipeline.h" #include "src/compiler/raw-machine-assembler.h" #include "src/simulator.h" +#include "test/cctest/cctest.h" #include "test/cctest/compiler/call-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc index c88713a6dc..436d46f4cd 100644 --- a/deps/v8/test/cctest/compiler/function-tester.cc +++ b/deps/v8/test/cctest/compiler/function-tester.cc @@ -155,9 +155,8 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph, } Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { - Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); - ParseInfo parse_info(&zone, handle(function->shared())); - CompilationInfo info(&parse_info, function); + ParseInfo parse_info(handle(function->shared())); + CompilationInfo info(parse_info.zone(), &parse_info, function); info.SetOptimizing(); info.MarkAsDeoptimizationEnabled(); @@ -185,9 +184,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(), ZONE_NAME); - ParseInfo parse_info(&zone, handle(function->shared())); - CompilationInfo info(&parse_info, function); + ParseInfo parse_info(handle(function->shared())); + CompilationInfo info(parse_info.zone(), &parse_info, function); CHECK(parsing::ParseFunction(info.parse_info())); info.SetOptimizing(); diff --git a/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc b/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc index 17400abe53..663b66b74d 100644 --- a/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc +++ b/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "src/basic-block-profiler.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" diff --git a/deps/v8/test/cctest/compiler/test-branch-combine.cc b/deps/v8/test/cctest/compiler/test-branch-combine.cc index edaf7b6ac1..ab17ff0992 100644 --- a/deps/v8/test/cctest/compiler/test-branch-combine.cc +++ b/deps/v8/test/cctest/compiler/test-branch-combine.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/value-helper.h" diff --git a/deps/v8/test/cctest/compiler/test-code-assembler.cc b/deps/v8/test/cctest/compiler/test-code-assembler.cc index 90fdc2b7ae..e851f61f8f 100644 --- a/deps/v8/test/cctest/compiler/test-code-assembler.cc +++ b/deps/v8/test/cctest/compiler/test-code-assembler.cc @@ -5,6 +5,7 @@ #include "src/code-factory.h" #include "src/compiler/code-assembler.h" #include "src/isolate.h" +#include "src/objects-inl.h" #include "test/cctest/compiler/code-assembler-tester.h" #include "test/cctest/compiler/function-tester.h" diff --git a/deps/v8/test/cctest/compiler/test-instruction.cc b/deps/v8/test/cctest/compiler/test-instruction.cc index 15749b8950..2d2546690b 100644 --- a/deps/v8/test/cctest/compiler/test-instruction.cc +++ b/deps/v8/test/cctest/compiler/test-instruction.cc @@ -12,6 +12,7 @@ #include "src/compiler/operator.h" #include "src/compiler/schedule.h" #include "src/compiler/scheduler.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" namespace v8 { 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 d8122c4fdb..f3e0ed3bc2 100644 --- a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc +++ b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc @@ -8,6 +8,9 @@ #include "src/compiler/js-operator.h" #include "src/compiler/node-matchers.h" #include "src/compiler/node-properties.h" +#include "src/factory.h" +#include "src/objects-inl.h" +#include "src/property.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 03c4282542..360672c41a 100644 --- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc @@ -264,11 +264,11 @@ TEST(AddNumber1) { TEST(NumberBinops) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), - R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), - R.javascript.Divide(R.binop_hints), R.simplified.NumberDivide(), - R.javascript.Modulus(R.binop_hints), R.simplified.NumberModulus(), + R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), + R.javascript.Subtract(), R.simplified.NumberSubtract(), + R.javascript.Multiply(), R.simplified.NumberMultiply(), + R.javascript.Divide(), R.simplified.NumberDivide(), + R.javascript.Modulus(), R.simplified.NumberModulus(), }; for (size_t i = 0; i < arraysize(kNumberTypes); ++i) { @@ -310,11 +310,11 @@ class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { public: JSBitwiseShiftTypedLoweringTester() : JSTypedLoweringTester() { int i = 0; - set(i++, javascript.ShiftLeft(binop_hints), true); + set(i++, javascript.ShiftLeft(), true); set(i++, simplified.NumberShiftLeft(), false); - set(i++, javascript.ShiftRight(binop_hints), true); + set(i++, javascript.ShiftRight(), true); set(i++, simplified.NumberShiftRight(), false); - set(i++, javascript.ShiftRightLogical(binop_hints), false); + set(i++, javascript.ShiftRightLogical(), false); set(i++, simplified.NumberShiftRightLogical(), false); } static const int kNumberOps = 6; @@ -366,11 +366,11 @@ class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester { public: JSBitwiseTypedLoweringTester() : JSTypedLoweringTester() { int i = 0; - set(i++, javascript.BitwiseOr(binop_hints), true); + set(i++, javascript.BitwiseOr(), true); set(i++, simplified.NumberBitwiseOr(), true); - set(i++, javascript.BitwiseXor(binop_hints), true); + set(i++, javascript.BitwiseXor(), true); set(i++, simplified.NumberBitwiseXor(), true); - set(i++, javascript.BitwiseAnd(binop_hints), true); + set(i++, javascript.BitwiseAnd(), true); set(i++, simplified.NumberBitwiseAnd(), true); } static const int kNumberOps = 6; @@ -899,13 +899,13 @@ TEST(RemovePureNumberBinopEffects) { R.simplified.NumberEqual(), R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), - R.javascript.Subtract(R.binop_hints), + R.javascript.Subtract(), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.binop_hints), + R.javascript.Multiply(), R.simplified.NumberMultiply(), - R.javascript.Divide(R.binop_hints), + R.javascript.Divide(), R.simplified.NumberDivide(), - R.javascript.Modulus(R.binop_hints), + R.javascript.Modulus(), R.simplified.NumberModulus(), R.javascript.LessThan(R.compare_hints), R.simplified.NumberLessThan(), @@ -931,8 +931,8 @@ TEST(OrderNumberBinopEffects1) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), + R.javascript.Subtract(), R.simplified.NumberSubtract(), + R.javascript.Multiply(), R.simplified.NumberMultiply(), }; for (size_t j = 0; j < arraysize(ops); j += 2) { @@ -956,9 +956,9 @@ TEST(OrderNumberBinopEffects2) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), - R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), + R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), + R.javascript.Subtract(), R.simplified.NumberSubtract(), + R.javascript.Multiply(), R.simplified.NumberMultiply(), }; for (size_t j = 0; j < arraysize(ops); j += 2) { diff --git a/deps/v8/test/cctest/compiler/test-jump-threading.cc b/deps/v8/test/cctest/compiler/test-jump-threading.cc index a756254d82..f115989f43 100644 --- a/deps/v8/test/cctest/compiler/test-jump-threading.cc +++ b/deps/v8/test/cctest/compiler/test-jump-threading.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/compiler/instruction.h" #include "src/compiler/instruction-codes.h" +#include "src/compiler/instruction.h" #include "src/compiler/jump-threading.h" +#include "src/source-position.h" #include "test/cctest/cctest.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-linkage.cc b/deps/v8/test/cctest/compiler/test-linkage.cc index fef3415984..aed67b8233 100644 --- a/deps/v8/test/cctest/compiler/test-linkage.cc +++ b/deps/v8/test/cctest/compiler/test-linkage.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/api.h" #include "src/code-factory.h" #include "src/code-stubs.h" #include "src/compilation-info.h" @@ -14,6 +15,7 @@ #include "src/compiler/operator.h" #include "src/compiler/pipeline.h" #include "src/compiler/schedule.h" +#include "src/objects-inl.h" #include "src/parsing/parse-info.h" #include "src/zone/zone.h" #include "test/cctest/cctest.h" @@ -34,7 +36,7 @@ static Handle<JSFunction> Compile(const char* source) { Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, - v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); + v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE); return isolate->factory()->NewFunctionFromSharedFunctionInfo( shared, isolate->native_context()); } @@ -43,8 +45,8 @@ static Handle<JSFunction> Compile(const char* source) { TEST(TestLinkageCreate) { HandleAndZoneScope handles; Handle<JSFunction> function = Compile("a + b"); - ParseInfo parse_info(handles.main_zone(), handle(function->shared())); - CompilationInfo info(&parse_info, function); + ParseInfo parse_info(handle(function->shared())); + CompilationInfo info(parse_info.zone(), &parse_info, function); CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CHECK(descriptor); } @@ -59,8 +61,8 @@ 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(), handle(function->shared())); - CompilationInfo info(&parse_info, function); + ParseInfo parse_info(handle(function->shared())); + CompilationInfo info(parse_info.zone(), &parse_info, function); CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CHECK(descriptor); @@ -75,8 +77,8 @@ TEST(TestLinkageJSFunctionIncoming) { TEST(TestLinkageJSCall) { HandleAndZoneScope handles; Handle<JSFunction> function = Compile("a + c"); - ParseInfo parse_info(handles.main_zone(), handle(function->shared())); - CompilationInfo info(&parse_info, function); + ParseInfo parse_info(handle(function->shared())); + CompilationInfo info(parse_info.zone(), &parse_info, function); for (int i = 0; i < 32; i++) { CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( 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 b70df3563c..eaf972d0c8 100644 --- a/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc @@ -33,8 +33,8 @@ 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(), handle(function->shared())); - CompilationInfo info(&parse_info, function); + ParseInfo parse_info(handle(function->shared())); + CompilationInfo info(parse_info.zone(), &parse_info, function); CHECK(parsing::ParseFunction(&parse_info)); CHECK(Rewriter::Rewrite(&parse_info)); diff --git a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc index 15bd72c4d4..b146080618 100644 --- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc +++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc @@ -8,6 +8,7 @@ #include "src/compiler/machine-operator-reducer.h" #include "src/compiler/operator-properties.h" #include "src/compiler/typer.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index 39824b5155..2ab5050c99 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -13,6 +13,7 @@ #include "src/compiler.h" #include "src/compiler/linkage.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/value-helper.h" diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc index c8519faeb5..94bd460850 100644 --- a/deps/v8/test/cctest/compiler/test-representation-change.cc +++ b/deps/v8/test/cctest/compiler/test-representation-change.cc @@ -4,14 +4,14 @@ #include <limits> +#include "src/compiler/node-matchers.h" +#include "src/compiler/representation-change.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/graph-builder-tester.h" #include "test/cctest/compiler/value-helper.h" -#include "src/compiler/node-matchers.h" -#include "src/compiler/representation-change.h" - namespace v8 { namespace internal { namespace compiler { 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 ea7fcd6449..b21447ef30 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 @@ -74,9 +74,9 @@ class BytecodeGraphCallable { class BytecodeGraphTester { public: - BytecodeGraphTester(Isolate* isolate, Zone* zone, const char* script, + BytecodeGraphTester(Isolate* isolate, const char* script, const char* filter = kFunctionName) - : isolate_(isolate), zone_(zone), script_(script) { + : isolate_(isolate), script_(script) { i::FLAG_ignition = true; i::FLAG_always_opt = false; i::FLAG_allow_natives_syntax = true; @@ -108,7 +108,6 @@ class BytecodeGraphTester { private: Isolate* isolate_; - Zone* zone_; const char* script_; Handle<JSFunction> GetFunction(const char* functionName) { @@ -123,9 +122,9 @@ class BytecodeGraphTester { // TODO(mstarzinger): We should be able to prime CompilationInfo without // having to instantiate a ParseInfo first. Fix this! - ParseInfo parse_info(zone_, handle(function->shared())); + ParseInfo parse_info(handle(function->shared())); - CompilationInfo compilation_info(&parse_info, function); + CompilationInfo compilation_info(parse_info.zone(), &parse_info, function); compilation_info.SetOptimizing(); compilation_info.MarkAsDeoptimizationEnabled(); compilation_info.MarkAsOptimizeFromBytecode(); @@ -187,7 +186,6 @@ struct ExpectedSnippet { TEST(BytecodeGraphBuilderReturnStatements) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -212,7 +210,7 @@ TEST(BytecodeGraphBuilderReturnStatements) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -223,7 +221,6 @@ TEST(BytecodeGraphBuilderReturnStatements) { TEST(BytecodeGraphBuilderPrimitiveExpressions) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -239,7 +236,7 @@ TEST(BytecodeGraphBuilderPrimitiveExpressions) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -250,7 +247,6 @@ TEST(BytecodeGraphBuilderPrimitiveExpressions) { TEST(BytecodeGraphBuilderTwoParameterTests) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<2> snippets[] = { @@ -297,7 +293,7 @@ TEST(BytecodeGraphBuilderTwoParameterTests) { SNPrintF(script, "function %s(p1, p2) { %s }\n%s(0, 0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0), snippets[i].parameter(1)) @@ -310,7 +306,6 @@ TEST(BytecodeGraphBuilderTwoParameterTests) { TEST(BytecodeGraphBuilderNamedLoad) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -341,7 +336,7 @@ TEST(BytecodeGraphBuilderNamedLoad) { SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -353,7 +348,6 @@ TEST(BytecodeGraphBuilderNamedLoad) { TEST(BytecodeGraphBuilderKeyedLoad) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<2> snippets[] = { @@ -397,7 +391,7 @@ TEST(BytecodeGraphBuilderKeyedLoad) { SNPrintF(script, "function %s(p1, p2) { %s };\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0), snippets[i].parameter(1)) @@ -409,7 +403,6 @@ TEST(BytecodeGraphBuilderKeyedLoad) { void TestBytecodeGraphBuilderNamedStore(size_t shard) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -447,7 +440,7 @@ void TestBytecodeGraphBuilderNamedStore(size_t shard) { SNPrintF(script, "function %s(p1) { %s };\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -460,7 +453,6 @@ SHARD_TEST_BY_2(BytecodeGraphBuilderNamedStore) void TestBytecodeGraphBuilderKeyedStore(size_t shard) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<2> snippets[] = { @@ -506,7 +498,7 @@ void TestBytecodeGraphBuilderKeyedStore(size_t shard) { SNPrintF(script, "function %s(p1, p2) { %s };\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -519,7 +511,6 @@ SHARD_TEST_BY_2(BytecodeGraphBuilderKeyedStore) TEST(BytecodeGraphBuilderPropertyCall) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -541,7 +532,7 @@ TEST(BytecodeGraphBuilderPropertyCall) { SNPrintF(script, "function %s(p1) { %s };\n%s({func() {}});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -553,7 +544,6 @@ TEST(BytecodeGraphBuilderPropertyCall) { TEST(BytecodeGraphBuilderCallNew) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -580,7 +570,7 @@ TEST(BytecodeGraphBuilderCallNew) { }; for (size_t i = 0; i < arraysize(snippets); i++) { - BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); + BytecodeGraphTester tester(isolate, snippets[i].code_snippet); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -591,7 +581,6 @@ TEST(BytecodeGraphBuilderCallNew) { TEST(BytecodeGraphBuilderCreateClosure) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -618,7 +607,7 @@ TEST(BytecodeGraphBuilderCreateClosure) { }; for (size_t i = 0; i < arraysize(snippets); i++) { - BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); + BytecodeGraphTester tester(isolate, snippets[i].code_snippet); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -629,7 +618,6 @@ TEST(BytecodeGraphBuilderCreateClosure) { TEST(BytecodeGraphBuilderCallRuntime) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -645,7 +633,7 @@ TEST(BytecodeGraphBuilderCallRuntime) { }; for (size_t i = 0; i < arraysize(snippets); i++) { - BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); + BytecodeGraphTester tester(isolate, snippets[i].code_snippet); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -656,7 +644,6 @@ TEST(BytecodeGraphBuilderCallRuntime) { TEST(BytecodeGraphBuilderInvokeIntrinsic) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -667,7 +654,7 @@ TEST(BytecodeGraphBuilderInvokeIntrinsic) { }; for (size_t i = 0; i < arraysize(snippets); i++) { - BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); + BytecodeGraphTester tester(isolate, snippets[i].code_snippet); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -678,7 +665,6 @@ TEST(BytecodeGraphBuilderInvokeIntrinsic) { void TestBytecodeGraphBuilderGlobals(size_t shard) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -717,7 +703,7 @@ void TestBytecodeGraphBuilderGlobals(size_t shard) { for (size_t i = 0; i < arraysize(snippets); i++) { if ((i % 2) != shard) continue; - BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); + BytecodeGraphTester tester(isolate, snippets[i].code_snippet); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -734,7 +720,6 @@ TEST(BytecodeGraphBuilderToObject) { TEST(BytecodeGraphBuilderToName) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -767,7 +752,7 @@ TEST(BytecodeGraphBuilderToName) { SNPrintF(script, "function %s() { %s }\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -778,7 +763,6 @@ TEST(BytecodeGraphBuilderToName) { TEST(BytecodeGraphBuilderLogicalNot) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -798,7 +782,7 @@ TEST(BytecodeGraphBuilderLogicalNot) { SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -810,7 +794,6 @@ TEST(BytecodeGraphBuilderLogicalNot) { TEST(BytecodeGraphBuilderTypeOf) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -835,7 +818,7 @@ TEST(BytecodeGraphBuilderTypeOf) { SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -847,7 +830,6 @@ TEST(BytecodeGraphBuilderTypeOf) { TEST(BytecodeGraphBuilderCountOperation) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -889,7 +871,7 @@ TEST(BytecodeGraphBuilderCountOperation) { SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -901,7 +883,6 @@ TEST(BytecodeGraphBuilderCountOperation) { TEST(BytecodeGraphBuilderDelete) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -928,7 +909,7 @@ TEST(BytecodeGraphBuilderDelete) { SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -940,7 +921,6 @@ TEST(BytecodeGraphBuilderDelete) { TEST(BytecodeGraphBuilderDeleteGlobal) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -981,7 +961,7 @@ TEST(BytecodeGraphBuilderDeleteGlobal) { ScopedVector<char> script(1024); SNPrintF(script, "%s %s({});", snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -992,7 +972,6 @@ TEST(BytecodeGraphBuilderDeleteGlobal) { TEST(BytecodeGraphBuilderDeleteLookupSlot) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); // TODO(mythria): Add more tests when we have support for LdaLookupSlot. @@ -1018,7 +997,7 @@ TEST(BytecodeGraphBuilderDeleteLookupSlot) { SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet, function_epilogue); - BytecodeGraphTester tester(isolate, zone, script.start(), "t"); + BytecodeGraphTester tester(isolate, script.start(), "t"); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1029,7 +1008,6 @@ TEST(BytecodeGraphBuilderDeleteLookupSlot) { TEST(BytecodeGraphBuilderLookupSlot) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); const char* function_prologue = "var f;" @@ -1059,7 +1037,7 @@ TEST(BytecodeGraphBuilderLookupSlot) { SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet, function_epilogue); - BytecodeGraphTester tester(isolate, zone, script.start(), "t"); + BytecodeGraphTester tester(isolate, script.start(), "t"); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1069,7 +1047,6 @@ TEST(BytecodeGraphBuilderLookupSlot) { TEST(BytecodeGraphBuilderLookupContextSlot) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); // Testing with eval called in the current context. @@ -1087,7 +1064,7 @@ TEST(BytecodeGraphBuilderLookupContextSlot) { inner_eval_prologue, inner_eval_snippets[i].code_snippet, inner_eval_epilogue, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*inner_eval_snippets[i].return_value())); @@ -1109,7 +1086,7 @@ TEST(BytecodeGraphBuilderLookupContextSlot) { outer_eval_prologue, outer_eval_snippets[i].code_snippet, outer_eval_epilogue, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*outer_eval_snippets[i].return_value())); @@ -1119,7 +1096,6 @@ TEST(BytecodeGraphBuilderLookupContextSlot) { TEST(BytecodeGraphBuilderLookupGlobalSlot) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); // Testing with eval called in the current context. @@ -1137,7 +1113,7 @@ TEST(BytecodeGraphBuilderLookupGlobalSlot) { inner_eval_prologue, inner_eval_snippets[i].code_snippet, inner_eval_epilogue, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*inner_eval_snippets[i].return_value())); @@ -1159,7 +1135,7 @@ TEST(BytecodeGraphBuilderLookupGlobalSlot) { outer_eval_prologue, outer_eval_snippets[i].code_snippet, outer_eval_epilogue, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*outer_eval_snippets[i].return_value())); @@ -1169,7 +1145,6 @@ TEST(BytecodeGraphBuilderLookupGlobalSlot) { TEST(BytecodeGraphBuilderLookupSlotWide) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); const char* function_prologue = @@ -1201,7 +1176,7 @@ TEST(BytecodeGraphBuilderLookupSlotWide) { SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet, function_epilogue); - BytecodeGraphTester tester(isolate, zone, script.start(), "t"); + BytecodeGraphTester tester(isolate, script.start(), "t"); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1212,7 +1187,6 @@ TEST(BytecodeGraphBuilderLookupSlotWide) { TEST(BytecodeGraphBuilderCallLookupSlot) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<0> snippets[] = { {"g = function(){ return 2 }; eval(''); return g();", @@ -1230,7 +1204,7 @@ TEST(BytecodeGraphBuilderCallLookupSlot) { ScopedVector<char> script(1024); SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1241,7 +1215,6 @@ TEST(BytecodeGraphBuilderCallLookupSlot) { TEST(BytecodeGraphBuilderEval) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -1282,7 +1255,7 @@ TEST(BytecodeGraphBuilderEval) { ScopedVector<char> script(1024); SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1293,7 +1266,6 @@ TEST(BytecodeGraphBuilderEval) { TEST(BytecodeGraphBuilderEvalParams) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<1> snippets[] = { {"var x = 10; return eval('x + p1;');", @@ -1310,7 +1282,7 @@ TEST(BytecodeGraphBuilderEvalParams) { ScopedVector<char> script(1024); SNPrintF(script, "function %s(p1) { %s }\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -1322,7 +1294,6 @@ TEST(BytecodeGraphBuilderEvalParams) { TEST(BytecodeGraphBuilderEvalGlobal) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -1338,7 +1309,7 @@ TEST(BytecodeGraphBuilderEvalGlobal) { }; for (size_t i = 0; i < arraysize(snippets); i++) { - BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); + BytecodeGraphTester tester(isolate, snippets[i].code_snippet); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1400,7 +1371,6 @@ const char* get_code_snippet(Token::Value opcode) { TEST(BytecodeGraphBuilderCompare) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); Handle<Object> lhs_values[] = { factory->NewNumberFromInt(10), factory->NewHeapNumber(3.45), @@ -1419,7 +1389,7 @@ TEST(BytecodeGraphBuilderCompare) { SNPrintF(script, "function %s(p1, p2) { %s }\n%s({}, {});", kFunctionName, get_code_snippet(kCompareOperators[i]), kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); for (size_t j = 0; j < arraysize(lhs_values); j++) { for (size_t k = 0; k < arraysize(rhs_values); k++) { @@ -1437,7 +1407,6 @@ TEST(BytecodeGraphBuilderCompare) { TEST(BytecodeGraphBuilderTestIn) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<2> snippets[] = { @@ -1473,7 +1442,7 @@ TEST(BytecodeGraphBuilderTestIn) { SNPrintF(script, "function %s(p1, p2) { %s }\n%s({}, {});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0), snippets[i].parameter(1)) @@ -1486,7 +1455,6 @@ TEST(BytecodeGraphBuilderTestIn) { TEST(BytecodeGraphBuilderTestInstanceOf) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -1505,7 +1473,7 @@ TEST(BytecodeGraphBuilderTestInstanceOf) { SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -1516,7 +1484,6 @@ TEST(BytecodeGraphBuilderTestInstanceOf) { TEST(BytecodeGraphBuilderTryCatch) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<0> snippets[] = { {"var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;", @@ -1535,7 +1502,7 @@ TEST(BytecodeGraphBuilderTryCatch) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1545,7 +1512,6 @@ TEST(BytecodeGraphBuilderTryCatch) { TEST(BytecodeGraphBuilderTryFinally1) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<0> snippets[] = { {"var a = 1; try { a = a + 1; } finally { a = a + 2; }; return a;", @@ -1573,7 +1539,7 @@ TEST(BytecodeGraphBuilderTryFinally1) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1583,7 +1549,6 @@ TEST(BytecodeGraphBuilderTryFinally1) { TEST(BytecodeGraphBuilderTryFinally2) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<0, const char*> snippets[] = { {"var a = 1; try { a = 2; throw 23; } finally { a = 3 }; return a;", @@ -1597,7 +1562,7 @@ TEST(BytecodeGraphBuilderTryFinally2) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); v8::Local<v8::String> expected_string = v8_str(snippets[i].return_value()); CHECK( @@ -1609,7 +1574,6 @@ TEST(BytecodeGraphBuilderTryFinally2) { TEST(BytecodeGraphBuilderThrow) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); // TODO(mythria): Add more tests when real try-catch and deoptimization // information are supported. @@ -1626,7 +1590,7 @@ TEST(BytecodeGraphBuilderThrow) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); v8::Local<v8::String> expected_string = v8_str(snippets[i].return_value()); CHECK( @@ -1639,7 +1603,6 @@ TEST(BytecodeGraphBuilderThrow) { TEST(BytecodeGraphBuilderContext) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -1687,7 +1650,7 @@ TEST(BytecodeGraphBuilderContext) { ScopedVector<char> script(1024); SNPrintF(script, "%s", snippets[i].code_snippet); - BytecodeGraphTester tester(isolate, zone, script.start(), "f"); + BytecodeGraphTester tester(isolate, script.start(), "f"); auto callable = tester.GetCallable<>("f"); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1698,7 +1661,6 @@ TEST(BytecodeGraphBuilderContext) { TEST(BytecodeGraphBuilderLoadContext) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -1752,7 +1714,7 @@ TEST(BytecodeGraphBuilderLoadContext) { ScopedVector<char> script(1024); SNPrintF(script, "%s", snippets[i].code_snippet); - BytecodeGraphTester tester(isolate, zone, script.start(), "*"); + BytecodeGraphTester tester(isolate, script.start(), "*"); auto callable = tester.GetCallable<Handle<Object>>("f"); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -1764,7 +1726,6 @@ TEST(BytecodeGraphBuilderLoadContext) { TEST(BytecodeGraphBuilderCreateArgumentsNoParameters) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -1784,7 +1745,7 @@ TEST(BytecodeGraphBuilderCreateArgumentsNoParameters) { ScopedVector<char> script(1024); SNPrintF(script, "%s\n%s();", snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1795,7 +1756,6 @@ TEST(BytecodeGraphBuilderCreateArgumentsNoParameters) { TEST(BytecodeGraphBuilderCreateArguments) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<3> snippets[] = { @@ -1827,7 +1787,7 @@ TEST(BytecodeGraphBuilderCreateArguments) { ScopedVector<char> script(1024); SNPrintF(script, "%s\n%s();", snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>(); Handle<Object> return_value = @@ -1841,7 +1801,6 @@ TEST(BytecodeGraphBuilderCreateArguments) { TEST(BytecodeGraphBuilderCreateRestArguments) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<3> snippets[] = { @@ -1870,7 +1829,7 @@ TEST(BytecodeGraphBuilderCreateRestArguments) { ScopedVector<char> script(1024); SNPrintF(script, "%s\n%s();", snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>(); Handle<Object> return_value = @@ -1884,7 +1843,6 @@ TEST(BytecodeGraphBuilderCreateRestArguments) { TEST(BytecodeGraphBuilderRegExpLiterals) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -1909,7 +1867,7 @@ TEST(BytecodeGraphBuilderRegExpLiterals) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1920,7 +1878,6 @@ TEST(BytecodeGraphBuilderRegExpLiterals) { TEST(BytecodeGraphBuilderArrayLiterals) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -1949,7 +1906,7 @@ TEST(BytecodeGraphBuilderArrayLiterals) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -1960,7 +1917,6 @@ TEST(BytecodeGraphBuilderArrayLiterals) { TEST(BytecodeGraphBuilderObjectLiterals) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2013,7 +1969,7 @@ TEST(BytecodeGraphBuilderObjectLiterals) { ScopedVector<char> script(4096); SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2024,7 +1980,6 @@ TEST(BytecodeGraphBuilderObjectLiterals) { TEST(BytecodeGraphBuilderIf) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -2122,7 +2077,7 @@ TEST(BytecodeGraphBuilderIf) { SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -2134,7 +2089,6 @@ TEST(BytecodeGraphBuilderIf) { TEST(BytecodeGraphBuilderConditionalOperator) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<1> snippets[] = { @@ -2153,7 +2107,7 @@ TEST(BytecodeGraphBuilderConditionalOperator) { SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -2165,7 +2119,6 @@ TEST(BytecodeGraphBuilderConditionalOperator) { TEST(BytecodeGraphBuilderSwitch) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); const char* switch_code = @@ -2201,7 +2154,7 @@ TEST(BytecodeGraphBuilderSwitch) { SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -2212,7 +2165,6 @@ TEST(BytecodeGraphBuilderSwitch) { TEST(BytecodeGraphBuilderSwitchMerge) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); const char* switch_code = @@ -2250,7 +2202,7 @@ TEST(BytecodeGraphBuilderSwitchMerge) { SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0)).ToHandleChecked(); @@ -2261,7 +2213,6 @@ TEST(BytecodeGraphBuilderSwitchMerge) { TEST(BytecodeGraphBuilderNestedSwitch) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); const char* switch_code = @@ -2309,7 +2260,7 @@ TEST(BytecodeGraphBuilderNestedSwitch) { SNPrintF(script, "function %s(p1, p2) { %s };\n%s(0, 0);", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); Handle<Object> return_value = callable(snippets[i].parameter(0), snippets[i].parameter(1)) @@ -2322,7 +2273,6 @@ TEST(BytecodeGraphBuilderNestedSwitch) { TEST(BytecodeGraphBuilderBreakableBlocks) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2352,7 +2302,7 @@ TEST(BytecodeGraphBuilderBreakableBlocks) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2363,7 +2313,6 @@ TEST(BytecodeGraphBuilderBreakableBlocks) { TEST(BytecodeGraphBuilderWhile) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2401,7 +2350,7 @@ TEST(BytecodeGraphBuilderWhile) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2412,7 +2361,6 @@ TEST(BytecodeGraphBuilderWhile) { TEST(BytecodeGraphBuilderDo) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2450,7 +2398,7 @@ TEST(BytecodeGraphBuilderDo) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2461,7 +2409,6 @@ TEST(BytecodeGraphBuilderDo) { TEST(BytecodeGraphBuilderFor) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2544,7 +2491,7 @@ TEST(BytecodeGraphBuilderFor) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2555,7 +2502,6 @@ TEST(BytecodeGraphBuilderFor) { TEST(BytecodeGraphBuilderForIn) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { {"var sum = 0;\n" @@ -2616,7 +2562,7 @@ TEST(BytecodeGraphBuilderForIn) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2627,7 +2573,6 @@ TEST(BytecodeGraphBuilderForIn) { TEST(BytecodeGraphBuilderForOf) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { {" var r = 0;\n" @@ -2709,7 +2654,7 @@ TEST(BytecodeGraphBuilderForOf) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2745,8 +2690,7 @@ void TestJumpWithConstantsAndWideConstants(size_t shard) { HandleAndZoneScope scope; auto isolate = scope.main_isolate(); auto factory = isolate->factory(); - auto zone = scope.main_zone(); - BytecodeGraphTester tester(isolate, zone, script.c_str()); + BytecodeGraphTester tester(isolate, script.c_str()); auto callable = tester.GetCallable<Handle<Object>>(); for (int a = 0; a < 3; a++) { Handle<Object> return_val = @@ -2764,7 +2708,6 @@ TEST(BytecodeGraphBuilderDoExpressions) { FLAG_harmony_do_expressions = true; HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { {"var a = do {}; return a;", {factory->undefined_value()}}, @@ -2782,7 +2725,7 @@ TEST(BytecodeGraphBuilderDoExpressions) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2794,7 +2737,6 @@ TEST(BytecodeGraphBuilderDoExpressions) { TEST(BytecodeGraphBuilderWithStatement) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<0> snippets[] = { {"with({x:42}) return x;", {handle(Smi::FromInt(42), isolate)}}, @@ -2821,7 +2763,7 @@ TEST(BytecodeGraphBuilderWithStatement) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2831,7 +2773,6 @@ TEST(BytecodeGraphBuilderWithStatement) { TEST(BytecodeGraphBuilderConstDeclaration) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2868,7 +2809,7 @@ TEST(BytecodeGraphBuilderConstDeclaration) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2880,7 +2821,7 @@ TEST(BytecodeGraphBuilderConstDeclaration) { SNPrintF(script, "function %s() {'use strict'; %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2890,7 +2831,6 @@ TEST(BytecodeGraphBuilderConstDeclaration) { TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); Factory* factory = isolate->factory(); ExpectedSnippet<0> snippets[] = { @@ -2910,7 +2850,7 @@ TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2922,7 +2862,7 @@ TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) { SNPrintF(script, "function %s() {'use strict'; %s }\n%s();", kFunctionName, snippets[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*snippets[i].return_value())); @@ -2932,7 +2872,6 @@ TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) { TEST(BytecodeGraphBuilderConstInLookupContextChain) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); const char* prologue = "function OuterMost() {\n" @@ -2970,7 +2909,7 @@ TEST(BytecodeGraphBuilderConstInLookupContextChain) { SNPrintF(script, "%s %s %s", prologue, const_decl[i].code_snippet, epilogue); - BytecodeGraphTester tester(isolate, zone, script.start(), "*"); + BytecodeGraphTester tester(isolate, script.start(), "*"); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*const_decl[i].return_value())); @@ -2980,7 +2919,6 @@ TEST(BytecodeGraphBuilderConstInLookupContextChain) { TEST(BytecodeGraphBuilderIllegalConstDeclaration) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); ExpectedSnippet<0, const char*> illegal_const_decl[] = { {"const x = x = 10 + 3; return x;", @@ -3003,7 +2941,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) { SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, illegal_const_decl[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); v8::Local<v8::String> expected_string = v8_str(illegal_const_decl[i].return_value()); @@ -3018,7 +2956,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) { SNPrintF(script, "function %s() {'use strict'; %s }\n%s();", kFunctionName, illegal_const_decl[i].code_snippet, kFunctionName); - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, script.start()); v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); v8::Local<v8::String> expected_string = v8_str(illegal_const_decl[i].return_value()); @@ -3036,7 +2974,6 @@ static void DebugEventCounter(const v8::Debug::EventDetails& event_details) { TEST(BytecodeGraphBuilderDebuggerStatement) { HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - Zone* zone = scope.main_zone(); v8::Debug::SetDebugEventListener(CcTest::isolate(), DebugEventCounter); @@ -3047,7 +2984,7 @@ TEST(BytecodeGraphBuilderDebuggerStatement) { "f();", {isolate->factory()->undefined_value()}}; - BytecodeGraphTester tester(isolate, zone, snippet.code_snippet); + BytecodeGraphTester tester(isolate, snippet.code_snippet); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); diff --git a/deps/v8/test/cctest/compiler/test-run-calls-to-external-references.cc b/deps/v8/test/cctest/compiler/test-run-calls-to-external-references.cc index 0bc6ff3998..efea4ce4cc 100644 --- a/deps/v8/test/cctest/compiler/test-run-calls-to-external-references.cc +++ b/deps/v8/test/cctest/compiler/test-run-calls-to-external-references.cc @@ -2,6 +2,7 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. +#include "src/objects-inl.h" #include "src/wasm/wasm-external-refs.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" diff --git a/deps/v8/test/cctest/compiler/test-run-jsbranches.cc b/deps/v8/test/cctest/compiler/test-run-jsbranches.cc index 502295e471..76cb9a2843 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsbranches.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsbranches.cc @@ -104,70 +104,6 @@ TEST(ForStatement) { T.CheckCall(T.Val("str"), T.Val("str"), T.Val("str")); } - -static void TestForIn(const char* code) { - FunctionTester T(code); - T.CheckCall(T.undefined(), T.undefined()); - T.CheckCall(T.undefined(), T.null()); - T.CheckCall(T.undefined(), T.NewObject("({})")); - T.CheckCall(T.undefined(), T.Val(1)); - T.CheckCall(T.Val("2"), T.Val("str")); - T.CheckCall(T.Val("a"), T.NewObject("({'a' : 1})")); - T.CheckCall(T.Val("2"), T.NewObject("([1, 2, 3])")); - T.CheckCall(T.Val("a"), T.NewObject("({'a' : 1, 'b' : 1})"), T.Val("b")); - T.CheckCall(T.Val("1"), T.NewObject("([1, 2, 3])"), T.Val("2")); -} - - -TEST(ForInStatement) { - // Variable assignment. - TestForIn( - "(function(a, b) {" - "var last;" - "for (var x in a) {" - " if (b) { delete a[b]; b = undefined; }" - " last = x;" - "}" - "return last;})"); - // Indexed assignment. - TestForIn( - "(function(a, b) {" - "var array = [0, 1, undefined];" - "for (array[2] in a) {" - " if (b) { delete a[b]; b = undefined; }" - "}" - "return array[2];})"); - // Named assignment. - TestForIn( - "(function(a, b) {" - "var obj = {'a' : undefined};" - "for (obj.a in a) {" - " if (b) { delete a[b]; b = undefined; }" - "}" - "return obj.a;})"); -} - - -TEST(ForInContinueStatement) { - const char* src = - "(function(a,b) {" - " var r = '-';" - " for (var x in a) {" - " r += 'A-';" - " if (b) continue;" - " r += 'B-';" - " }" - " return r;" - "})"; - FunctionTester T(src); - - T.CheckCall(T.Val("-A-B-"), T.NewObject("({x:1})"), T.false_value()); - T.CheckCall(T.Val("-A-B-A-B-"), T.NewObject("({x:1,y:2})"), T.false_value()); - T.CheckCall(T.Val("-A-"), T.NewObject("({x:1})"), T.true_value()); - T.CheckCall(T.Val("-A-A-"), T.NewObject("({x:1,y:2})"), T.true_value()); -} - - TEST(ForOfContinueStatement) { const char* src = "(function(a,b) {" 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 559e6fd02a..bf42188207 100644 --- a/deps/v8/test/cctest/compiler/test-run-load-store.cc +++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc @@ -9,6 +9,7 @@ #include "src/base/bits.h" #include "src/base/utils/random-number-generator.h" #include "src/codegen.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/graph-builder-tester.h" diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc index 195f0a91dc..5414c553bd 100644 --- a/deps/v8/test/cctest/compiler/test-run-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-machops.cc @@ -10,6 +10,7 @@ #include "src/base/ieee754.h" #include "src/base/utils/random-number-generator.h" #include "src/codegen.h" +#include "src/objects-inl.h" #include "src/utils.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" @@ -6709,6 +6710,37 @@ TEST(ParentFramePointer) { CHECK_EQ(1, r.Call(1)); } +#if V8_TARGET_ARCH_64_BIT + +TEST(Regression5923) { + { + BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64()); + m.Return(m.Int64Add( + m.Word64Shr(m.Parameter(0), m.Int64Constant(4611686018427387888)), + m.Parameter(0))); + int64_t input = 16; + m.Call(input); + } + { + BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64()); + m.Return(m.Int64Add( + m.Parameter(0), + m.Word64Shr(m.Parameter(0), m.Int64Constant(4611686018427387888)))); + int64_t input = 16; + m.Call(input); + } +} + +TEST(Regression5951) { + BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64()); + m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(0)), + m.Int64Constant(0xffffffffffffffffl))); + int64_t input = 1234; + CHECK_EQ(input, m.Call(input)); +} + +#endif // V8_TARGET_ARCH_64_BIT + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-native-calls.cc b/deps/v8/test/cctest/compiler/test-run-native-calls.cc index e877d258b5..fb35744904 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -7,6 +7,7 @@ #include "src/compiler/linkage.h" #include "src/compiler/raw-machine-assembler.h" #include "src/machine-type.h" +#include "src/objects-inl.h" #include "src/register-configuration.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/compiler/test-run-stubs.cc b/deps/v8/test/cctest/compiler/test-run-stubs.cc index 8b6519eac5..0d618bda65 100644 --- a/deps/v8/test/cctest/compiler/test-run-stubs.cc +++ b/deps/v8/test/cctest/compiler/test-run-stubs.cc @@ -12,6 +12,7 @@ #include "src/compiler/linkage.h" #include "src/compiler/machine-operator.h" #include "src/compiler/pipeline.h" +#include "src/objects-inl.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { 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 9359b25779..cbf2b2a0a3 100644 --- a/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc @@ -9,6 +9,7 @@ #include "src/base/bits.h" #include "src/base/utils/random-number-generator.h" #include "src/codegen.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/graph-builder-tester.h" @@ -26,13 +27,13 @@ static void UpdateMemoryReferences(Handle<Code> code, Address old_base, RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_SIZE_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemoryReference(mode) || - RelocInfo::IsWasmMemorySizeReference(mode)) { - // Patch addresses with change in memory start address - it.rinfo()->update_wasm_memory_reference(old_base, new_base, old_size, - new_size); - modified = true; + if (RelocInfo::IsWasmMemoryReference(mode)) { + it.rinfo()->update_wasm_memory_reference(old_base, new_base); + } else { + DCHECK(RelocInfo::IsWasmMemorySizeReference(mode)); + it.rinfo()->update_wasm_memory_size(old_size, new_size); } + modified = true; } if (modified) { Assembler::FlushICache(isolate, code->instruction_start(), diff --git a/deps/v8/test/cctest/compiler/value-helper.h b/deps/v8/test/cctest/compiler/value-helper.h index 297bccb05b..dc74f8d1ed 100644 --- a/deps/v8/test/cctest/compiler/value-helper.h +++ b/deps/v8/test/cctest/compiler/value-helper.h @@ -300,6 +300,18 @@ class ValueHelper { return std::vector<double>(&values[0], &values[arraysize(values)]); } + static const std::vector<int16_t> int16_vector() { + static const int16_t kValues[] = { + 0, 1, 2, INT16_MAX - 1, INT16_MAX, INT16_MIN, INT16_MIN + 1, -2, -1}; + return std::vector<int16_t>(&kValues[0], &kValues[arraysize(kValues)]); + } + + static const std::vector<int8_t> int8_vector() { + static const int8_t kValues[] = { + 0, 1, 2, INT8_MAX - 1, INT8_MAX, INT8_MIN, INT8_MIN + 1, -2, -1}; + return std::vector<int8_t>(&kValues[0], &kValues[arraysize(kValues)]); + } + static const std::vector<uint32_t> ror_vector() { static const uint32_t kValues[31] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, @@ -317,6 +329,8 @@ class ValueHelper { #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) +#define FOR_INT16_INPUTS(var) FOR_INPUTS(int16_t, int16, var) +#define FOR_INT8_INPUTS(var) FOR_INPUTS(int8_t, int8, var) #define FOR_INT64_INPUTS(var) FOR_INPUTS(int64_t, int64, var) #define FOR_UINT64_INPUTS(var) FOR_INPUTS(uint64_t, uint64, var) #define FOR_FLOAT32_INPUTS(var) FOR_INPUTS(float, float32, var) diff --git a/deps/v8/test/cctest/ffi/OWNERS b/deps/v8/test/cctest/ffi/OWNERS new file mode 100644 index 0000000000..dc9a9780a6 --- /dev/null +++ b/deps/v8/test/cctest/ffi/OWNERS @@ -0,0 +1,2 @@ +mattloring@google.com +ofrobots@google.com diff --git a/deps/v8/test/cctest/ffi/test-ffi.cc b/deps/v8/test/cctest/ffi/test-ffi.cc new file mode 100644 index 0000000000..9d87244e94 --- /dev/null +++ b/deps/v8/test/cctest/ffi/test-ffi.cc @@ -0,0 +1,222 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/api.h" +#include "src/codegen.h" +#include "src/ffi/ffi-compiler.h" +#include "src/objects-inl.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace internal { +namespace ffi { + +static void hello_world() { printf("hello world from native code\n"); } + +TEST(Run_FFI_Hello) { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + + Handle<String> name = + isolate->factory()->InternalizeUtf8String("hello_world"); + Handle<Object> undefined = isolate->factory()->undefined_value(); + + AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + FFISignature::Builder sig_builder(&zone, 0, 0); + NativeFunction func = {sig_builder.Build(), + reinterpret_cast<uint8_t*>(hello_world)}; + + Handle<JSFunction> jsfunc = CompileJSToNativeWrapper(isolate, name, func); + + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, 0, nullptr).ToHandleChecked(); + + CHECK(result->IsUndefined(isolate)); +} + +static int add2(int x, int y) { return x + y; } + +TEST(Run_FFI_add2) { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + + Handle<String> name = isolate->factory()->InternalizeUtf8String("add2"); + Handle<Object> undefined = isolate->factory()->undefined_value(); + + AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + FFISignature::Builder sig_builder(&zone, 1, 2); + sig_builder.AddReturn(FFIType::kInt32); + sig_builder.AddParam(FFIType::kInt32); + sig_builder.AddParam(FFIType::kInt32); + NativeFunction func = {sig_builder.Build(), reinterpret_cast<uint8_t*>(add2)}; + + Handle<JSFunction> jsfunc = CompileJSToNativeWrapper(isolate, name, func); + + // Simple math should work. + { + Handle<Object> args[] = {isolate->factory()->NewNumber(1.0), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(42.0, result->Number()); + } + + // Truncate floating point to integer. + { + Handle<Object> args[] = {isolate->factory()->NewNumber(1.9), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(42.0, result->Number()); + } + + // INT_MAX + 1 should wrap. + { + Handle<Object> args[] = {isolate->factory()->NewNumber(kMaxInt), + isolate->factory()->NewNumber(1)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(kMinInt, result->Number()); + } + + // INT_MIN + -1 should wrap. + { + Handle<Object> args[] = {isolate->factory()->NewNumber(kMinInt), + isolate->factory()->NewNumber(-1)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(kMaxInt, result->Number()); + } + + // Numbers get truncated to the 32 least significant bits. + { + Handle<Object> args[] = {isolate->factory()->NewNumber(1ull << 40), + isolate->factory()->NewNumber(-1)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(-1, result->Number()); + } + + // String '57' converts to 57. + { + Handle<Object> args[] = { + isolate->factory()->NewStringFromAsciiChecked("57"), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(98.0, result->Number()); + } + + // String 'foo' converts to 0. + { + Handle<Object> args[] = { + isolate->factory()->NewStringFromAsciiChecked("foo"), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(41.0, result->Number()); + } + + // String '58o' converts to 0. + { + Handle<Object> args[] = { + isolate->factory()->NewStringFromAsciiChecked("58o"), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(41.0, result->Number()); + } + + // NaN converts to 0. + { + Handle<Object> args[] = {isolate->factory()->nan_value(), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(41.0, result->Number()); + } + + // null converts to 0. + { + Handle<Object> args[] = {isolate->factory()->null_value(), + isolate->factory()->NewNumber(41.0)}; + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(41.0, result->Number()); + } +} + +static int add6(int a, int b, int c, int d, int e, int f) { + return a + b + c + d + e + f; +} + +TEST(Run_FFI_add6) { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + + Handle<String> name = isolate->factory()->InternalizeUtf8String("add6"); + Handle<Object> undefined = isolate->factory()->undefined_value(); + + AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + FFISignature::Builder sig_builder(&zone, 1, 7); + sig_builder.AddReturn(FFIType::kInt32); + for (int i = 0; i < 7; i++) { + sig_builder.AddParam(FFIType::kInt32); + } + NativeFunction func = {sig_builder.Build(), reinterpret_cast<uint8_t*>(add6)}; + + Handle<JSFunction> jsfunc = CompileJSToNativeWrapper(isolate, name, func); + Handle<Object> args[] = { + isolate->factory()->NewNumber(1), isolate->factory()->NewNumber(2), + isolate->factory()->NewNumber(3), isolate->factory()->NewNumber(4), + isolate->factory()->NewNumber(5), isolate->factory()->NewNumber(6)}; + + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + + CHECK_EQ(21.0, result->Number()); + + { + // Ensure builtin frames are generated + FLAG_allow_natives_syntax = true; + v8::Local<v8::Value> res = CompileRun( + "var o = { valueOf: function() { %DebugTrace(); return 1; } }; o;"); + Handle<JSReceiver> param(v8::Utils::OpenHandle(v8::Object::Cast(*res))); + Handle<Object> args[] = {param, + isolate->factory()->NewNumber(2), + isolate->factory()->NewNumber(3), + isolate->factory()->NewNumber(4), + isolate->factory()->NewNumber(5), + isolate->factory()->NewNumber(6), + isolate->factory()->NewNumber(21)}; + + Handle<Object> result = + Execution::Call(isolate, jsfunc, undefined, arraysize(args), args) + .ToHandleChecked(); + CHECK_EQ(21.0, result->Number()); + CHECK_EQ( + 1.0, + res->NumberValue( + reinterpret_cast<v8::Isolate*>(isolate)->GetCurrentContext()) + .ToChecked()); + } +} + +} // namespace ffi +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h index acfbe92bb6..289439c182 100644 --- a/deps/v8/test/cctest/heap/heap-tester.h +++ b/deps/v8/test/cctest/heap/heap-tester.h @@ -5,7 +5,6 @@ #ifndef HEAP_HEAP_TESTER_H_ #define HEAP_HEAP_TESTER_H_ -#include "src/handles.h" #include "src/heap/spaces.h" // Tests that should have access to private methods of {v8::internal::Heap}. @@ -56,6 +55,9 @@ namespace v8 { namespace internal { +template <typename T> +class Handle; + class HeapTester { public: #define DECLARE_STATIC(Name) static void Test##Name(); diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc index 3485c0ab07..27070c9da8 100644 --- a/deps/v8/test/cctest/heap/test-alloc.cc +++ b/deps/v8/test/cctest/heap/test-alloc.cc @@ -48,7 +48,7 @@ AllocationResult v8::internal::HeapTester::AllocateAfterFailures() { // Make sure we can allocate through optimized allocation functions // for specific kinds. heap->AllocateFixedArray(100).ToObjectChecked(); - heap->AllocateHeapNumber(0.42).ToObjectChecked(); + heap->AllocateHeapNumber().ToObjectChecked(); Object* object = heap->AllocateJSObject( *CcTest::i_isolate()->object_function()).ToObjectChecked(); heap->CopyJSObject(JSObject::cast(object)).ToObjectChecked(); diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index 7dc7123b65..3042ca8df8 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -28,9 +28,12 @@ #include <stdlib.h> #include <utility> +#include "src/api.h" +#include "src/assembler-inl.h" #include "src/code-stubs.h" #include "src/compilation-cache.h" #include "src/context-measure.h" +#include "src/debug/debug.h" #include "src/deoptimizer.h" #include "src/elements.h" #include "src/execution.h" @@ -38,11 +41,15 @@ #include "src/field-type.h" #include "src/global-handles.h" #include "src/heap/gc-tracer.h" +#include "src/heap/incremental-marking.h" +#include "src/heap/mark-compact.h" #include "src/heap/memory-reducer.h" #include "src/ic/ic.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "src/regexp/jsregexp.h" #include "src/snapshot/snapshot.h" +#include "src/transitions.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" #include "test/cctest/heap/heap-utils.h" @@ -68,14 +75,68 @@ TEST(HeapMaps) { Heap* heap = CcTest::heap(); CheckMap(heap->meta_map(), MAP_TYPE, Map::kSize); CheckMap(heap->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize); -#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ - CheckMap(heap->type##_map(), SIMD128_VALUE_TYPE, Type::kSize); - SIMD128_TYPES(SIMD128_TYPE) -#undef SIMD128_TYPE CheckMap(heap->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel); CheckMap(heap->string_map(), STRING_TYPE, kVariableSizeSentinel); } +static void VerifyStoredPrototypeMap(Isolate* isolate, + int stored_map_context_index, + int stored_ctor_context_index) { + Handle<Context> context = isolate->native_context(); + + Handle<Map> this_map(Map::cast(context->get(stored_map_context_index))); + + Handle<JSFunction> fun( + JSFunction::cast(context->get(stored_ctor_context_index))); + Handle<JSObject> proto(JSObject::cast(fun->initial_map()->prototype())); + Handle<Map> that_map(proto->map()); + + CHECK(proto->HasFastProperties()); + CHECK_EQ(*this_map, *that_map); +} + +// Checks that critical maps stored on the context (mostly used for fast-path +// checks) are unchanged after initialization. +TEST(ContextMaps) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope handle_scope(isolate); + + VerifyStoredPrototypeMap(isolate, + Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX, + Context::STRING_FUNCTION_INDEX); + VerifyStoredPrototypeMap(isolate, Context::REGEXP_PROTOTYPE_MAP_INDEX, + Context::REGEXP_FUNCTION_INDEX); + VerifyStoredPrototypeMap(isolate, Context::PROMISE_PROTOTYPE_MAP_INDEX, + Context::PROMISE_FUNCTION_INDEX); +} + +TEST(InitialObjects) { + LocalContext env; + HandleScope scope(CcTest::i_isolate()); + Handle<Context> context = v8::Utils::OpenHandle(*env); + // Initial ArrayIterator prototype. + CHECK_EQ( + context->initial_array_iterator_prototype(), + *v8::Utils::OpenHandle(*CompileRun("[][Symbol.iterator]().__proto__"))); + // Initial ArrayIterator prototype map. + CHECK_EQ(context->initial_array_iterator_prototype_map(), + context->initial_array_iterator_prototype()->map()); + // Initial Array prototype. + CHECK_EQ(context->initial_array_prototype(), + *v8::Utils::OpenHandle(*CompileRun("Array.prototype"))); + // Initial Generator prototype. + CHECK_EQ(context->initial_generator_prototype(), + *v8::Utils::OpenHandle( + *CompileRun("(function*(){}).__proto__.prototype"))); + // Initial Iterator prototype. + CHECK_EQ(context->initial_iterator_prototype(), + *v8::Utils::OpenHandle( + *CompileRun("[][Symbol.iterator]().__proto__.__proto__"))); + // Initial Object prototype. + CHECK_EQ(context->initial_object_prototype(), + *v8::Utils::OpenHandle(*CompileRun("Object.prototype"))); +} static void CheckOddball(Isolate* isolate, Object* obj, const char* string) { CHECK(obj->IsOddball()); @@ -266,206 +327,6 @@ TEST(HeapObjects) { CheckFindCodeObject(isolate); } - -template <typename T, typename LANE_TYPE, int LANES> -static void CheckSimdValue(T* value, LANE_TYPE lane_values[LANES], - LANE_TYPE other_value) { - // Check against lane_values, and check that all lanes can be set to - // other_value without disturbing the other lanes. - for (int i = 0; i < LANES; i++) { - CHECK_EQ(lane_values[i], value->get_lane(i)); - } - for (int i = 0; i < LANES; i++) { - value->set_lane(i, other_value); // change the value - for (int j = 0; j < LANES; j++) { - if (i != j) - CHECK_EQ(lane_values[j], value->get_lane(j)); - else - CHECK_EQ(other_value, value->get_lane(j)); - } - value->set_lane(i, lane_values[i]); // restore the lane - } - CHECK(value->BooleanValue()); // SIMD values are 'true'. -} - - -TEST(SimdObjects) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - Factory* factory = isolate->factory(); - - HandleScope sc(isolate); - - // Float32x4 - { - float lanes[4] = {1, 2, 3, 4}; - float quiet_NaN = std::numeric_limits<float>::quiet_NaN(); - float signaling_NaN = std::numeric_limits<float>::signaling_NaN(); - - Handle<Float32x4> value = factory->NewFloat32x4(lanes); - CHECK(value->IsFloat32x4()); - CheckSimdValue<Float32x4, float, 4>(*value, lanes, 3.14f); - - // Check special lane values. - value->set_lane(1, -0.0); - CHECK_EQ(-0.0f, value->get_lane(1)); - CHECK(std::signbit(value->get_lane(1))); // Sign bit should be preserved. - value->set_lane(2, quiet_NaN); - CHECK(std::isnan(value->get_lane(2))); - value->set_lane(3, signaling_NaN); - CHECK(std::isnan(value->get_lane(3))); - -#ifdef OBJECT_PRINT - // Check value printing. - { - value = factory->NewFloat32x4(lanes); - std::ostringstream os; - value->Float32x4Print(os); - CHECK_EQ("1, 2, 3, 4", os.str()); - } - { - float special_lanes[4] = {0, -0.0, quiet_NaN, signaling_NaN}; - value = factory->NewFloat32x4(special_lanes); - std::ostringstream os; - value->Float32x4Print(os); - // Value printing doesn't preserve signed zeroes. - CHECK_EQ("0, 0, NaN, NaN", os.str()); - } -#endif // OBJECT_PRINT - } - // Int32x4 - { - int32_t lanes[4] = {1, 2, 3, 4}; - - Handle<Int32x4> value = factory->NewInt32x4(lanes); - CHECK(value->IsInt32x4()); - CheckSimdValue<Int32x4, int32_t, 4>(*value, lanes, 3); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Int32x4Print(os); - CHECK_EQ("1, 2, 3, 4", os.str()); -#endif // OBJECT_PRINT - } - // Uint32x4 - { - uint32_t lanes[4] = {1, 2, 3, 4}; - - Handle<Uint32x4> value = factory->NewUint32x4(lanes); - CHECK(value->IsUint32x4()); - CheckSimdValue<Uint32x4, uint32_t, 4>(*value, lanes, 3); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Uint32x4Print(os); - CHECK_EQ("1, 2, 3, 4", os.str()); -#endif // OBJECT_PRINT - } - // Bool32x4 - { - bool lanes[4] = {true, false, true, false}; - - Handle<Bool32x4> value = factory->NewBool32x4(lanes); - CHECK(value->IsBool32x4()); - CheckSimdValue<Bool32x4, bool, 4>(*value, lanes, false); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Bool32x4Print(os); - CHECK_EQ("true, false, true, false", os.str()); -#endif // OBJECT_PRINT - } - // Int16x8 - { - int16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8}; - - Handle<Int16x8> value = factory->NewInt16x8(lanes); - CHECK(value->IsInt16x8()); - CheckSimdValue<Int16x8, int16_t, 8>(*value, lanes, 32767); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Int16x8Print(os); - CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str()); -#endif // OBJECT_PRINT - } - // Uint16x8 - { - uint16_t lanes[8] = {1, 2, 3, 4, 5, 6, 7, 8}; - - Handle<Uint16x8> value = factory->NewUint16x8(lanes); - CHECK(value->IsUint16x8()); - CheckSimdValue<Uint16x8, uint16_t, 8>(*value, lanes, 32767); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Uint16x8Print(os); - CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8", os.str()); -#endif // OBJECT_PRINT - } - // Bool16x8 - { - bool lanes[8] = {true, false, true, false, true, false, true, false}; - - Handle<Bool16x8> value = factory->NewBool16x8(lanes); - CHECK(value->IsBool16x8()); - CheckSimdValue<Bool16x8, bool, 8>(*value, lanes, false); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Bool16x8Print(os); - CHECK_EQ("true, false, true, false, true, false, true, false", os.str()); -#endif // OBJECT_PRINT - } - // Int8x16 - { - int8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - - Handle<Int8x16> value = factory->NewInt8x16(lanes); - CHECK(value->IsInt8x16()); - CheckSimdValue<Int8x16, int8_t, 16>(*value, lanes, 127); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Int8x16Print(os); - CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str()); -#endif // OBJECT_PRINT - } - // Uint8x16 - { - uint8_t lanes[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - - Handle<Uint8x16> value = factory->NewUint8x16(lanes); - CHECK(value->IsUint8x16()); - CheckSimdValue<Uint8x16, uint8_t, 16>(*value, lanes, 127); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Uint8x16Print(os); - CHECK_EQ("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", os.str()); -#endif // OBJECT_PRINT - } - // Bool8x16 - { - bool lanes[16] = {true, false, true, false, true, false, true, false, - true, false, true, false, true, false, true, false}; - - Handle<Bool8x16> value = factory->NewBool8x16(lanes); - CHECK(value->IsBool8x16()); - CheckSimdValue<Bool8x16, bool, 16>(*value, lanes, false); - -#ifdef OBJECT_PRINT - std::ostringstream os; - value->Bool8x16Print(os); - CHECK_EQ( - "true, false, true, false, true, false, true, false, true, false, " - "true, false, true, false, true, false", - os.str()); -#endif // OBJECT_PRINT - } -} - - TEST(Tagging) { CcTest::InitializeVM(); int request = 24; @@ -1646,37 +1507,37 @@ TEST(CompilationCacheCachingBehavior) { } // The script should be in the cache now. - MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( + InfoVectorPair pair = compilation_cache->LookupScript( source, Handle<Object>(), 0, 0, v8::ScriptOriginOptions(true, false), native_context, language_mode); - CHECK(!info.is_null()); + CHECK(pair.has_shared()); // Check that the code cache entry survives at least on GC. // (Unless --optimize-for-size, in which case it might get collected // immediately.) if (!FLAG_optimize_for_size) { CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, + pair = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, v8::ScriptOriginOptions(true, false), native_context, language_mode); - CHECK(!info.is_null()); + CHECK(pair.has_shared()); } // Progress code age until it's old and ready for GC. const int kAgingThreshold = 6; for (int i = 0; i < kAgingThreshold; i++) { - info.ToHandleChecked()->code()->MakeOlder(); - if (info.ToHandleChecked()->HasBytecodeArray()) { - info.ToHandleChecked()->bytecode_array()->MakeOlder(); + pair.shared()->code()->MakeOlder(); + if (pair.shared()->HasBytecodeArray()) { + pair.shared()->bytecode_array()->MakeOlder(); } } CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Ensure code aging cleared the entry from the cache. - info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, + pair = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, v8::ScriptOriginOptions(true, false), native_context, language_mode); - CHECK(info.is_null()); + CHECK(!pair.has_shared()); } @@ -2015,16 +1876,12 @@ HEAP_TEST(TestSizeOfObjects) { TEST(TestAlignmentCalculations) { // Maximum fill amounts are consistent. int maximum_double_misalignment = kDoubleSize - kPointerSize; - int maximum_simd128_misalignment = kSimd128Size - kPointerSize; int max_word_fill = Heap::GetMaximumFillToAlign(kWordAligned); CHECK_EQ(0, max_word_fill); int max_double_fill = Heap::GetMaximumFillToAlign(kDoubleAligned); CHECK_EQ(maximum_double_misalignment, max_double_fill); int max_double_unaligned_fill = Heap::GetMaximumFillToAlign(kDoubleUnaligned); CHECK_EQ(maximum_double_misalignment, max_double_unaligned_fill); - int max_simd128_unaligned_fill = - Heap::GetMaximumFillToAlign(kSimd128Unaligned); - CHECK_EQ(maximum_simd128_misalignment, max_simd128_unaligned_fill); Address base = static_cast<Address>(NULL); int fill = 0; @@ -2046,16 +1903,6 @@ TEST(TestAlignmentCalculations) { CHECK_EQ(maximum_double_misalignment, fill); fill = Heap::GetFillToAlign(base + kPointerSize, kDoubleUnaligned); CHECK_EQ(0, fill); - - // 128 bit SIMD types have 2 or 4 possible alignments, depending on platform. - fill = Heap::GetFillToAlign(base, kSimd128Unaligned); - CHECK_EQ((3 * kPointerSize) & kSimd128AlignmentMask, fill); - fill = Heap::GetFillToAlign(base + kPointerSize, kSimd128Unaligned); - CHECK_EQ((2 * kPointerSize) & kSimd128AlignmentMask, fill); - fill = Heap::GetFillToAlign(base + 2 * kPointerSize, kSimd128Unaligned); - CHECK_EQ(kPointerSize, fill); - fill = Heap::GetFillToAlign(base + 3 * kPointerSize, kSimd128Unaligned); - CHECK_EQ(0, fill); } @@ -2123,42 +1970,6 @@ TEST(TestAlignedAllocation) { filler->Size() == kPointerSize); CHECK_EQ(kPointerSize + double_misalignment, *top_addr - start); } - - // Now test SIMD alignment. There are 2 or 4 possible alignments, depending - // on platform. - start = AlignNewSpace(kSimd128Unaligned, 0); - obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There is no filler. - CHECK_EQ(kPointerSize, *top_addr - start); - start = AlignNewSpace(kSimd128Unaligned, kPointerSize); - obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There is a filler object before the object. - filler = HeapObject::FromAddress(start); - CHECK(obj != filler && filler->IsFiller() && - filler->Size() == kSimd128Size - kPointerSize); - CHECK_EQ(kPointerSize + kSimd128Size - kPointerSize, *top_addr - start); - - if (double_misalignment) { - // Test the 2 other alignments possible on 32 bit platforms. - start = AlignNewSpace(kSimd128Unaligned, 2 * kPointerSize); - obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There is a filler object before the object. - filler = HeapObject::FromAddress(start); - CHECK(obj != filler && filler->IsFiller() && - filler->Size() == 2 * kPointerSize); - CHECK_EQ(kPointerSize + 2 * kPointerSize, *top_addr - start); - start = AlignNewSpace(kSimd128Unaligned, 3 * kPointerSize); - obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There is a filler object before the object. - filler = HeapObject::FromAddress(start); - CHECK(obj != filler && filler->IsFiller() && - filler->Size() == kPointerSize); - CHECK_EQ(kPointerSize + kPointerSize, *top_addr - start); - } } @@ -2207,83 +2018,41 @@ TEST(TestAlignedOverAllocation) { const intptr_t double_misalignment = kDoubleSize - kPointerSize; Address start; HeapObject* obj; - HeapObject* filler1; - HeapObject* filler2; + HeapObject* filler; if (double_misalignment) { start = AlignOldSpace(kDoubleAligned, 0); obj = OldSpaceAllocateAligned(kPointerSize, kDoubleAligned); // The object is aligned, and a filler object is created after. CHECK(IsAddressAligned(obj->address(), kDoubleAlignment)); - filler1 = HeapObject::FromAddress(start + kPointerSize); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kPointerSize); + filler = HeapObject::FromAddress(start + kPointerSize); + CHECK(obj != filler && filler->IsFiller() && + filler->Size() == kPointerSize); // Try the opposite alignment case. start = AlignOldSpace(kDoubleAligned, kPointerSize); obj = OldSpaceAllocateAligned(kPointerSize, kDoubleAligned); CHECK(IsAddressAligned(obj->address(), kDoubleAlignment)); - filler1 = HeapObject::FromAddress(start); - CHECK(obj != filler1); - CHECK(filler1->IsFiller()); - CHECK(filler1->Size() == kPointerSize); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kPointerSize); + filler = HeapObject::FromAddress(start); + CHECK(obj != filler); + CHECK(filler->IsFiller()); + CHECK(filler->Size() == kPointerSize); + CHECK(obj != filler && filler->IsFiller() && + filler->Size() == kPointerSize); // Similarly for kDoubleUnaligned. start = AlignOldSpace(kDoubleUnaligned, 0); obj = OldSpaceAllocateAligned(kPointerSize, kDoubleUnaligned); // The object is aligned, and a filler object is created after. CHECK(IsAddressAligned(obj->address(), kDoubleAlignment, kPointerSize)); - filler1 = HeapObject::FromAddress(start + kPointerSize); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kPointerSize); + filler = HeapObject::FromAddress(start + kPointerSize); + CHECK(obj != filler && filler->IsFiller() && + filler->Size() == kPointerSize); // Try the opposite alignment case. start = AlignOldSpace(kDoubleUnaligned, kPointerSize); obj = OldSpaceAllocateAligned(kPointerSize, kDoubleUnaligned); CHECK(IsAddressAligned(obj->address(), kDoubleAlignment, kPointerSize)); - filler1 = HeapObject::FromAddress(start); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kPointerSize); - } - - // Now test SIMD alignment. There are 2 or 4 possible alignments, depending - // on platform. - start = AlignOldSpace(kSimd128Unaligned, 0); - obj = OldSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There is a filler object after the object. - filler1 = HeapObject::FromAddress(start + kPointerSize); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kSimd128Size - kPointerSize); - start = AlignOldSpace(kSimd128Unaligned, kPointerSize); - obj = OldSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There is a filler object before the object. - filler1 = HeapObject::FromAddress(start); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kSimd128Size - kPointerSize); - - if (double_misalignment) { - // Test the 2 other alignments possible on 32 bit platforms. - start = AlignOldSpace(kSimd128Unaligned, 2 * kPointerSize); - obj = OldSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There are filler objects before and after the object. - filler1 = HeapObject::FromAddress(start); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == 2 * kPointerSize); - filler2 = HeapObject::FromAddress(start + 3 * kPointerSize); - CHECK(obj != filler2 && filler2->IsFiller() && - filler2->Size() == kPointerSize); - start = AlignOldSpace(kSimd128Unaligned, 3 * kPointerSize); - obj = OldSpaceAllocateAligned(kPointerSize, kSimd128Unaligned); - CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize)); - // There are filler objects before and after the object. - filler1 = HeapObject::FromAddress(start); - CHECK(obj != filler1 && filler1->IsFiller() && - filler1->Size() == kPointerSize); - filler2 = HeapObject::FromAddress(start + 2 * kPointerSize); - CHECK(obj != filler2 && filler2->IsFiller() && - filler2->Size() == 2 * kPointerSize); + filler = HeapObject::FromAddress(start); + CHECK(obj != filler && filler->IsFiller() && + filler->Size() == kPointerSize); } } @@ -2338,6 +2107,10 @@ TEST(GrowAndShrinkNewSpace) { return; } + // Make sure we're in a consistent state to start out. + CcTest::CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); + // Explicitly growing should double the space capacity. size_t old_capacity, new_capacity; old_capacity = new_space->TotalCapacity(); @@ -3739,12 +3512,12 @@ static void CheckVectorIC(Handle<JSFunction> f, int slot_index, InlineCacheState desired_state) { Handle<FeedbackVector> vector = Handle<FeedbackVector>(f->feedback_vector()); FeedbackVectorHelper helper(vector); - FeedbackVectorSlot slot = helper.slot(slot_index); - if (vector->GetKind(slot) == FeedbackVectorSlotKind::LOAD_IC) { + FeedbackSlot slot = helper.slot(slot_index); + if (vector->IsLoadIC(slot)) { LoadICNexus nexus(vector, slot); CHECK(nexus.StateFromFeedback() == desired_state); } else { - CHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot)); + CHECK(vector->IsKeyedLoadIC(slot)); KeyedLoadICNexus nexus(vector, slot); CHECK(nexus.StateFromFeedback() == desired_state); } @@ -3766,12 +3539,12 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) { CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); Handle<FeedbackVector> vector(f->feedback_vector()); - CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); + CHECK(vector->Get(FeedbackSlot(0))->IsWeakCell()); heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); + CHECK(vector->Get(FeedbackSlot(0))->IsWeakCell()); } TEST(IncrementalMarkingPreservesMonomorphicIC) { @@ -4296,10 +4069,6 @@ TEST(Regress513507) { if (!code->is_optimized_code()) return; } - Handle<FeedbackVector> vector = - FeedbackVector::New(isolate, handle(shared->feedback_metadata())); - Handle<LiteralsArray> lit = - LiteralsArray::New(isolate, vector, shared->num_literals()); Handle<Context> context(isolate->context()); // Add the new code several times to the optimized code map and also set an @@ -4308,211 +4077,11 @@ TEST(Regress513507) { FLAG_gc_interval = 1000; for (int i = 0; i < 10; ++i) { BailoutId id = BailoutId(i); - SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); + SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, id); } } #endif // DEBUG -TEST(Regress514122) { - if (!i::FLAG_incremental_marking) return; - i::FLAG_allow_natives_syntax = true; - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - LocalContext env; - Heap* heap = isolate->heap(); - HandleScope scope(isolate); - - // Perfrom one initial GC to enable code flushing. - CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - - // Prepare function whose optimized code map we can use. - Handle<SharedFunctionInfo> shared; - { - HandleScope inner_scope(isolate); - CompileRun( - "function f() { return 1 }" - "f(); %OptimizeFunctionOnNextCall(f); f();"); - - Handle<JSFunction> f = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - CcTest::global()->Get(env.local(), v8_str("f")).ToLocalChecked()))); - shared = inner_scope.CloseAndEscape(handle(f->shared(), isolate)); - CompileRun("f = null"); - } - - // Prepare optimized code that we can use. - Handle<Code> code; - { - HandleScope inner_scope(isolate); - CompileRun( - "function g() { return 2 }" - "g(); %OptimizeFunctionOnNextCall(g); g();"); - - Handle<JSFunction> g = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - CcTest::global()->Get(env.local(), v8_str("g")).ToLocalChecked()))); - code = inner_scope.CloseAndEscape(handle(g->code(), isolate)); - if (!code->is_optimized_code()) return; - } - - Handle<FeedbackVector> vector = - FeedbackVector::New(isolate, handle(shared->feedback_metadata())); - Handle<LiteralsArray> lit = - LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED); - Handle<Context> context(isolate->context()); - - // Add the code several times to the optimized code map. - for (int i = 0; i < 3; ++i) { - HandleScope inner_scope(isolate); - BailoutId id = BailoutId(i); - SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); - } - shared->optimized_code_map()->Print(); - - // Add the code with a literals array to be evacuated. - Page* evac_page; - { - HandleScope inner_scope(isolate); - AlwaysAllocateScope always_allocate(isolate); - // Make sure literal is placed on an old-space evacuation candidate. - heap::SimulateFullSpace(heap->old_space()); - - // Make sure there the number of literals is > 0. - Handle<LiteralsArray> lit = LiteralsArray::New(isolate, vector, 23); - - evac_page = Page::FromAddress(lit->address()); - BailoutId id = BailoutId(100); - SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); - } - - // 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; - heap::ForceEvacuationCandidate(evac_page); - heap::SimulateIncrementalMarking(heap); - - // No matter whether reachable or not, {boomer} is doomed. - Handle<Object> boomer(shared->optimized_code_map(), isolate); - - // Add the code several times to the optimized code map. This will leave old - // copies of the optimized code map unreachable but still marked. - for (int i = 3; i < 6; ++i) { - HandleScope inner_scope(isolate); - BailoutId id = BailoutId(i); - SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); - } - - // Trigger a GC to flush out the bug. - CcTest::CollectGarbage(i::OLD_SPACE); - boomer->Print(); -} - -TEST(OptimizedCodeMapReuseEntries) { - i::FLAG_allow_natives_syntax = true; - // BUG(v8:4598): Since TurboFan doesn't treat maps in code weakly, we can't - // run this test. - if (i::FLAG_turbo) return; - CcTest::InitializeVM(); - v8::Isolate* v8_isolate = CcTest::isolate(); - Isolate* isolate = CcTest::i_isolate(); - HandleScope scope(isolate); - - // Create 3 contexts, allow the 2nd one to be disposed, and verify that - // a 4th context will re-use the weak slots in the optimized code map - // to hold data, rather than expanding the map. - v8::Local<v8::Context> c1 = v8::Context::New(v8_isolate); - const char* source = "function foo(x) { var l = [1]; return x+l[0]; }"; - v8::ScriptCompiler::Source script_source( - v8::String::NewFromUtf8(v8_isolate, source, v8::NewStringType::kNormal) - .ToLocalChecked()); - v8::Local<v8::UnboundScript> indep = - v8::ScriptCompiler::CompileUnboundScript(v8_isolate, &script_source) - .ToLocalChecked(); - const char* toplevel = "foo(3); %OptimizeFunctionOnNextCall(foo); foo(3);"; - // Perfrom one initial GC to enable code flushing. - CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - - c1->Enter(); - indep->BindToCurrentContext()->Run(c1).ToLocalChecked(); - CompileRun(toplevel); - - Handle<SharedFunctionInfo> shared; - Handle<JSFunction> foo = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - CcTest::global()->Get(c1, v8_str("foo")).ToLocalChecked()))); - CHECK(foo->shared()->is_compiled()); - shared = handle(foo->shared()); - c1->Exit(); - - { - HandleScope scope(isolate); - v8::Local<v8::Context> c2 = v8::Context::New(v8_isolate); - c2->Enter(); - indep->BindToCurrentContext()->Run(c2).ToLocalChecked(); - CompileRun(toplevel); - c2->Exit(); - } - - { - HandleScope scope(isolate); - v8::Local<v8::Context> c3 = v8::Context::New(v8_isolate); - c3->Enter(); - indep->BindToCurrentContext()->Run(c3).ToLocalChecked(); - CompileRun(toplevel); - c3->Exit(); - - // Now, collect garbage. Context c2 should have no roots to it, and it's - // entry in the optimized code map should be free for a new context. - for (int i = 0; i < 4; i++) { - CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - } - - Handle<FixedArray> optimized_code_map = - handle(shared->optimized_code_map()); - // There should be 3 entries in the map. - CHECK_EQ( - 3, ((optimized_code_map->length() - SharedFunctionInfo::kEntriesStart) / - SharedFunctionInfo::kEntryLength)); - // But one of them (formerly for c2) should be cleared. - int cleared_count = 0; - for (int i = SharedFunctionInfo::kEntriesStart; - i < optimized_code_map->length(); - i += SharedFunctionInfo::kEntryLength) { - cleared_count += - WeakCell::cast( - optimized_code_map->get(i + SharedFunctionInfo::kContextOffset)) - ->cleared() - ? 1 - : 0; - } - CHECK_EQ(1, cleared_count); - - // Verify that a new context uses the cleared entry rather than creating a - // new - // optimized code map array. - v8::Local<v8::Context> c4 = v8::Context::New(v8_isolate); - c4->Enter(); - indep->BindToCurrentContext()->Run(c4).ToLocalChecked(); - CompileRun(toplevel); - c4->Exit(); - CHECK_EQ(*optimized_code_map, shared->optimized_code_map()); - - // Now each entry is in use. - cleared_count = 0; - for (int i = SharedFunctionInfo::kEntriesStart; - i < optimized_code_map->length(); - i += SharedFunctionInfo::kEntryLength) { - cleared_count += - WeakCell::cast( - optimized_code_map->get(i + SharedFunctionInfo::kContextOffset)) - ->cleared() - ? 1 - : 0; - } - CHECK_EQ(0, cleared_count); - } -} - TEST(Regress513496) { i::FLAG_allow_natives_syntax = true; CcTest::InitializeVM(); @@ -4558,9 +4127,9 @@ TEST(Regress513496) { } // Lookup the optimized code and keep it alive. - CodeAndLiterals result = shared->SearchOptimizedCodeMap( + Code* result = shared->SearchOptimizedCodeMap( isolate->context()->native_context(), BailoutId::None()); - Handle<Code> optimized_code(result.code, isolate); + Handle<Code> optimized_code(result, isolate); // Finish a full GC cycle so that the unoptimized code of 'g' is flushed even // though the optimized code for 'f' is reachable via the optimized code map. @@ -4780,7 +4349,6 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) { TEST(CellsInOptimizedCodeAreWeak) { if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; - i::FLAG_weak_embedded_objects_in_optimized_code = true; i::FLAG_allow_natives_syntax = true; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -4825,7 +4393,6 @@ TEST(CellsInOptimizedCodeAreWeak) { TEST(ObjectsInOptimizedCodeAreWeak) { if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; - i::FLAG_weak_embedded_objects_in_optimized_code = true; i::FLAG_allow_natives_syntax = true; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -4867,7 +4434,6 @@ TEST(ObjectsInOptimizedCodeAreWeak) { TEST(NewSpaceObjectsInOptimizedCode) { if (i::FLAG_always_opt || !i::FLAG_crankshaft || i::FLAG_turbo) return; - i::FLAG_weak_embedded_objects_in_optimized_code = true; i::FLAG_allow_natives_syntax = true; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -4930,7 +4496,6 @@ TEST(NewSpaceObjectsInOptimizedCode) { TEST(NoWeakHashTableLeakWithIncrementalMarking) { if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; if (!i::FLAG_incremental_marking) return; - i::FLAG_weak_embedded_objects_in_optimized_code = true; i::FLAG_allow_natives_syntax = true; i::FLAG_compilation_cache = false; i::FLAG_retain_maps_for_n_gc = 0; @@ -5134,18 +4699,18 @@ TEST(WeakFunctionInConstructor) { Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(createObj->feedback_vector(), CcTest::i_isolate()); for (int i = 0; i < 20; i++) { - Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0)); + Object* slot_value = feedback_vector->Get(FeedbackSlot(0)); CHECK(slot_value->IsWeakCell()); if (WeakCell::cast(slot_value)->cleared()) break; CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } - Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0)); + Object* slot_value = feedback_vector->Get(FeedbackSlot(0)); CHECK(slot_value->IsWeakCell() && WeakCell::cast(slot_value)->cleared()); CompileRun( "function coat() { this.x = 6; }" "createObj(coat);"); - slot_value = feedback_vector->Get(FeedbackVectorSlot(0)); + slot_value = feedback_vector->Get(FeedbackSlot(0)); CHECK(slot_value->IsWeakCell() && !WeakCell::cast(slot_value)->cleared()); } @@ -5334,19 +4899,15 @@ Handle<JSFunction> GetFunctionByName(Isolate* isolate, const char* name) { void CheckIC(Handle<JSFunction> function, Code::Kind kind, int slot_index, InlineCacheState state) { - if (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC || - kind == Code::CALL_IC) { + if (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC) { FeedbackVector* vector = function->feedback_vector(); - FeedbackVectorSlot slot(slot_index); + FeedbackSlot slot(slot_index); if (kind == Code::LOAD_IC) { LoadICNexus nexus(vector, slot); CHECK_EQ(nexus.StateFromFeedback(), state); } else if (kind == Code::KEYED_LOAD_IC) { KeyedLoadICNexus nexus(vector, slot); CHECK_EQ(nexus.StateFromFeedback(), state); - } else if (kind == Code::CALL_IC) { - CallICNexus nexus(vector, slot); - CHECK_EQ(nexus.StateFromFeedback(), state); } } else { Code* ic = FindFirstIC(function->code(), kind); @@ -5742,7 +5303,7 @@ TEST(Regress388880) { Handle<String> name = factory->NewStringFromStaticChars("foo"); name = factory->InternalizeString(name); Handle<Map> map2 = - Map::CopyWithField(map1, name, FieldType::Any(isolate), NONE, + Map::CopyWithField(map1, name, FieldType::Any(isolate), NONE, kMutable, Representation::Tagged(), OMIT_TRANSITION) .ToHandleChecked(); @@ -5943,18 +5504,6 @@ TEST(RegressArrayListGC) { } -#ifdef DEBUG -TEST(PathTracer) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - - v8::Local<v8::Value> result = CompileRun("'abc'"); - Handle<Object> o = v8::Utils::OpenHandle(*result); - CcTest::i_isolate()->heap()->TracePathToObject(*o); -} -#endif // DEBUG - - TEST(WritableVsImmortalRoots) { for (int i = 0; i < Heap::kStrongRootListLength; ++i) { Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); @@ -6158,6 +5707,7 @@ TEST(NewSpaceAllocationCounter) { Heap* heap = isolate->heap(); size_t counter1 = heap->NewSpaceAllocationCounter(); CcTest::CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // Ensure new space is empty. const size_t kSize = 1024; AllocateInSpace(isolate, kSize, NEW_SPACE); size_t counter2 = heap->NewSpaceAllocationCounter(); diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc index 642a3584e7..ce1fb34951 100644 --- a/deps/v8/test/cctest/heap/test-incremental-marking.cc +++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc @@ -18,6 +18,9 @@ #include "src/full-codegen/full-codegen.h" #include "src/global-handles.h" +#include "src/heap/incremental-marking.h" +#include "src/heap/spaces.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-utils.h" diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc index ee37d070ac..9f749c5f42 100644 --- a/deps/v8/test/cctest/heap/test-mark-compact.cc +++ b/deps/v8/test/cctest/heap/test-mark-compact.cc @@ -43,6 +43,7 @@ #include "src/global-handles.h" #include "src/heap/mark-compact-inl.h" #include "src/heap/mark-compact.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" #include "test/cctest/heap/heap-utils.h" diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc index 3d9999513a..6d6e70046c 100644 --- a/deps/v8/test/cctest/heap/test-page-promotion.cc +++ b/deps/v8/test/cctest/heap/test-page-promotion.cc @@ -115,7 +115,7 @@ UNINITIALIZED_TEST(PagePromotion_NewToNewJSArrayBuffer) { // Allocate a buffer we would like to check against. Handle<JSArrayBuffer> buffer = i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); - JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, 100); + CHECK(JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, 100)); std::vector<Handle<FixedArray>> handles; // Simulate a full space, filling the interesting page with live objects. heap::SimulateFullSpace(heap->new_space(), &handles); diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc index 8f34308ee0..2a1731f75a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc @@ -11,7 +11,9 @@ #include "include/libplatform/libplatform.h" #include "include/v8.h" +#include "src/api.h" #include "src/base/logging.h" +#include "src/objects-inl.h" #include "src/runtime/runtime.h" #include "src/interpreter/bytecode-array-iterator.h" @@ -70,7 +72,11 @@ v8::Local<v8::Script> BytecodeExpectationsPrinter::CompileScript( v8::Local<v8::Module> BytecodeExpectationsPrinter::CompileModule( const char* program) const { - v8::ScriptCompiler::Source source(V8StringFromUTF8(program)); + ScriptOrigin origin( + Local<v8::Value>(), Local<v8::Integer>(), Local<v8::Integer>(), + Local<v8::Boolean>(), Local<v8::Integer>(), Local<v8::Value>(), + Local<v8::Boolean>(), Local<v8::Boolean>(), True(isolate_)); + v8::ScriptCompiler::Source source(V8StringFromUTF8(program), origin); return v8::ScriptCompiler::CompileModule(isolate_, &source).ToLocalChecked(); } @@ -171,13 +177,13 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( stream << '(' << register_value.index() << ')'; } } else { - stream << 'U' << size_tag << '('; - switch (op_type) { case OperandType::kFlag8: + stream << 'U' << size_tag << '('; stream << bytecode_iterator.GetFlagOperand(op_index); break; case OperandType::kIdx: { + stream << 'U' << size_tag << '('; uint32_t idx = bytecode_iterator.GetIndexOperand(op_index); if (bytecode == Bytecode::kCallJSRuntime && op_index == 0) { stream << "%" << NameForNativeContextIntrinsicIndex(idx); @@ -187,21 +193,26 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( break; } case OperandType::kUImm: + stream << 'U' << size_tag << '('; stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index); break; case OperandType::kImm: + stream << 'I' << size_tag << '('; stream << bytecode_iterator.GetImmediateOperand(op_index); break; case OperandType::kRegCount: + stream << 'U' << size_tag << '('; stream << bytecode_iterator.GetRegisterCountOperand(op_index); break; case OperandType::kRuntimeId: { + stream << 'U' << size_tag << '('; Runtime::FunctionId id = bytecode_iterator.GetRuntimeIdOperand(op_index); stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; break; } case OperandType::kIntrinsicId: { + stream << 'U' << size_tag << '('; Runtime::FunctionId id = bytecode_iterator.GetIntrinsicIdOperand(op_index); stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden index 2d57edf4a0..da9ea93bd9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 6 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(9), /* 51 S> */ B(Return), ] constant pool: [ @@ -32,18 +32,18 @@ parameter count: 1 bytecode array length: 35 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(3), U8(9), B(Star), R(2), B(LdaZero), B(Star), R(1), B(Ldar), R(0), - /* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(3), - B(LdaSmi), U8(1), + /* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(4), + B(LdaSmi), I8(1), B(Star), R(1), - /* 59 E> */ B(AddSmi), U8(1), R(0), U8(2), - B(StaKeyedPropertySloppy), R(2), R(1), U8(3), + /* 59 E> */ B(AddSmi), I8(1), R(0), U8(2), + B(StaKeyedPropertySloppy), R(2), R(1), U8(4), B(Ldar), R(2), /* 66 S> */ B(Return), ] @@ -62,7 +62,7 @@ parameter count: 1 bytecode array length: 6 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(0), + /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(4), U8(0), /* 62 S> */ B(Return), ] constant pool: [ @@ -80,30 +80,30 @@ parameter count: 1 bytecode array length: 65 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(0), + /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(9), U8(0), B(Star), R(2), B(LdaZero), B(Star), R(1), - B(CreateArrayLiteral), U8(1), U8(0), U8(9), + B(CreateArrayLiteral), U8(1), U8(2), U8(9), B(Star), R(4), B(LdaZero), B(Star), R(3), B(Ldar), R(0), - /* 56 E> */ B(StaKeyedPropertySloppy), R(4), R(3), U8(2), + /* 56 E> */ B(StaKeyedPropertySloppy), R(4), R(3), U8(3), B(Ldar), R(4), - B(StaKeyedPropertySloppy), R(2), R(1), U8(7), - B(LdaSmi), U8(1), + B(StaKeyedPropertySloppy), R(2), R(1), U8(10), + B(LdaSmi), I8(1), B(Star), R(1), - B(CreateArrayLiteral), U8(2), U8(1), U8(9), + B(CreateArrayLiteral), U8(2), U8(6), U8(9), B(Star), R(4), B(LdaZero), B(Star), R(3), - /* 68 E> */ B(AddSmi), U8(2), R(0), U8(4), - B(StaKeyedPropertySloppy), R(4), R(3), U8(5), + /* 68 E> */ B(AddSmi), I8(2), R(0), U8(5), + B(StaKeyedPropertySloppy), R(4), R(3), U8(7), B(Ldar), R(4), - B(StaKeyedPropertySloppy), R(2), R(1), U8(7), + B(StaKeyedPropertySloppy), R(2), R(1), U8(10), B(Ldar), R(2), /* 77 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden index 1dcfc48cbc..6755fb80a0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden @@ -783,7 +783,7 @@ bytecodes: [ B(Star), R(0), /* 2591 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 2601 S> */ B(Wide), B(CreateArrayLiteral), U16(256), U16(0), U8(9), + /* 2601 S> */ B(Wide), B(CreateArrayLiteral), U16(256), U16(2), U8(9), /* 2619 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden index 4ea65897ff..afc009f7d8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden @@ -17,15 +17,15 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 49 S> */ B(LdaSmi), U8(1), + /* 49 S> */ B(LdaSmi), I8(1), B(Star), R(1), - /* 52 S> */ B(LdaSmi), U8(2), + /* 52 S> */ B(LdaSmi), I8(2), B(Star), R(0), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(1), - B(LdaSmi), U8(4), + B(LdaSmi), I8(4), B(Star), R(0), - B(LdaSmi), U8(5), + B(LdaSmi), I8(5), B(Star), R(1), /* 89 S> */ B(Return), ] @@ -45,9 +45,9 @@ parameter count: 1 bytecode array length: 13 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(55), + /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), - /* 57 S> */ B(LdaSmi), U8(100), + /* 57 S> */ B(LdaSmi), I8(100), B(Star), R(0), B(Star), R(1), /* 65 S> */ B(Nop), @@ -69,14 +69,14 @@ parameter count: 1 bytecode array length: 28 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(55), + /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(100), + /* 46 S> */ B(LdaSmi), I8(100), B(Mov), R(0), R(1), B(Star), R(0), /* 52 E> */ B(Add), R(1), U8(2), B(Star), R(1), - B(LdaSmi), U8(101), + B(LdaSmi), I8(101), B(Star), R(0), /* 64 E> */ B(Add), R(1), U8(3), B(Star), R(0), @@ -100,13 +100,13 @@ parameter count: 1 bytecode array length: 29 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(55), + /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(56), + /* 46 S> */ B(LdaSmi), I8(56), B(Star), R(0), /* 59 E> */ B(Sub), R(0), U8(2), B(Star), R(1), - B(LdaSmi), U8(57), + B(LdaSmi), I8(57), B(Star), R(0), /* 63 E> */ B(Add), R(1), U8(3), B(Star), R(0), @@ -131,18 +131,18 @@ parameter count: 1 bytecode array length: 37 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(55), + /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), - /* 76 S> */ B(LdaSmi), U8(1), + /* 76 S> */ B(LdaSmi), I8(1), B(Mov), R(0), R(2), B(Star), R(0), /* 56 E> */ B(Add), R(2), U8(2), B(Star), R(2), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(0), /* 66 E> */ B(Add), R(2), U8(3), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(0), /* 76 E> */ B(Add), R(2), U8(4), B(Star), R(1), @@ -165,18 +165,18 @@ parameter count: 1 bytecode array length: 37 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(55), + /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), - /* 76 S> */ B(LdaSmi), U8(1), + /* 76 S> */ B(LdaSmi), I8(1), B(Mov), R(0), R(1), B(Star), R(0), /* 56 E> */ B(Add), R(1), U8(2), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(0), /* 66 E> */ B(Add), R(1), U8(3), B(Star), R(1), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(0), /* 76 E> */ B(Add), R(1), U8(4), B(Star), R(0), @@ -198,31 +198,31 @@ parameter count: 1 bytecode array length: 72 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 50 S> */ B(LdaSmi), U8(20), + /* 50 S> */ B(LdaSmi), I8(20), B(Star), R(1), - /* 54 S> */ B(LdaSmi), U8(1), + /* 54 S> */ B(LdaSmi), I8(1), B(Mov), R(0), R(2), B(Star), R(0), /* 63 E> */ B(Add), R(2), U8(2), B(Star), R(2), - /* 78 E> */ B(AddSmi), U8(1), R(0), U8(3), + /* 78 E> */ B(AddSmi), I8(1), R(0), U8(3), B(Star), R(3), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(1), /* 83 E> */ B(Mul), R(3), U8(4), /* 73 E> */ B(Add), R(2), U8(5), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(1), /* 93 E> */ B(Add), R(2), U8(6), B(Star), R(2), - B(LdaSmi), U8(4), + B(LdaSmi), I8(4), B(Star), R(0), /* 103 E> */ B(Add), R(2), U8(7), B(Star), R(2), - B(LdaSmi), U8(5), + B(LdaSmi), I8(5), B(Star), R(1), /* 113 E> */ B(Add), R(2), U8(8), B(Star), R(2), @@ -245,9 +245,9 @@ parameter count: 1 bytecode array length: 43 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(17), + /* 42 S> */ B(LdaSmi), I8(17), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(1), + /* 46 S> */ B(LdaSmi), I8(1), B(Star), R(1), B(Ldar), R(0), /* 55 E> */ B(Add), R(1), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden index 547e83590e..acb9c36ce3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden @@ -14,13 +14,13 @@ parameter count: 1 bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(8), B(LdaZero), /* 56 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(5), - /* 63 S> */ B(LdaSmi), U8(1), + /* 63 S> */ B(LdaSmi), I8(1), /* 75 S> */ B(Return), B(LdaUndefined), /* 75 S> */ B(Return), @@ -39,13 +39,13 @@ parameter count: 1 bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(11), B(LdaZero), /* 56 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(5), - /* 63 S> */ B(LdaSmi), U8(1), + /* 63 S> */ B(LdaSmi), I8(1), /* 75 S> */ B(Return), B(LdaUndefined), /* 75 S> */ B(Return), @@ -64,15 +64,15 @@ parameter count: 1 bytecode array length: 23 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(8), B(LdaZero), /* 57 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(6), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Jump), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(0), B(LdaUndefined), /* 71 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden index d0c7f4934c..3bb478f3c4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden @@ -68,27 +68,27 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(1), + /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), - /* 65 S> */ B(LdaSmi), U8(10), + /* 65 S> */ B(LdaSmi), I8(10), /* 65 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(38), /* 56 E> */ B(StackCheck), - /* 75 S> */ B(LdaSmi), U8(12), + /* 75 S> */ B(LdaSmi), I8(12), /* 81 E> */ B(Mul), R(1), U8(3), B(Star), R(1), - /* 89 S> */ B(LdaSmi), U8(1), + /* 89 S> */ B(LdaSmi), I8(1), /* 95 E> */ B(Add), R(0), U8(4), B(Star), R(0), - /* 102 S> */ B(LdaSmi), U8(3), + /* 102 S> */ B(LdaSmi), I8(3), /* 108 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), /* 114 S> */ B(Jump), U8(11), - /* 126 S> */ B(LdaSmi), U8(4), + /* 126 S> */ B(LdaSmi), I8(4), /* 132 E> */ B(TestEqual), R(0), U8(6), B(JumpIfFalse), U8(4), /* 138 S> */ B(Jump), U8(5), - B(JumpLoop), U8(-40), U8(0), + B(JumpLoop), U8(40), I8(0), /* 147 S> */ B(Ldar), R(1), /* 157 S> */ B(Return), ] @@ -122,26 +122,26 @@ bytecodes: [ /* 68 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(4), /* 73 S> */ B(Jump), U8(45), - /* 85 S> */ B(LdaSmi), U8(3), + /* 85 S> */ B(LdaSmi), I8(3), /* 91 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 97 S> */ B(Jump), U8(39), - /* 106 S> */ B(LdaSmi), U8(4), + /* 106 S> */ B(LdaSmi), I8(4), /* 112 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 118 S> */ B(Jump), U8(30), - /* 127 S> */ B(LdaSmi), U8(10), + /* 127 S> */ B(LdaSmi), I8(10), /* 133 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), /* 140 S> */ B(Jump), U8(18), - /* 152 S> */ B(LdaSmi), U8(5), + /* 152 S> */ B(LdaSmi), I8(5), /* 158 E> */ B(TestEqual), R(0), U8(6), B(JumpIfFalse), U8(4), /* 164 S> */ B(Jump), U8(12), - /* 173 S> */ B(LdaSmi), U8(1), + /* 173 S> */ B(LdaSmi), I8(1), /* 179 E> */ B(Add), R(0), U8(7), B(Star), R(0), - B(JumpLoop), U8(-52), U8(0), + B(JumpLoop), U8(52), I8(0), /* 186 S> */ B(Ldar), R(0), /* 196 S> */ B(Return), ] @@ -171,19 +171,19 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), - /* 71 S> */ B(LdaSmi), U8(3), + /* 71 S> */ B(LdaSmi), I8(3), /* 71 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(22), /* 62 E> */ B(StackCheck), - /* 82 S> */ B(LdaSmi), U8(2), + /* 82 S> */ B(LdaSmi), I8(2), /* 88 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 94 S> */ B(Jump), U8(12), - /* 105 S> */ B(LdaSmi), U8(1), + /* 105 S> */ B(LdaSmi), I8(1), /* 111 E> */ B(Add), R(0), U8(4), B(Star), R(0), - B(JumpLoop), U8(-24), U8(1), - /* 122 S> */ B(LdaSmi), U8(1), + B(JumpLoop), U8(24), I8(1), + /* 122 S> */ B(LdaSmi), I8(1), /* 128 E> */ B(Add), R(0), U8(5), B(Star), R(0), /* 135 S> */ B(Jump), U8(2), @@ -210,20 +210,20 @@ parameter count: 1 bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 54 S> */ B(LdaSmi), U8(1), + /* 54 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 64 S> */ B(Ldar), R(0), B(JumpIfToBooleanFalse), U8(20), /* 57 E> */ B(StackCheck), - /* 71 S> */ B(LdaSmi), U8(12), + /* 71 S> */ B(LdaSmi), I8(12), /* 77 E> */ B(Mul), R(1), U8(2), B(Star), R(1), - /* 85 S> */ B(LdaSmi), U8(1), + /* 85 S> */ B(LdaSmi), I8(1), /* 91 E> */ B(Sub), R(0), U8(3), B(Star), R(0), - B(JumpLoop), U8(-19), U8(0), + B(JumpLoop), U8(19), I8(0), /* 98 S> */ B(Ldar), R(1), /* 108 S> */ B(Return), ] @@ -250,27 +250,27 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(1), + /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 56 E> */ B(StackCheck), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), /* 69 E> */ B(Mul), R(1), U8(2), B(Star), R(1), - /* 77 S> */ B(LdaSmi), U8(5), + /* 77 S> */ B(LdaSmi), I8(5), /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 89 S> */ B(Jump), U8(28), - /* 98 S> */ B(LdaSmi), U8(6), + /* 98 S> */ B(LdaSmi), I8(6), /* 104 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 110 S> */ B(Jump), U8(9), - /* 122 S> */ B(LdaSmi), U8(1), + /* 122 S> */ B(LdaSmi), I8(1), /* 128 E> */ B(Add), R(0), U8(5), B(Star), R(0), - /* 144 S> */ B(LdaSmi), U8(10), + /* 144 S> */ B(LdaSmi), I8(10), /* 144 E> */ B(TestLessThan), R(0), U8(6), B(JumpIfFalse), U8(5), - B(JumpLoop), U8(-40), U8(0), + B(JumpLoop), U8(40), I8(0), /* 151 S> */ B(Ldar), R(1), /* 161 S> */ B(Return), ] @@ -294,19 +294,19 @@ parameter count: 1 bytecode array length: 32 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 54 S> */ B(LdaSmi), U8(1), + /* 54 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 57 E> */ B(StackCheck), - /* 64 S> */ B(LdaSmi), U8(12), + /* 64 S> */ B(LdaSmi), I8(12), /* 70 E> */ B(Mul), R(1), U8(2), B(Star), R(1), - /* 78 S> */ B(LdaSmi), U8(1), + /* 78 S> */ B(LdaSmi), I8(1), /* 84 E> */ B(Sub), R(0), U8(3), B(Star), R(0), /* 98 S> */ B(JumpIfToBooleanFalse), U8(5), - B(JumpLoop), U8(-17), U8(0), + B(JumpLoop), U8(17), I8(0), /* 102 S> */ B(Ldar), R(1), /* 112 S> */ B(Return), ] @@ -333,20 +333,20 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(1), + /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 56 E> */ B(StackCheck), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), /* 69 E> */ B(Mul), R(1), U8(2), B(Star), R(1), - /* 77 S> */ B(LdaSmi), U8(5), + /* 77 S> */ B(LdaSmi), I8(5), /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 89 S> */ B(Jump), U8(18), - /* 98 S> */ B(LdaSmi), U8(1), + /* 98 S> */ B(LdaSmi), I8(1), /* 104 E> */ B(Add), R(0), U8(4), B(Star), R(0), - /* 111 S> */ B(LdaSmi), U8(6), + /* 111 S> */ B(LdaSmi), I8(6), /* 117 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), /* 123 S> */ B(Jump), U8(2), @@ -376,24 +376,24 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(1), + /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 56 E> */ B(StackCheck), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), /* 69 E> */ B(Mul), R(1), U8(2), B(Star), R(1), - /* 77 S> */ B(LdaSmi), U8(5), + /* 77 S> */ B(LdaSmi), I8(5), /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 89 S> */ B(Jump), U8(21), - /* 98 S> */ B(LdaSmi), U8(1), + /* 98 S> */ B(LdaSmi), I8(1), /* 104 E> */ B(Add), R(0), U8(4), B(Star), R(0), - /* 111 S> */ B(LdaSmi), U8(6), + /* 111 S> */ B(LdaSmi), I8(6), /* 117 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), /* 123 S> */ B(Jump), U8(2), - B(JumpLoop), U8(-33), U8(0), + B(JumpLoop), U8(33), I8(0), /* 149 S> */ B(Ldar), R(1), /* 159 S> */ B(Return), ] @@ -419,18 +419,18 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), - /* 58 S> */ B(LdaSmi), U8(1), + /* 58 S> */ B(LdaSmi), I8(1), /* 64 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(4), /* 70 S> */ B(Jump), U8(21), - /* 79 S> */ B(LdaSmi), U8(2), + /* 79 S> */ B(LdaSmi), I8(2), /* 85 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 91 S> */ B(Jump), U8(9), - /* 103 S> */ B(LdaSmi), U8(1), + /* 103 S> */ B(LdaSmi), I8(1), /* 109 E> */ B(Add), R(0), U8(4), B(Star), R(0), - B(JumpLoop), U8(-26), U8(0), + B(JumpLoop), U8(26), I8(0), B(LdaUndefined), /* 116 S> */ B(Return), ] @@ -455,18 +455,18 @@ bytecodes: [ /* 47 S> */ B(LdaZero), B(Star), R(0), /* 34 E> */ B(StackCheck), - /* 56 S> */ B(LdaSmi), U8(1), + /* 56 S> */ B(LdaSmi), I8(1), /* 62 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(4), /* 68 S> */ B(Jump), U8(21), - /* 77 S> */ B(LdaSmi), U8(2), + /* 77 S> */ B(LdaSmi), I8(2), /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 89 S> */ B(Jump), U8(9), - /* 101 S> */ B(LdaSmi), U8(1), + /* 101 S> */ B(LdaSmi), I8(1), /* 107 E> */ B(Add), R(0), U8(4), B(Star), R(0), - B(JumpLoop), U8(-26), U8(0), + B(JumpLoop), U8(26), I8(0), B(LdaUndefined), /* 114 S> */ B(Return), ] @@ -491,18 +491,18 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), - /* 68 S> */ B(LdaSmi), U8(1), + /* 68 S> */ B(LdaSmi), I8(1), /* 74 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 80 S> */ B(Jump), U8(21), - /* 89 S> */ B(LdaSmi), U8(2), + /* 89 S> */ B(LdaSmi), I8(2), /* 95 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 101 S> */ B(Jump), U8(2), - /* 55 S> */ B(LdaSmi), U8(1), + /* 55 S> */ B(LdaSmi), I8(1), /* 59 E> */ B(Add), R(0), U8(2), B(Star), R(0), - B(JumpLoop), U8(-26), U8(0), + B(JumpLoop), U8(26), I8(0), B(LdaUndefined), /* 113 S> */ B(Return), ] @@ -526,18 +526,18 @@ bytecodes: [ /* 47 S> */ B(LdaZero), B(Star), R(0), /* 34 E> */ B(StackCheck), - /* 66 S> */ B(LdaSmi), U8(1), + /* 66 S> */ B(LdaSmi), I8(1), /* 72 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 78 S> */ B(Jump), U8(21), - /* 87 S> */ B(LdaSmi), U8(2), + /* 87 S> */ B(LdaSmi), I8(2), /* 93 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 99 S> */ B(Jump), U8(2), - /* 53 S> */ B(LdaSmi), U8(1), + /* 53 S> */ B(LdaSmi), I8(1), /* 57 E> */ B(Add), R(0), U8(2), B(Star), R(0), - B(JumpLoop), U8(-26), U8(0), + B(JumpLoop), U8(26), I8(0), B(LdaUndefined), /* 111 S> */ B(Return), ] @@ -563,18 +563,18 @@ bytecodes: [ B(Star), R(0), /* 58 S> */ B(LdaZero), B(Star), R(1), - /* 63 S> */ B(LdaSmi), U8(100), + /* 63 S> */ B(LdaSmi), I8(100), /* 63 E> */ B(TestLessThan), R(1), U8(2), B(JumpIfFalse), U8(22), /* 45 E> */ B(StackCheck), - /* 85 S> */ B(LdaSmi), U8(1), + /* 85 S> */ B(LdaSmi), I8(1), /* 91 E> */ B(Add), R(0), U8(4), B(Star), R(0), /* 98 S> */ B(Jump), U8(2), - /* 72 S> */ B(LdaSmi), U8(1), + /* 72 S> */ B(LdaSmi), I8(1), /* 76 E> */ B(Add), R(1), U8(3), B(Star), R(1), - B(JumpLoop), U8(-24), U8(0), + B(JumpLoop), U8(24), I8(0), B(LdaUndefined), /* 110 S> */ B(Return), ] @@ -596,20 +596,20 @@ parameter count: 1 bytecode array length: 33 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 58 S> */ B(LdaSmi), U8(10), + /* 58 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 62 S> */ B(Ldar), R(1), B(JumpIfToBooleanFalse), U8(19), /* 45 E> */ B(StackCheck), - /* 74 S> */ B(LdaSmi), U8(12), + /* 74 S> */ B(LdaSmi), I8(12), /* 80 E> */ B(Mul), R(0), U8(3), B(Star), R(0), /* 67 S> */ B(Ldar), R(1), B(Dec), U8(2), B(Star), R(1), - B(JumpLoop), U8(-18), U8(0), + B(JumpLoop), U8(18), I8(0), /* 88 S> */ B(Ldar), R(0), /* 98 S> */ B(Return), ] @@ -662,17 +662,17 @@ bytecodes: [ /* 58 S> */ B(LdaZero), B(Star), R(1), /* 45 E> */ B(StackCheck), - /* 76 S> */ B(LdaSmi), U8(1), + /* 76 S> */ B(LdaSmi), I8(1), /* 82 E> */ B(Add), R(0), U8(3), B(Star), R(0), - /* 89 S> */ B(LdaSmi), U8(20), + /* 89 S> */ B(LdaSmi), I8(20), /* 95 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 102 S> */ B(Jump), U8(11), /* 69 S> */ B(Ldar), R(1), B(Inc), U8(2), B(Star), R(1), - B(JumpLoop), U8(-23), U8(0), + B(JumpLoop), U8(23), I8(0), /* 112 S> */ B(Ldar), R(0), /* 122 S> */ B(Return), ] @@ -710,7 +710,7 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), B(CreateClosure), U8(1), U8(2), U8(2), B(Star), R(0), - /* 73 S> */ B(LdaSmi), U8(1), + /* 73 S> */ B(LdaSmi), I8(1), /* 73 E> */ B(StaCurrentContextSlot), U8(4), B(Mov), R(0), R(2), /* 106 S> */ B(LdaCurrentContextSlot), U8(4), @@ -722,7 +722,7 @@ bytecodes: [ B(Inc), U8(3), /* 127 E> */ B(StaCurrentContextSlot), U8(4), B(PopContext), R(3), - B(JumpLoop), U8(-45), U8(0), + B(JumpLoop), U8(45), I8(0), B(LdaUndefined), /* 137 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden index ce343d01b3..61915b27ea 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden @@ -22,7 +22,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 56 S> */ B(LdaSmi), U8(1), + /* 56 S> */ B(LdaSmi), I8(1), /* 62 E> */ B(Add), R(0), U8(2), B(Star), R(0), /* 69 S> */ B(Jump), U8(2), @@ -56,13 +56,13 @@ bytecodes: [ B(Star), R(0), /* 71 S> */ B(LdaZero), B(Star), R(1), - /* 76 S> */ B(LdaSmi), U8(10), + /* 76 S> */ B(LdaSmi), I8(10), /* 76 E> */ B(TestLessThan), R(1), U8(2), B(JumpIfFalse), U8(54), /* 58 E> */ B(StackCheck), /* 106 S> */ B(LdaZero), B(Star), R(2), - /* 111 S> */ B(LdaSmi), U8(3), + /* 111 S> */ B(LdaSmi), I8(3), /* 111 E> */ B(TestLessThan), R(2), U8(4), B(JumpIfFalse), U8(34), /* 93 E> */ B(StackCheck), @@ -72,18 +72,18 @@ bytecodes: [ /* 142 S> */ B(Ldar), R(2), /* 148 E> */ B(Add), R(1), U8(7), B(Star), R(3), - B(LdaSmi), U8(12), + B(LdaSmi), I8(12), /* 152 E> */ B(TestEqual), R(3), U8(8), B(JumpIfFalse), U8(4), /* 161 S> */ B(Jump), U8(20), /* 118 S> */ B(Ldar), R(2), B(Inc), U8(5), B(Star), R(2), - B(JumpLoop), U8(-36), U8(1), + B(JumpLoop), U8(36), I8(1), /* 84 S> */ B(Ldar), R(1), B(Inc), U8(3), B(Star), R(1), - B(JumpLoop), U8(-56), U8(0), + B(JumpLoop), U8(56), I8(0), /* 188 S> */ B(Ldar), R(0), /* 200 S> */ B(Return), ] @@ -112,7 +112,7 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), B(CreateClosure), U8(1), U8(2), U8(2), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(10), + /* 53 S> */ B(LdaSmi), I8(10), /* 53 E> */ B(StaCurrentContextSlot), U8(4), B(Mov), R(0), R(1), B(Ldar), R(0), @@ -150,7 +150,7 @@ bytecodes: [ B(LdaTheHole), B(StaCurrentContextSlot), U8(4), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(4), B(Ldar), R(closure), B(CreateBlockContext), U8(0), @@ -159,17 +159,17 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), B(CreateClosure), U8(1), U8(2), U8(2), B(Star), R(0), - /* 76 S> */ B(LdaSmi), U8(2), + /* 76 S> */ B(LdaSmi), I8(2), /* 76 E> */ B(StaCurrentContextSlot), U8(4), B(Mov), R(0), R(1), /* 118 S> */ B(LdaCurrentContextSlot), U8(4), B(JumpIfToBooleanFalse), U8(6), /* 125 S> */ B(PopContext), R(3), B(Jump), U8(8), - /* 142 S> */ B(LdaSmi), U8(3), + /* 142 S> */ B(LdaSmi), I8(3), /* 144 E> */ B(StaCurrentContextSlot), U8(4), B(PopContext), R(3), - /* 155 S> */ B(LdaSmi), U8(4), + /* 155 S> */ B(LdaSmi), I8(4), /* 157 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 162 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden new file mode 100644 index 0000000000..c2acbec102 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden @@ -0,0 +1,107 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: yes + +--- +snippet: " + Math.max(...[1, 2, 3]); +" +frame size: 3 +parameter count: 1 +bytecode array length: 24 +bytecodes: [ + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaGlobal), U8(0), U8(4), + B(Star), R(1), + /* 38 E> */ B(LdaNamedProperty), R(1), U8(1), U8(6), + B(Star), R(0), + B(CreateArrayLiteral), U8(2), U8(8), U8(9), + B(Star), R(2), + /* 39 E> */ B(CallWithSpread), R(0), R(1), U8(2), + B(LdaUndefined), + /* 58 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Math"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["max"], + CONSTANT_ELEMENTS_PAIR_TYPE, +] +handlers: [ +] + +--- +snippet: " + Math.max(0, ...[1, 2, 3]); +" +frame size: 4 +parameter count: 1 +bytecode array length: 27 +bytecodes: [ + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaGlobal), U8(0), U8(4), + B(Star), R(1), + /* 38 E> */ B(LdaNamedProperty), R(1), U8(1), U8(6), + B(Star), R(0), + B(LdaZero), + B(Star), R(2), + B(CreateArrayLiteral), U8(2), U8(8), U8(9), + B(Star), R(3), + /* 39 E> */ B(CallWithSpread), R(0), R(1), U8(3), + B(LdaUndefined), + /* 61 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Math"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["max"], + CONSTANT_ELEMENTS_PAIR_TYPE, +] +handlers: [ +] + +--- +snippet: " + Math.max(0, ...[1, 2, 3], 4); +" +frame size: 8 +parameter count: 1 +bytecode array length: 60 +bytecodes: [ + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaUndefined), + B(Star), R(1), + /* 34 E> */ B(LdaGlobal), U8(0), U8(2), + B(Star), R(0), + B(LdaNamedProperty), R(0), U8(1), U8(4), + B(Star), R(2), + B(LdaUndefined), + B(Star), R(4), + B(CreateArrayLiteral), U8(2), U8(6), U8(9), + B(Star), R(5), + B(LdaUndefined), + B(Star), R(6), + B(CreateArrayLiteral), U8(3), U8(7), U8(9), + B(Star), R(7), + B(CallJSRuntime), U8(%spread_iterable), R(6), U8(2), + B(Star), R(6), + B(CreateArrayLiteral), U8(4), U8(8), U8(9), + B(Star), R(7), + B(CallJSRuntime), U8(%spread_arguments), R(4), U8(4), + B(Star), R(4), + B(Mov), R(0), R(3), + B(CallJSRuntime), U8(%reflect_apply), R(1), U8(4), + B(LdaUndefined), + /* 64 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Math"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["max"], + CONSTANT_ELEMENTS_PAIR_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden index beb9a30222..88bf4420f2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden @@ -45,11 +45,11 @@ bytecodes: [ B(Star), R(1), B(LdaGlobal), U8(0), U8(4), B(Star), R(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(2), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(3), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(4), /* 46 E> */ B(Call), R(0), R(1), U8(4), U8(2), /* 58 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden index cad09007e5..fc7a6f7843 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden @@ -32,9 +32,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(30), + B(LdaSmi), I8(30), B(Star), R(8), - B(LdaSmi), U8(52), + B(LdaSmi), I8(52), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden index f60f73e065..bd3067686d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden @@ -19,7 +19,7 @@ bytecodes: [ /* 45 E> */ B(StackCheck), /* 50 S> */ B(LdaGlobal), U8(0), U8(4), B(Star), R(0), - /* 57 E> */ B(New), R(0), R(0), U8(0), U8(2), + /* 57 E> */ B(Construct), R(0), R(0), U8(0), U8(2), /* 68 S> */ B(Return), ] constant pool: [ @@ -41,10 +41,10 @@ bytecodes: [ /* 58 E> */ B(StackCheck), /* 63 S> */ B(LdaGlobal), U8(0), U8(4), B(Star), R(0), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(1), B(Ldar), R(0), - /* 70 E> */ B(New), R(0), R(1), U8(1), U8(2), + /* 70 E> */ B(Construct), R(0), R(1), U8(1), U8(2), /* 82 S> */ B(Return), ] constant pool: [ @@ -71,14 +71,14 @@ bytecodes: [ /* 100 E> */ B(StackCheck), /* 105 S> */ B(LdaGlobal), U8(0), U8(4), B(Star), R(0), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(1), - B(LdaSmi), U8(4), + B(LdaSmi), I8(4), B(Star), R(2), - B(LdaSmi), U8(5), + B(LdaSmi), I8(5), B(Star), R(3), B(Ldar), R(0), - /* 112 E> */ B(New), R(0), R(1), U8(3), U8(2), + /* 112 E> */ B(Construct), R(0), R(1), U8(3), U8(2), /* 130 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden index 31e697590e..45f504ede1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden @@ -53,9 +53,9 @@ parameter count: 1 bytecode array length: 15 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 15 S> */ B(LdaSmi), U8(1), + /* 15 S> */ B(LdaSmi), I8(1), B(Star), R(0), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(1), B(CallRuntime), U16(Runtime::kAdd), R(0), U8(2), /* 33 S> */ B(Return), @@ -77,7 +77,7 @@ bytecodes: [ /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaUndefined), B(Star), R(0), - B(CreateArrayLiteral), U8(0), U8(0), U8(9), + B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(Star), R(1), B(CallJSRuntime), U8(%spread_iterable), R(0), U8(2), /* 44 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden index 0c41685b86..9316f65b3f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden @@ -36,7 +36,7 @@ bytecodes: [ B(Star), R(1), /* 117 E> */ B(Call), R(1), R(this), U8(1), U8(2), B(Star), R(1), - /* 126 E> */ B(AddSmi), U8(1), R(1), U8(8), + /* 126 E> */ B(AddSmi), I8(1), R(1), U8(8), /* 131 S> */ B(Return), ] constant pool: [ @@ -72,7 +72,7 @@ bytecodes: [ B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(3), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(4), B(Mov), R(this), R(1), /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4), @@ -115,10 +115,10 @@ bytecodes: [ /* 113 E> */ B(StackCheck), /* 118 S> */ B(Ldar), R(1), B(GetSuperConstructor), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), B(Ldar), R(0), - /* 118 E> */ B(New), R(2), R(3), U8(1), U8(2), + /* 118 E> */ B(Construct), R(2), R(3), U8(1), U8(2), B(Star), R(2), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -131,7 +131,7 @@ bytecodes: [ B(Star), R(2), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), B(Star), R(2), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), /* 136 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), B(Ldar), R(this), B(JumpIfNotHole), U8(11), @@ -171,7 +171,7 @@ bytecodes: [ /* 117 S> */ B(Ldar), R(1), B(GetSuperConstructor), R(2), B(Ldar), R(0), - /* 117 E> */ B(New), R(2), R(0), U8(0), U8(2), + /* 117 E> */ B(Construct), R(2), R(0), U8(0), U8(2), B(Star), R(2), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -184,7 +184,7 @@ bytecodes: [ B(Star), R(2), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), B(Star), R(2), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), /* 134 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), B(Ldar), R(this), B(JumpIfNotHole), U8(11), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index 7b283024c8..7ff8973bc6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -25,9 +25,9 @@ bytecodes: [ B(Star), R(3), B(LdaTheHole), B(Star), R(4), - B(LdaSmi), U8(34), + B(LdaSmi), I8(34), B(Star), R(6), - B(Wide), B(LdaSmi), U16(148), + B(Wide), B(LdaSmi), I16(148), B(Star), R(7), B(Mov), R(3), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), @@ -36,7 +36,7 @@ bytecodes: [ B(Star), R(6), B(CreateClosure), U8(2), U8(3), U8(2), B(Star), R(7), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(8), B(Ldar), R(7), B(StaDataPropertyInLiteral), R(4), R(6), U8(1), U8(4), @@ -76,9 +76,9 @@ bytecodes: [ B(Star), R(3), B(LdaTheHole), B(Star), R(4), - B(LdaSmi), U8(34), + B(LdaSmi), I8(34), B(Star), R(6), - B(Wide), B(LdaSmi), U16(148), + B(Wide), B(LdaSmi), I16(148), B(Star), R(7), B(Mov), R(3), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), @@ -87,7 +87,7 @@ bytecodes: [ B(Star), R(6), B(CreateClosure), U8(2), U8(3), U8(2), B(Star), R(7), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(8), B(Ldar), R(7), B(StaDataPropertyInLiteral), R(4), R(6), U8(1), U8(4), @@ -135,22 +135,22 @@ bytecodes: [ B(Star), R(4), B(LdaTheHole), B(Star), R(5), - B(LdaSmi), U8(62), + B(LdaSmi), I8(62), B(Star), R(7), - B(Wide), B(LdaSmi), U16(128), + B(Wide), B(LdaSmi), I16(128), B(Star), R(8), B(Mov), R(4), R(6), B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(4), B(Star), R(5), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), /* 75 E> */ B(ToName), R(7), B(CreateClosure), U8(3), U8(3), U8(2), B(Star), R(8), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(9), B(Ldar), R(8), B(StaDataPropertyInLiteral), R(5), R(7), U8(3), U8(5), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), /* 106 E> */ B(ToName), R(7), B(LdaConstant), U8(4), B(TestEqualStrict), R(7), U8(0), @@ -202,9 +202,9 @@ bytecodes: [ B(Star), R(4), B(LdaTheHole), B(Star), R(5), - B(LdaSmi), U8(49), + B(LdaSmi), I8(49), B(Star), R(7), - B(LdaSmi), U8(86), + B(LdaSmi), I8(86), B(Star), R(8), B(Mov), R(4), R(6), B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(4), @@ -215,7 +215,7 @@ bytecodes: [ B(Star), R(1), B(Star), R(2), /* 87 S> */ B(Nop), - /* 94 E> */ B(New), R(2), R(0), U8(0), U8(3), + /* 94 E> */ B(Construct), R(2), R(0), U8(0), U8(3), /* 103 S> */ B(Return), ] constant pool: [ @@ -240,9 +240,9 @@ bytecodes: [ B(Star), R(4), B(LdaTheHole), B(Star), R(5), - B(LdaSmi), U8(35), + B(LdaSmi), I8(35), B(Star), R(7), - B(LdaSmi), U8(43), + B(LdaSmi), I8(43), B(Star), R(8), B(Mov), R(4), R(6), B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(4), @@ -255,9 +255,9 @@ bytecodes: [ B(Star), R(4), B(LdaTheHole), B(Star), R(5), - B(LdaSmi), U8(45), + B(LdaSmi), I8(45), B(Star), R(7), - B(LdaSmi), U8(73), + B(LdaSmi), I8(73), B(Star), R(8), B(Mov), R(4), R(6), B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(4), @@ -266,7 +266,7 @@ bytecodes: [ B(Star), R(7), B(CreateClosure), U8(3), U8(4), U8(2), B(Star), R(8), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(9), B(Ldar), R(8), B(StaDataPropertyInLiteral), R(6), R(7), U8(1), U8(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden index 273f3323eb..620031bf27 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden @@ -14,9 +14,9 @@ parameter count: 1 bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(AddSmi), U8(2), R(0), U8(2), + /* 45 S> */ B(AddSmi), I8(2), R(0), U8(2), B(Mov), R(0), R(1), B(Star), R(0), B(LdaUndefined), @@ -36,9 +36,9 @@ parameter count: 1 bytecode array length: 17 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(2), + /* 45 S> */ B(LdaSmi), I8(2), B(Div), R(0), U8(2), B(Mov), R(0), R(1), B(Star), R(0), @@ -59,13 +59,13 @@ parameter count: 1 bytecode array length: 26 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), - /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(3), B(Star), R(2), - B(LdaSmi), U8(2), - B(Mul), R(2), U8(4), - /* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(5), + B(LdaSmi), I8(2), + B(Mul), R(2), U8(5), + /* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(6), B(LdaUndefined), /* 67 S> */ B(Return), ] @@ -85,15 +85,15 @@ parameter count: 1 bytecode array length: 29 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), - /* 52 S> */ B(LdaSmi), U8(1), + /* 52 S> */ B(LdaSmi), I8(1), B(Star), R(2), - B(LdaKeyedProperty), R(0), U8(2), + B(LdaKeyedProperty), R(0), U8(3), B(Star), R(3), - B(LdaSmi), U8(2), - B(BitwiseXor), R(3), U8(4), - /* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(5), + B(LdaSmi), I8(2), + B(BitwiseXor), R(3), U8(5), + /* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(6), B(LdaUndefined), /* 63 S> */ B(Return), ] @@ -114,12 +114,12 @@ bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 45 S> */ B(CreateClosure), U8(0), U8(2), U8(2), /* 75 S> */ B(LdaCurrentContextSlot), U8(4), B(Star), R(1), - B(BitwiseOrSmi), U8(24), R(1), U8(3), + B(BitwiseOrSmi), I8(24), R(1), U8(3), /* 77 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 84 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden index 049de5a8b3..db44e2bd87 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(2), + /* 34 S> */ B(LdaSmi), I8(2), /* 52 S> */ B(Return), ] constant pool: [ @@ -31,7 +31,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(3), + /* 34 S> */ B(LdaSmi), I8(3), /* 60 S> */ B(Return), ] constant pool: [ @@ -50,12 +50,12 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaZero), B(Star), R(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), /* 43 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(6), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Jump), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 56 S> */ B(Return), ] constant pool: [ @@ -76,9 +76,9 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(6), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Jump), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 63 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden index f19879c9e2..6ba2ad4d94 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden @@ -16,7 +16,7 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(10), + /* 44 S> */ B(LdaSmi), I8(10), B(Star), R(0), B(LdaUndefined), /* 48 S> */ B(Return), @@ -37,7 +37,7 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(10), + /* 44 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 48 S> */ B(Nop), /* 58 S> */ B(Return), @@ -58,7 +58,7 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 48 S> */ B(LdaSmi), U8(20), + /* 48 S> */ B(LdaSmi), I8(20), B(Star), R(1), B(Ldar), R(0), B(JumpIfNotHole), U8(11), @@ -87,9 +87,9 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(10), + /* 44 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 48 S> */ B(LdaSmi), U8(20), + /* 48 S> */ B(LdaSmi), I8(20), /* 50 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(LdaUndefined), /* 56 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden index 8dc85b3326..c92627b183 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden @@ -20,7 +20,7 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(10), + /* 44 S> */ B(LdaSmi), I8(10), /* 44 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 74 S> */ B(Return), @@ -46,9 +46,9 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(10), + /* 44 S> */ B(LdaSmi), I8(10), /* 44 E> */ B(StaCurrentContextSlot), U8(4), - /* 74 S> */ B(LdaCurrentContextSlot), U8(4), + /* 74 S> */ B(LdaImmutableCurrentContextSlot), U8(4), /* 84 S> */ B(Return), ] constant pool: [ @@ -72,7 +72,7 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 47 S> */ B(LdaSmi), U8(20), + /* 47 S> */ B(LdaSmi), I8(20), B(Star), R(2), B(LdaCurrentContextSlot), U8(4), B(JumpIfNotHole), U8(11), @@ -106,9 +106,9 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(10), + /* 44 S> */ B(LdaSmi), I8(10), /* 44 E> */ B(StaCurrentContextSlot), U8(4), - /* 48 S> */ B(LdaSmi), U8(20), + /* 48 S> */ B(LdaSmi), I8(20), /* 50 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(LdaUndefined), /* 82 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 b0df006a63..dc8d7f67f2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden @@ -36,7 +36,7 @@ bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 45 S> */ B(CreateClosure), U8(0), U8(2), U8(2), /* 75 S> */ B(Return), @@ -58,9 +58,9 @@ bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(4), - /* 53 S> */ B(LdaSmi), U8(2), + /* 53 S> */ B(LdaSmi), I8(2), /* 53 E> */ B(StaCurrentContextSlot), U8(5), /* 56 S> */ B(CreateClosure), U8(0), U8(2), U8(2), /* 92 S> */ B(Return), @@ -111,14 +111,14 @@ bytecodes: [ B(LdaTheHole), B(StaCurrentContextSlot), U8(4), /* 30 E> */ B(StackCheck), - /* 56 S> */ B(LdaSmi), U8(1), + /* 56 S> */ B(LdaSmi), I8(1), /* 56 E> */ B(StaCurrentContextSlot), U8(4), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), - /* 69 S> */ B(LdaSmi), U8(2), + /* 69 S> */ B(LdaSmi), I8(2), /* 69 E> */ B(StaCurrentContextSlot), U8(4), /* 72 S> */ B(CreateClosure), U8(1), U8(2), U8(2), B(PopContext), R(0), @@ -906,7 +906,7 @@ bytecodes: [ B(LdaGlobal), U8(0), 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 S> */ B(LdaSmi), I8(100), /* 3454 E> */ B(Wide), B(StaCurrentContextSlot), U16(256), /* 3459 S> */ B(Wide), B(LdaCurrentContextSlot), U16(256), /* 3468 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden index 61186cd887..512ad2668a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 10 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(Inc), U8(2), B(Star), R(0), @@ -34,7 +34,7 @@ parameter count: 1 bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(ToNumber), R(1), B(Ldar), R(1), @@ -57,7 +57,7 @@ parameter count: 1 bytecode array length: 10 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(Dec), U8(2), B(Star), R(0), @@ -77,7 +77,7 @@ parameter count: 1 bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(ToNumber), R(1), B(Ldar), R(1), @@ -100,13 +100,13 @@ parameter count: 1 bytecode array length: 26 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), - /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(3), B(ToNumber), R(2), B(Ldar), R(2), - B(Inc), U8(6), - /* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), + B(Inc), U8(7), + /* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(5), B(Ldar), R(2), /* 70 S> */ B(Return), ] @@ -126,11 +126,11 @@ parameter count: 1 bytecode array length: 20 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), - /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), - B(Dec), U8(6), - /* 65 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(3), + B(Dec), U8(7), + /* 65 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(5), /* 70 S> */ B(Return), ] constant pool: [ @@ -151,14 +151,14 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(1), R(2), + /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(2), U8(1), R(2), B(Mov), R(2), R(1), /* 72 S> */ B(Ldar), R(0), - /* 81 E> */ B(LdaKeyedProperty), R(1), U8(2), + /* 81 E> */ B(LdaKeyedProperty), R(1), U8(3), B(ToNumber), R(4), B(Ldar), R(4), - B(Dec), U8(6), - /* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(4), + B(Dec), U8(7), + /* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(5), B(Ldar), R(4), /* 90 S> */ B(Return), ] @@ -180,12 +180,12 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(1), R(2), + /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(2), U8(1), R(2), B(Mov), R(2), R(1), /* 72 S> */ B(Ldar), R(0), - /* 83 E> */ B(LdaKeyedProperty), R(1), U8(2), - B(Inc), U8(6), - /* 87 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(4), + /* 83 E> */ B(LdaKeyedProperty), R(1), U8(3), + B(Inc), U8(7), + /* 87 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(5), /* 90 S> */ B(Return), ] constant pool: [ @@ -206,7 +206,7 @@ bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 53 S> */ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), @@ -232,7 +232,7 @@ bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 53 S> */ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), @@ -259,17 +259,17 @@ parameter count: 1 bytecode array length: 28 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 44 S> */ B(LdaSmi), U8(1), + /* 44 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 55 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 55 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(Star), R(1), /* 63 S> */ B(Ldar), R(0), B(ToNumber), R(3), B(Ldar), R(3), - B(Inc), U8(2), + B(Inc), U8(3), B(Star), R(0), - B(LdaSmi), U8(2), - /* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(3), + B(LdaSmi), I8(2), + /* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(4), /* 84 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden index 6c4a7b5ac2..7e6f40a3b6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden @@ -31,7 +31,7 @@ parameter count: 1 bytecode array length: 7 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 66 S> */ B(LdaSmi), U8(1), + /* 66 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(LdaUndefined), /* 69 S> */ B(Return), @@ -50,7 +50,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(LdaSmi), U8(1), + /* 46 S> */ B(LdaSmi), I8(1), /* 78 S> */ B(Return), ] constant pool: [ @@ -67,12 +67,12 @@ parameter count: 1 bytecode array length: 13 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(5), - /* 54 S> */ B(LdaSmi), U8(1), + /* 54 S> */ B(LdaSmi), I8(1), /* 77 S> */ B(Return), - /* 67 S> */ B(LdaSmi), U8(2), + /* 67 S> */ B(LdaSmi), I8(2), /* 77 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden index 91c3bb99d4..62dc163a70 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -25,7 +25,7 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), B(LdaUndefined), @@ -82,10 +82,10 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), - /* 11 S> */ B(LdaSmi), U8(2), + /* 11 S> */ B(LdaSmi), I8(2), /* 12 E> */ B(StaGlobalSloppy), U8(1), U8(4), B(Star), R(0), /* 15 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 e139fd65d1..08b3f47e13 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 14 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), /* 56 S> */ B(LdaConstant), U8(1), B(DeletePropertySloppy), R(0), @@ -36,7 +36,7 @@ parameter count: 1 bytecode array length: 14 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), /* 70 S> */ B(LdaConstant), U8(1), B(DeletePropertyStrict), R(0), @@ -58,9 +58,9 @@ parameter count: 1 bytecode array length: 14 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), - /* 56 S> */ B(LdaSmi), U8(2), + /* 56 S> */ B(LdaSmi), I8(2), B(DeletePropertySloppy), R(0), /* 76 S> */ B(Return), ] @@ -79,7 +79,7 @@ parameter count: 1 bytecode array length: 7 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(LdaFalse), /* 63 S> */ B(Return), @@ -103,13 +103,13 @@ 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), + /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Ldar), R(1), /* 56 E> */ B(StaCurrentContextSlot), U8(4), - /* 64 S> */ B(CreateClosure), U8(1), U8(2), U8(2), - /* 93 S> */ B(LdaCurrentContextSlot), U8(4), + /* 64 S> */ B(CreateClosure), U8(1), U8(3), U8(2), + /* 93 S> */ B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(1), - B(LdaSmi), U8(1), + B(LdaSmi), I8(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 662ecf14d9..412c5ccbe6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden @@ -33,7 +33,7 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 55 S> */ B(LdaSmi), U8(100), + /* 55 S> */ B(LdaSmi), I8(100), B(Star), R(0), /* 42 S> */ B(LdaUndefined), B(Star), R(1), @@ -56,7 +56,7 @@ bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 E> */ B(StackCheck), - /* 56 S> */ B(LdaSmi), U8(10), + /* 56 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 69 S> */ B(Inc), U8(2), B(Star), R(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden index a311aa9101..3a865c65db 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden @@ -30,9 +30,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(30), + B(LdaSmi), I8(30), B(Star), R(8), - B(LdaSmi), U8(41), + B(LdaSmi), I8(41), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden new file mode 100644 index 0000000000..3b705f1799 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden @@ -0,0 +1,1803 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: no +test function name: f +async iteration: yes + +--- +snippet: " + async function f() { + for await (let x of [1, 2, 3]) {} + } + f(); +" +frame size: 19 +parameter count: 1 +bytecode array length: 1055 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(42), + B(CallRuntime), U16(Runtime::k_GeneratorGetContext), R(new_target), U8(1), + B(PushContext), R(4), + B(ResumeGenerator), R(new_target), + B(Star), R(3), + B(LdaZero), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(136), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrueConstant), U8(13), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrueConstant), U8(15), + B(LdaSmi), I8(78), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CreateFunctionContext), U8(13), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaCurrentContextSlot), U8(4), + /* 16 E> */ B(StackCheck), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(6), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaCurrentContextSlot), U8(5), + B(LdaUndefined), + B(Star), R(5), + B(CallJSRuntime), U8(%async_function_promise_create), R(5), U8(1), + B(StaCurrentContextSlot), U8(10), + B(Mov), R(context), R(7), + B(Mov), R(context), R(8), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), U8(0), + B(Mov), R(context), R(11), + B(Mov), R(context), R(12), + /* 43 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(9), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(2), U8(7), + B(JumpIfUndefined), U8(18), + B(JumpIfNull), U8(16), + B(Star), R(14), + B(CallProperty), R(14), R(13), U8(1), U8(9), + B(JumpIfJSReceiver), U8(24), + B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), + B(LdaNamedProperty), R(13), U8(3), U8(3), + B(Star), R(14), + B(CallProperty), R(14), R(13), U8(1), U8(5), + B(Star), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(14), U8(1), + /* 43 E> */ B(StaContextSlot), R(1), U8(7), U8(0), + B(LdaSmi), I8(-2), + B(TestEqual), R(3), U8(0), + B(JumpIfTrue), U8(17), + B(LdaZero), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(75), + B(LdaSmi), I8(78), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1), + /* 40 S> */ B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(14), + B(LdaNamedProperty), R(14), U8(4), U8(13), + B(Star), R(13), + /* 40 E> */ B(CallProperty), R(13), R(14), U8(1), U8(11), + B(StaContextSlot), R(1), U8(11), U8(0), + /* 40 S> */ B(LdaUndefined), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(11), U8(0), + B(Star), R(15), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(13), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaZero), + B(SuspendGenerator), R(14), + B(Ldar), R(13), + /* 57 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1), + B(Star), R(15), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1), + B(Star), R(16), + B(LdaZero), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(31), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(21), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(18), + B(Mov), R(15), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(Star), R(10), + B(LdaZero), + B(Star), R(9), + B(Jump), U8(155), + B(Ldar), R(15), + B(ReThrow), + B(Ldar), R(15), + /* 40 E> */ B(StaContextSlot), R(1), U8(8), U8(0), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(15), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(13), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(5), U8(15), + B(JumpIfToBooleanTrue), U8(56), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(6), U8(17), + B(StaContextSlot), R(1), U8(12), U8(0), + B(LdaSmi), I8(2), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaContextSlot), R(1), U8(12), U8(0), + B(StaContextSlot), R(1), U8(6), U8(0), + /* 23 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(7), + B(PushContext), R(2), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaContextSlot), R(1), U8(6), U8(0), + B(StaCurrentContextSlot), U8(4), + B(PopContext), R(2), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), U8(0), + B(JumpLoop), U8(226), I8(0), + B(Jump), U8(48), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(8), U8(9), + B(Star), R(12), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(12), + B(PushContext), R(2), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(13), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(13), U8(19), + B(JumpIfFalse), U8(8), + B(LdaSmi), I8(1), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), + B(PopContext), R(2), + B(LdaSmi), I8(-1), + B(Star), R(9), + B(Jump), U8(8), + B(Star), R(10), + B(LdaSmi), I8(1), + B(Star), R(9), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(11), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaZero), + B(TestEqualStrict), R(12), U8(20), + B(JumpIfTrueConstant), U8(17), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(12), + B(LdaNamedProperty), R(12), U8(10), U8(21), + B(StaContextSlot), R(1), U8(13), U8(0), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(12), + B(TestUndetectable), R(12), + B(JumpIfFalse), U8(4), + B(JumpConstant), U8(16), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(12), U8(24), + B(JumpIfFalse), U8(186), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(TypeOf), + B(Star), R(12), + B(LdaConstant), U8(11), + B(TestEqualStrict), R(12), U8(25), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), I16(130), + B(Star), R(12), + B(LdaConstant), U8(12), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), + B(Throw), + B(Mov), R(context), R(12), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(13), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(StaContextSlot), R(1), U8(14), U8(0), + B(LdaUndefined), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(14), U8(0), + B(Star), R(15), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_await_caught), R(13), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaSmi), I8(1), + B(SuspendGenerator), R(14), + B(Ldar), R(13), + /* 57 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1), + B(Star), R(15), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1), + B(Star), R(16), + B(LdaZero), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(39), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(29), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(18), + B(Mov), R(15), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaZero), + B(Star), R(5), + B(JumpConstant), U8(19), + B(Ldar), R(15), + B(ReThrow), + B(Ldar), R(15), + B(Jump), U8(20), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(8), U8(14), + B(Star), R(12), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(12), + B(PushContext), R(2), + B(PopContext), R(2), + B(Jump), U8(159), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(12), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(StaContextSlot), R(1), U8(16), U8(0), + B(LdaUndefined), + B(Star), R(12), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(13), + B(LdaContextSlot), R(1), U8(16), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(15), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(12), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(12), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(13), + B(LdaSmi), I8(2), + B(SuspendGenerator), R(13), + B(Ldar), R(12), + /* 57 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1), + B(Star), R(14), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(13), U8(1), + B(Star), R(15), + B(LdaZero), + B(TestEqualStrict), R(15), U8(0), + B(JumpIfTrue), U8(40), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(15), U8(0), + B(JumpIfTrue), U8(30), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(17), + B(Mov), R(14), R(16), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaSmi), I8(1), + B(Star), R(5), + B(Jump), U8(170), + B(Ldar), R(14), + B(ReThrow), + B(Ldar), R(14), + B(StaContextSlot), R(1), U8(15), U8(0), + B(LdaContextSlot), R(1), U8(15), U8(0), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(13), + B(LdaContextSlot), R(1), U8(15), U8(0), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), + B(Ldar), R(11), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(11), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(21), + B(Jump), U8(26), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(LdaSmi), I8(2), + B(Star), R(5), + B(Mov), R(10), R(6), + B(Jump), U8(101), + B(PopContext), R(1), + B(PopContext), R(1), + B(Ldar), R(10), + B(ReThrow), + B(PopContext), R(1), + B(LdaUndefined), + B(Star), R(9), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(10), + B(LdaUndefined), + B(Star), R(11), + B(CallJSRuntime), U8(%promise_resolve), R(9), U8(3), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(6), + B(LdaSmi), I8(3), + B(Star), R(5), + B(Jump), U8(68), + B(Jump), U8(54), + B(Star), R(9), + B(Ldar), R(closure), + B(CreateCatchContext), R(9), U8(8), U8(18), + B(Star), R(8), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(8), + B(PushContext), R(1), + B(LdaUndefined), + B(Star), R(9), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(10), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(11), + B(LdaFalse), + B(Star), R(12), + B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaSmi), I8(4), + B(Star), R(5), + B(Jump), U8(14), + B(LdaSmi), I8(-1), + B(Star), R(5), + B(Jump), U8(8), + B(Star), R(6), + B(LdaSmi), I8(5), + B(Star), R(5), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(7), + B(LdaUndefined), + B(Star), R(8), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(9), + B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(2), + B(Ldar), R(7), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(39), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(35), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(31), + B(LdaSmi), I8(3), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(27), + B(LdaSmi), I8(4), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(23), + B(LdaSmi), I8(5), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(19), + B(Jump), U8(20), + B(Ldar), R(6), + /* 57 S> */ B(Return), + B(Ldar), R(6), + /* 57 S> */ B(Return), + B(Ldar), R(6), + /* 57 S> */ B(Return), + B(Ldar), R(6), + /* 57 S> */ B(Return), + B(Ldar), R(6), + /* 57 S> */ B(Return), + B(Ldar), R(6), + B(ReThrow), + B(LdaUndefined), + /* 57 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + SYMBOL_TYPE, + SYMBOL_TYPE, + 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 [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + Smi [572], + FIXED_ARRAY_TYPE, + Smi [714], + Smi [356], + Smi [382], + FIXED_ARRAY_TYPE, + Smi [320], +] +handlers: [ + [83, 962, 968], + [86, 908, 910], + [103, 432, 438], + [106, 384, 386], + [534, 661, 663], +] + +--- +snippet: " + async function f() { + for await (let x of [1, 2, 3]) { return x; } + } + f(); +" +frame size: 19 +parameter count: 1 +bytecode array length: 1115 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(42), + B(CallRuntime), U16(Runtime::k_GeneratorGetContext), R(new_target), U8(1), + B(PushContext), R(4), + B(ResumeGenerator), R(new_target), + B(Star), R(3), + B(LdaZero), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(136), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrueConstant), U8(13), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrueConstant), U8(15), + B(LdaSmi), I8(78), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CreateFunctionContext), U8(13), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaCurrentContextSlot), U8(4), + /* 16 E> */ B(StackCheck), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(6), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaCurrentContextSlot), U8(5), + B(LdaUndefined), + B(Star), R(5), + B(CallJSRuntime), U8(%async_function_promise_create), R(5), U8(1), + B(StaCurrentContextSlot), U8(10), + B(Mov), R(context), R(7), + B(Mov), R(context), R(8), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), U8(0), + B(Mov), R(context), R(11), + B(Mov), R(context), R(12), + /* 43 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(9), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(2), U8(7), + B(JumpIfUndefined), U8(18), + B(JumpIfNull), U8(16), + B(Star), R(14), + B(CallProperty), R(14), R(13), U8(1), U8(9), + B(JumpIfJSReceiver), U8(24), + B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), + B(LdaNamedProperty), R(13), U8(3), U8(3), + B(Star), R(14), + B(CallProperty), R(14), R(13), U8(1), U8(5), + B(Star), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(14), U8(1), + /* 43 E> */ B(StaContextSlot), R(1), U8(7), U8(0), + B(LdaSmi), I8(-2), + B(TestEqual), R(3), U8(0), + B(JumpIfTrue), U8(17), + B(LdaZero), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(75), + B(LdaSmi), I8(78), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1), + /* 40 S> */ B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(14), + B(LdaNamedProperty), R(14), U8(4), U8(13), + B(Star), R(13), + /* 40 E> */ B(CallProperty), R(13), R(14), U8(1), U8(11), + B(StaContextSlot), R(1), U8(11), U8(0), + /* 40 S> */ B(LdaUndefined), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(11), U8(0), + B(Star), R(15), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(13), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaZero), + B(SuspendGenerator), R(14), + B(Ldar), R(13), + /* 68 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1), + B(Star), R(15), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1), + B(Star), R(16), + B(LdaZero), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(31), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(21), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(18), + B(Mov), R(15), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(Star), R(10), + B(LdaZero), + B(Star), R(9), + B(Jump), U8(167), + B(Ldar), R(15), + B(ReThrow), + B(Ldar), R(15), + /* 40 E> */ B(StaContextSlot), R(1), U8(8), U8(0), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(15), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(13), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(5), U8(15), + B(JumpIfToBooleanTrue), U8(68), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(6), U8(17), + B(StaContextSlot), R(1), U8(12), U8(0), + B(LdaSmi), I8(2), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaContextSlot), R(1), U8(12), U8(0), + B(StaContextSlot), R(1), U8(6), U8(0), + /* 23 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(7), + B(PushContext), R(2), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaContextSlot), R(1), U8(6), U8(0), + B(StaCurrentContextSlot), U8(4), + /* 56 S> */ B(LdaImmutableCurrentContextSlot), U8(4), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(Star), R(10), + B(LdaSmi), I8(1), + B(Star), R(9), + B(Jump), U8(62), + B(Jump), U8(48), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(8), U8(9), + B(Star), R(12), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(12), + B(PushContext), R(2), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(13), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(13), U8(19), + B(JumpIfFalse), U8(8), + B(LdaSmi), I8(1), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), + B(PopContext), R(2), + B(LdaSmi), I8(-1), + B(Star), R(9), + B(Jump), U8(8), + B(Star), R(10), + B(LdaSmi), I8(2), + B(Star), R(9), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(11), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaZero), + B(TestEqualStrict), R(12), U8(20), + B(JumpIfTrueConstant), U8(17), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(12), + B(LdaNamedProperty), R(12), U8(10), U8(21), + B(StaContextSlot), R(1), U8(13), U8(0), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(12), + B(TestUndetectable), R(12), + B(JumpIfFalse), U8(4), + B(JumpConstant), U8(16), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(12), U8(24), + B(JumpIfFalse), U8(186), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(TypeOf), + B(Star), R(12), + B(LdaConstant), U8(11), + B(TestEqualStrict), R(12), U8(25), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), I16(130), + B(Star), R(12), + B(LdaConstant), U8(12), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), + B(Throw), + B(Mov), R(context), R(12), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(13), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(StaContextSlot), R(1), U8(14), U8(0), + B(LdaUndefined), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(14), U8(0), + B(Star), R(15), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_await_caught), R(13), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaSmi), I8(1), + B(SuspendGenerator), R(14), + B(Ldar), R(13), + /* 68 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1), + B(Star), R(15), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1), + B(Star), R(16), + B(LdaZero), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(39), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(29), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(18), + B(Mov), R(15), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaZero), + B(Star), R(5), + B(JumpConstant), U8(19), + B(Ldar), R(15), + B(ReThrow), + B(Ldar), R(15), + B(Jump), U8(20), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(8), U8(14), + B(Star), R(12), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(12), + B(PushContext), R(2), + B(PopContext), R(2), + B(Jump), U8(159), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(12), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(StaContextSlot), R(1), U8(16), U8(0), + B(LdaUndefined), + B(Star), R(12), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(13), + B(LdaContextSlot), R(1), U8(16), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(15), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(12), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(12), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(13), + B(LdaSmi), I8(2), + B(SuspendGenerator), R(13), + B(Ldar), R(12), + /* 68 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1), + B(Star), R(14), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(13), U8(1), + B(Star), R(15), + B(LdaZero), + B(TestEqualStrict), R(15), U8(0), + B(JumpIfTrue), U8(40), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(15), U8(0), + B(JumpIfTrue), U8(30), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(17), + B(Mov), R(14), R(16), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaSmi), I8(1), + B(Star), R(5), + B(Jump), U8(194), + B(Ldar), R(14), + B(ReThrow), + B(Ldar), R(14), + B(StaContextSlot), R(1), U8(15), U8(0), + B(LdaContextSlot), R(1), U8(15), U8(0), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(13), + B(LdaContextSlot), R(1), U8(15), U8(0), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), + B(Ldar), R(11), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(18), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(28), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(38), + B(Jump), U8(43), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(LdaSmi), I8(2), + B(Star), R(5), + B(Mov), R(10), R(6), + B(Jump), U8(118), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(LdaSmi), I8(3), + B(Star), R(5), + B(Mov), R(10), R(6), + B(Jump), U8(101), + B(PopContext), R(1), + B(PopContext), R(1), + B(Ldar), R(10), + B(ReThrow), + B(PopContext), R(1), + B(LdaUndefined), + B(Star), R(9), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(10), + B(LdaUndefined), + B(Star), R(11), + B(CallJSRuntime), U8(%promise_resolve), R(9), U8(3), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(6), + B(LdaSmi), I8(4), + B(Star), R(5), + B(Jump), U8(68), + B(Jump), U8(54), + B(Star), R(9), + B(Ldar), R(closure), + B(CreateCatchContext), R(9), U8(8), U8(18), + B(Star), R(8), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(8), + B(PushContext), R(1), + B(LdaUndefined), + B(Star), R(9), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(10), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(11), + B(LdaFalse), + B(Star), R(12), + B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaSmi), I8(5), + B(Star), R(5), + B(Jump), U8(14), + B(LdaSmi), I8(-1), + B(Star), R(5), + B(Jump), U8(8), + B(Star), R(6), + B(LdaSmi), I8(6), + B(Star), R(5), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(7), + B(LdaUndefined), + B(Star), R(8), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(9), + B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(2), + B(Ldar), R(7), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(46), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(42), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(38), + B(LdaSmi), I8(3), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(34), + B(LdaSmi), I8(4), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(44), + B(LdaSmi), I8(5), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(40), + B(LdaSmi), I8(6), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(36), + B(Jump), U8(37), + B(Ldar), R(6), + /* 68 S> */ B(Return), + B(Ldar), R(6), + /* 68 S> */ B(Return), + B(Ldar), R(6), + /* 68 S> */ B(Return), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(9), + B(LdaUndefined), + B(Star), R(8), + B(Mov), R(6), R(10), + B(CallJSRuntime), U8(%promise_resolve), R(8), U8(3), + B(Ldar), R(9), + /* 68 S> */ B(Return), + B(Ldar), R(6), + /* 68 S> */ B(Return), + B(Ldar), R(6), + /* 68 S> */ B(Return), + B(Ldar), R(6), + B(ReThrow), + B(LdaUndefined), + /* 68 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + SYMBOL_TYPE, + SYMBOL_TYPE, + 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 [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + Smi [584], + FIXED_ARRAY_TYPE, + Smi [726], + Smi [356], + Smi [382], + FIXED_ARRAY_TYPE, + Smi [344], +] +handlers: [ + [83, 998, 1004], + [86, 944, 946], + [103, 444, 450], + [106, 396, 398], + [546, 673, 675], +] + +--- +snippet: " + async function f() { + for await (let x of [10, 20, 30]) { + if (x == 10) continue; + if (x == 20) break; + } + } + f(); +" +frame size: 19 +parameter count: 1 +bytecode array length: 1092 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(42), + B(CallRuntime), U16(Runtime::k_GeneratorGetContext), R(new_target), U8(1), + B(PushContext), R(4), + B(ResumeGenerator), R(new_target), + B(Star), R(3), + B(LdaZero), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(136), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrueConstant), U8(13), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrueConstant), U8(15), + B(LdaSmi), I8(78), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CreateFunctionContext), U8(13), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaCurrentContextSlot), U8(4), + /* 16 E> */ B(StackCheck), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(6), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaCurrentContextSlot), U8(5), + B(LdaUndefined), + B(Star), R(5), + B(CallJSRuntime), U8(%async_function_promise_create), R(5), U8(1), + B(StaCurrentContextSlot), U8(10), + B(Mov), R(context), R(7), + B(Mov), R(context), R(8), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), U8(0), + B(Mov), R(context), R(11), + B(Mov), R(context), R(12), + /* 43 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(9), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(2), U8(7), + B(JumpIfUndefined), U8(18), + B(JumpIfNull), U8(16), + B(Star), R(14), + B(CallProperty), R(14), R(13), U8(1), U8(9), + B(JumpIfJSReceiver), U8(24), + B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), + B(LdaNamedProperty), R(13), U8(3), U8(3), + B(Star), R(14), + B(CallProperty), R(14), R(13), U8(1), U8(5), + B(Star), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(14), U8(1), + /* 43 E> */ B(StaContextSlot), R(1), U8(7), U8(0), + B(LdaSmi), I8(-2), + B(TestEqual), R(3), U8(0), + B(JumpIfTrue), U8(17), + B(LdaZero), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(75), + B(LdaSmi), I8(78), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1), + /* 40 S> */ B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(14), + B(LdaNamedProperty), R(14), U8(4), U8(13), + B(Star), R(13), + /* 40 E> */ B(CallProperty), R(13), R(14), U8(1), U8(11), + B(StaContextSlot), R(1), U8(11), U8(0), + /* 40 S> */ B(LdaUndefined), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(11), U8(0), + B(Star), R(15), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(13), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaZero), + B(SuspendGenerator), R(14), + B(Ldar), R(13), + /* 114 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1), + B(Star), R(15), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1), + B(Star), R(16), + B(LdaZero), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(31), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(21), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(18), + B(Mov), R(15), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(Star), R(10), + B(LdaZero), + B(Star), R(9), + B(Jump), U8(192), + B(Ldar), R(15), + B(ReThrow), + B(Ldar), R(15), + /* 40 E> */ B(StaContextSlot), R(1), U8(8), U8(0), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(15), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(13), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(5), U8(15), + B(JumpIfToBooleanTrue), U8(93), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(6), U8(17), + B(StaContextSlot), R(1), U8(12), U8(0), + B(LdaSmi), I8(2), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaContextSlot), R(1), U8(12), U8(0), + B(StaContextSlot), R(1), U8(6), U8(0), + /* 23 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(7), + B(PushContext), R(2), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaContextSlot), R(1), U8(6), U8(0), + B(StaCurrentContextSlot), U8(4), + /* 63 S> */ B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(13), + B(LdaSmi), I8(10), + /* 69 E> */ B(TestEqual), R(13), U8(19), + B(JumpIfFalse), U8(8), + /* 76 S> */ B(PopContext), R(2), + B(PopContext), R(2), + B(Jump), U8(26), + /* 90 S> */ B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(13), + B(LdaSmi), I8(20), + /* 96 E> */ B(TestEqual), R(13), U8(20), + B(JumpIfFalse), U8(8), + /* 103 S> */ B(PopContext), R(2), + B(PopContext), R(2), + B(Jump), U8(15), + B(PopContext), R(2), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), U8(0), + B(Wide), B(JumpLoop), U16(261), I16(0), + B(Jump), U8(48), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(8), U8(9), + B(Star), R(12), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(12), + B(PushContext), R(2), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(13), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(13), U8(21), + B(JumpIfFalse), U8(8), + B(LdaSmi), I8(1), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), + B(PopContext), R(2), + B(LdaSmi), I8(-1), + B(Star), R(9), + B(Jump), U8(8), + B(Star), R(10), + B(LdaSmi), I8(1), + B(Star), R(9), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(11), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaZero), + B(TestEqualStrict), R(12), U8(22), + B(JumpIfTrueConstant), U8(17), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(12), + B(LdaNamedProperty), R(12), U8(10), U8(23), + B(StaContextSlot), R(1), U8(13), U8(0), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(12), + B(TestUndetectable), R(12), + B(JumpIfFalse), U8(4), + B(JumpConstant), U8(16), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(12), U8(26), + B(JumpIfFalse), U8(186), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(TypeOf), + B(Star), R(12), + B(LdaConstant), U8(11), + B(TestEqualStrict), R(12), U8(27), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), I16(130), + B(Star), R(12), + B(LdaConstant), U8(12), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), + B(Throw), + B(Mov), R(context), R(12), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(13), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(StaContextSlot), R(1), U8(14), U8(0), + B(LdaUndefined), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(14), U8(0), + B(Star), R(15), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_await_caught), R(13), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(13), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(14), + B(LdaSmi), I8(1), + B(SuspendGenerator), R(14), + B(Ldar), R(13), + /* 114 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1), + B(Star), R(15), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1), + B(Star), R(16), + B(LdaZero), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(39), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(16), U8(0), + B(JumpIfTrue), U8(29), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(18), + B(Mov), R(15), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaZero), + B(Star), R(5), + B(JumpConstant), U8(19), + B(Ldar), R(15), + B(ReThrow), + B(Ldar), R(15), + B(Jump), U8(20), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(8), U8(14), + B(Star), R(12), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(12), + B(PushContext), R(2), + B(PopContext), R(2), + B(Jump), U8(159), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(12), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(StaContextSlot), R(1), U8(16), U8(0), + B(LdaUndefined), + B(Star), R(12), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(13), + B(LdaContextSlot), R(1), U8(16), U8(0), + B(Star), R(14), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(15), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(12), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(12), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), + B(Star), R(13), + B(LdaSmi), I8(2), + B(SuspendGenerator), R(13), + B(Ldar), R(12), + /* 114 S> */ B(Return), + B(LdaSmi), I8(-2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1), + B(Star), R(14), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(13), U8(1), + B(Star), R(15), + B(LdaZero), + B(TestEqualStrict), R(15), U8(0), + B(JumpIfTrue), U8(40), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(15), U8(0), + B(JumpIfTrue), U8(30), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(17), + B(Mov), R(14), R(16), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaSmi), I8(1), + B(Star), R(5), + B(Jump), U8(170), + B(Ldar), R(14), + B(ReThrow), + B(Ldar), R(14), + B(StaContextSlot), R(1), U8(15), U8(0), + B(LdaContextSlot), R(1), U8(15), U8(0), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(13), + B(LdaContextSlot), R(1), U8(15), U8(0), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), + B(Ldar), R(11), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(11), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(9), U8(0), + B(JumpIfTrue), U8(21), + B(Jump), U8(26), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(PopContext), R(1), + B(LdaSmi), I8(2), + B(Star), R(5), + B(Mov), R(10), R(6), + B(Jump), U8(101), + B(PopContext), R(1), + B(PopContext), R(1), + B(Ldar), R(10), + B(ReThrow), + B(PopContext), R(1), + B(LdaUndefined), + B(Star), R(9), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(10), + B(LdaUndefined), + B(Star), R(11), + B(CallJSRuntime), U8(%promise_resolve), R(9), U8(3), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(6), + B(LdaSmi), I8(3), + B(Star), R(5), + B(Jump), U8(68), + B(Jump), U8(54), + B(Star), R(9), + B(Ldar), R(closure), + B(CreateCatchContext), R(9), U8(8), U8(18), + B(Star), R(8), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(8), + B(PushContext), R(1), + B(LdaUndefined), + B(Star), R(9), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(Star), R(10), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(11), + B(LdaFalse), + B(Star), R(12), + B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(4), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(6), + B(LdaSmi), I8(4), + B(Star), R(5), + B(Jump), U8(14), + B(LdaSmi), I8(-1), + B(Star), R(5), + B(Jump), U8(8), + B(Star), R(6), + B(LdaSmi), I8(5), + B(Star), R(5), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(7), + B(LdaUndefined), + B(Star), R(8), + B(LdaCurrentContextSlot), U8(10), + B(Star), R(9), + B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(2), + B(Ldar), R(7), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(39), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(35), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(31), + B(LdaSmi), I8(3), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(27), + B(LdaSmi), I8(4), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(23), + B(LdaSmi), I8(5), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(19), + B(Jump), U8(20), + B(Ldar), R(6), + /* 114 S> */ B(Return), + B(Ldar), R(6), + /* 114 S> */ B(Return), + B(Ldar), R(6), + /* 114 S> */ B(Return), + B(Ldar), R(6), + /* 114 S> */ B(Return), + B(Ldar), R(6), + /* 114 S> */ B(Return), + B(Ldar), R(6), + B(ReThrow), + B(LdaUndefined), + /* 114 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + SYMBOL_TYPE, + SYMBOL_TYPE, + 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 [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + Smi [609], + FIXED_ARRAY_TYPE, + Smi [751], + Smi [356], + Smi [382], + FIXED_ARRAY_TYPE, + Smi [320], +] +handlers: [ + [83, 999, 1005], + [86, 945, 947], + [103, 469, 475], + [106, 421, 423], + [571, 698, 700], +] + +--- +snippet: " + async function f() { + var x = { 'a': 1, 'b': 2 }; + for (x['a'] of [1,2,3]) { return x['a']; } + } + f(); +" +frame size: 14 +parameter count: 1 +bytecode array length: 596 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(22), + B(CallRuntime), U16(Runtime::k_GeneratorGetContext), R(new_target), U8(1), + B(PushContext), R(3), + B(ResumeGenerator), R(new_target), + B(Star), R(2), + B(LdaSmi), I8(78), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), + B(LdaSmi), I8(-2), + B(Star), R(2), + B(CreateFunctionContext), U8(10), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaCurrentContextSlot), U8(4), + /* 16 E> */ B(StackCheck), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(5), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(4), U8(2), + B(StaCurrentContextSlot), U8(5), + B(LdaUndefined), + B(Star), R(4), + B(CallJSRuntime), U8(%async_function_promise_create), R(4), U8(1), + B(StaCurrentContextSlot), U8(13), + B(Mov), R(context), R(6), + B(Mov), R(context), R(7), + /* 31 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(8), + B(Ldar), R(8), + /* 31 E> */ B(StaCurrentContextSlot), U8(6), + B(LdaZero), + B(StaCurrentContextSlot), U8(9), + B(Mov), R(context), R(10), + B(Mov), R(context), R(11), + /* 68 S> */ B(CreateArrayLiteral), U8(1), U8(3), U8(9), + B(Star), R(12), + B(LdaNamedProperty), R(12), U8(2), U8(4), + B(Star), R(13), + B(CallProperty), R(13), R(12), U8(1), U8(6), + B(JumpIfJSReceiver), U8(7), + B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 68 E> */ B(StaCurrentContextSlot), U8(7), + /* 65 S> */ B(LdaCurrentContextSlot), U8(7), + B(Star), R(13), + B(LdaNamedProperty), R(13), U8(3), U8(10), + B(Star), R(12), + /* 65 E> */ B(CallProperty), R(12), R(13), U8(1), U8(8), + /* 65 E> */ B(StaCurrentContextSlot), U8(8), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(11), + B(LdaCurrentContextSlot), U8(8), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), + B(LdaCurrentContextSlot), U8(8), + B(Star), R(12), + B(LdaNamedProperty), R(12), U8(4), U8(12), + B(JumpIfToBooleanTrue), U8(42), + B(LdaImmutableCurrentContextSlot), U8(6), + B(Star), R(12), + B(LdaCurrentContextSlot), U8(8), + B(Star), R(13), + /* 58 E> */ B(LdaNamedProperty), R(13), U8(5), U8(14), + B(StaCurrentContextSlot), U8(10), + B(LdaSmi), I8(2), + B(StaCurrentContextSlot), U8(9), + B(LdaCurrentContextSlot), U8(10), + B(StaNamedPropertySloppy), R(12), U8(6), U8(16), + /* 53 E> */ B(StackCheck), + /* 79 S> */ B(LdaImmutableCurrentContextSlot), U8(6), + B(Star), R(12), + /* 87 E> */ B(LdaNamedProperty), R(12), U8(6), U8(18), + B(Star), R(9), + B(LdaZero), + B(Star), R(8), + B(Jump), U8(62), + B(Jump), U8(48), + B(Star), R(12), + B(Ldar), R(closure), + B(CreateCatchContext), R(12), U8(7), U8(8), + B(Star), R(11), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(11), + B(PushContext), R(1), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(12), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(12), U8(20), + B(JumpIfFalse), U8(8), + B(LdaSmi), I8(1), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), + B(PopContext), R(1), + B(LdaSmi), I8(-1), + B(Star), R(8), + B(Jump), U8(8), + B(Star), R(9), + B(LdaSmi), I8(1), + B(Star), R(8), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(10), + B(LdaCurrentContextSlot), U8(9), + B(Star), R(11), + B(LdaZero), + B(TestEqualStrict), R(11), U8(21), + B(JumpIfTrue), U8(135), + B(LdaCurrentContextSlot), U8(7), + B(Star), R(11), + B(LdaNamedProperty), R(11), U8(9), U8(22), + B(StaCurrentContextSlot), U8(11), + B(LdaCurrentContextSlot), U8(11), + B(Star), R(11), + B(TestUndetectable), R(11), + B(JumpIfFalse), U8(4), + B(Jump), U8(115), + B(LdaCurrentContextSlot), U8(9), + B(Star), R(11), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(11), U8(25), + B(JumpIfFalse), U8(69), + B(LdaCurrentContextSlot), U8(11), + B(TypeOf), + B(Star), R(11), + B(LdaConstant), U8(10), + B(TestEqualStrict), R(11), U8(26), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), I16(130), + B(Star), R(11), + B(LdaConstant), U8(11), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(Throw), + B(Mov), R(context), R(11), + B(LdaCurrentContextSlot), U8(11), + B(Star), R(12), + B(LdaCurrentContextSlot), U8(7), + B(Star), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Jump), U8(20), + B(Star), R(12), + B(Ldar), R(closure), + B(CreateCatchContext), R(12), U8(7), U8(12), + B(Star), R(11), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(11), + B(PushContext), R(1), + B(PopContext), R(1), + B(Jump), U8(37), + B(LdaCurrentContextSlot), U8(11), + B(Star), R(11), + B(LdaCurrentContextSlot), U8(7), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), + B(StaCurrentContextSlot), U8(12), + B(LdaCurrentContextSlot), U8(12), + B(Star), R(11), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(11), + B(LdaCurrentContextSlot), U8(12), + B(Star), R(11), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), + B(Ldar), R(10), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(8), U8(0), + B(JumpIfTrue), U8(11), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(8), U8(0), + B(JumpIfTrue), U8(12), + B(Jump), U8(13), + B(LdaZero), + B(Star), R(4), + B(Mov), R(9), R(5), + B(Jump), U8(95), + B(Ldar), R(9), + B(ReThrow), + B(LdaUndefined), + B(Star), R(8), + B(LdaCurrentContextSlot), U8(13), + B(Star), R(9), + B(LdaUndefined), + B(Star), R(10), + B(CallJSRuntime), U8(%promise_resolve), R(8), U8(3), + B(LdaCurrentContextSlot), U8(13), + B(Star), R(5), + B(LdaSmi), I8(1), + B(Star), R(4), + B(Jump), U8(68), + B(Jump), U8(54), + B(Star), R(8), + B(Ldar), R(closure), + B(CreateCatchContext), R(8), U8(7), U8(13), + B(Star), R(7), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(7), + B(PushContext), R(1), + B(LdaUndefined), + B(Star), R(8), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(Star), R(9), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(10), + B(LdaFalse), + B(Star), R(11), + B(CallJSRuntime), U8(%promise_internal_reject), R(8), U8(4), + B(LdaContextSlot), R(1), U8(13), U8(0), + B(PopContext), R(1), + B(PopContext), R(1), + B(Star), R(5), + B(LdaSmi), I8(2), + B(Star), R(4), + B(Jump), U8(14), + B(LdaSmi), I8(-1), + B(Star), R(4), + B(Jump), U8(8), + B(Star), R(5), + B(LdaSmi), I8(3), + B(Star), R(4), + B(LdaTheHole), + B(SetPendingMessage), + B(Star), R(6), + B(LdaUndefined), + B(Star), R(7), + B(LdaCurrentContextSlot), U8(13), + B(Star), R(8), + B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2), + B(Ldar), R(6), + B(SetPendingMessage), + B(LdaZero), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(25), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(35), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(31), + B(LdaSmi), I8(3), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(27), + B(Jump), U8(28), + B(LdaCurrentContextSlot), U8(13), + B(Star), R(8), + B(LdaUndefined), + B(Star), R(7), + B(Mov), R(5), R(9), + B(CallJSRuntime), U8(%promise_resolve), R(7), U8(3), + B(Ldar), R(8), + /* 96 S> */ B(Return), + B(Ldar), R(5), + /* 96 S> */ B(Return), + B(Ldar), R(5), + /* 96 S> */ B(Return), + B(Ldar), R(5), + B(ReThrow), + B(LdaUndefined), + /* 96 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, +] +handlers: [ + [63, 509, 515], + [66, 455, 457], + [81, 243, 249], + [84, 195, 197], + [333, 345, 347], +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden index e03f83d3fc..a0e62b8519 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden @@ -85,7 +85,7 @@ bytecodes: [ /* 85 S> */ B(Return), B(ForInStep), R(7), B(Star), R(7), - B(JumpLoop), U8(-23), U8(0), + B(JumpLoop), U8(23), I8(0), B(LdaUndefined), /* 85 S> */ B(Return), ] @@ -107,7 +107,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(JumpIfUndefined), U8(46), B(JumpIfNull), U8(44), B(ToObject), R(3), @@ -116,18 +116,18 @@ bytecodes: [ B(Star), R(7), /* 54 S> */ B(ForInContinue), R(7), R(6), B(JumpIfFalse), U8(31), - B(ForInNext), R(3), R(7), R(4), U8(3), + B(ForInNext), R(3), R(7), R(4), U8(4), B(JumpIfUndefined), U8(17), B(Star), R(1), /* 45 E> */ B(StackCheck), B(Star), R(2), /* 70 S> */ B(Ldar), R(1), - /* 75 E> */ B(Add), R(0), U8(2), + /* 75 E> */ B(Add), R(0), U8(3), B(Mov), R(0), R(8), B(Star), R(0), /* 72 E> */ B(ForInStep), R(7), B(Star), R(7), - B(JumpLoop), U8(-31), U8(0), + B(JumpLoop), U8(31), I8(0), B(LdaUndefined), /* 80 S> */ B(Return), ] @@ -150,9 +150,9 @@ parameter count: 1 bytecode array length: 85 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Mov), R(1), R(0), - /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9), + /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(3), U8(9), B(JumpIfUndefined), U8(70), B(JumpIfNull), U8(68), B(ToObject), R(1), @@ -161,28 +161,28 @@ bytecodes: [ B(Star), R(5), /* 68 S> */ B(ForInContinue), R(5), R(4), B(JumpIfFalse), U8(55), - B(ForInNext), R(1), R(5), R(2), U8(12), + B(ForInNext), R(1), R(5), R(2), U8(14), B(JumpIfUndefined), U8(41), B(Star), R(6), - /* 67 E> */ B(StaNamedPropertySloppy), R(0), U8(2), U8(10), + /* 67 E> */ B(StaNamedPropertySloppy), R(0), U8(2), U8(12), /* 62 E> */ B(StackCheck), /* 95 S> */ B(Nop), - /* 100 E> */ B(LdaNamedProperty), R(0), U8(2), U8(4), + /* 100 E> */ B(LdaNamedProperty), R(0), U8(2), U8(6), B(Star), R(6), - B(LdaSmi), U8(10), - /* 106 E> */ B(TestEqual), R(6), U8(6), + B(LdaSmi), I8(10), + /* 106 E> */ B(TestEqual), R(6), U8(8), B(JumpIfFalse), U8(4), /* 113 S> */ B(Jump), U8(18), /* 125 S> */ B(Nop), - /* 130 E> */ B(LdaNamedProperty), R(0), U8(2), U8(7), + /* 130 E> */ B(LdaNamedProperty), R(0), U8(2), U8(9), B(Star), R(6), - B(LdaSmi), U8(20), - /* 136 E> */ B(TestEqual), R(6), U8(9), + B(LdaSmi), I8(20), + /* 136 E> */ B(TestEqual), R(6), U8(11), B(JumpIfFalse), U8(4), /* 143 S> */ B(Jump), U8(9), B(ForInStep), R(5), B(Star), R(5), - B(JumpLoop), U8(-55), U8(0), + B(JumpLoop), U8(55), I8(0), B(LdaUndefined), /* 152 S> */ B(Return), ] @@ -204,9 +204,9 @@ parameter count: 1 bytecode array length: 62 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(Star), R(0), - /* 72 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9), + /* 72 S> */ B(CreateArrayLiteral), U8(1), U8(3), U8(9), B(JumpIfUndefined), U8(49), B(JumpIfNull), U8(47), B(ToObject), R(1), @@ -215,20 +215,20 @@ bytecodes: [ B(Star), R(5), /* 65 S> */ B(ForInContinue), R(5), R(4), B(JumpIfFalse), U8(34), - B(ForInNext), R(1), R(5), R(2), U8(8), + B(ForInNext), R(1), R(5), R(2), U8(10), B(JumpIfUndefined), U8(20), B(Star), R(6), B(LdaZero), B(Star), R(8), B(Ldar), R(6), - /* 64 E> */ B(StaKeyedPropertySloppy), R(0), R(8), U8(6), + /* 64 E> */ B(StaKeyedPropertySloppy), R(0), R(8), U8(8), /* 59 E> */ B(StackCheck), - /* 83 S> */ B(LdaSmi), U8(3), - /* 91 E> */ B(LdaKeyedProperty), R(0), U8(4), + /* 83 S> */ B(LdaSmi), I8(3), + /* 91 E> */ B(LdaKeyedProperty), R(0), U8(6), /* 98 S> */ B(Return), B(ForInStep), R(5), B(Star), R(5), - B(JumpLoop), U8(-34), U8(0), + B(JumpLoop), U8(34), I8(0), B(LdaUndefined), /* 98 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 610b8b1a06..a5f7f6e683 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -18,50 +18,50 @@ bytecodes: [ B(Star), R(4), B(Mov), R(context), R(11), B(Mov), R(context), R(12), - /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(Star), R(13), - B(LdaNamedProperty), R(13), U8(1), U8(2), + B(LdaNamedProperty), R(13), U8(1), U8(3), B(Star), R(14), - B(CallProperty), R(14), R(13), U8(1), U8(4), + B(CallProperty), R(14), R(13), U8(1), U8(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), - /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(8), + /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(9), B(Star), R(13), - /* 45 E> */ B(CallProperty), R(13), R(2), U8(1), U8(6), + /* 45 E> */ B(CallProperty), R(13), R(2), U8(1), U8(7), 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(LdaNamedProperty), R(3), U8(3), U8(11), B(JumpIfToBooleanTrue), U8(25), - B(LdaNamedProperty), R(3), U8(4), U8(12), + B(LdaNamedProperty), R(3), U8(4), U8(13), B(Star), R(5), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(4), B(Mov), R(5), R(0), /* 34 E> */ B(StackCheck), B(Mov), R(0), R(1), B(LdaZero), B(Star), R(4), - B(JumpLoop), U8(-51), U8(0), + B(JumpLoop), U8(51), I8(0), B(Jump), U8(36), B(Star), R(13), B(Ldar), R(closure), B(CreateCatchContext), R(13), U8(5), U8(6), B(Star), R(12), B(PushContext), R(8), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(4), U8(14), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(4), U8(15), B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(4), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(9), B(Jump), U8(7), B(Star), R(10), @@ -71,24 +71,24 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(4), U8(15), + B(TestEqualStrict), R(4), U8(16), B(JumpIfTrue), U8(111), - B(LdaNamedProperty), R(2), U8(7), U8(16), + B(LdaNamedProperty), R(2), U8(7), U8(17), B(Star), R(6), B(TestUndetectable), R(6), B(JumpIfFalse), U8(4), B(Jump), U8(99), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(4), U8(19), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(4), U8(20), B(JumpIfFalse), U8(67), B(Ldar), R(6), B(TypeOf), B(Star), R(12), B(LdaConstant), U8(8), - B(TestEqualStrict), R(12), U8(20), + B(TestEqualStrict), R(12), U8(21), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), I16(130), B(Star), R(12), B(LdaConstant), U8(9), B(Star), R(13), @@ -182,7 +182,7 @@ bytecodes: [ B(JumpIfToBooleanTrue), U8(27), B(LdaNamedProperty), R(4), U8(4), U8(12), B(Star), R(6), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(5), B(Mov), R(6), R(1), /* 54 E> */ B(StackCheck), @@ -197,20 +197,20 @@ bytecodes: [ B(CreateCatchContext), R(14), U8(5), U8(6), B(Star), R(13), B(PushContext), R(9), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(5), U8(14), B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(5), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(14), B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), B(PopContext), R(9), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(10), B(Jump), U8(8), B(Star), R(11), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(10), B(LdaTheHole), B(SetPendingMessage), @@ -223,7 +223,7 @@ bytecodes: [ B(TestUndetectable), R(7), B(JumpIfFalse), U8(4), B(Jump), U8(99), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(5), U8(19), B(JumpIfFalse), U8(67), B(Ldar), R(7), @@ -233,7 +233,7 @@ bytecodes: [ B(TestEqualStrict), R(13), U8(20), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), I16(130), B(Star), R(13), B(LdaConstant), U8(9), B(Star), R(14), @@ -267,7 +267,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(10), U8(0), B(JumpIfTrue), U8(11), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(10), U8(0), B(JumpIfTrue), U8(7), B(Jump), U8(8), @@ -313,58 +313,58 @@ bytecodes: [ B(Star), R(4), B(Mov), R(context), R(11), B(Mov), R(context), R(12), - /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(Star), R(13), - B(LdaNamedProperty), R(13), U8(1), U8(2), + B(LdaNamedProperty), R(13), U8(1), U8(3), B(Star), R(14), - B(CallProperty), R(14), R(13), U8(1), U8(4), + B(CallProperty), R(14), R(13), U8(1), U8(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), - /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(8), + /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(9), B(Star), R(13), - /* 45 E> */ B(CallProperty), R(13), R(2), U8(1), U8(6), + /* 45 E> */ B(CallProperty), R(13), R(2), U8(1), U8(7), 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(LdaNamedProperty), R(3), U8(3), U8(11), B(JumpIfToBooleanTrue), U8(43), - B(LdaNamedProperty), R(3), U8(4), U8(12), + B(LdaNamedProperty), R(3), U8(4), U8(13), B(Star), R(5), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(4), B(Mov), R(5), R(0), /* 34 E> */ B(StackCheck), B(Mov), R(0), R(1), - /* 66 S> */ B(LdaSmi), U8(10), - /* 72 E> */ B(TestEqual), R(1), U8(14), + /* 66 S> */ B(LdaSmi), I8(10), + /* 72 E> */ B(TestEqual), R(1), U8(15), B(JumpIfFalse), U8(4), /* 79 S> */ B(Jump), U8(14), - /* 91 S> */ B(LdaSmi), U8(20), - /* 97 E> */ B(TestEqual), R(1), U8(15), + /* 91 S> */ B(LdaSmi), I8(20), + /* 97 E> */ B(TestEqual), R(1), U8(16), B(JumpIfFalse), U8(4), /* 104 S> */ B(Jump), U8(8), B(LdaZero), B(Star), R(4), - B(JumpLoop), U8(-69), U8(0), + B(JumpLoop), U8(69), I8(0), B(Jump), U8(36), B(Star), R(13), B(Ldar), R(closure), B(CreateCatchContext), R(13), U8(5), U8(6), B(Star), R(12), B(PushContext), R(8), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(4), U8(16), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(4), U8(17), B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(4), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(9), B(Jump), U8(7), B(Star), R(10), @@ -374,24 +374,24 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(4), U8(17), + B(TestEqualStrict), R(4), U8(18), B(JumpIfTrue), U8(111), - B(LdaNamedProperty), R(2), U8(7), U8(18), + B(LdaNamedProperty), R(2), U8(7), U8(19), B(Star), R(6), B(TestUndetectable), R(6), B(JumpIfFalse), U8(4), B(Jump), U8(99), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(4), U8(21), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(4), U8(22), B(JumpIfFalse), U8(67), B(Ldar), R(6), B(TypeOf), B(Star), R(12), B(LdaConstant), U8(8), - B(TestEqualStrict), R(12), U8(22), + B(TestEqualStrict), R(12), U8(23), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), I16(130), B(Star), R(12), B(LdaConstant), U8(9), B(Star), R(13), @@ -460,39 +460,39 @@ parameter count: 1 bytecode array length: 297 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(8), B(Mov), R(8), R(0), B(LdaZero), B(Star), R(3), B(Mov), R(context), R(10), B(Mov), R(context), R(11), - /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9), + /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(3), U8(9), B(Star), R(12), - B(LdaNamedProperty), R(12), U8(2), U8(2), + B(LdaNamedProperty), R(12), U8(2), U8(4), B(Star), R(13), - B(CallProperty), R(13), R(12), U8(1), U8(4), + B(CallProperty), R(13), R(12), U8(1), U8(6), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(1), - /* 74 S> */ B(LdaNamedProperty), R(1), U8(3), U8(8), + /* 74 S> */ B(LdaNamedProperty), R(1), U8(3), U8(10), B(Star), R(12), - /* 74 E> */ B(CallProperty), R(12), R(1), U8(1), U8(6), + /* 74 E> */ B(CallProperty), R(12), R(1), U8(1), U8(8), 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(LdaNamedProperty), R(2), U8(4), U8(12), B(JumpIfToBooleanTrue), U8(31), - /* 67 E> */ B(LdaNamedProperty), R(2), U8(5), U8(12), + /* 67 E> */ B(LdaNamedProperty), R(2), U8(5), U8(14), B(Star), R(4), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(3), B(Ldar), R(4), - B(StaNamedPropertySloppy), R(0), U8(6), U8(14), + B(StaNamedPropertySloppy), R(0), U8(6), U8(16), /* 62 E> */ B(StackCheck), /* 88 S> */ B(Nop), - /* 96 E> */ B(LdaNamedProperty), R(0), U8(6), U8(16), + /* 96 E> */ B(LdaNamedProperty), R(0), U8(6), U8(18), B(Star), R(9), B(LdaZero), B(Star), R(8), @@ -503,43 +503,43 @@ bytecodes: [ B(CreateCatchContext), R(12), U8(7), U8(8), B(Star), R(11), B(PushContext), R(7), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), U8(18), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(3), U8(20), B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(12), B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), B(PopContext), R(7), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(8), B(Jump), U8(8), B(Star), R(9), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(8), B(LdaTheHole), B(SetPendingMessage), B(Star), R(10), B(LdaZero), - B(TestEqualStrict), R(3), U8(19), + B(TestEqualStrict), R(3), U8(21), B(JumpIfTrue), U8(111), - B(LdaNamedProperty), R(1), U8(9), U8(20), + B(LdaNamedProperty), R(1), U8(9), U8(22), B(Star), R(5), B(TestUndetectable), R(5), B(JumpIfFalse), U8(4), B(Jump), U8(99), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), U8(23), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(3), U8(25), B(JumpIfFalse), U8(67), B(Ldar), R(5), B(TypeOf), B(Star), R(11), B(LdaConstant), U8(10), - B(TestEqualStrict), R(11), U8(24), + B(TestEqualStrict), R(11), U8(26), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), I16(130), B(Star), R(11), B(LdaConstant), U8(11), B(Star), R(12), @@ -573,7 +573,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(11), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(7), B(Jump), U8(8), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden index f897381d86..7d55ebf94c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden @@ -58,7 +58,7 @@ bytecodes: [ B(Star), R(1), B(CreateClosure), U8(0), U8(4), U8(2), B(Star), R(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(2), /* 67 E> */ B(Call), R(0), R(1), U8(2), U8(2), /* 71 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden index 1ee3738f2e..d12f5a6d05 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden @@ -17,13 +17,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestUndetectable), R(0), B(JumpIfFalse), U8(6), - /* 88 S> */ B(LdaSmi), U8(20), + /* 88 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 97 S> */ B(Ldar), R(1), /* 107 S> */ B(Return), @@ -46,13 +46,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestUndetectable), R(0), B(JumpIfFalse), U8(6), - /* 93 S> */ B(LdaSmi), U8(20), + /* 93 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 102 S> */ B(Ldar), R(1), /* 112 S> */ B(Return), @@ -75,13 +75,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestUndetectable), R(0), B(JumpIfTrue), U8(6), - /* 88 S> */ B(LdaSmi), U8(20), + /* 88 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 97 S> */ B(Ldar), R(1), /* 107 S> */ B(Return), @@ -104,13 +104,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestUndetectable), R(0), B(JumpIfTrue), U8(6), - /* 93 S> */ B(LdaSmi), U8(20), + /* 93 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 102 S> */ B(Ldar), R(1), /* 112 S> */ B(Return), @@ -133,13 +133,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestNull), R(0), B(JumpIfFalse), U8(6), - /* 89 S> */ B(LdaSmi), U8(20), + /* 89 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 98 S> */ B(Ldar), R(1), /* 108 S> */ B(Return), @@ -162,13 +162,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestUndefined), R(0), B(JumpIfFalse), U8(6), - /* 94 S> */ B(LdaSmi), U8(20), + /* 94 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 103 S> */ B(Ldar), R(1), /* 113 S> */ B(Return), @@ -191,13 +191,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestNull), R(0), B(JumpIfTrue), U8(6), - /* 89 S> */ B(LdaSmi), U8(20), + /* 89 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 98 S> */ B(Ldar), R(1), /* 108 S> */ B(Return), @@ -220,13 +220,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(2), + /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(2), B(Mov), R(2), R(0), - /* 63 S> */ B(LdaSmi), U8(10), + /* 63 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 67 S> */ B(TestUndefined), R(0), B(JumpIfTrue), U8(6), - /* 94 S> */ B(LdaSmi), U8(20), + /* 94 S> */ B(LdaSmi), I8(20), B(Star), R(1), /* 103 S> */ B(Ldar), R(1), /* 113 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index a53f7f622f..1a542b8aec 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -24,10 +24,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(53), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CreateFunctionContext), U8(2), B(PushContext), R(0), @@ -35,19 +35,19 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(5), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(7), B(Mov), R(closure), R(6), /* 11 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(6), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(6), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(7), B(LdaZero), B(SuspendGenerator), R(7), B(Ldar), R(6), /* 16 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(7), U8(1), B(Star), R(8), @@ -56,7 +56,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(31), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(21), B(Jump), U8(2), @@ -76,19 +76,19 @@ bytecodes: [ B(Star), R(7), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(6), U8(2), B(Star), R(4), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), B(Jump), U8(14), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(3), B(Jump), U8(8), B(Star), R(4), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(3), B(LdaTheHole), B(SetPendingMessage), B(Star), R(5), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(6), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(6), U8(1), B(Ldar), R(5), @@ -96,10 +96,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(18), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(14), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(10), B(Jump), U8(11), @@ -136,13 +136,13 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(60), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrueConstant), U8(0), - B(LdaSmi), U8(78), + B(JumpIfTrue), U8(130), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CreateFunctionContext), U8(2), B(PushContext), R(0), @@ -150,19 +150,19 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(5), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(7), B(Mov), R(closure), R(6), /* 11 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(6), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(6), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(7), B(LdaZero), B(SuspendGenerator), R(7), B(Ldar), R(6), /* 25 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(7), U8(1), B(Star), R(8), @@ -171,7 +171,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(31), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(21), B(Jump), U8(2), @@ -185,19 +185,19 @@ bytecodes: [ B(Jump), U8(113), B(Ldar), R(8), /* 11 E> */ B(Throw), - /* 16 S> */ B(LdaSmi), U8(42), + /* 16 S> */ B(LdaSmi), I8(42), B(Star), R(6), B(LdaFalse), B(Star), R(7), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(6), U8(2), B(Star), R(6), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(7), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(SuspendGenerator), R(7), B(Ldar), R(6), /* 25 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(7), U8(1), B(Star), R(8), @@ -206,7 +206,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(32), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(22), B(Jump), U8(2), @@ -215,7 +215,7 @@ bytecodes: [ B(Mov), R(8), R(10), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(10), U8(2), B(Star), R(4), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), B(Jump), U8(35), B(Ldar), R(8), @@ -226,19 +226,19 @@ bytecodes: [ B(Star), R(7), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(6), U8(2), B(Star), R(4), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(3), B(Jump), U8(14), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(3), B(Jump), U8(8), B(Star), R(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(3), B(LdaTheHole), B(SetPendingMessage), B(Star), R(5), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(6), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(6), U8(1), B(Ldar), R(5), @@ -246,13 +246,13 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(21), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(17), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(13), B(Jump), U8(14), @@ -268,7 +268,6 @@ bytecodes: [ /* 25 S> */ B(Return), ] constant pool: [ - Smi [130], ] handlers: [ [53, 228, 234], @@ -281,7 +280,7 @@ snippet: " " frame size: 18 parameter count: 1 -bytecode array length: 778 +bytecode array length: 775 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(35), @@ -292,13 +291,13 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrue), U8(60), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(3), U8(0), - B(JumpIfTrueConstant), U8(3), - B(LdaSmi), U8(78), + B(JumpIfTrue), U8(154), + B(LdaSmi), I8(78), B(Star), R(5), B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(3), B(CreateFunctionContext), U8(9), B(PushContext), R(0), @@ -306,19 +305,19 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(7), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(9), B(Mov), R(closure), R(8), /* 11 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(8), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(8), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(9), B(LdaZero), B(SuspendGenerator), R(9), B(Ldar), R(8), /* 44 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(3), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1), B(Star), R(10), @@ -327,7 +326,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(11), U8(0), B(JumpIfTrue), U8(31), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(11), U8(0), B(JumpIfTrue), U8(21), B(Jump), U8(2), @@ -338,7 +337,7 @@ bytecodes: [ B(Star), R(6), B(LdaZero), B(Star), R(5), - B(JumpConstant), U8(18), + B(JumpConstant), U8(13), B(Ldar), R(10), /* 11 E> */ B(Throw), B(Ldar), R(closure), @@ -350,28 +349,28 @@ bytecodes: [ B(StaContextSlot), R(1), U8(9), U8(0), B(Mov), R(context), R(10), B(Mov), R(context), R(11), - /* 30 S> */ B(CreateArrayLiteral), U8(1), U8(0), U8(9), + /* 30 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(9), B(Star), R(12), - B(LdaNamedProperty), R(12), U8(2), U8(2), + B(LdaNamedProperty), R(12), U8(2), U8(3), B(Star), R(13), - B(CallProperty), R(13), R(12), U8(1), U8(4), + B(CallProperty), R(13), R(12), U8(1), U8(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), /* 30 E> */ B(StaContextSlot), R(1), U8(7), U8(0), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(TestEqual), R(3), U8(0), B(JumpIfTrue), U8(18), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(3), U8(0), - B(JumpIfTrueConstant), U8(8), - B(LdaSmi), U8(78), + B(JumpIfTrue), U8(134), + B(LdaSmi), I8(78), B(Star), R(12), B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), /* 27 S> */ B(LdaContextSlot), R(1), U8(7), U8(0), B(Star), R(13), - B(LdaNamedProperty), R(13), U8(4), U8(8), + B(LdaNamedProperty), R(13), U8(3), U8(9), B(Star), R(12), - /* 27 E> */ B(CallProperty), R(12), R(13), U8(1), U8(6), + /* 27 E> */ B(CallProperty), R(12), R(13), U8(1), U8(7), /* 27 E> */ B(StaContextSlot), R(1), U8(8), U8(0), B(Star), R(12), B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), @@ -382,37 +381,37 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), B(LdaContextSlot), R(1), U8(8), U8(0), B(Star), R(12), - B(LdaNamedProperty), R(12), U8(5), U8(10), - B(JumpIfToBooleanTrueConstant), U8(9), + B(LdaNamedProperty), R(12), U8(4), U8(11), + B(JumpIfToBooleanTrue), U8(147), B(LdaContextSlot), R(1), U8(8), U8(0), B(Star), R(12), - B(LdaNamedProperty), R(12), U8(6), U8(12), + B(LdaNamedProperty), R(12), U8(5), U8(13), B(StaContextSlot), R(1), U8(10), U8(0), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(StaContextSlot), R(1), U8(9), U8(0), B(LdaContextSlot), R(1), U8(10), U8(0), B(StaContextSlot), R(1), U8(6), U8(0), /* 16 E> */ B(StackCheck), B(Ldar), R(closure), - B(CreateBlockContext), U8(7), + B(CreateBlockContext), U8(6), B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaContextSlot), R(1), U8(6), U8(0), B(StaCurrentContextSlot), U8(4), - /* 36 S> */ B(LdaCurrentContextSlot), U8(4), + /* 36 S> */ B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(12), B(LdaFalse), B(Star), R(13), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2), B(Star), R(12), - B(LdaContextSlot), R(1), U8(5), U8(0), + B(LdaImmutableContextSlot), R(1), U8(5), U8(0), B(Star), R(13), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(SuspendGenerator), R(13), B(Ldar), R(12), /* 44 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(3), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1), B(Star), R(14), @@ -421,7 +420,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(15), U8(0), B(JumpIfTrue), U8(43), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(15), U8(0), B(JumpIfTrue), U8(33), B(Jump), U8(2), @@ -438,35 +437,35 @@ bytecodes: [ B(Star), R(9), B(LdaZero), B(Star), R(8), - B(Jump), U8(74), + B(Jump), U8(71), B(Ldar), R(14), /* 36 E> */ B(Throw), B(PopContext), R(2), B(LdaZero), B(StaContextSlot), R(1), U8(9), U8(0), - B(Wide), B(JumpLoop), U16(-219), U16(0), + B(JumpLoop), U8(218), I8(0), B(Jump), U8(44), B(Star), R(12), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(10), U8(11), + B(CreateCatchContext), R(12), U8(7), U8(8), B(Star), R(11), B(PushContext), R(2), B(LdaContextSlot), R(1), U8(9), U8(0), B(Star), R(12), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(12), U8(14), + B(LdaSmi), I8(2), + B(TestEqualStrict), R(12), U8(15), B(JumpIfFalse), U8(8), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(StaContextSlot), R(1), U8(9), U8(0), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(12), B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), B(PopContext), R(2), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(8), B(Jump), U8(8), B(Star), R(9), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(8), B(LdaTheHole), B(SetPendingMessage), @@ -474,32 +473,32 @@ bytecodes: [ B(LdaContextSlot), R(1), U8(9), U8(0), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(11), U8(15), - B(JumpIfTrueConstant), U8(17), + B(TestEqualStrict), R(11), U8(16), + B(JumpIfTrue), U8(159), B(LdaContextSlot), R(1), U8(7), U8(0), B(Star), R(11), - B(LdaNamedProperty), R(11), U8(12), U8(16), + B(LdaNamedProperty), R(11), U8(9), U8(17), B(StaContextSlot), R(1), U8(11), U8(0), B(LdaContextSlot), R(1), U8(11), U8(0), B(Star), R(11), B(TestUndetectable), R(11), B(JumpIfFalse), U8(4), - B(JumpConstant), U8(16), + B(Jump), U8(133), B(LdaContextSlot), R(1), U8(9), U8(0), B(Star), R(11), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(11), U8(19), + B(LdaSmi), I8(1), + B(TestEqualStrict), R(11), U8(20), B(JumpIfFalse), U8(75), B(LdaContextSlot), R(1), U8(11), U8(0), B(TypeOf), B(Star), R(11), - B(LdaConstant), U8(13), - B(TestEqualStrict), R(11), U8(20), + B(LdaConstant), U8(10), + B(TestEqualStrict), R(11), U8(21), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), I16(130), B(Star), R(11), - B(LdaConstant), U8(14), + B(LdaConstant), U8(11), B(Star), R(12), B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), B(Throw), @@ -512,7 +511,7 @@ bytecodes: [ B(Jump), U8(20), B(Star), R(12), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(10), U8(15), + B(CreateCatchContext), R(12), U8(7), U8(12), B(Star), R(11), B(LdaTheHole), B(SetPendingMessage), @@ -539,19 +538,19 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(11), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(17), B(Jump), U8(28), B(PopContext), R(1), B(PopContext), R(1), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(5), B(Mov), R(9), R(6), B(Jump), U8(47), B(PopContext), R(1), B(PopContext), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(5), B(Mov), R(9), R(6), B(Jump), U8(34), @@ -562,19 +561,19 @@ bytecodes: [ B(Star), R(9), B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(8), U8(2), B(Star), R(6), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(Star), R(5), B(Jump), U8(14), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(5), B(Jump), U8(8), B(Star), R(6), - B(LdaSmi), U8(4), + B(LdaSmi), I8(4), B(Star), R(5), B(LdaTheHole), B(SetPendingMessage), B(Star), R(7), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(8), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(8), U8(1), B(Ldar), R(7), @@ -582,16 +581,16 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(5), U8(0), B(JumpIfTrue), U8(32), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(TestEqualStrict), R(5), U8(0), B(JumpIfTrue), U8(28), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(5), U8(0), B(JumpIfTrue), U8(24), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(TestEqualStrict), R(5), U8(0), B(JumpIfTrue), U8(20), - B(LdaSmi), U8(4), + B(LdaSmi), I8(4), B(TestEqualStrict), R(5), U8(0), B(JumpIfTrue), U8(16), B(Jump), U8(17), @@ -612,27 +611,22 @@ constant pool: [ FIXED_ARRAY_TYPE, CONSTANT_ELEMENTS_PAIR_TYPE, SYMBOL_TYPE, - Smi [154], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], FIXED_ARRAY_TYPE, - Smi [134], - Smi [150], 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 [133], - Smi [159], - Smi [582], + Smi [579], ] handlers: [ - [53, 697, 703], - [149, 448, 454], - [152, 404, 406], - [550, 566, 568], + [53, 694, 700], + [149, 445, 451], + [152, 401, 403], + [547, 563, 565], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden index 57403bc402..4d04f6a3fa 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden @@ -19,7 +19,7 @@ bytecodes: [ /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(0), U8(2), B(Star), R(0), - B(BitwiseAndSmi), U8(1), R(0), U8(4), + B(BitwiseAndSmi), I8(1), R(0), U8(4), /* 45 E> */ B(StaGlobalSloppy), U8(0), U8(5), /* 51 S> */ B(Return), ] @@ -42,7 +42,7 @@ bytecodes: [ /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(0), U8(2), B(Star), R(0), - B(AddSmi), U8(1), R(0), U8(4), + B(AddSmi), I8(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/GlobalDelete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden index b717c71bea..1db8a27f03 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden @@ -48,7 +48,7 @@ bytecodes: [ /* 28 E> */ B(StackCheck), /* 51 S> */ B(LdaGlobal), U8(0), U8(2), B(Star), R(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(DeletePropertyStrict), R(0), /* 71 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden index 17ee039b91..ce53de6b7c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden @@ -22,7 +22,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 55 S> */ B(LdaSmi), U8(-1), + /* 55 S> */ B(LdaSmi), I8(-1), /* 70 S> */ B(Return), ] constant pool: [ @@ -46,7 +46,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 36 S> */ B(LdaSmi), U8(1), + /* 36 S> */ B(LdaSmi), I8(1), /* 76 S> */ B(Return), ] constant pool: [ @@ -70,7 +70,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 59 S> */ B(LdaSmi), U8(-1), + /* 59 S> */ B(LdaSmi), I8(-1), /* 74 S> */ B(Return), ] constant pool: [ @@ -117,14 +117,14 @@ parameter count: 1 bytecode array length: 23 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 25 S> */ B(LdaSmi), U8(1), + /* 25 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 30 S> */ B(JumpIfToBooleanFalse), U8(13), - /* 43 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 43 S> */ B(AddSmi), I8(1), R(0), U8(2), B(Mov), R(0), R(1), B(Star), R(0), B(Jump), U8(5), - /* 66 S> */ B(LdaSmi), U8(2), + /* 66 S> */ B(LdaSmi), I8(2), /* 80 S> */ B(Return), B(LdaUndefined), /* 80 S> */ B(Return), @@ -153,9 +153,9 @@ bytecodes: [ /* 18 S> */ B(LdaZero), /* 24 E> */ B(TestLessThanOrEqual), R(arg0), U8(2), B(JumpIfFalse), U8(7), - /* 36 S> */ B(Wide), B(LdaSmi), U16(200), + /* 36 S> */ B(Wide), B(LdaSmi), I16(200), /* 80 S> */ B(Return), - /* 63 S> */ B(Wide), B(LdaSmi), U16(-200), + /* 63 S> */ B(Wide), B(LdaSmi), I16(-200), /* 80 S> */ B(Return), B(LdaUndefined), /* 80 S> */ B(Return), @@ -177,7 +177,7 @@ bytecodes: [ /* 19 S> */ B(Ldar), R(arg1), /* 25 E> */ B(TestIn), R(arg0), B(JumpIfFalse), U8(7), - /* 33 S> */ B(Wide), B(LdaSmi), U16(200), + /* 33 S> */ B(Wide), B(LdaSmi), I16(200), /* 47 S> */ B(Return), B(LdaUndefined), /* 47 S> */ B(Return), @@ -396,9 +396,9 @@ bytecodes: [ /* 1057 S> */ B(Mov), R(1), R(0), /* 1066 S> */ B(Mov), R(0), R(1), /* 1073 S> */ B(Mov), R(1), R(0), - /* 1081 S> */ B(Wide), B(LdaSmi), U16(200), + /* 1081 S> */ B(Wide), B(LdaSmi), I16(200), /* 1117 S> */ B(Return), - /* 1102 S> */ B(Wide), B(LdaSmi), U16(-200), + /* 1102 S> */ B(Wide), B(LdaSmi), I16(-200), /* 1117 S> */ B(Return), B(LdaUndefined), /* 1117 S> */ B(Return), @@ -622,9 +622,9 @@ bytecodes: [ /* 1051 S> */ B(Mov), R(1), R(0), /* 1060 S> */ B(Mov), R(0), R(1), /* 1067 S> */ B(Mov), R(1), R(0), - /* 1076 S> */ B(Wide), B(LdaSmi), U16(200), + /* 1076 S> */ B(Wide), B(LdaSmi), I16(200), /* 1112 S> */ B(Return), - /* 1097 S> */ B(Wide), B(LdaSmi), U16(-200), + /* 1097 S> */ B(Wide), B(LdaSmi), I16(-200), /* 1112 S> */ B(Return), B(LdaUndefined), /* 1112 S> */ B(Return), @@ -658,42 +658,42 @@ bytecodes: [ /* 21 S> */ B(Ldar), R(arg1), /* 27 E> */ B(TestEqual), R(arg0), U8(2), B(JumpIfFalse), U8(5), - /* 35 S> */ B(LdaSmi), U8(1), + /* 35 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 49 S> */ B(Ldar), R(arg1), /* 55 E> */ B(TestEqualStrict), R(arg0), U8(3), B(JumpIfFalse), U8(5), - /* 64 S> */ B(LdaSmi), U8(1), + /* 64 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 78 S> */ B(Ldar), R(arg1), /* 84 E> */ B(TestLessThan), R(arg0), U8(4), B(JumpIfFalse), U8(5), - /* 91 S> */ B(LdaSmi), U8(1), + /* 91 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 105 S> */ B(Ldar), R(arg1), /* 111 E> */ B(TestGreaterThan), R(arg0), U8(5), B(JumpIfFalse), U8(5), - /* 118 S> */ B(LdaSmi), U8(1), + /* 118 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 132 S> */ B(Ldar), R(arg1), /* 138 E> */ B(TestLessThanOrEqual), R(arg0), U8(6), B(JumpIfFalse), U8(5), - /* 146 S> */ B(LdaSmi), U8(1), + /* 146 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 160 S> */ B(Ldar), R(arg1), /* 166 E> */ B(TestGreaterThanOrEqual), R(arg0), U8(7), B(JumpIfFalse), U8(5), - /* 174 S> */ B(LdaSmi), U8(1), + /* 174 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 188 S> */ B(Ldar), R(arg1), /* 194 E> */ B(TestIn), R(arg0), B(JumpIfFalse), U8(5), - /* 202 S> */ B(LdaSmi), U8(1), + /* 202 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 216 S> */ B(Ldar), R(arg1), /* 222 E> */ B(TestInstanceOf), R(arg0), B(JumpIfFalse), U8(5), - /* 238 S> */ B(LdaSmi), U8(1), + /* 238 S> */ B(LdaSmi), I8(1), /* 262 S> */ B(Return), /* 252 S> */ B(LdaZero), /* 262 S> */ B(Return), @@ -723,9 +723,9 @@ bytecodes: [ /* 25 S> */ B(LdaZero), B(Star), R(0), /* 30 S> */ B(JumpIfToBooleanFalse), U8(5), - /* 43 S> */ B(LdaSmi), U8(20), + /* 43 S> */ B(LdaSmi), I8(20), /* 85 S> */ B(Return), - /* 69 S> */ B(LdaSmi), U8(-20), + /* 69 S> */ B(LdaSmi), I8(-20), /* 85 S> */ B(Return), B(LdaUndefined), /* 85 S> */ B(Return), @@ -759,7 +759,7 @@ bytecodes: [ B(LdaZero), /* 37 E> */ B(TestLessThan), R(arg0), U8(3), B(JumpIfFalse), U8(5), - /* 48 S> */ B(LdaSmi), U8(1), + /* 48 S> */ B(LdaSmi), I8(1), /* 133 S> */ B(Return), /* 67 S> */ B(LdaZero), /* 73 E> */ B(TestGreaterThan), R(arg0), U8(4), @@ -769,7 +769,7 @@ bytecodes: [ B(JumpIfFalse), U8(4), /* 93 S> */ B(LdaZero), /* 133 S> */ B(Return), - /* 118 S> */ B(LdaSmi), U8(-1), + /* 118 S> */ B(LdaSmi), I8(-1), /* 133 S> */ B(Return), B(LdaUndefined), /* 133 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden index f71907ba4d..1997d02233 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 8 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(ExtraWide), B(LdaSmi), U32(12345678), + /* 34 S> */ B(ExtraWide), B(LdaSmi), I32(12345678), /* 51 S> */ B(Return), ] constant pool: [ @@ -31,9 +31,9 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), + /* 42 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), - /* 48 S> */ B(Wide), B(LdaSmi), U16(5678), + /* 48 S> */ B(Wide), B(LdaSmi), I16(5678), /* 61 S> */ B(Return), ] constant pool: [ @@ -50,9 +50,9 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), + /* 42 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), - /* 48 S> */ B(Wide), B(LdaSmi), U16(1234), + /* 48 S> */ B(Wide), B(LdaSmi), I16(1234), /* 61 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden index 99e7eac9c2..292247b425 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden @@ -956,23 +956,23 @@ bytecodes: [ B(Star), R(0), /* 4103 S> */ B(LdaZero), B(Star), R(1), - /* 4108 S> */ B(LdaSmi), U8(3), + /* 4108 S> */ B(LdaSmi), I8(3), /* 4108 E> */ B(TestLessThan), R(1), U8(2), B(Wide), B(JumpIfFalse), U16(39), /* 4090 E> */ B(StackCheck), - /* 4122 S> */ B(LdaSmi), U8(1), + /* 4122 S> */ B(LdaSmi), I8(1), /* 4128 E> */ B(TestEqual), R(1), U8(4), B(Wide), B(JumpIfFalse), U16(7), /* 4134 S> */ B(Wide), B(Jump), U16(16), - /* 4146 S> */ B(LdaSmi), U8(2), + /* 4146 S> */ B(LdaSmi), I8(2), /* 4152 E> */ B(TestEqual), R(1), U8(5), B(Wide), B(JumpIfFalse), U16(7), /* 4158 S> */ B(Wide), B(Jump), U16(12), /* 4114 S> */ B(Ldar), R(1), B(Inc), U8(3), B(Star), R(1), - B(JumpLoop), U8(-42), U8(0), - /* 4167 S> */ B(LdaSmi), U8(3), + B(JumpLoop), U8(42), I8(0), + /* 4167 S> */ B(LdaSmi), I8(3), /* 4177 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden index 74709fdab9..60f236f17a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden @@ -16,7 +16,7 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), B(LdaUndefined), /* 46 S> */ B(Return), @@ -37,7 +37,7 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(Nop), /* 56 S> */ B(Return), @@ -58,7 +58,7 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 45 S> */ B(LdaSmi), U8(20), + /* 45 S> */ B(LdaSmi), I8(20), B(Star), R(1), B(Ldar), R(0), B(JumpIfNotHole), U8(11), @@ -87,9 +87,9 @@ bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(20), + /* 46 S> */ B(LdaSmi), I8(20), B(Star), R(0), B(LdaUndefined), /* 54 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden index c1c979c0ac..5d10939959 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden @@ -20,7 +20,7 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), /* 42 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 72 S> */ B(Return), @@ -46,9 +46,9 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), /* 42 E> */ B(StaCurrentContextSlot), U8(4), - /* 72 S> */ B(LdaCurrentContextSlot), U8(4), + /* 72 S> */ B(LdaImmutableCurrentContextSlot), U8(4), /* 82 S> */ B(Return), ] constant pool: [ @@ -72,7 +72,7 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 45 S> */ B(LdaSmi), U8(20), + /* 45 S> */ B(LdaSmi), I8(20), B(Star), R(2), B(LdaCurrentContextSlot), U8(4), B(JumpIfNotHole), U8(11), @@ -107,9 +107,9 @@ bytecodes: [ B(CreateClosure), U8(0), U8(2), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), /* 42 E> */ B(StaCurrentContextSlot), U8(4), - /* 46 S> */ B(LdaSmi), U8(20), + /* 46 S> */ B(LdaSmi), I8(20), /* 48 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 80 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden index fae86a673d..8cfa8474f9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden @@ -17,7 +17,7 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 60 S> */ B(Return), ] constant pool: [ @@ -36,10 +36,10 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), /* 55 E> */ B(TestEqual), R(0), U8(2), B(JumpIfTrue), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 67 S> */ B(Return), ] constant pool: [ @@ -59,7 +59,7 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 60 S> */ B(Return), ] constant pool: [ @@ -81,7 +81,7 @@ bytecodes: [ /* 45 S> */ B(LdaZero), /* 55 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 67 S> */ B(Return), ] constant pool: [ @@ -101,7 +101,7 @@ bytecodes: [ /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 68 S> */ B(Return), ] constant pool: [ @@ -118,17 +118,17 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(2), + /* 42 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 49 S> */ B(LdaSmi), U8(3), + /* 49 S> */ B(LdaSmi), I8(3), B(Star), R(1), - /* 56 S> */ B(LdaSmi), U8(4), + /* 56 S> */ B(LdaSmi), I8(4), B(Star), R(2), /* 59 S> */ B(Ldar), R(0), B(JumpIfToBooleanTrue), U8(8), - B(LdaSmi), U8(5), + B(LdaSmi), I8(5), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 95 S> */ B(Return), ] constant pool: [ @@ -177,143 +177,143 @@ parameter count: 1 bytecode array length: 276 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(2), + /* 53 S> */ B(LdaSmi), I8(2), B(Star), R(1), - /* 60 S> */ B(LdaSmi), U8(3), + /* 60 S> */ B(LdaSmi), I8(3), B(Star), R(2), /* 63 S> */ B(Ldar), R(0), B(JumpIfToBooleanTrueConstant), U8(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 624 S> */ B(Return), ] constant pool: [ @@ -365,141 +365,141 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(2), + /* 53 S> */ B(LdaSmi), I8(2), B(Star), R(1), - /* 60 S> */ B(LdaSmi), U8(3), + /* 60 S> */ B(LdaSmi), I8(3), B(Star), R(2), /* 63 S> */ B(Ldar), R(0), B(JumpIfToBooleanFalseConstant), U8(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 624 S> */ B(Return), ] constant pool: [ @@ -549,144 +549,144 @@ parameter count: 1 bytecode array length: 279 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(2), + /* 53 S> */ B(LdaSmi), I8(2), B(Star), R(1), - /* 60 S> */ B(LdaSmi), U8(3), + /* 60 S> */ B(LdaSmi), I8(3), B(Star), R(2), - /* 63 S> */ B(LdaSmi), U8(3), + /* 63 S> */ B(LdaSmi), I8(3), /* 73 E> */ B(TestGreaterThan), R(0), U8(2), B(JumpIfTrueConstant), U8(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 630 S> */ B(Return), ] constant pool: [ @@ -738,142 +738,142 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 53 S> */ B(LdaSmi), U8(2), + /* 53 S> */ B(LdaSmi), I8(2), B(Star), R(1), - /* 60 S> */ B(LdaSmi), U8(3), + /* 60 S> */ B(LdaSmi), I8(3), B(Star), R(2), - /* 63 S> */ B(LdaSmi), U8(5), + /* 63 S> */ B(LdaSmi), I8(5), /* 73 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalseConstant), U8(0), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(1), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(Star), R(2), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), /* 630 S> */ B(Return), ] constant pool: [ @@ -908,7 +908,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(1), + /* 34 S> */ B(LdaSmi), I8(1), /* 49 S> */ B(Return), ] constant pool: [ @@ -925,13 +925,13 @@ parameter count: 1 bytecode array length: 15 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(4), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(JumpIfToBooleanTrue), U8(3), B(LdaZero), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), /* 68 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden index 07dbbdfe19..fdfe86481c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden @@ -31,9 +31,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(10), + B(LdaSmi), I8(10), B(Star), R(8), - B(LdaSmi), U8(14), + B(LdaSmi), I8(14), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), @@ -77,9 +77,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(10), + B(LdaSmi), I8(10), B(Star), R(8), - B(LdaSmi), U8(14), + B(LdaSmi), I8(14), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), @@ -116,7 +116,7 @@ bytecodes: [ B(Ldar), R(new_target), B(StaCurrentContextSlot), U8(5), /* 10 E> */ B(StackCheck), - /* 14 S> */ B(LdaSmi), U8(20), + /* 14 S> */ B(LdaSmi), I8(20), /* 16 E> */ B(StaLookupSlotSloppy), U8(0), /* 22 S> */ B(LdaUndefined), B(Star), R(2), @@ -126,9 +126,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(10), + B(LdaSmi), I8(10), B(Star), R(8), - B(LdaSmi), U8(29), + B(LdaSmi), I8(29), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), @@ -176,9 +176,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(38), + B(LdaSmi), I8(38), B(Star), R(8), - B(LdaSmi), U8(44), + B(LdaSmi), I8(44), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), @@ -227,9 +227,9 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(34), + B(LdaSmi), I8(34), B(Star), R(8), - B(LdaSmi), U8(40), + B(LdaSmi), I8(40), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden index ce915d51c0..9a40416535 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden @@ -43,7 +43,7 @@ parameter count: 1 bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 15 S> */ B(LdaSmi), U8(10), + /* 15 S> */ B(LdaSmi), I8(10), /* 17 E> */ B(StaLookupSlotSloppy), U8(0), B(LdaUndefined), /* 23 S> */ B(Return), @@ -68,7 +68,7 @@ parameter count: 1 bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 29 S> */ B(LdaSmi), U8(10), + /* 29 S> */ B(LdaSmi), I8(10), /* 31 E> */ B(StaLookupSlotStrict), U8(0), B(LdaUndefined), /* 37 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden index f7e64f4864..2dcd93b231 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden @@ -2895,7 +2895,7 @@ bytecodes: [ B(Star), R(0), /* 3082 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 3086 S> */ B(LdaSmi), U8(10), + /* 3086 S> */ B(LdaSmi), I8(10), /* 3088 E> */ B(Wide), B(StaLookupSlotSloppy), U16(256), B(LdaUndefined), /* 3093 S> */ B(Return), @@ -3949,7 +3949,7 @@ bytecodes: [ B(Star), R(0), /* 3095 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 3099 S> */ B(LdaSmi), U8(10), + /* 3099 S> */ B(LdaSmi), I8(10), /* 3101 E> */ B(Wide), B(StaLookupSlotStrict), U16(256), B(LdaUndefined), /* 3106 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden index db5b72c6ee..f8c4df6b30 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -24,10 +24,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(63), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -38,19 +38,19 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 13 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -59,7 +59,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -96,10 +96,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(63), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -110,19 +110,19 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 24 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -131,7 +131,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -170,10 +170,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(63), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(4), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(6), @@ -184,19 +184,19 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(5), B(Mov), R(closure), R(4), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(4), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(4), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(5), B(LdaZero), B(SuspendGenerator), R(5), B(Ldar), R(4), /* 64 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(5), U8(1), B(Star), R(6), @@ -205,7 +205,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -218,13 +218,13 @@ bytecodes: [ /* 0 E> */ B(Throw), /* 32 S> */ B(LdaUndefined), B(Star), R(5), - /* 32 E> */ B(LdaModuleVariable), U8(-1), U8(0), + /* 32 E> */ B(LdaModuleVariable), I8(-1), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(6), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(6), U8(1), B(Star), R(4), - B(LdaSmi), U8(42), + B(LdaSmi), I8(42), B(Star), R(6), /* 32 E> */ B(Call), R(4), R(5), U8(2), U8(2), B(Ldar), R(closure), @@ -236,13 +236,13 @@ bytecodes: [ /* 47 E> */ B(StaCurrentContextSlot), U8(4), /* 52 S> */ B(LdaUndefined), B(Star), R(5), - /* 52 E> */ B(LdaModuleVariable), U8(-1), U8(1), + /* 52 E> */ B(LdaModuleVariable), I8(-1), U8(1), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(6), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(6), U8(1), B(Star), R(4), - B(LdaSmi), U8(42), + B(LdaSmi), I8(42), B(Star), R(6), /* 52 E> */ B(Call), R(4), R(5), U8(2), U8(4), B(PopContext), R(1), @@ -276,10 +276,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(63), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(4), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(6), @@ -290,19 +290,19 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(5), B(Mov), R(closure), R(4), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(4), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(4), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(5), B(LdaZero), B(SuspendGenerator), R(5), B(Ldar), R(4), /* 49 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(5), U8(1), B(Star), R(6), @@ -311,7 +311,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -322,11 +322,11 @@ bytecodes: [ /* 49 S> */ B(Return), B(Ldar), R(6), /* 0 E> */ B(Throw), - /* 17 S> */ B(LdaSmi), U8(42), - /* 17 E> */ B(StaModuleVariable), U8(1), U8(0), - /* 21 S> */ B(LdaModuleVariable), U8(1), U8(0), + /* 17 S> */ B(LdaSmi), I8(42), + /* 17 E> */ B(StaModuleVariable), I8(1), U8(0), + /* 21 S> */ B(LdaModuleVariable), I8(1), U8(0), B(Inc), U8(2), - /* 24 E> */ B(StaModuleVariable), U8(1), U8(0), + /* 24 E> */ B(StaModuleVariable), I8(1), U8(0), B(Ldar), R(closure), B(CreateBlockContext), U8(1), B(PushContext), R(1), @@ -334,9 +334,9 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 34 S> */ B(LdaUndefined), /* 34 E> */ B(StaCurrentContextSlot), U8(4), - /* 39 S> */ B(LdaModuleVariable), U8(1), U8(1), + /* 39 S> */ B(LdaModuleVariable), I8(1), U8(1), B(Inc), U8(3), - /* 42 E> */ B(StaModuleVariable), U8(1), U8(1), + /* 42 E> */ B(StaModuleVariable), I8(1), U8(1), B(PopContext), R(1), B(LdaUndefined), /* 49 S> */ B(Return), @@ -367,10 +367,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(67), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(4), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(6), @@ -381,21 +381,21 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaModuleVariable), U8(1), U8(0), + B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(5), B(Mov), R(closure), R(4), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(4), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(4), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(5), B(LdaZero), B(SuspendGenerator), R(5), B(Ldar), R(4), /* 49 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(5), U8(1), B(Star), R(6), @@ -404,7 +404,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -415,11 +415,11 @@ bytecodes: [ /* 49 S> */ B(Return), B(Ldar), R(6), /* 0 E> */ B(Throw), - /* 17 S> */ B(LdaSmi), U8(42), - /* 17 E> */ B(StaModuleVariable), U8(1), U8(0), - /* 21 S> */ B(LdaModuleVariable), U8(1), U8(0), + /* 17 S> */ B(LdaSmi), I8(42), + /* 17 E> */ B(StaModuleVariable), I8(1), U8(0), + /* 21 S> */ B(LdaModuleVariable), I8(1), U8(0), B(Inc), U8(2), - /* 24 E> */ B(StaModuleVariable), U8(1), U8(0), + /* 24 E> */ B(StaModuleVariable), I8(1), U8(0), B(Ldar), R(closure), B(CreateBlockContext), U8(1), B(PushContext), R(1), @@ -427,9 +427,9 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 34 S> */ B(LdaUndefined), /* 34 E> */ B(StaCurrentContextSlot), U8(4), - /* 39 S> */ B(LdaModuleVariable), U8(1), U8(1), + /* 39 S> */ B(LdaModuleVariable), I8(1), U8(1), B(Inc), U8(3), - /* 42 E> */ B(StaModuleVariable), U8(1), U8(1), + /* 42 E> */ B(StaModuleVariable), I8(1), U8(1), B(PopContext), R(1), B(LdaUndefined), /* 49 S> */ B(Return), @@ -460,10 +460,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(67), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(4), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(6), @@ -474,21 +474,21 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaModuleVariable), U8(1), U8(0), + B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(5), B(Mov), R(closure), R(4), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(4), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(4), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(5), B(LdaZero), B(SuspendGenerator), R(5), B(Ldar), R(4), /* 51 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(2), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(5), U8(1), B(Star), R(6), @@ -497,7 +497,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -508,9 +508,9 @@ bytecodes: [ /* 51 S> */ B(Return), B(Ldar), R(6), /* 0 E> */ B(Throw), - /* 19 S> */ B(LdaSmi), U8(42), - /* 19 E> */ B(StaModuleVariable), U8(1), U8(0), - /* 23 S> */ B(LdaModuleVariable), U8(1), U8(0), + /* 19 S> */ B(LdaSmi), I8(42), + /* 19 E> */ B(StaModuleVariable), I8(1), U8(0), + /* 23 S> */ B(LdaModuleVariable), I8(1), U8(0), B(Inc), U8(2), /* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(Ldar), R(closure), @@ -520,7 +520,7 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 36 S> */ B(LdaUndefined), /* 36 E> */ B(StaCurrentContextSlot), U8(4), - /* 41 S> */ B(LdaModuleVariable), U8(1), U8(1), + /* 41 S> */ B(LdaModuleVariable), I8(1), U8(1), B(Inc), U8(3), /* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(PopContext), R(1), @@ -551,10 +551,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(67), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -565,21 +565,21 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaModuleVariable), U8(1), U8(0), + B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 32 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -588,7 +588,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -600,7 +600,7 @@ bytecodes: [ B(Ldar), R(5), /* 0 E> */ B(Throw), B(CreateClosure), U8(1), U8(2), U8(0), - B(StaModuleVariable), U8(1), U8(0), + B(StaModuleVariable), I8(1), U8(0), B(LdaUndefined), /* 32 S> */ B(Return), ] @@ -628,10 +628,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(67), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -642,21 +642,21 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaModuleVariable), U8(1), U8(0), + B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 26 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -665,7 +665,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -680,9 +680,9 @@ bytecodes: [ B(Star), R(3), B(LdaTheHole), B(Star), R(4), - B(LdaSmi), U8(16), + B(LdaSmi), I8(16), B(Star), R(6), - B(LdaSmi), U8(24), + B(LdaSmi), I8(24), B(Star), R(7), B(Mov), R(3), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), @@ -691,7 +691,7 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1), B(StaCurrentContextSlot), U8(6), B(LdaCurrentContextSlot), U8(6), - /* 16 E> */ B(StaModuleVariable), U8(1), U8(0), + /* 16 E> */ B(StaModuleVariable), I8(1), U8(0), B(LdaUndefined), /* 26 S> */ B(Return), ] @@ -719,10 +719,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(63), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -733,19 +733,19 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 30 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -754,7 +754,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -791,10 +791,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(63), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -805,19 +805,19 @@ bytecodes: [ B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 19 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -826,7 +826,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -864,10 +864,10 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(73), - B(LdaSmi), U8(78), + B(LdaSmi), I8(78), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(5), @@ -882,19 +882,19 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(3), U8(1), B(StaCurrentContextSlot), U8(6), /* 0 E> */ B(StackCheck), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(4), B(Mov), R(closure), R(3), /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaImmutableCurrentContextSlot), U8(5), B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), /* 45 S> */ B(Return), - B(LdaSmi), U8(-2), + B(LdaSmi), I8(-2), B(Star), R(1), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), B(Star), R(5), @@ -903,7 +903,7 @@ bytecodes: [ B(LdaZero), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(25), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(6), U8(0), B(JumpIfTrue), U8(15), B(Jump), U8(2), @@ -914,13 +914,13 @@ bytecodes: [ /* 45 S> */ B(Return), B(Ldar), R(5), /* 0 E> */ B(Throw), - /* 27 S> */ B(LdaCurrentContextSlot), U8(6), + /* 27 S> */ B(LdaImmutableCurrentContextSlot), U8(6), B(Star), R(4), /* 30 E> */ B(LdaNamedProperty), R(4), U8(1), U8(4), B(Star), R(3), - B(LdaCurrentContextSlot), U8(6), + B(LdaImmutableCurrentContextSlot), U8(6), B(Star), R(5), - B(LdaCurrentContextSlot), U8(6), + B(LdaImmutableCurrentContextSlot), U8(6), B(Star), R(6), /* 41 E> */ B(LdaNamedProperty), R(6), U8(2), U8(6), B(Star), R(6), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden new file mode 100644 index 0000000000..e77314533c --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden @@ -0,0 +1,157 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: yes + +--- +snippet: " + class A { constructor(...args) { this.args = args; } } + new A(...[1, 2, 3]); +" +frame size: 8 +parameter count: 1 +bytecode array length: 64 +bytecodes: [ + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + B(LdaTheHole), + B(Star), R(0), + /* 34 S> */ B(CreateClosure), U8(0), U8(2), U8(2), + B(Star), R(3), + B(LdaTheHole), + B(Star), R(4), + B(LdaSmi), I8(34), + B(Star), R(6), + B(LdaSmi), I8(88), + B(Star), R(7), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(3), U8(1), + B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + /* 89 S> */ B(CreateArrayLiteral), U8(1), U8(5), U8(9), + B(Star), R(4), + B(Ldar), R(2), + /* 89 E> */ B(ConstructWithSpread), R(2), R(4), U8(1), + B(LdaUndefined), + /* 110 S> */ B(Return), +] +constant pool: [ + SHARED_FUNCTION_INFO_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, +] +handlers: [ +] + +--- +snippet: " + class A { constructor(...args) { this.args = args; } } + new A(0, ...[1, 2, 3]); +" +frame size: 8 +parameter count: 1 +bytecode array length: 67 +bytecodes: [ + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + B(LdaTheHole), + B(Star), R(0), + /* 34 S> */ B(CreateClosure), U8(0), U8(2), U8(2), + B(Star), R(3), + B(LdaTheHole), + B(Star), R(4), + B(LdaSmi), I8(34), + B(Star), R(6), + B(LdaSmi), I8(88), + B(Star), R(7), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(3), U8(1), + B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + /* 89 S> */ B(LdaZero), + B(Star), R(4), + B(CreateArrayLiteral), U8(1), U8(5), U8(9), + B(Star), R(5), + B(Ldar), R(2), + /* 89 E> */ B(ConstructWithSpread), R(2), R(4), U8(2), + B(LdaUndefined), + /* 113 S> */ B(Return), +] +constant pool: [ + SHARED_FUNCTION_INFO_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, +] +handlers: [ +] + +--- +snippet: " + class A { constructor(...args) { this.args = args; } } + new A(0, ...[1, 2, 3], 4); +" +frame size: 9 +parameter count: 1 +bytecode array length: 98 +bytecodes: [ + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + B(LdaTheHole), + B(Star), R(0), + /* 34 S> */ B(CreateClosure), U8(0), U8(2), U8(2), + B(Star), R(3), + B(LdaTheHole), + B(Star), R(4), + B(LdaSmi), I8(34), + B(Star), R(6), + B(LdaSmi), I8(88), + B(Star), R(7), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(3), U8(1), + B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + /* 89 S> */ B(LdaUndefined), + B(Star), R(3), + B(LdaUndefined), + B(Star), R(5), + /* 93 E> */ B(CreateArrayLiteral), U8(1), U8(3), U8(9), + B(Star), R(6), + B(LdaUndefined), + B(Star), R(7), + B(CreateArrayLiteral), U8(2), U8(4), U8(9), + B(Star), R(8), + B(CallJSRuntime), U8(%spread_iterable), R(7), U8(2), + B(Star), R(7), + B(CreateArrayLiteral), U8(3), U8(5), U8(9), + B(Star), R(8), + B(CallJSRuntime), U8(%spread_arguments), R(5), U8(4), + B(Star), R(5), + B(Mov), R(1), R(4), + B(CallJSRuntime), U8(%reflect_construct), R(3), U8(3), + B(LdaUndefined), + /* 116 S> */ B(Return), +] +constant pool: [ + SHARED_FUNCTION_INFO_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, + CONSTANT_ELEMENTS_PAIR_TYPE, +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden index 75c6ff57be..de0db058e9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(35), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(35), R(0), B(Ldar), R(0), /* 46 S> */ B(Return), ] @@ -33,7 +33,7 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(0), B(Ldar), R(0), /* 71 S> */ B(Return), ] @@ -52,10 +52,10 @@ parameter count: 1 bytecode array length: 17 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), - /* 75 E> */ B(StaNamedPropertySloppy), R(1), U8(1), U8(2), + /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), + /* 75 E> */ B(StaNamedOwnProperty), R(1), U8(1), U8(3), B(Ldar), R(1), /* 80 S> */ B(Return), ] @@ -75,11 +75,11 @@ parameter count: 1 bytecode array length: 21 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), - /* 69 E> */ B(AddSmi), U8(1), R(0), U8(2), - B(StaNamedPropertySloppy), R(1), U8(1), U8(3), + /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(3), U8(1), R(1), + /* 69 E> */ B(AddSmi), I8(1), R(0), U8(2), + B(StaNamedOwnProperty), R(1), U8(1), U8(4), B(Ldar), R(1), /* 76 S> */ B(Return), ] @@ -99,9 +99,9 @@ parameter count: 1 bytecode array length: 17 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(3), U8(1), R(0), B(CreateClosure), U8(1), U8(2), U8(2), - B(StaNamedPropertySloppy), R(0), U8(2), U8(3), + B(StaNamedOwnProperty), R(0), U8(2), U8(4), B(Ldar), R(0), /* 67 S> */ B(Return), ] @@ -122,9 +122,9 @@ parameter count: 1 bytecode array length: 17 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(3), U8(1), R(0), B(CreateClosure), U8(1), U8(2), U8(2), - B(StaNamedPropertySloppy), R(0), U8(2), U8(3), + B(StaNamedOwnProperty), R(0), U8(2), U8(4), B(Ldar), R(0), /* 68 S> */ B(Return), ] @@ -145,7 +145,7 @@ parameter count: 1 bytecode array length: 33 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(3), U8(1), R(0), B(LdaConstant), U8(1), B(Star), R(2), B(CreateClosure), U8(2), U8(2), U8(2), @@ -176,7 +176,7 @@ parameter count: 1 bytecode array length: 36 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(4), U8(1), R(0), B(LdaConstant), U8(1), B(Star), R(2), B(CreateClosure), U8(2), U8(2), U8(2), @@ -208,7 +208,7 @@ parameter count: 1 bytecode array length: 33 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(3), U8(1), R(0), B(LdaConstant), U8(1), B(Star), R(2), B(LdaNull), @@ -239,10 +239,10 @@ parameter count: 1 bytecode array length: 31 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), - B(LdaSmi), U8(1), + /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), + B(LdaSmi), I8(1), B(Star), R(3), B(LdaZero), B(Star), R(5), @@ -267,7 +267,7 @@ parameter count: 1 bytecode array length: 20 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(35), R(0), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(35), R(0), B(LdaNull), B(Star), R(2), B(Mov), R(0), R(1), @@ -292,11 +292,11 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(35), R(1), + /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(2), U8(35), R(1), /* 60 E> */ B(ToName), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), - B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(2), + B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(3), B(Ldar), R(1), /* 69 S> */ B(Return), ] @@ -318,12 +318,12 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(1), R(1), - /* 64 E> */ B(StaNamedPropertySloppy), R(1), U8(2), U8(2), + /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(2), U8(1), R(1), + /* 64 E> */ B(StaNamedOwnProperty), R(1), U8(2), U8(3), /* 68 E> */ B(ToName), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), - B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(4), + B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(5), B(Ldar), R(1), /* 77 S> */ B(Return), ] @@ -346,12 +346,12 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(1), U8(35), R(1), + /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(3), U8(35), R(1), /* 60 E> */ B(ToName), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(1), B(Star), R(3), - B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(2), - B(CreateObjectLiteral), U8(1), U8(0), U8(35), R(4), + B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(4), + B(CreateObjectLiteral), U8(1), U8(2), U8(35), R(4), B(Mov), R(1), R(2), B(Mov), R(4), R(3), B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(2), U8(2), @@ -376,11 +376,11 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(35), R(1), + /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(4), U8(35), R(1), /* 60 E> */ B(ToName), R(2), B(LdaConstant), U8(2), B(Star), R(3), - B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(4), + B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(5), B(LdaConstant), U8(3), B(ToName), R(3), B(CreateClosure), U8(4), U8(2), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden index b281cb7336..e1f320e397 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden @@ -783,7 +783,7 @@ bytecodes: [ B(Star), R(0), /* 2591 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 2601 S> */ B(Wide), B(CreateObjectLiteral), U16(256), U16(0), U8(1), R16(1), + /* 2601 S> */ B(Wide), B(CreateObjectLiteral), U16(256), U16(2), U8(1), R16(1), B(Ldar), R(1), /* 2638 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden index 52ea01f910..d72a32aef4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden @@ -23,9 +23,9 @@ parameter count: 1 bytecode array length: 13 bytecodes: [ /* 97 E> */ B(StackCheck), - /* 102 S> */ B(LdaContextSlot), R(context), U8(4), U8(1), + /* 102 S> */ B(LdaImmutableContextSlot), R(context), U8(4), U8(1), B(Star), R(0), - B(LdaCurrentContextSlot), U8(4), + B(LdaImmutableCurrentContextSlot), U8(4), /* 118 E> */ B(Mul), R(0), U8(2), /* 130 S> */ B(Return), ] @@ -51,7 +51,7 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 97 E> */ B(StackCheck), - /* 102 S> */ B(LdaCurrentContextSlot), U8(4), + /* 102 S> */ B(LdaImmutableCurrentContextSlot), 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/Parameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden index 01c3ad0694..b3c987f296 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden @@ -106,7 +106,7 @@ parameter count: 2 bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 19 S> */ B(LdaSmi), U8(1), + /* 19 S> */ B(LdaSmi), I8(1), B(Star), R(arg0), B(LdaUndefined), /* 29 S> */ B(Return), @@ -126,7 +126,7 @@ parameter count: 5 bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 37 S> */ B(LdaSmi), U8(1), + /* 37 S> */ B(LdaSmi), I8(1), B(Star), R(arg1), B(LdaUndefined), /* 47 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden index 90fb7b9dbb..055c016e24 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden @@ -35,7 +35,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(3), + /* 45 S> */ B(LdaSmi), I8(3), /* 54 E> */ B(Add), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -55,7 +55,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(3), + /* 45 S> */ B(LdaSmi), I8(3), /* 54 E> */ B(Sub), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -73,9 +73,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(4), + /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(3), + /* 45 S> */ B(LdaSmi), I8(3), /* 54 E> */ B(Mul), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -93,9 +93,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(4), + /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(3), + /* 45 S> */ B(LdaSmi), I8(3), /* 54 E> */ B(Div), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -113,9 +113,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(4), + /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(3), + /* 45 S> */ B(LdaSmi), I8(3), /* 54 E> */ B(Mod), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -133,9 +133,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(2), + /* 45 S> */ B(LdaSmi), I8(2), /* 54 E> */ B(BitwiseOr), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -153,9 +153,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(2), + /* 45 S> */ B(LdaSmi), I8(2), /* 54 E> */ B(BitwiseXor), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -173,9 +173,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(2), + /* 45 S> */ B(LdaSmi), I8(2), /* 54 E> */ B(BitwiseAnd), R(0), U8(2), /* 59 S> */ B(Return), ] @@ -193,9 +193,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(3), + /* 46 S> */ B(LdaSmi), I8(3), /* 55 E> */ B(ShiftLeft), R(0), U8(2), /* 61 S> */ B(Return), ] @@ -213,9 +213,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(3), + /* 46 S> */ B(LdaSmi), I8(3), /* 55 E> */ B(ShiftRight), R(0), U8(2), /* 61 S> */ B(Return), ] @@ -233,9 +233,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(10), + /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(3), + /* 46 S> */ B(LdaSmi), I8(3), /* 55 E> */ B(ShiftRightLogical), R(0), U8(2), /* 62 S> */ B(Return), ] @@ -255,7 +255,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 S> */ B(LdaSmi), U8(3), + /* 45 S> */ B(LdaSmi), I8(3), /* 60 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden index 48db168d03..aae0c2d0bd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden @@ -115,7 +115,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(1), + /* 34 S> */ B(LdaSmi), I8(1), /* 45 S> */ B(Return), ] constant pool: [ @@ -132,7 +132,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(-1), + /* 34 S> */ B(LdaSmi), I8(-1), /* 45 S> */ B(Return), ] constant pool: [ @@ -149,7 +149,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(127), + /* 34 S> */ B(LdaSmi), I8(127), /* 47 S> */ B(Return), ] constant pool: [ @@ -166,7 +166,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(-128), + /* 34 S> */ B(LdaSmi), I8(-128), /* 47 S> */ B(Return), ] constant pool: [ @@ -183,7 +183,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(2), + /* 34 S> */ B(LdaSmi), I8(2), /* 46 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden index f0a51af8bd..38ef6a3fc4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden @@ -500,20 +500,20 @@ bytecodes: [ /* 16 S> */ B(Nop), /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), B(Star), R(2), - B(LdaSmi), U8(1), + B(LdaSmi), I8(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(LdaSmi), I8(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(LdaSmi), I8(3), B(Star), R(2), /* 41 E> */ B(CallProperty), R(0), R(1), U8(2), U8(2), /* 50 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden index 70e75645b2..bee525cf44 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden @@ -56,7 +56,7 @@ parameter count: 2 bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 16 S> */ B(LdaSmi), U8(100), + /* 16 S> */ B(LdaSmi), I8(100), /* 24 E> */ B(LdaKeyedProperty), R(arg0), U8(2), /* 31 S> */ B(Return), ] @@ -97,7 +97,7 @@ bytecodes: [ /* 25 S> */ B(Nop), /* 25 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), B(Star), R(0), - /* 32 S> */ B(LdaSmi), U8(-124), + /* 32 S> */ B(LdaSmi), I8(-124), /* 40 E> */ B(LdaKeyedProperty), R(arg0), U8(4), /* 48 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden index ed71814500..7e6dd5ae78 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden @@ -60,7 +60,7 @@ parameter count: 2 bytecode array length: 13 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 16 S> */ B(LdaSmi), U8(100), + /* 16 S> */ B(LdaSmi), I8(100), B(Star), R(1), B(LdaConstant), U8(0), /* 23 E> */ B(StaKeyedPropertySloppy), R(arg0), R(1), U8(2), @@ -104,7 +104,7 @@ parameter count: 2 bytecode array length: 12 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 16 S> */ B(LdaSmi), U8(-124), + /* 16 S> */ B(LdaSmi), I8(-124), /* 26 E> */ B(LdaKeyedProperty), R(arg0), U8(2), /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(4), B(LdaUndefined), @@ -299,263 +299,263 @@ parameter count: 2 bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 18 S> */ B(LdaSmi), U8(1), + /* 18 S> */ B(LdaSmi), I8(1), /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(2), - /* 32 S> */ B(LdaSmi), U8(1), + /* 32 S> */ B(LdaSmi), I8(1), /* 39 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(4), - /* 46 S> */ B(LdaSmi), U8(1), + /* 46 S> */ B(LdaSmi), I8(1), /* 53 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(6), - /* 60 S> */ B(LdaSmi), U8(1), + /* 60 S> */ B(LdaSmi), I8(1), /* 67 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(8), - /* 74 S> */ B(LdaSmi), U8(1), + /* 74 S> */ B(LdaSmi), I8(1), /* 81 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(10), - /* 88 S> */ B(LdaSmi), U8(1), + /* 88 S> */ B(LdaSmi), I8(1), /* 95 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(12), - /* 102 S> */ B(LdaSmi), U8(1), + /* 102 S> */ B(LdaSmi), I8(1), /* 109 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(14), - /* 116 S> */ B(LdaSmi), U8(1), + /* 116 S> */ B(LdaSmi), I8(1), /* 123 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(16), - /* 130 S> */ B(LdaSmi), U8(1), + /* 130 S> */ B(LdaSmi), I8(1), /* 137 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(18), - /* 144 S> */ B(LdaSmi), U8(1), + /* 144 S> */ B(LdaSmi), I8(1), /* 151 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(20), - /* 158 S> */ B(LdaSmi), U8(1), + /* 158 S> */ B(LdaSmi), I8(1), /* 165 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(22), - /* 172 S> */ B(LdaSmi), U8(1), + /* 172 S> */ B(LdaSmi), I8(1), /* 179 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(24), - /* 186 S> */ B(LdaSmi), U8(1), + /* 186 S> */ B(LdaSmi), I8(1), /* 193 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(26), - /* 200 S> */ B(LdaSmi), U8(1), + /* 200 S> */ B(LdaSmi), I8(1), /* 207 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(28), - /* 214 S> */ B(LdaSmi), U8(1), + /* 214 S> */ B(LdaSmi), I8(1), /* 221 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(30), - /* 228 S> */ B(LdaSmi), U8(1), + /* 228 S> */ B(LdaSmi), I8(1), /* 235 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(32), - /* 242 S> */ B(LdaSmi), U8(1), + /* 242 S> */ B(LdaSmi), I8(1), /* 249 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(34), - /* 256 S> */ B(LdaSmi), U8(1), + /* 256 S> */ B(LdaSmi), I8(1), /* 263 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(36), - /* 270 S> */ B(LdaSmi), U8(1), + /* 270 S> */ B(LdaSmi), I8(1), /* 277 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(38), - /* 284 S> */ B(LdaSmi), U8(1), + /* 284 S> */ B(LdaSmi), I8(1), /* 291 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(40), - /* 298 S> */ B(LdaSmi), U8(1), + /* 298 S> */ B(LdaSmi), I8(1), /* 305 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(42), - /* 312 S> */ B(LdaSmi), U8(1), + /* 312 S> */ B(LdaSmi), I8(1), /* 319 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(44), - /* 326 S> */ B(LdaSmi), U8(1), + /* 326 S> */ B(LdaSmi), I8(1), /* 333 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(46), - /* 340 S> */ B(LdaSmi), U8(1), + /* 340 S> */ B(LdaSmi), I8(1), /* 347 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(48), - /* 354 S> */ B(LdaSmi), U8(1), + /* 354 S> */ B(LdaSmi), I8(1), /* 361 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(50), - /* 368 S> */ B(LdaSmi), U8(1), + /* 368 S> */ B(LdaSmi), I8(1), /* 375 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(52), - /* 382 S> */ B(LdaSmi), U8(1), + /* 382 S> */ B(LdaSmi), I8(1), /* 389 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(54), - /* 396 S> */ B(LdaSmi), U8(1), + /* 396 S> */ B(LdaSmi), I8(1), /* 403 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(56), - /* 410 S> */ B(LdaSmi), U8(1), + /* 410 S> */ B(LdaSmi), I8(1), /* 417 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(58), - /* 424 S> */ B(LdaSmi), U8(1), + /* 424 S> */ B(LdaSmi), I8(1), /* 431 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(60), - /* 438 S> */ B(LdaSmi), U8(1), + /* 438 S> */ B(LdaSmi), I8(1), /* 445 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(62), - /* 452 S> */ B(LdaSmi), U8(1), + /* 452 S> */ B(LdaSmi), I8(1), /* 459 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(64), - /* 466 S> */ B(LdaSmi), U8(1), + /* 466 S> */ B(LdaSmi), I8(1), /* 473 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(66), - /* 480 S> */ B(LdaSmi), U8(1), + /* 480 S> */ B(LdaSmi), I8(1), /* 487 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(68), - /* 494 S> */ B(LdaSmi), U8(1), + /* 494 S> */ B(LdaSmi), I8(1), /* 501 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(70), - /* 508 S> */ B(LdaSmi), U8(1), + /* 508 S> */ B(LdaSmi), I8(1), /* 515 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(72), - /* 522 S> */ B(LdaSmi), U8(1), + /* 522 S> */ B(LdaSmi), I8(1), /* 529 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(74), - /* 536 S> */ B(LdaSmi), U8(1), + /* 536 S> */ B(LdaSmi), I8(1), /* 543 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(76), - /* 550 S> */ B(LdaSmi), U8(1), + /* 550 S> */ B(LdaSmi), I8(1), /* 557 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(78), - /* 564 S> */ B(LdaSmi), U8(1), + /* 564 S> */ B(LdaSmi), I8(1), /* 571 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(80), - /* 578 S> */ B(LdaSmi), U8(1), + /* 578 S> */ B(LdaSmi), I8(1), /* 585 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(82), - /* 592 S> */ B(LdaSmi), U8(1), + /* 592 S> */ B(LdaSmi), I8(1), /* 599 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(84), - /* 606 S> */ B(LdaSmi), U8(1), + /* 606 S> */ B(LdaSmi), I8(1), /* 613 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(86), - /* 620 S> */ B(LdaSmi), U8(1), + /* 620 S> */ B(LdaSmi), I8(1), /* 627 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(88), - /* 634 S> */ B(LdaSmi), U8(1), + /* 634 S> */ B(LdaSmi), I8(1), /* 641 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(90), - /* 648 S> */ B(LdaSmi), U8(1), + /* 648 S> */ B(LdaSmi), I8(1), /* 655 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(92), - /* 662 S> */ B(LdaSmi), U8(1), + /* 662 S> */ B(LdaSmi), I8(1), /* 669 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(94), - /* 676 S> */ B(LdaSmi), U8(1), + /* 676 S> */ B(LdaSmi), I8(1), /* 683 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(96), - /* 690 S> */ B(LdaSmi), U8(1), + /* 690 S> */ B(LdaSmi), I8(1), /* 697 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(98), - /* 704 S> */ B(LdaSmi), U8(1), + /* 704 S> */ B(LdaSmi), I8(1), /* 711 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(100), - /* 718 S> */ B(LdaSmi), U8(1), + /* 718 S> */ B(LdaSmi), I8(1), /* 725 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(102), - /* 732 S> */ B(LdaSmi), U8(1), + /* 732 S> */ B(LdaSmi), I8(1), /* 739 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(104), - /* 746 S> */ B(LdaSmi), U8(1), + /* 746 S> */ B(LdaSmi), I8(1), /* 753 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(106), - /* 760 S> */ B(LdaSmi), U8(1), + /* 760 S> */ B(LdaSmi), I8(1), /* 767 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(108), - /* 774 S> */ B(LdaSmi), U8(1), + /* 774 S> */ B(LdaSmi), I8(1), /* 781 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(110), - /* 788 S> */ B(LdaSmi), U8(1), + /* 788 S> */ B(LdaSmi), I8(1), /* 795 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(112), - /* 802 S> */ B(LdaSmi), U8(1), + /* 802 S> */ B(LdaSmi), I8(1), /* 809 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(114), - /* 816 S> */ B(LdaSmi), U8(1), + /* 816 S> */ B(LdaSmi), I8(1), /* 823 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(116), - /* 830 S> */ B(LdaSmi), U8(1), + /* 830 S> */ B(LdaSmi), I8(1), /* 837 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(118), - /* 844 S> */ B(LdaSmi), U8(1), + /* 844 S> */ B(LdaSmi), I8(1), /* 851 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(120), - /* 858 S> */ B(LdaSmi), U8(1), + /* 858 S> */ B(LdaSmi), I8(1), /* 865 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(122), - /* 872 S> */ B(LdaSmi), U8(1), + /* 872 S> */ B(LdaSmi), I8(1), /* 879 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(124), - /* 886 S> */ B(LdaSmi), U8(1), + /* 886 S> */ B(LdaSmi), I8(1), /* 893 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(126), - /* 900 S> */ B(LdaSmi), U8(1), + /* 900 S> */ B(LdaSmi), I8(1), /* 907 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(128), - /* 914 S> */ B(LdaSmi), U8(1), + /* 914 S> */ B(LdaSmi), I8(1), /* 921 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(130), - /* 928 S> */ B(LdaSmi), U8(1), + /* 928 S> */ B(LdaSmi), I8(1), /* 935 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(132), - /* 942 S> */ B(LdaSmi), U8(1), + /* 942 S> */ B(LdaSmi), I8(1), /* 949 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(134), - /* 956 S> */ B(LdaSmi), U8(1), + /* 956 S> */ B(LdaSmi), I8(1), /* 963 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(136), - /* 970 S> */ B(LdaSmi), U8(1), + /* 970 S> */ B(LdaSmi), I8(1), /* 977 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(138), - /* 984 S> */ B(LdaSmi), U8(1), + /* 984 S> */ B(LdaSmi), I8(1), /* 991 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(140), - /* 998 S> */ B(LdaSmi), U8(1), + /* 998 S> */ B(LdaSmi), I8(1), /* 1005 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(142), - /* 1012 S> */ B(LdaSmi), U8(1), + /* 1012 S> */ B(LdaSmi), I8(1), /* 1019 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(144), - /* 1026 S> */ B(LdaSmi), U8(1), + /* 1026 S> */ B(LdaSmi), I8(1), /* 1033 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(146), - /* 1040 S> */ B(LdaSmi), U8(1), + /* 1040 S> */ B(LdaSmi), I8(1), /* 1047 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(148), - /* 1054 S> */ B(LdaSmi), U8(1), + /* 1054 S> */ B(LdaSmi), I8(1), /* 1061 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(150), - /* 1068 S> */ B(LdaSmi), U8(1), + /* 1068 S> */ B(LdaSmi), I8(1), /* 1075 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(152), - /* 1082 S> */ B(LdaSmi), U8(1), + /* 1082 S> */ B(LdaSmi), I8(1), /* 1089 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(154), - /* 1096 S> */ B(LdaSmi), U8(1), + /* 1096 S> */ B(LdaSmi), I8(1), /* 1103 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(156), - /* 1110 S> */ B(LdaSmi), U8(1), + /* 1110 S> */ B(LdaSmi), I8(1), /* 1117 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(158), - /* 1124 S> */ B(LdaSmi), U8(1), + /* 1124 S> */ B(LdaSmi), I8(1), /* 1131 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(160), - /* 1138 S> */ B(LdaSmi), U8(1), + /* 1138 S> */ B(LdaSmi), I8(1), /* 1145 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(162), - /* 1152 S> */ B(LdaSmi), U8(1), + /* 1152 S> */ B(LdaSmi), I8(1), /* 1159 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(164), - /* 1166 S> */ B(LdaSmi), U8(1), + /* 1166 S> */ B(LdaSmi), I8(1), /* 1173 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(166), - /* 1180 S> */ B(LdaSmi), U8(1), + /* 1180 S> */ B(LdaSmi), I8(1), /* 1187 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(168), - /* 1194 S> */ B(LdaSmi), U8(1), + /* 1194 S> */ B(LdaSmi), I8(1), /* 1201 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(170), - /* 1208 S> */ B(LdaSmi), U8(1), + /* 1208 S> */ B(LdaSmi), I8(1), /* 1215 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(172), - /* 1222 S> */ B(LdaSmi), U8(1), + /* 1222 S> */ B(LdaSmi), I8(1), /* 1229 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(174), - /* 1236 S> */ B(LdaSmi), U8(1), + /* 1236 S> */ B(LdaSmi), I8(1), /* 1243 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(176), - /* 1250 S> */ B(LdaSmi), U8(1), + /* 1250 S> */ B(LdaSmi), I8(1), /* 1257 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(178), - /* 1264 S> */ B(LdaSmi), U8(1), + /* 1264 S> */ B(LdaSmi), I8(1), /* 1271 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(180), - /* 1278 S> */ B(LdaSmi), U8(1), + /* 1278 S> */ B(LdaSmi), I8(1), /* 1285 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(182), - /* 1292 S> */ B(LdaSmi), U8(1), + /* 1292 S> */ B(LdaSmi), I8(1), /* 1299 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(184), - /* 1306 S> */ B(LdaSmi), U8(1), + /* 1306 S> */ B(LdaSmi), I8(1), /* 1313 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(186), - /* 1320 S> */ B(LdaSmi), U8(1), + /* 1320 S> */ B(LdaSmi), I8(1), /* 1327 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(188), - /* 1334 S> */ B(LdaSmi), U8(1), + /* 1334 S> */ B(LdaSmi), I8(1), /* 1341 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(190), - /* 1348 S> */ B(LdaSmi), U8(1), + /* 1348 S> */ B(LdaSmi), I8(1), /* 1355 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(192), - /* 1362 S> */ B(LdaSmi), U8(1), + /* 1362 S> */ B(LdaSmi), I8(1), /* 1369 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(194), - /* 1376 S> */ B(LdaSmi), U8(1), + /* 1376 S> */ B(LdaSmi), I8(1), /* 1383 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(196), - /* 1390 S> */ B(LdaSmi), U8(1), + /* 1390 S> */ B(LdaSmi), I8(1), /* 1397 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(198), - /* 1404 S> */ B(LdaSmi), U8(1), + /* 1404 S> */ B(LdaSmi), I8(1), /* 1411 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(200), - /* 1418 S> */ B(LdaSmi), U8(1), + /* 1418 S> */ B(LdaSmi), I8(1), /* 1425 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(202), - /* 1432 S> */ B(LdaSmi), U8(1), + /* 1432 S> */ B(LdaSmi), I8(1), /* 1439 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(204), - /* 1446 S> */ B(LdaSmi), U8(1), + /* 1446 S> */ B(LdaSmi), I8(1), /* 1453 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(206), - /* 1460 S> */ B(LdaSmi), U8(1), + /* 1460 S> */ B(LdaSmi), I8(1), /* 1467 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(208), - /* 1474 S> */ B(LdaSmi), U8(1), + /* 1474 S> */ B(LdaSmi), I8(1), /* 1481 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(210), - /* 1488 S> */ B(LdaSmi), U8(1), + /* 1488 S> */ B(LdaSmi), I8(1), /* 1495 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(212), - /* 1502 S> */ B(LdaSmi), U8(1), + /* 1502 S> */ B(LdaSmi), I8(1), /* 1509 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(214), - /* 1516 S> */ B(LdaSmi), U8(1), + /* 1516 S> */ B(LdaSmi), I8(1), /* 1523 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(216), - /* 1530 S> */ B(LdaSmi), U8(1), + /* 1530 S> */ B(LdaSmi), I8(1), /* 1537 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(218), - /* 1544 S> */ B(LdaSmi), U8(1), + /* 1544 S> */ B(LdaSmi), I8(1), /* 1551 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(220), - /* 1558 S> */ B(LdaSmi), U8(1), + /* 1558 S> */ B(LdaSmi), I8(1), /* 1565 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(222), - /* 1572 S> */ B(LdaSmi), U8(1), + /* 1572 S> */ B(LdaSmi), I8(1), /* 1579 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(224), - /* 1586 S> */ B(LdaSmi), U8(1), + /* 1586 S> */ B(LdaSmi), I8(1), /* 1593 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(226), - /* 1600 S> */ B(LdaSmi), U8(1), + /* 1600 S> */ B(LdaSmi), I8(1), /* 1607 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(228), - /* 1614 S> */ B(LdaSmi), U8(1), + /* 1614 S> */ B(LdaSmi), I8(1), /* 1621 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(230), - /* 1628 S> */ B(LdaSmi), U8(1), + /* 1628 S> */ B(LdaSmi), I8(1), /* 1635 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(232), - /* 1642 S> */ B(LdaSmi), U8(1), + /* 1642 S> */ B(LdaSmi), I8(1), /* 1649 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(234), - /* 1656 S> */ B(LdaSmi), U8(1), + /* 1656 S> */ B(LdaSmi), I8(1), /* 1663 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(236), - /* 1670 S> */ B(LdaSmi), U8(1), + /* 1670 S> */ B(LdaSmi), I8(1), /* 1677 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(238), - /* 1684 S> */ B(LdaSmi), U8(1), + /* 1684 S> */ B(LdaSmi), I8(1), /* 1691 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(240), - /* 1698 S> */ B(LdaSmi), U8(1), + /* 1698 S> */ B(LdaSmi), I8(1), /* 1705 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(242), - /* 1712 S> */ B(LdaSmi), U8(1), + /* 1712 S> */ B(LdaSmi), I8(1), /* 1719 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(244), - /* 1726 S> */ B(LdaSmi), U8(1), + /* 1726 S> */ B(LdaSmi), I8(1), /* 1733 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(246), - /* 1740 S> */ B(LdaSmi), U8(1), + /* 1740 S> */ B(LdaSmi), I8(1), /* 1747 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(248), - /* 1754 S> */ B(LdaSmi), U8(1), + /* 1754 S> */ B(LdaSmi), I8(1), /* 1761 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(250), - /* 1768 S> */ B(LdaSmi), U8(1), + /* 1768 S> */ B(LdaSmi), I8(1), /* 1775 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(252), - /* 1782 S> */ B(LdaSmi), U8(1), + /* 1782 S> */ B(LdaSmi), I8(1), /* 1789 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(254), - /* 1796 S> */ B(LdaSmi), U8(1), + /* 1796 S> */ B(LdaSmi), I8(1), /* 1803 E> */ B(Wide), B(StaNamedPropertySloppy), R16(arg0), U16(0), U16(256), - /* 1810 S> */ B(LdaSmi), U8(2), + /* 1810 S> */ B(LdaSmi), I8(2), /* 1817 E> */ B(Wide), B(StaNamedPropertySloppy), R16(arg0), U16(0), U16(258), B(LdaUndefined), /* 1822 S> */ B(Return), @@ -707,263 +707,263 @@ parameter count: 2 bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 33 S> */ B(LdaSmi), U8(1), + /* 33 S> */ B(LdaSmi), I8(1), /* 40 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(2), - /* 47 S> */ B(LdaSmi), U8(1), + /* 47 S> */ B(LdaSmi), I8(1), /* 54 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(4), - /* 61 S> */ B(LdaSmi), U8(1), + /* 61 S> */ B(LdaSmi), I8(1), /* 68 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(6), - /* 75 S> */ B(LdaSmi), U8(1), + /* 75 S> */ B(LdaSmi), I8(1), /* 82 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(8), - /* 89 S> */ B(LdaSmi), U8(1), + /* 89 S> */ B(LdaSmi), I8(1), /* 96 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(10), - /* 103 S> */ B(LdaSmi), U8(1), + /* 103 S> */ B(LdaSmi), I8(1), /* 110 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(12), - /* 117 S> */ B(LdaSmi), U8(1), + /* 117 S> */ B(LdaSmi), I8(1), /* 124 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(14), - /* 131 S> */ B(LdaSmi), U8(1), + /* 131 S> */ B(LdaSmi), I8(1), /* 138 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(16), - /* 145 S> */ B(LdaSmi), U8(1), + /* 145 S> */ B(LdaSmi), I8(1), /* 152 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(18), - /* 159 S> */ B(LdaSmi), U8(1), + /* 159 S> */ B(LdaSmi), I8(1), /* 166 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(20), - /* 173 S> */ B(LdaSmi), U8(1), + /* 173 S> */ B(LdaSmi), I8(1), /* 180 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(22), - /* 187 S> */ B(LdaSmi), U8(1), + /* 187 S> */ B(LdaSmi), I8(1), /* 194 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(24), - /* 201 S> */ B(LdaSmi), U8(1), + /* 201 S> */ B(LdaSmi), I8(1), /* 208 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(26), - /* 215 S> */ B(LdaSmi), U8(1), + /* 215 S> */ B(LdaSmi), I8(1), /* 222 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(28), - /* 229 S> */ B(LdaSmi), U8(1), + /* 229 S> */ B(LdaSmi), I8(1), /* 236 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(30), - /* 243 S> */ B(LdaSmi), U8(1), + /* 243 S> */ B(LdaSmi), I8(1), /* 250 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(32), - /* 257 S> */ B(LdaSmi), U8(1), + /* 257 S> */ B(LdaSmi), I8(1), /* 264 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(34), - /* 271 S> */ B(LdaSmi), U8(1), + /* 271 S> */ B(LdaSmi), I8(1), /* 278 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(36), - /* 285 S> */ B(LdaSmi), U8(1), + /* 285 S> */ B(LdaSmi), I8(1), /* 292 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(38), - /* 299 S> */ B(LdaSmi), U8(1), + /* 299 S> */ B(LdaSmi), I8(1), /* 306 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(40), - /* 313 S> */ B(LdaSmi), U8(1), + /* 313 S> */ B(LdaSmi), I8(1), /* 320 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(42), - /* 327 S> */ B(LdaSmi), U8(1), + /* 327 S> */ B(LdaSmi), I8(1), /* 334 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(44), - /* 341 S> */ B(LdaSmi), U8(1), + /* 341 S> */ B(LdaSmi), I8(1), /* 348 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(46), - /* 355 S> */ B(LdaSmi), U8(1), + /* 355 S> */ B(LdaSmi), I8(1), /* 362 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(48), - /* 369 S> */ B(LdaSmi), U8(1), + /* 369 S> */ B(LdaSmi), I8(1), /* 376 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(50), - /* 383 S> */ B(LdaSmi), U8(1), + /* 383 S> */ B(LdaSmi), I8(1), /* 390 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(52), - /* 397 S> */ B(LdaSmi), U8(1), + /* 397 S> */ B(LdaSmi), I8(1), /* 404 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(54), - /* 411 S> */ B(LdaSmi), U8(1), + /* 411 S> */ B(LdaSmi), I8(1), /* 418 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(56), - /* 425 S> */ B(LdaSmi), U8(1), + /* 425 S> */ B(LdaSmi), I8(1), /* 432 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(58), - /* 439 S> */ B(LdaSmi), U8(1), + /* 439 S> */ B(LdaSmi), I8(1), /* 446 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(60), - /* 453 S> */ B(LdaSmi), U8(1), + /* 453 S> */ B(LdaSmi), I8(1), /* 460 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(62), - /* 467 S> */ B(LdaSmi), U8(1), + /* 467 S> */ B(LdaSmi), I8(1), /* 474 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(64), - /* 481 S> */ B(LdaSmi), U8(1), + /* 481 S> */ B(LdaSmi), I8(1), /* 488 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(66), - /* 495 S> */ B(LdaSmi), U8(1), + /* 495 S> */ B(LdaSmi), I8(1), /* 502 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(68), - /* 509 S> */ B(LdaSmi), U8(1), + /* 509 S> */ B(LdaSmi), I8(1), /* 516 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(70), - /* 523 S> */ B(LdaSmi), U8(1), + /* 523 S> */ B(LdaSmi), I8(1), /* 530 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(72), - /* 537 S> */ B(LdaSmi), U8(1), + /* 537 S> */ B(LdaSmi), I8(1), /* 544 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(74), - /* 551 S> */ B(LdaSmi), U8(1), + /* 551 S> */ B(LdaSmi), I8(1), /* 558 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(76), - /* 565 S> */ B(LdaSmi), U8(1), + /* 565 S> */ B(LdaSmi), I8(1), /* 572 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(78), - /* 579 S> */ B(LdaSmi), U8(1), + /* 579 S> */ B(LdaSmi), I8(1), /* 586 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(80), - /* 593 S> */ B(LdaSmi), U8(1), + /* 593 S> */ B(LdaSmi), I8(1), /* 600 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(82), - /* 607 S> */ B(LdaSmi), U8(1), + /* 607 S> */ B(LdaSmi), I8(1), /* 614 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(84), - /* 621 S> */ B(LdaSmi), U8(1), + /* 621 S> */ B(LdaSmi), I8(1), /* 628 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(86), - /* 635 S> */ B(LdaSmi), U8(1), + /* 635 S> */ B(LdaSmi), I8(1), /* 642 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(88), - /* 649 S> */ B(LdaSmi), U8(1), + /* 649 S> */ B(LdaSmi), I8(1), /* 656 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(90), - /* 663 S> */ B(LdaSmi), U8(1), + /* 663 S> */ B(LdaSmi), I8(1), /* 670 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(92), - /* 677 S> */ B(LdaSmi), U8(1), + /* 677 S> */ B(LdaSmi), I8(1), /* 684 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(94), - /* 691 S> */ B(LdaSmi), U8(1), + /* 691 S> */ B(LdaSmi), I8(1), /* 698 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(96), - /* 705 S> */ B(LdaSmi), U8(1), + /* 705 S> */ B(LdaSmi), I8(1), /* 712 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(98), - /* 719 S> */ B(LdaSmi), U8(1), + /* 719 S> */ B(LdaSmi), I8(1), /* 726 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(100), - /* 733 S> */ B(LdaSmi), U8(1), + /* 733 S> */ B(LdaSmi), I8(1), /* 740 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(102), - /* 747 S> */ B(LdaSmi), U8(1), + /* 747 S> */ B(LdaSmi), I8(1), /* 754 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(104), - /* 761 S> */ B(LdaSmi), U8(1), + /* 761 S> */ B(LdaSmi), I8(1), /* 768 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(106), - /* 775 S> */ B(LdaSmi), U8(1), + /* 775 S> */ B(LdaSmi), I8(1), /* 782 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(108), - /* 789 S> */ B(LdaSmi), U8(1), + /* 789 S> */ B(LdaSmi), I8(1), /* 796 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(110), - /* 803 S> */ B(LdaSmi), U8(1), + /* 803 S> */ B(LdaSmi), I8(1), /* 810 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(112), - /* 817 S> */ B(LdaSmi), U8(1), + /* 817 S> */ B(LdaSmi), I8(1), /* 824 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(114), - /* 831 S> */ B(LdaSmi), U8(1), + /* 831 S> */ B(LdaSmi), I8(1), /* 838 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(116), - /* 845 S> */ B(LdaSmi), U8(1), + /* 845 S> */ B(LdaSmi), I8(1), /* 852 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(118), - /* 859 S> */ B(LdaSmi), U8(1), + /* 859 S> */ B(LdaSmi), I8(1), /* 866 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(120), - /* 873 S> */ B(LdaSmi), U8(1), + /* 873 S> */ B(LdaSmi), I8(1), /* 880 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(122), - /* 887 S> */ B(LdaSmi), U8(1), + /* 887 S> */ B(LdaSmi), I8(1), /* 894 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(124), - /* 901 S> */ B(LdaSmi), U8(1), + /* 901 S> */ B(LdaSmi), I8(1), /* 908 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(126), - /* 915 S> */ B(LdaSmi), U8(1), + /* 915 S> */ B(LdaSmi), I8(1), /* 922 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(128), - /* 929 S> */ B(LdaSmi), U8(1), + /* 929 S> */ B(LdaSmi), I8(1), /* 936 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(130), - /* 943 S> */ B(LdaSmi), U8(1), + /* 943 S> */ B(LdaSmi), I8(1), /* 950 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(132), - /* 957 S> */ B(LdaSmi), U8(1), + /* 957 S> */ B(LdaSmi), I8(1), /* 964 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(134), - /* 971 S> */ B(LdaSmi), U8(1), + /* 971 S> */ B(LdaSmi), I8(1), /* 978 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(136), - /* 985 S> */ B(LdaSmi), U8(1), + /* 985 S> */ B(LdaSmi), I8(1), /* 992 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(138), - /* 999 S> */ B(LdaSmi), U8(1), + /* 999 S> */ B(LdaSmi), I8(1), /* 1006 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(140), - /* 1013 S> */ B(LdaSmi), U8(1), + /* 1013 S> */ B(LdaSmi), I8(1), /* 1020 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(142), - /* 1027 S> */ B(LdaSmi), U8(1), + /* 1027 S> */ B(LdaSmi), I8(1), /* 1034 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(144), - /* 1041 S> */ B(LdaSmi), U8(1), + /* 1041 S> */ B(LdaSmi), I8(1), /* 1048 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(146), - /* 1055 S> */ B(LdaSmi), U8(1), + /* 1055 S> */ B(LdaSmi), I8(1), /* 1062 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(148), - /* 1069 S> */ B(LdaSmi), U8(1), + /* 1069 S> */ B(LdaSmi), I8(1), /* 1076 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(150), - /* 1083 S> */ B(LdaSmi), U8(1), + /* 1083 S> */ B(LdaSmi), I8(1), /* 1090 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(152), - /* 1097 S> */ B(LdaSmi), U8(1), + /* 1097 S> */ B(LdaSmi), I8(1), /* 1104 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(154), - /* 1111 S> */ B(LdaSmi), U8(1), + /* 1111 S> */ B(LdaSmi), I8(1), /* 1118 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(156), - /* 1125 S> */ B(LdaSmi), U8(1), + /* 1125 S> */ B(LdaSmi), I8(1), /* 1132 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(158), - /* 1139 S> */ B(LdaSmi), U8(1), + /* 1139 S> */ B(LdaSmi), I8(1), /* 1146 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(160), - /* 1153 S> */ B(LdaSmi), U8(1), + /* 1153 S> */ B(LdaSmi), I8(1), /* 1160 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(162), - /* 1167 S> */ B(LdaSmi), U8(1), + /* 1167 S> */ B(LdaSmi), I8(1), /* 1174 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(164), - /* 1181 S> */ B(LdaSmi), U8(1), + /* 1181 S> */ B(LdaSmi), I8(1), /* 1188 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(166), - /* 1195 S> */ B(LdaSmi), U8(1), + /* 1195 S> */ B(LdaSmi), I8(1), /* 1202 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(168), - /* 1209 S> */ B(LdaSmi), U8(1), + /* 1209 S> */ B(LdaSmi), I8(1), /* 1216 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(170), - /* 1223 S> */ B(LdaSmi), U8(1), + /* 1223 S> */ B(LdaSmi), I8(1), /* 1230 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(172), - /* 1237 S> */ B(LdaSmi), U8(1), + /* 1237 S> */ B(LdaSmi), I8(1), /* 1244 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(174), - /* 1251 S> */ B(LdaSmi), U8(1), + /* 1251 S> */ B(LdaSmi), I8(1), /* 1258 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(176), - /* 1265 S> */ B(LdaSmi), U8(1), + /* 1265 S> */ B(LdaSmi), I8(1), /* 1272 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(178), - /* 1279 S> */ B(LdaSmi), U8(1), + /* 1279 S> */ B(LdaSmi), I8(1), /* 1286 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(180), - /* 1293 S> */ B(LdaSmi), U8(1), + /* 1293 S> */ B(LdaSmi), I8(1), /* 1300 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(182), - /* 1307 S> */ B(LdaSmi), U8(1), + /* 1307 S> */ B(LdaSmi), I8(1), /* 1314 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(184), - /* 1321 S> */ B(LdaSmi), U8(1), + /* 1321 S> */ B(LdaSmi), I8(1), /* 1328 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(186), - /* 1335 S> */ B(LdaSmi), U8(1), + /* 1335 S> */ B(LdaSmi), I8(1), /* 1342 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(188), - /* 1349 S> */ B(LdaSmi), U8(1), + /* 1349 S> */ B(LdaSmi), I8(1), /* 1356 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(190), - /* 1363 S> */ B(LdaSmi), U8(1), + /* 1363 S> */ B(LdaSmi), I8(1), /* 1370 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(192), - /* 1377 S> */ B(LdaSmi), U8(1), + /* 1377 S> */ B(LdaSmi), I8(1), /* 1384 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(194), - /* 1391 S> */ B(LdaSmi), U8(1), + /* 1391 S> */ B(LdaSmi), I8(1), /* 1398 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(196), - /* 1405 S> */ B(LdaSmi), U8(1), + /* 1405 S> */ B(LdaSmi), I8(1), /* 1412 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(198), - /* 1419 S> */ B(LdaSmi), U8(1), + /* 1419 S> */ B(LdaSmi), I8(1), /* 1426 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(200), - /* 1433 S> */ B(LdaSmi), U8(1), + /* 1433 S> */ B(LdaSmi), I8(1), /* 1440 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(202), - /* 1447 S> */ B(LdaSmi), U8(1), + /* 1447 S> */ B(LdaSmi), I8(1), /* 1454 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(204), - /* 1461 S> */ B(LdaSmi), U8(1), + /* 1461 S> */ B(LdaSmi), I8(1), /* 1468 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(206), - /* 1475 S> */ B(LdaSmi), U8(1), + /* 1475 S> */ B(LdaSmi), I8(1), /* 1482 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(208), - /* 1489 S> */ B(LdaSmi), U8(1), + /* 1489 S> */ B(LdaSmi), I8(1), /* 1496 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(210), - /* 1503 S> */ B(LdaSmi), U8(1), + /* 1503 S> */ B(LdaSmi), I8(1), /* 1510 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(212), - /* 1517 S> */ B(LdaSmi), U8(1), + /* 1517 S> */ B(LdaSmi), I8(1), /* 1524 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(214), - /* 1531 S> */ B(LdaSmi), U8(1), + /* 1531 S> */ B(LdaSmi), I8(1), /* 1538 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(216), - /* 1545 S> */ B(LdaSmi), U8(1), + /* 1545 S> */ B(LdaSmi), I8(1), /* 1552 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(218), - /* 1559 S> */ B(LdaSmi), U8(1), + /* 1559 S> */ B(LdaSmi), I8(1), /* 1566 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(220), - /* 1573 S> */ B(LdaSmi), U8(1), + /* 1573 S> */ B(LdaSmi), I8(1), /* 1580 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(222), - /* 1587 S> */ B(LdaSmi), U8(1), + /* 1587 S> */ B(LdaSmi), I8(1), /* 1594 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(224), - /* 1601 S> */ B(LdaSmi), U8(1), + /* 1601 S> */ B(LdaSmi), I8(1), /* 1608 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(226), - /* 1615 S> */ B(LdaSmi), U8(1), + /* 1615 S> */ B(LdaSmi), I8(1), /* 1622 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(228), - /* 1629 S> */ B(LdaSmi), U8(1), + /* 1629 S> */ B(LdaSmi), I8(1), /* 1636 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(230), - /* 1643 S> */ B(LdaSmi), U8(1), + /* 1643 S> */ B(LdaSmi), I8(1), /* 1650 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(232), - /* 1657 S> */ B(LdaSmi), U8(1), + /* 1657 S> */ B(LdaSmi), I8(1), /* 1664 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(234), - /* 1671 S> */ B(LdaSmi), U8(1), + /* 1671 S> */ B(LdaSmi), I8(1), /* 1678 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(236), - /* 1685 S> */ B(LdaSmi), U8(1), + /* 1685 S> */ B(LdaSmi), I8(1), /* 1692 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(238), - /* 1699 S> */ B(LdaSmi), U8(1), + /* 1699 S> */ B(LdaSmi), I8(1), /* 1706 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(240), - /* 1713 S> */ B(LdaSmi), U8(1), + /* 1713 S> */ B(LdaSmi), I8(1), /* 1720 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(242), - /* 1727 S> */ B(LdaSmi), U8(1), + /* 1727 S> */ B(LdaSmi), I8(1), /* 1734 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(244), - /* 1741 S> */ B(LdaSmi), U8(1), + /* 1741 S> */ B(LdaSmi), I8(1), /* 1748 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(246), - /* 1755 S> */ B(LdaSmi), U8(1), + /* 1755 S> */ B(LdaSmi), I8(1), /* 1762 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(248), - /* 1769 S> */ B(LdaSmi), U8(1), + /* 1769 S> */ B(LdaSmi), I8(1), /* 1776 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(250), - /* 1783 S> */ B(LdaSmi), U8(1), + /* 1783 S> */ B(LdaSmi), I8(1), /* 1790 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(252), - /* 1797 S> */ B(LdaSmi), U8(1), + /* 1797 S> */ B(LdaSmi), I8(1), /* 1804 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(254), - /* 1811 S> */ B(LdaSmi), U8(1), + /* 1811 S> */ B(LdaSmi), I8(1), /* 1818 E> */ B(Wide), B(StaNamedPropertyStrict), R16(arg0), U16(0), U16(256), - /* 1825 S> */ B(LdaSmi), U8(2), + /* 1825 S> */ B(LdaSmi), I8(2), /* 1832 E> */ B(Wide), B(StaNamedPropertyStrict), R16(arg0), U16(0), U16(258), B(LdaUndefined), /* 1837 S> */ B(Return), @@ -1114,263 +1114,263 @@ parameter count: 3 bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 21 S> */ B(LdaSmi), U8(1), + /* 21 S> */ B(LdaSmi), I8(1), /* 26 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(2), - /* 33 S> */ B(LdaSmi), U8(1), + /* 33 S> */ B(LdaSmi), I8(1), /* 38 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(4), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), /* 50 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(6), - /* 57 S> */ B(LdaSmi), U8(1), + /* 57 S> */ B(LdaSmi), I8(1), /* 62 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(8), - /* 69 S> */ B(LdaSmi), U8(1), + /* 69 S> */ B(LdaSmi), I8(1), /* 74 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(10), - /* 81 S> */ B(LdaSmi), U8(1), + /* 81 S> */ B(LdaSmi), I8(1), /* 86 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(12), - /* 93 S> */ B(LdaSmi), U8(1), + /* 93 S> */ B(LdaSmi), I8(1), /* 98 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(14), - /* 105 S> */ B(LdaSmi), U8(1), + /* 105 S> */ B(LdaSmi), I8(1), /* 110 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(16), - /* 117 S> */ B(LdaSmi), U8(1), + /* 117 S> */ B(LdaSmi), I8(1), /* 122 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(18), - /* 129 S> */ B(LdaSmi), U8(1), + /* 129 S> */ B(LdaSmi), I8(1), /* 134 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(20), - /* 141 S> */ B(LdaSmi), U8(1), + /* 141 S> */ B(LdaSmi), I8(1), /* 146 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(22), - /* 153 S> */ B(LdaSmi), U8(1), + /* 153 S> */ B(LdaSmi), I8(1), /* 158 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(24), - /* 165 S> */ B(LdaSmi), U8(1), + /* 165 S> */ B(LdaSmi), I8(1), /* 170 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(26), - /* 177 S> */ B(LdaSmi), U8(1), + /* 177 S> */ B(LdaSmi), I8(1), /* 182 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(28), - /* 189 S> */ B(LdaSmi), U8(1), + /* 189 S> */ B(LdaSmi), I8(1), /* 194 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(30), - /* 201 S> */ B(LdaSmi), U8(1), + /* 201 S> */ B(LdaSmi), I8(1), /* 206 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(32), - /* 213 S> */ B(LdaSmi), U8(1), + /* 213 S> */ B(LdaSmi), I8(1), /* 218 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(34), - /* 225 S> */ B(LdaSmi), U8(1), + /* 225 S> */ B(LdaSmi), I8(1), /* 230 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(36), - /* 237 S> */ B(LdaSmi), U8(1), + /* 237 S> */ B(LdaSmi), I8(1), /* 242 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(38), - /* 249 S> */ B(LdaSmi), U8(1), + /* 249 S> */ B(LdaSmi), I8(1), /* 254 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(40), - /* 261 S> */ B(LdaSmi), U8(1), + /* 261 S> */ B(LdaSmi), I8(1), /* 266 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(42), - /* 273 S> */ B(LdaSmi), U8(1), + /* 273 S> */ B(LdaSmi), I8(1), /* 278 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(44), - /* 285 S> */ B(LdaSmi), U8(1), + /* 285 S> */ B(LdaSmi), I8(1), /* 290 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(46), - /* 297 S> */ B(LdaSmi), U8(1), + /* 297 S> */ B(LdaSmi), I8(1), /* 302 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(48), - /* 309 S> */ B(LdaSmi), U8(1), + /* 309 S> */ B(LdaSmi), I8(1), /* 314 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(50), - /* 321 S> */ B(LdaSmi), U8(1), + /* 321 S> */ B(LdaSmi), I8(1), /* 326 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(52), - /* 333 S> */ B(LdaSmi), U8(1), + /* 333 S> */ B(LdaSmi), I8(1), /* 338 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(54), - /* 345 S> */ B(LdaSmi), U8(1), + /* 345 S> */ B(LdaSmi), I8(1), /* 350 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(56), - /* 357 S> */ B(LdaSmi), U8(1), + /* 357 S> */ B(LdaSmi), I8(1), /* 362 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(58), - /* 369 S> */ B(LdaSmi), U8(1), + /* 369 S> */ B(LdaSmi), I8(1), /* 374 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(60), - /* 381 S> */ B(LdaSmi), U8(1), + /* 381 S> */ B(LdaSmi), I8(1), /* 386 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(62), - /* 393 S> */ B(LdaSmi), U8(1), + /* 393 S> */ B(LdaSmi), I8(1), /* 398 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(64), - /* 405 S> */ B(LdaSmi), U8(1), + /* 405 S> */ B(LdaSmi), I8(1), /* 410 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(66), - /* 417 S> */ B(LdaSmi), U8(1), + /* 417 S> */ B(LdaSmi), I8(1), /* 422 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(68), - /* 429 S> */ B(LdaSmi), U8(1), + /* 429 S> */ B(LdaSmi), I8(1), /* 434 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(70), - /* 441 S> */ B(LdaSmi), U8(1), + /* 441 S> */ B(LdaSmi), I8(1), /* 446 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(72), - /* 453 S> */ B(LdaSmi), U8(1), + /* 453 S> */ B(LdaSmi), I8(1), /* 458 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(74), - /* 465 S> */ B(LdaSmi), U8(1), + /* 465 S> */ B(LdaSmi), I8(1), /* 470 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(76), - /* 477 S> */ B(LdaSmi), U8(1), + /* 477 S> */ B(LdaSmi), I8(1), /* 482 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(78), - /* 489 S> */ B(LdaSmi), U8(1), + /* 489 S> */ B(LdaSmi), I8(1), /* 494 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(80), - /* 501 S> */ B(LdaSmi), U8(1), + /* 501 S> */ B(LdaSmi), I8(1), /* 506 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(82), - /* 513 S> */ B(LdaSmi), U8(1), + /* 513 S> */ B(LdaSmi), I8(1), /* 518 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(84), - /* 525 S> */ B(LdaSmi), U8(1), + /* 525 S> */ B(LdaSmi), I8(1), /* 530 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(86), - /* 537 S> */ B(LdaSmi), U8(1), + /* 537 S> */ B(LdaSmi), I8(1), /* 542 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(88), - /* 549 S> */ B(LdaSmi), U8(1), + /* 549 S> */ B(LdaSmi), I8(1), /* 554 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(90), - /* 561 S> */ B(LdaSmi), U8(1), + /* 561 S> */ B(LdaSmi), I8(1), /* 566 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(92), - /* 573 S> */ B(LdaSmi), U8(1), + /* 573 S> */ B(LdaSmi), I8(1), /* 578 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(94), - /* 585 S> */ B(LdaSmi), U8(1), + /* 585 S> */ B(LdaSmi), I8(1), /* 590 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(96), - /* 597 S> */ B(LdaSmi), U8(1), + /* 597 S> */ B(LdaSmi), I8(1), /* 602 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(98), - /* 609 S> */ B(LdaSmi), U8(1), + /* 609 S> */ B(LdaSmi), I8(1), /* 614 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(100), - /* 621 S> */ B(LdaSmi), U8(1), + /* 621 S> */ B(LdaSmi), I8(1), /* 626 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(102), - /* 633 S> */ B(LdaSmi), U8(1), + /* 633 S> */ B(LdaSmi), I8(1), /* 638 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(104), - /* 645 S> */ B(LdaSmi), U8(1), + /* 645 S> */ B(LdaSmi), I8(1), /* 650 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(106), - /* 657 S> */ B(LdaSmi), U8(1), + /* 657 S> */ B(LdaSmi), I8(1), /* 662 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(108), - /* 669 S> */ B(LdaSmi), U8(1), + /* 669 S> */ B(LdaSmi), I8(1), /* 674 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(110), - /* 681 S> */ B(LdaSmi), U8(1), + /* 681 S> */ B(LdaSmi), I8(1), /* 686 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(112), - /* 693 S> */ B(LdaSmi), U8(1), + /* 693 S> */ B(LdaSmi), I8(1), /* 698 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(114), - /* 705 S> */ B(LdaSmi), U8(1), + /* 705 S> */ B(LdaSmi), I8(1), /* 710 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(116), - /* 717 S> */ B(LdaSmi), U8(1), + /* 717 S> */ B(LdaSmi), I8(1), /* 722 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(118), - /* 729 S> */ B(LdaSmi), U8(1), + /* 729 S> */ B(LdaSmi), I8(1), /* 734 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(120), - /* 741 S> */ B(LdaSmi), U8(1), + /* 741 S> */ B(LdaSmi), I8(1), /* 746 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(122), - /* 753 S> */ B(LdaSmi), U8(1), + /* 753 S> */ B(LdaSmi), I8(1), /* 758 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(124), - /* 765 S> */ B(LdaSmi), U8(1), + /* 765 S> */ B(LdaSmi), I8(1), /* 770 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(126), - /* 777 S> */ B(LdaSmi), U8(1), + /* 777 S> */ B(LdaSmi), I8(1), /* 782 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(128), - /* 789 S> */ B(LdaSmi), U8(1), + /* 789 S> */ B(LdaSmi), I8(1), /* 794 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(130), - /* 801 S> */ B(LdaSmi), U8(1), + /* 801 S> */ B(LdaSmi), I8(1), /* 806 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(132), - /* 813 S> */ B(LdaSmi), U8(1), + /* 813 S> */ B(LdaSmi), I8(1), /* 818 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(134), - /* 825 S> */ B(LdaSmi), U8(1), + /* 825 S> */ B(LdaSmi), I8(1), /* 830 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(136), - /* 837 S> */ B(LdaSmi), U8(1), + /* 837 S> */ B(LdaSmi), I8(1), /* 842 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(138), - /* 849 S> */ B(LdaSmi), U8(1), + /* 849 S> */ B(LdaSmi), I8(1), /* 854 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(140), - /* 861 S> */ B(LdaSmi), U8(1), + /* 861 S> */ B(LdaSmi), I8(1), /* 866 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(142), - /* 873 S> */ B(LdaSmi), U8(1), + /* 873 S> */ B(LdaSmi), I8(1), /* 878 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(144), - /* 885 S> */ B(LdaSmi), U8(1), + /* 885 S> */ B(LdaSmi), I8(1), /* 890 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(146), - /* 897 S> */ B(LdaSmi), U8(1), + /* 897 S> */ B(LdaSmi), I8(1), /* 902 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(148), - /* 909 S> */ B(LdaSmi), U8(1), + /* 909 S> */ B(LdaSmi), I8(1), /* 914 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(150), - /* 921 S> */ B(LdaSmi), U8(1), + /* 921 S> */ B(LdaSmi), I8(1), /* 926 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(152), - /* 933 S> */ B(LdaSmi), U8(1), + /* 933 S> */ B(LdaSmi), I8(1), /* 938 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(154), - /* 945 S> */ B(LdaSmi), U8(1), + /* 945 S> */ B(LdaSmi), I8(1), /* 950 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(156), - /* 957 S> */ B(LdaSmi), U8(1), + /* 957 S> */ B(LdaSmi), I8(1), /* 962 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(158), - /* 969 S> */ B(LdaSmi), U8(1), + /* 969 S> */ B(LdaSmi), I8(1), /* 974 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(160), - /* 981 S> */ B(LdaSmi), U8(1), + /* 981 S> */ B(LdaSmi), I8(1), /* 986 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(162), - /* 993 S> */ B(LdaSmi), U8(1), + /* 993 S> */ B(LdaSmi), I8(1), /* 998 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(164), - /* 1005 S> */ B(LdaSmi), U8(1), + /* 1005 S> */ B(LdaSmi), I8(1), /* 1010 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(166), - /* 1017 S> */ B(LdaSmi), U8(1), + /* 1017 S> */ B(LdaSmi), I8(1), /* 1022 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(168), - /* 1029 S> */ B(LdaSmi), U8(1), + /* 1029 S> */ B(LdaSmi), I8(1), /* 1034 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(170), - /* 1041 S> */ B(LdaSmi), U8(1), + /* 1041 S> */ B(LdaSmi), I8(1), /* 1046 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(172), - /* 1053 S> */ B(LdaSmi), U8(1), + /* 1053 S> */ B(LdaSmi), I8(1), /* 1058 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(174), - /* 1065 S> */ B(LdaSmi), U8(1), + /* 1065 S> */ B(LdaSmi), I8(1), /* 1070 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(176), - /* 1077 S> */ B(LdaSmi), U8(1), + /* 1077 S> */ B(LdaSmi), I8(1), /* 1082 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(178), - /* 1089 S> */ B(LdaSmi), U8(1), + /* 1089 S> */ B(LdaSmi), I8(1), /* 1094 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(180), - /* 1101 S> */ B(LdaSmi), U8(1), + /* 1101 S> */ B(LdaSmi), I8(1), /* 1106 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(182), - /* 1113 S> */ B(LdaSmi), U8(1), + /* 1113 S> */ B(LdaSmi), I8(1), /* 1118 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(184), - /* 1125 S> */ B(LdaSmi), U8(1), + /* 1125 S> */ B(LdaSmi), I8(1), /* 1130 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(186), - /* 1137 S> */ B(LdaSmi), U8(1), + /* 1137 S> */ B(LdaSmi), I8(1), /* 1142 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(188), - /* 1149 S> */ B(LdaSmi), U8(1), + /* 1149 S> */ B(LdaSmi), I8(1), /* 1154 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(190), - /* 1161 S> */ B(LdaSmi), U8(1), + /* 1161 S> */ B(LdaSmi), I8(1), /* 1166 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(192), - /* 1173 S> */ B(LdaSmi), U8(1), + /* 1173 S> */ B(LdaSmi), I8(1), /* 1178 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(194), - /* 1185 S> */ B(LdaSmi), U8(1), + /* 1185 S> */ B(LdaSmi), I8(1), /* 1190 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(196), - /* 1197 S> */ B(LdaSmi), U8(1), + /* 1197 S> */ B(LdaSmi), I8(1), /* 1202 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(198), - /* 1209 S> */ B(LdaSmi), U8(1), + /* 1209 S> */ B(LdaSmi), I8(1), /* 1214 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(200), - /* 1221 S> */ B(LdaSmi), U8(1), + /* 1221 S> */ B(LdaSmi), I8(1), /* 1226 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(202), - /* 1233 S> */ B(LdaSmi), U8(1), + /* 1233 S> */ B(LdaSmi), I8(1), /* 1238 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(204), - /* 1245 S> */ B(LdaSmi), U8(1), + /* 1245 S> */ B(LdaSmi), I8(1), /* 1250 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(206), - /* 1257 S> */ B(LdaSmi), U8(1), + /* 1257 S> */ B(LdaSmi), I8(1), /* 1262 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(208), - /* 1269 S> */ B(LdaSmi), U8(1), + /* 1269 S> */ B(LdaSmi), I8(1), /* 1274 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(210), - /* 1281 S> */ B(LdaSmi), U8(1), + /* 1281 S> */ B(LdaSmi), I8(1), /* 1286 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(212), - /* 1293 S> */ B(LdaSmi), U8(1), + /* 1293 S> */ B(LdaSmi), I8(1), /* 1298 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(214), - /* 1305 S> */ B(LdaSmi), U8(1), + /* 1305 S> */ B(LdaSmi), I8(1), /* 1310 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(216), - /* 1317 S> */ B(LdaSmi), U8(1), + /* 1317 S> */ B(LdaSmi), I8(1), /* 1322 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(218), - /* 1329 S> */ B(LdaSmi), U8(1), + /* 1329 S> */ B(LdaSmi), I8(1), /* 1334 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(220), - /* 1341 S> */ B(LdaSmi), U8(1), + /* 1341 S> */ B(LdaSmi), I8(1), /* 1346 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(222), - /* 1353 S> */ B(LdaSmi), U8(1), + /* 1353 S> */ B(LdaSmi), I8(1), /* 1358 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(224), - /* 1365 S> */ B(LdaSmi), U8(1), + /* 1365 S> */ B(LdaSmi), I8(1), /* 1370 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(226), - /* 1377 S> */ B(LdaSmi), U8(1), + /* 1377 S> */ B(LdaSmi), I8(1), /* 1382 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(228), - /* 1389 S> */ B(LdaSmi), U8(1), + /* 1389 S> */ B(LdaSmi), I8(1), /* 1394 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(230), - /* 1401 S> */ B(LdaSmi), U8(1), + /* 1401 S> */ B(LdaSmi), I8(1), /* 1406 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(232), - /* 1413 S> */ B(LdaSmi), U8(1), + /* 1413 S> */ B(LdaSmi), I8(1), /* 1418 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(234), - /* 1425 S> */ B(LdaSmi), U8(1), + /* 1425 S> */ B(LdaSmi), I8(1), /* 1430 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(236), - /* 1437 S> */ B(LdaSmi), U8(1), + /* 1437 S> */ B(LdaSmi), I8(1), /* 1442 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(238), - /* 1449 S> */ B(LdaSmi), U8(1), + /* 1449 S> */ B(LdaSmi), I8(1), /* 1454 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(240), - /* 1461 S> */ B(LdaSmi), U8(1), + /* 1461 S> */ B(LdaSmi), I8(1), /* 1466 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(242), - /* 1473 S> */ B(LdaSmi), U8(1), + /* 1473 S> */ B(LdaSmi), I8(1), /* 1478 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(244), - /* 1485 S> */ B(LdaSmi), U8(1), + /* 1485 S> */ B(LdaSmi), I8(1), /* 1490 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(246), - /* 1497 S> */ B(LdaSmi), U8(1), + /* 1497 S> */ B(LdaSmi), I8(1), /* 1502 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(248), - /* 1509 S> */ B(LdaSmi), U8(1), + /* 1509 S> */ B(LdaSmi), I8(1), /* 1514 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(250), - /* 1521 S> */ B(LdaSmi), U8(1), + /* 1521 S> */ B(LdaSmi), I8(1), /* 1526 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(252), - /* 1533 S> */ B(LdaSmi), U8(1), + /* 1533 S> */ B(LdaSmi), I8(1), /* 1538 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(254), - /* 1545 S> */ B(LdaSmi), U8(1), + /* 1545 S> */ B(LdaSmi), I8(1), /* 1550 E> */ B(Wide), B(StaKeyedPropertySloppy), R16(arg0), R16(arg1), U16(256), - /* 1557 S> */ B(LdaSmi), U8(2), + /* 1557 S> */ B(LdaSmi), I8(2), /* 1562 E> */ B(Wide), B(StaKeyedPropertySloppy), R16(arg0), R16(arg1), U16(258), B(LdaUndefined), /* 1567 S> */ B(Return), @@ -1521,263 +1521,263 @@ parameter count: 3 bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 37 S> */ B(LdaSmi), U8(1), + /* 37 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(2), - /* 49 S> */ B(LdaSmi), U8(1), + /* 49 S> */ B(LdaSmi), I8(1), /* 54 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(4), - /* 61 S> */ B(LdaSmi), U8(1), + /* 61 S> */ B(LdaSmi), I8(1), /* 66 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(6), - /* 73 S> */ B(LdaSmi), U8(1), + /* 73 S> */ B(LdaSmi), I8(1), /* 78 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(8), - /* 85 S> */ B(LdaSmi), U8(1), + /* 85 S> */ B(LdaSmi), I8(1), /* 90 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(10), - /* 97 S> */ B(LdaSmi), U8(1), + /* 97 S> */ B(LdaSmi), I8(1), /* 102 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(12), - /* 109 S> */ B(LdaSmi), U8(1), + /* 109 S> */ B(LdaSmi), I8(1), /* 114 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(14), - /* 121 S> */ B(LdaSmi), U8(1), + /* 121 S> */ B(LdaSmi), I8(1), /* 126 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(16), - /* 133 S> */ B(LdaSmi), U8(1), + /* 133 S> */ B(LdaSmi), I8(1), /* 138 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(18), - /* 145 S> */ B(LdaSmi), U8(1), + /* 145 S> */ B(LdaSmi), I8(1), /* 150 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(20), - /* 157 S> */ B(LdaSmi), U8(1), + /* 157 S> */ B(LdaSmi), I8(1), /* 162 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(22), - /* 169 S> */ B(LdaSmi), U8(1), + /* 169 S> */ B(LdaSmi), I8(1), /* 174 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(24), - /* 181 S> */ B(LdaSmi), U8(1), + /* 181 S> */ B(LdaSmi), I8(1), /* 186 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(26), - /* 193 S> */ B(LdaSmi), U8(1), + /* 193 S> */ B(LdaSmi), I8(1), /* 198 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(28), - /* 205 S> */ B(LdaSmi), U8(1), + /* 205 S> */ B(LdaSmi), I8(1), /* 210 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(30), - /* 217 S> */ B(LdaSmi), U8(1), + /* 217 S> */ B(LdaSmi), I8(1), /* 222 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(32), - /* 229 S> */ B(LdaSmi), U8(1), + /* 229 S> */ B(LdaSmi), I8(1), /* 234 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(34), - /* 241 S> */ B(LdaSmi), U8(1), + /* 241 S> */ B(LdaSmi), I8(1), /* 246 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(36), - /* 253 S> */ B(LdaSmi), U8(1), + /* 253 S> */ B(LdaSmi), I8(1), /* 258 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(38), - /* 265 S> */ B(LdaSmi), U8(1), + /* 265 S> */ B(LdaSmi), I8(1), /* 270 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(40), - /* 277 S> */ B(LdaSmi), U8(1), + /* 277 S> */ B(LdaSmi), I8(1), /* 282 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(42), - /* 289 S> */ B(LdaSmi), U8(1), + /* 289 S> */ B(LdaSmi), I8(1), /* 294 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(44), - /* 301 S> */ B(LdaSmi), U8(1), + /* 301 S> */ B(LdaSmi), I8(1), /* 306 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(46), - /* 313 S> */ B(LdaSmi), U8(1), + /* 313 S> */ B(LdaSmi), I8(1), /* 318 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(48), - /* 325 S> */ B(LdaSmi), U8(1), + /* 325 S> */ B(LdaSmi), I8(1), /* 330 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(50), - /* 337 S> */ B(LdaSmi), U8(1), + /* 337 S> */ B(LdaSmi), I8(1), /* 342 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(52), - /* 349 S> */ B(LdaSmi), U8(1), + /* 349 S> */ B(LdaSmi), I8(1), /* 354 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(54), - /* 361 S> */ B(LdaSmi), U8(1), + /* 361 S> */ B(LdaSmi), I8(1), /* 366 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(56), - /* 373 S> */ B(LdaSmi), U8(1), + /* 373 S> */ B(LdaSmi), I8(1), /* 378 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(58), - /* 385 S> */ B(LdaSmi), U8(1), + /* 385 S> */ B(LdaSmi), I8(1), /* 390 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(60), - /* 397 S> */ B(LdaSmi), U8(1), + /* 397 S> */ B(LdaSmi), I8(1), /* 402 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(62), - /* 409 S> */ B(LdaSmi), U8(1), + /* 409 S> */ B(LdaSmi), I8(1), /* 414 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(64), - /* 421 S> */ B(LdaSmi), U8(1), + /* 421 S> */ B(LdaSmi), I8(1), /* 426 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(66), - /* 433 S> */ B(LdaSmi), U8(1), + /* 433 S> */ B(LdaSmi), I8(1), /* 438 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(68), - /* 445 S> */ B(LdaSmi), U8(1), + /* 445 S> */ B(LdaSmi), I8(1), /* 450 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(70), - /* 457 S> */ B(LdaSmi), U8(1), + /* 457 S> */ B(LdaSmi), I8(1), /* 462 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(72), - /* 469 S> */ B(LdaSmi), U8(1), + /* 469 S> */ B(LdaSmi), I8(1), /* 474 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(74), - /* 481 S> */ B(LdaSmi), U8(1), + /* 481 S> */ B(LdaSmi), I8(1), /* 486 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(76), - /* 493 S> */ B(LdaSmi), U8(1), + /* 493 S> */ B(LdaSmi), I8(1), /* 498 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(78), - /* 505 S> */ B(LdaSmi), U8(1), + /* 505 S> */ B(LdaSmi), I8(1), /* 510 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(80), - /* 517 S> */ B(LdaSmi), U8(1), + /* 517 S> */ B(LdaSmi), I8(1), /* 522 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(82), - /* 529 S> */ B(LdaSmi), U8(1), + /* 529 S> */ B(LdaSmi), I8(1), /* 534 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(84), - /* 541 S> */ B(LdaSmi), U8(1), + /* 541 S> */ B(LdaSmi), I8(1), /* 546 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(86), - /* 553 S> */ B(LdaSmi), U8(1), + /* 553 S> */ B(LdaSmi), I8(1), /* 558 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(88), - /* 565 S> */ B(LdaSmi), U8(1), + /* 565 S> */ B(LdaSmi), I8(1), /* 570 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(90), - /* 577 S> */ B(LdaSmi), U8(1), + /* 577 S> */ B(LdaSmi), I8(1), /* 582 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(92), - /* 589 S> */ B(LdaSmi), U8(1), + /* 589 S> */ B(LdaSmi), I8(1), /* 594 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(94), - /* 601 S> */ B(LdaSmi), U8(1), + /* 601 S> */ B(LdaSmi), I8(1), /* 606 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(96), - /* 613 S> */ B(LdaSmi), U8(1), + /* 613 S> */ B(LdaSmi), I8(1), /* 618 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(98), - /* 625 S> */ B(LdaSmi), U8(1), + /* 625 S> */ B(LdaSmi), I8(1), /* 630 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(100), - /* 637 S> */ B(LdaSmi), U8(1), + /* 637 S> */ B(LdaSmi), I8(1), /* 642 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(102), - /* 649 S> */ B(LdaSmi), U8(1), + /* 649 S> */ B(LdaSmi), I8(1), /* 654 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(104), - /* 661 S> */ B(LdaSmi), U8(1), + /* 661 S> */ B(LdaSmi), I8(1), /* 666 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(106), - /* 673 S> */ B(LdaSmi), U8(1), + /* 673 S> */ B(LdaSmi), I8(1), /* 678 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(108), - /* 685 S> */ B(LdaSmi), U8(1), + /* 685 S> */ B(LdaSmi), I8(1), /* 690 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(110), - /* 697 S> */ B(LdaSmi), U8(1), + /* 697 S> */ B(LdaSmi), I8(1), /* 702 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(112), - /* 709 S> */ B(LdaSmi), U8(1), + /* 709 S> */ B(LdaSmi), I8(1), /* 714 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(114), - /* 721 S> */ B(LdaSmi), U8(1), + /* 721 S> */ B(LdaSmi), I8(1), /* 726 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(116), - /* 733 S> */ B(LdaSmi), U8(1), + /* 733 S> */ B(LdaSmi), I8(1), /* 738 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(118), - /* 745 S> */ B(LdaSmi), U8(1), + /* 745 S> */ B(LdaSmi), I8(1), /* 750 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(120), - /* 757 S> */ B(LdaSmi), U8(1), + /* 757 S> */ B(LdaSmi), I8(1), /* 762 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(122), - /* 769 S> */ B(LdaSmi), U8(1), + /* 769 S> */ B(LdaSmi), I8(1), /* 774 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(124), - /* 781 S> */ B(LdaSmi), U8(1), + /* 781 S> */ B(LdaSmi), I8(1), /* 786 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(126), - /* 793 S> */ B(LdaSmi), U8(1), + /* 793 S> */ B(LdaSmi), I8(1), /* 798 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(128), - /* 805 S> */ B(LdaSmi), U8(1), + /* 805 S> */ B(LdaSmi), I8(1), /* 810 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(130), - /* 817 S> */ B(LdaSmi), U8(1), + /* 817 S> */ B(LdaSmi), I8(1), /* 822 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(132), - /* 829 S> */ B(LdaSmi), U8(1), + /* 829 S> */ B(LdaSmi), I8(1), /* 834 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(134), - /* 841 S> */ B(LdaSmi), U8(1), + /* 841 S> */ B(LdaSmi), I8(1), /* 846 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(136), - /* 853 S> */ B(LdaSmi), U8(1), + /* 853 S> */ B(LdaSmi), I8(1), /* 858 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(138), - /* 865 S> */ B(LdaSmi), U8(1), + /* 865 S> */ B(LdaSmi), I8(1), /* 870 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(140), - /* 877 S> */ B(LdaSmi), U8(1), + /* 877 S> */ B(LdaSmi), I8(1), /* 882 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(142), - /* 889 S> */ B(LdaSmi), U8(1), + /* 889 S> */ B(LdaSmi), I8(1), /* 894 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(144), - /* 901 S> */ B(LdaSmi), U8(1), + /* 901 S> */ B(LdaSmi), I8(1), /* 906 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(146), - /* 913 S> */ B(LdaSmi), U8(1), + /* 913 S> */ B(LdaSmi), I8(1), /* 918 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(148), - /* 925 S> */ B(LdaSmi), U8(1), + /* 925 S> */ B(LdaSmi), I8(1), /* 930 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(150), - /* 937 S> */ B(LdaSmi), U8(1), + /* 937 S> */ B(LdaSmi), I8(1), /* 942 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(152), - /* 949 S> */ B(LdaSmi), U8(1), + /* 949 S> */ B(LdaSmi), I8(1), /* 954 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(154), - /* 961 S> */ B(LdaSmi), U8(1), + /* 961 S> */ B(LdaSmi), I8(1), /* 966 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(156), - /* 973 S> */ B(LdaSmi), U8(1), + /* 973 S> */ B(LdaSmi), I8(1), /* 978 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(158), - /* 985 S> */ B(LdaSmi), U8(1), + /* 985 S> */ B(LdaSmi), I8(1), /* 990 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(160), - /* 997 S> */ B(LdaSmi), U8(1), + /* 997 S> */ B(LdaSmi), I8(1), /* 1002 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(162), - /* 1009 S> */ B(LdaSmi), U8(1), + /* 1009 S> */ B(LdaSmi), I8(1), /* 1014 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(164), - /* 1021 S> */ B(LdaSmi), U8(1), + /* 1021 S> */ B(LdaSmi), I8(1), /* 1026 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(166), - /* 1033 S> */ B(LdaSmi), U8(1), + /* 1033 S> */ B(LdaSmi), I8(1), /* 1038 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(168), - /* 1045 S> */ B(LdaSmi), U8(1), + /* 1045 S> */ B(LdaSmi), I8(1), /* 1050 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(170), - /* 1057 S> */ B(LdaSmi), U8(1), + /* 1057 S> */ B(LdaSmi), I8(1), /* 1062 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(172), - /* 1069 S> */ B(LdaSmi), U8(1), + /* 1069 S> */ B(LdaSmi), I8(1), /* 1074 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(174), - /* 1081 S> */ B(LdaSmi), U8(1), + /* 1081 S> */ B(LdaSmi), I8(1), /* 1086 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(176), - /* 1093 S> */ B(LdaSmi), U8(1), + /* 1093 S> */ B(LdaSmi), I8(1), /* 1098 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(178), - /* 1105 S> */ B(LdaSmi), U8(1), + /* 1105 S> */ B(LdaSmi), I8(1), /* 1110 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(180), - /* 1117 S> */ B(LdaSmi), U8(1), + /* 1117 S> */ B(LdaSmi), I8(1), /* 1122 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(182), - /* 1129 S> */ B(LdaSmi), U8(1), + /* 1129 S> */ B(LdaSmi), I8(1), /* 1134 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(184), - /* 1141 S> */ B(LdaSmi), U8(1), + /* 1141 S> */ B(LdaSmi), I8(1), /* 1146 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(186), - /* 1153 S> */ B(LdaSmi), U8(1), + /* 1153 S> */ B(LdaSmi), I8(1), /* 1158 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(188), - /* 1165 S> */ B(LdaSmi), U8(1), + /* 1165 S> */ B(LdaSmi), I8(1), /* 1170 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(190), - /* 1177 S> */ B(LdaSmi), U8(1), + /* 1177 S> */ B(LdaSmi), I8(1), /* 1182 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(192), - /* 1189 S> */ B(LdaSmi), U8(1), + /* 1189 S> */ B(LdaSmi), I8(1), /* 1194 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(194), - /* 1201 S> */ B(LdaSmi), U8(1), + /* 1201 S> */ B(LdaSmi), I8(1), /* 1206 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(196), - /* 1213 S> */ B(LdaSmi), U8(1), + /* 1213 S> */ B(LdaSmi), I8(1), /* 1218 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(198), - /* 1225 S> */ B(LdaSmi), U8(1), + /* 1225 S> */ B(LdaSmi), I8(1), /* 1230 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(200), - /* 1237 S> */ B(LdaSmi), U8(1), + /* 1237 S> */ B(LdaSmi), I8(1), /* 1242 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(202), - /* 1249 S> */ B(LdaSmi), U8(1), + /* 1249 S> */ B(LdaSmi), I8(1), /* 1254 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(204), - /* 1261 S> */ B(LdaSmi), U8(1), + /* 1261 S> */ B(LdaSmi), I8(1), /* 1266 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(206), - /* 1273 S> */ B(LdaSmi), U8(1), + /* 1273 S> */ B(LdaSmi), I8(1), /* 1278 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(208), - /* 1285 S> */ B(LdaSmi), U8(1), + /* 1285 S> */ B(LdaSmi), I8(1), /* 1290 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(210), - /* 1297 S> */ B(LdaSmi), U8(1), + /* 1297 S> */ B(LdaSmi), I8(1), /* 1302 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(212), - /* 1309 S> */ B(LdaSmi), U8(1), + /* 1309 S> */ B(LdaSmi), I8(1), /* 1314 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(214), - /* 1321 S> */ B(LdaSmi), U8(1), + /* 1321 S> */ B(LdaSmi), I8(1), /* 1326 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(216), - /* 1333 S> */ B(LdaSmi), U8(1), + /* 1333 S> */ B(LdaSmi), I8(1), /* 1338 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(218), - /* 1345 S> */ B(LdaSmi), U8(1), + /* 1345 S> */ B(LdaSmi), I8(1), /* 1350 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(220), - /* 1357 S> */ B(LdaSmi), U8(1), + /* 1357 S> */ B(LdaSmi), I8(1), /* 1362 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(222), - /* 1369 S> */ B(LdaSmi), U8(1), + /* 1369 S> */ B(LdaSmi), I8(1), /* 1374 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(224), - /* 1381 S> */ B(LdaSmi), U8(1), + /* 1381 S> */ B(LdaSmi), I8(1), /* 1386 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(226), - /* 1393 S> */ B(LdaSmi), U8(1), + /* 1393 S> */ B(LdaSmi), I8(1), /* 1398 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(228), - /* 1405 S> */ B(LdaSmi), U8(1), + /* 1405 S> */ B(LdaSmi), I8(1), /* 1410 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(230), - /* 1417 S> */ B(LdaSmi), U8(1), + /* 1417 S> */ B(LdaSmi), I8(1), /* 1422 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(232), - /* 1429 S> */ B(LdaSmi), U8(1), + /* 1429 S> */ B(LdaSmi), I8(1), /* 1434 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(234), - /* 1441 S> */ B(LdaSmi), U8(1), + /* 1441 S> */ B(LdaSmi), I8(1), /* 1446 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(236), - /* 1453 S> */ B(LdaSmi), U8(1), + /* 1453 S> */ B(LdaSmi), I8(1), /* 1458 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(238), - /* 1465 S> */ B(LdaSmi), U8(1), + /* 1465 S> */ B(LdaSmi), I8(1), /* 1470 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(240), - /* 1477 S> */ B(LdaSmi), U8(1), + /* 1477 S> */ B(LdaSmi), I8(1), /* 1482 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(242), - /* 1489 S> */ B(LdaSmi), U8(1), + /* 1489 S> */ B(LdaSmi), I8(1), /* 1494 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(244), - /* 1501 S> */ B(LdaSmi), U8(1), + /* 1501 S> */ B(LdaSmi), I8(1), /* 1506 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(246), - /* 1513 S> */ B(LdaSmi), U8(1), + /* 1513 S> */ B(LdaSmi), I8(1), /* 1518 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(248), - /* 1525 S> */ B(LdaSmi), U8(1), + /* 1525 S> */ B(LdaSmi), I8(1), /* 1530 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(250), - /* 1537 S> */ B(LdaSmi), U8(1), + /* 1537 S> */ B(LdaSmi), I8(1), /* 1542 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(252), - /* 1549 S> */ B(LdaSmi), U8(1), + /* 1549 S> */ B(LdaSmi), I8(1), /* 1554 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(254), - /* 1561 S> */ B(LdaSmi), U8(1), + /* 1561 S> */ B(LdaSmi), I8(1), /* 1566 E> */ B(Wide), B(StaKeyedPropertyStrict), R16(arg0), R16(arg1), U16(256), - /* 1573 S> */ B(LdaSmi), U8(2), + /* 1573 S> */ B(LdaSmi), I8(2), /* 1578 E> */ B(Wide), B(StaKeyedPropertyStrict), R16(arg0), R16(arg1), U16(258), B(LdaUndefined), /* 1583 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden index cdb00db659..61b3b242b7 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 6 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), + /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(2), U8(0), /* 49 S> */ B(Return), ] constant pool: [ @@ -32,7 +32,7 @@ parameter count: 1 bytecode array length: 6 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(2), + /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(2), U8(2), /* 58 S> */ B(Return), ] constant pool: [ @@ -50,9 +50,9 @@ parameter count: 1 bytecode array length: 23 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), + /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(4), U8(0), B(Star), R(1), - /* 47 E> */ B(LdaNamedProperty), R(1), U8(1), U8(4), + /* 47 E> */ B(LdaNamedProperty), R(1), U8(1), U8(5), B(Star), R(0), B(LdaConstant), U8(2), B(Star), R(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden index 3eb79ba725..2fcd4b1188 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden @@ -783,7 +783,7 @@ bytecodes: [ B(Star), R(0), /* 2591 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 2601 S> */ B(Wide), B(CreateRegExpLiteral), U16(256), U16(0), U8(0), + /* 2601 S> */ B(Wide), B(CreateRegExpLiteral), U16(256), U16(2), U8(0), /* 2616 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden index 1c806b7f46..4fb7fbe420 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden @@ -19,17 +19,17 @@ parameter count: 1 bytecode array length: 28 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 48 E> */ B(StackCheck), /* 64 S> */ B(Ldar), R(0), /* 76 E> */ B(Add), R(0), U8(2), B(Star), R(0), - /* 86 S> */ B(LdaSmi), U8(10), + /* 86 S> */ B(LdaSmi), I8(10), /* 95 E> */ B(TestGreaterThan), R(0), U8(3), B(JumpIfFalse), U8(4), /* 101 S> */ B(Jump), U8(5), - B(JumpLoop), U8(-17), U8(0), + B(JumpLoop), U8(17), I8(0), /* 110 S> */ B(Ldar), R(0), /* 123 S> */ B(Return), ] @@ -52,13 +52,13 @@ parameter count: 1 bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 48 E> */ B(StackCheck), /* 55 S> */ B(Nop), /* 67 E> */ B(Add), R(0), U8(2), B(Star), R(0), - /* 77 S> */ B(LdaSmi), U8(10), + /* 77 S> */ B(LdaSmi), I8(10), /* 86 E> */ B(TestGreaterThan), R(0), U8(3), B(JumpIfFalse), U8(4), /* 92 S> */ B(Jump), U8(2), @@ -81,7 +81,7 @@ parameter count: 1 bytecode array length: 13 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 50 S> */ B(Nop), /* 62 E> */ B(Add), R(0), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden index 422fa12cb1..4e0330ede3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden @@ -17,7 +17,7 @@ parameter count: 1 bytecode array length: 8 bytecodes: [ /* 21 E> */ B(StackCheck), - /* 26 S> */ B(LdaSmi), U8(2), + /* 26 S> */ B(LdaSmi), I8(2), /* 28 E> */ B(StaGlobalSloppy), U8(0), U8(2), B(LdaUndefined), /* 33 S> */ B(Return), @@ -60,7 +60,7 @@ parameter count: 1 bytecode array length: 8 bytecodes: [ /* 35 E> */ B(StackCheck), - /* 40 S> */ B(LdaSmi), U8(2), + /* 40 S> */ B(LdaSmi), I8(2), /* 42 E> */ B(StaGlobalStrict), U8(0), U8(2), B(LdaUndefined), /* 47 S> */ B(Return), @@ -82,7 +82,7 @@ parameter count: 1 bytecode array length: 8 bytecodes: [ /* 17 E> */ B(StackCheck), - /* 22 S> */ B(LdaSmi), U8(2), + /* 22 S> */ B(LdaSmi), I8(2), /* 24 E> */ B(StaGlobalSloppy), U8(0), U8(2), B(LdaUndefined), /* 29 S> */ B(Return), @@ -490,7 +490,7 @@ bytecodes: [ /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1295 S> */ B(Nop), /* 1296 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), - /* 1305 S> */ B(LdaSmi), U8(2), + /* 1305 S> */ B(LdaSmi), I8(2), /* 1307 E> */ B(Wide), B(StaGlobalSloppy), U16(1), U16(258), B(LdaUndefined), /* 1312 S> */ B(Return), @@ -900,7 +900,7 @@ bytecodes: [ /* 1302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1311 S> */ B(Nop), /* 1312 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), - /* 1321 S> */ B(LdaSmi), U8(2), + /* 1321 S> */ B(LdaSmi), I8(2), /* 1323 E> */ B(Wide), B(StaGlobalStrict), U16(1), U16(258), B(LdaUndefined), /* 1328 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden index 2dd9ec5383..8446beb7bf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden @@ -17,9 +17,9 @@ snippet: " test = new B(1, 2, 3).constructor; })(); " -frame size: 7 +frame size: 4 parameter count: 1 -bytecode array length: 29 +bytecode array length: 23 bytecodes: [ B(CreateRestParameter), B(Star), R(2), @@ -29,10 +29,8 @@ bytecodes: [ /* 93 E> */ B(StackCheck), /* 93 S> */ B(Ldar), R(1), B(GetSuperConstructor), R(3), - B(Mov), R(3), R(4), - B(Mov), R(0), R(5), - B(Mov), R(2), R(6), - /* 93 E> */ B(NewWithSpread), R(4), U8(3), + B(Ldar), R(0), + /* 93 E> */ B(ConstructWithSpread), R(3), R(2), U8(1), /* 93 S> */ B(Return), ] constant pool: [ @@ -53,9 +51,9 @@ snippet: " test = new B(1, 2, 3).constructor; })(); " -frame size: 8 +frame size: 6 parameter count: 1 -bytecode array length: 62 +bytecode array length: 59 bytecodes: [ B(CreateRestParameter), B(Star), R(2), @@ -65,12 +63,11 @@ bytecodes: [ /* 128 E> */ B(StackCheck), /* 140 S> */ B(Ldar), R(1), B(GetSuperConstructor), R(3), - B(LdaSmi), U8(1), - B(Star), R(6), - B(Mov), R(3), R(4), - B(Mov), R(0), R(5), - B(Mov), R(2), R(7), - /* 140 E> */ B(NewWithSpread), R(4), U8(4), + B(LdaSmi), I8(1), + B(Star), R(4), + B(Ldar), R(0), + B(Mov), R(2), R(5), + /* 140 E> */ B(ConstructWithSpread), R(3), R(4), U8(2), B(Star), R(3), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -119,14 +116,14 @@ bytecodes: [ B(Star), R(4), B(LdaUndefined), B(Star), R(5), - B(CreateArrayLiteral), U8(0), U8(0), U8(9), + B(CreateArrayLiteral), U8(0), U8(2), U8(9), B(Star), R(6), B(LdaUndefined), B(Star), R(7), B(Mov), R(2), R(8), /* 152 E> */ B(CallJSRuntime), U8(%spread_iterable), R(7), U8(2), B(Star), R(7), - B(CreateArrayLiteral), U8(1), U8(1), U8(9), + B(CreateArrayLiteral), U8(1), U8(3), U8(9), B(Star), R(8), B(CallJSRuntime), U8(%spread_arguments), R(5), U8(4), B(Star), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden index 77bee13e14..a1025e5ba4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden @@ -18,20 +18,20 @@ parameter count: 1 bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(1), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(7), B(Jump), U8(8), - /* 66 S> */ B(LdaSmi), U8(2), + /* 66 S> */ B(LdaSmi), I8(2), /* 97 S> */ B(Return), - /* 85 S> */ B(LdaSmi), U8(3), + /* 85 S> */ B(LdaSmi), I8(3), /* 97 S> */ B(Return), B(LdaUndefined), /* 97 S> */ B(Return), @@ -54,21 +54,21 @@ parameter count: 1 bytecode array length: 40 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(1), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(10), B(Jump), U8(14), - /* 66 S> */ B(LdaSmi), U8(2), + /* 66 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 73 S> */ B(Jump), U8(8), - /* 89 S> */ B(LdaSmi), U8(3), + /* 89 S> */ B(LdaSmi), I8(3), B(Star), R(0), /* 96 S> */ B(Jump), U8(2), B(LdaUndefined), @@ -92,20 +92,20 @@ parameter count: 1 bytecode array length: 38 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(1), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(8), B(Jump), U8(12), - /* 66 S> */ B(LdaSmi), U8(2), + /* 66 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 98 S> */ B(LdaSmi), U8(3), + /* 98 S> */ B(LdaSmi), I8(3), B(Star), R(0), /* 105 S> */ B(Jump), U8(2), B(LdaUndefined), @@ -130,20 +130,20 @@ parameter count: 1 bytecode array length: 38 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(1), - /* 45 S> */ B(LdaSmi), U8(2), + /* 45 S> */ B(LdaSmi), I8(2), B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(6), B(Jump), U8(6), /* 66 S> */ B(Jump), U8(10), /* 82 S> */ B(Jump), U8(8), - /* 99 S> */ B(LdaSmi), U8(1), + /* 99 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 106 S> */ B(Jump), U8(2), B(LdaUndefined), @@ -168,25 +168,25 @@ parameter count: 1 bytecode array length: 47 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 42 E> */ B(TypeOf), B(Star), R(1), - /* 45 S> */ B(LdaSmi), U8(2), + /* 45 S> */ B(LdaSmi), I8(2), B(TestEqualStrict), R(1), U8(2), B(Mov), R(1), R(2), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(3), + B(LdaSmi), I8(3), B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(10), B(Jump), U8(14), - /* 74 S> */ B(LdaSmi), U8(1), + /* 74 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 81 S> */ B(Jump), U8(14), - /* 97 S> */ B(LdaSmi), U8(2), + /* 97 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 104 S> */ B(Jump), U8(8), - /* 121 S> */ B(LdaSmi), U8(3), + /* 121 S> */ B(LdaSmi), I8(3), B(Star), R(0), /* 128 S> */ B(Jump), U8(2), B(LdaUndefined), @@ -210,7 +210,7 @@ parameter count: 1 bytecode array length: 32 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(1), /* 45 S> */ B(TypeOf), @@ -218,10 +218,10 @@ bytecodes: [ B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(4), B(Jump), U8(8), - /* 74 S> */ B(LdaSmi), U8(1), + /* 74 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 81 S> */ B(Jump), U8(8), - /* 98 S> */ B(LdaSmi), U8(2), + /* 98 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 105 S> */ B(Jump), U8(2), B(LdaUndefined), @@ -312,147 +312,147 @@ parameter count: 1 bytecode array length: 292 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(1), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(2), U8(3), B(JumpIfTrueConstant), U8(0), B(JumpConstant), U8(1), - /* 68 S> */ B(LdaSmi), U8(2), + /* 68 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 77 S> */ B(LdaSmi), U8(2), + /* 77 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 86 S> */ B(LdaSmi), U8(2), + /* 86 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 95 S> */ B(LdaSmi), U8(2), + /* 95 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 104 S> */ B(LdaSmi), U8(2), + /* 104 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 113 S> */ B(LdaSmi), U8(2), + /* 113 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 122 S> */ B(LdaSmi), U8(2), + /* 122 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 131 S> */ B(LdaSmi), U8(2), + /* 131 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 140 S> */ B(LdaSmi), U8(2), + /* 140 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 149 S> */ B(LdaSmi), U8(2), + /* 149 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 158 S> */ B(LdaSmi), U8(2), + /* 158 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 167 S> */ B(LdaSmi), U8(2), + /* 167 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 176 S> */ B(LdaSmi), U8(2), + /* 176 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 185 S> */ B(LdaSmi), U8(2), + /* 185 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 194 S> */ B(LdaSmi), U8(2), + /* 194 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 203 S> */ B(LdaSmi), U8(2), + /* 203 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 212 S> */ B(LdaSmi), U8(2), + /* 212 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 221 S> */ B(LdaSmi), U8(2), + /* 221 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 230 S> */ B(LdaSmi), U8(2), + /* 230 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 239 S> */ B(LdaSmi), U8(2), + /* 239 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 248 S> */ B(LdaSmi), U8(2), + /* 248 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 257 S> */ B(LdaSmi), U8(2), + /* 257 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 266 S> */ B(LdaSmi), U8(2), + /* 266 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 275 S> */ B(LdaSmi), U8(2), + /* 275 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 284 S> */ B(LdaSmi), U8(2), + /* 284 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 293 S> */ B(LdaSmi), U8(2), + /* 293 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 302 S> */ B(LdaSmi), U8(2), + /* 302 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 311 S> */ B(LdaSmi), U8(2), + /* 311 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 320 S> */ B(LdaSmi), U8(2), + /* 320 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 329 S> */ B(LdaSmi), U8(2), + /* 329 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 338 S> */ B(LdaSmi), U8(2), + /* 338 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 347 S> */ B(LdaSmi), U8(2), + /* 347 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 356 S> */ B(LdaSmi), U8(2), + /* 356 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 365 S> */ B(LdaSmi), U8(2), + /* 365 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 374 S> */ B(LdaSmi), U8(2), + /* 374 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 383 S> */ B(LdaSmi), U8(2), + /* 383 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 392 S> */ B(LdaSmi), U8(2), + /* 392 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 401 S> */ B(LdaSmi), U8(2), + /* 401 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 410 S> */ B(LdaSmi), U8(2), + /* 410 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 419 S> */ B(LdaSmi), U8(2), + /* 419 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 428 S> */ B(LdaSmi), U8(2), + /* 428 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 437 S> */ B(LdaSmi), U8(2), + /* 437 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 446 S> */ B(LdaSmi), U8(2), + /* 446 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 455 S> */ B(LdaSmi), U8(2), + /* 455 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 464 S> */ B(LdaSmi), U8(2), + /* 464 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 473 S> */ B(LdaSmi), U8(2), + /* 473 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 482 S> */ B(LdaSmi), U8(2), + /* 482 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 491 S> */ B(LdaSmi), U8(2), + /* 491 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 500 S> */ B(LdaSmi), U8(2), + /* 500 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 509 S> */ B(LdaSmi), U8(2), + /* 509 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 518 S> */ B(LdaSmi), U8(2), + /* 518 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 527 S> */ B(LdaSmi), U8(2), + /* 527 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 536 S> */ B(LdaSmi), U8(2), + /* 536 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 545 S> */ B(LdaSmi), U8(2), + /* 545 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 554 S> */ B(LdaSmi), U8(2), + /* 554 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 563 S> */ B(LdaSmi), U8(2), + /* 563 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 572 S> */ B(LdaSmi), U8(2), + /* 572 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 581 S> */ B(LdaSmi), U8(2), + /* 581 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 590 S> */ B(LdaSmi), U8(2), + /* 590 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 599 S> */ B(LdaSmi), U8(2), + /* 599 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 608 S> */ B(LdaSmi), U8(2), + /* 608 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 617 S> */ B(LdaSmi), U8(2), + /* 617 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 626 S> */ B(LdaSmi), U8(2), + /* 626 S> */ B(LdaSmi), I8(2), B(Star), R(0), - /* 635 S> */ B(LdaSmi), U8(2), + /* 635 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 644 S> */ B(Jump), U8(8), - /* 662 S> */ B(LdaSmi), U8(3), + /* 662 S> */ B(LdaSmi), I8(3), B(Star), R(0), /* 671 S> */ B(Jump), U8(2), B(LdaUndefined), @@ -482,31 +482,31 @@ parameter count: 1 bytecode array length: 62 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Star), R(2), - /* 45 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(LdaSmi), I8(1), B(TestEqualStrict), R(2), U8(5), B(Mov), R(0), R(3), B(JumpIfToBooleanTrue), U8(11), - B(LdaSmi), U8(2), + B(LdaSmi), I8(2), B(TestEqualStrict), R(3), U8(6), B(JumpIfTrue), U8(34), B(Jump), U8(36), - /* 79 E> */ B(AddSmi), U8(1), R(0), U8(2), + /* 79 E> */ B(AddSmi), I8(1), R(0), U8(2), B(Star), R(1), - /* 70 S> */ B(LdaSmi), U8(2), + /* 70 S> */ B(LdaSmi), I8(2), B(TestEqualStrict), R(1), U8(3), B(Mov), R(1), R(4), B(JumpIfToBooleanTrue), U8(4), B(Jump), U8(8), - /* 101 S> */ B(LdaSmi), U8(1), + /* 101 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 108 S> */ B(Jump), U8(8), - /* 131 S> */ B(LdaSmi), U8(2), + /* 131 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 138 S> */ B(Jump), U8(2), - /* 176 S> */ B(LdaSmi), U8(3), + /* 176 S> */ B(LdaSmi), I8(3), B(Star), R(0), B(LdaUndefined), /* 185 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden index 15afe2f4eb..73e203a60b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(1), + /* 34 S> */ B(LdaSmi), I8(1), /* 34 E> */ B(Throw), ] constant pool: [ @@ -49,7 +49,7 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(5), /* 54 S> */ B(LdaConstant), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden index 1594422e49..275bdf5491 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden @@ -24,10 +24,10 @@ bytecodes: [ /* 8 S> */ B(LdaConstant), U8(1), B(Star), R(1), B(LdaZero), - B(CreateObjectLiteral), U8(2), U8(0), U8(1), R(3), + B(CreateObjectLiteral), U8(2), U8(5), U8(1), R(3), B(Star), R(2), B(CreateClosure), U8(3), U8(4), U8(0), - B(StaNamedPropertySloppy), R(3), U8(4), U8(5), + B(StaNamedOwnProperty), R(3), U8(4), U8(6), 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/TryCatch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden index b687ed24ca..93f906c287 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden @@ -15,7 +15,7 @@ bytecode array length: 32 bytecodes: [ /* 30 E> */ B(StackCheck), B(Mov), R(context), R(1), - /* 40 S> */ B(LdaSmi), U8(1), + /* 40 S> */ B(LdaSmi), I8(1), /* 75 S> */ B(Return), B(Jump), U8(23), B(Star), R(2), @@ -26,7 +26,7 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(1), B(PushContext), R(0), - /* 63 S> */ B(LdaSmi), U8(2), + /* 63 S> */ B(LdaSmi), I8(2), B(PopContext), R(0), /* 75 S> */ B(Return), B(LdaUndefined), @@ -52,7 +52,7 @@ bytecode array length: 61 bytecodes: [ /* 30 E> */ B(StackCheck), B(Mov), R(context), R(2), - /* 47 S> */ B(LdaSmi), U8(1), + /* 47 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Jump), U8(20), B(Star), R(3), @@ -65,7 +65,7 @@ bytecodes: [ B(PushContext), R(1), B(PopContext), R(1), B(Mov), R(context), R(2), - /* 75 S> */ B(LdaSmi), U8(2), + /* 75 S> */ B(LdaSmi), I8(2), B(Star), R(0), B(Jump), U8(24), B(Star), R(3), @@ -76,7 +76,7 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(2), B(PushContext), R(1), - /* 95 S> */ B(LdaSmi), U8(3), + /* 95 S> */ B(LdaSmi), I8(3), B(Star), R(0), B(PopContext), R(1), B(LdaUndefined), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden index b85ae8c51a..eaad3bb8bb 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden @@ -15,12 +15,12 @@ parameter count: 1 bytecode array length: 47 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Mov), R(context), R(3), - /* 51 S> */ B(LdaSmi), U8(2), + /* 51 S> */ B(LdaSmi), I8(2), B(Star), R(0), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(1), B(Jump), U8(7), B(Star), R(2), @@ -29,7 +29,7 @@ bytecodes: [ B(LdaTheHole), /* 53 E> */ B(SetPendingMessage), B(Star), R(3), - /* 70 S> */ B(LdaSmi), U8(3), + /* 70 S> */ B(LdaSmi), I8(3), B(Star), R(0), B(Ldar), R(3), /* 72 E> */ B(SetPendingMessage), @@ -58,11 +58,11 @@ parameter count: 1 bytecode array length: 74 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(1), + /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Mov), R(context), R(4), B(Mov), R(context), R(5), - /* 51 S> */ B(LdaSmi), U8(2), + /* 51 S> */ B(LdaSmi), I8(2), B(Star), R(0), B(Jump), U8(24), B(Star), R(6), @@ -73,10 +73,10 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(5), B(PushContext), R(1), - /* 71 S> */ B(LdaSmi), U8(20), + /* 71 S> */ B(LdaSmi), I8(20), B(Star), R(0), B(PopContext), R(1), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(2), B(Jump), U8(7), B(Star), R(3), @@ -85,7 +85,7 @@ bytecodes: [ B(LdaTheHole), /* 73 E> */ B(SetPendingMessage), B(Star), R(4), - /* 90 S> */ B(LdaSmi), U8(3), + /* 90 S> */ B(LdaSmi), I8(3), B(Star), R(0), B(Ldar), R(4), /* 92 E> */ B(SetPendingMessage), @@ -121,7 +121,7 @@ bytecodes: [ B(Mov), R(context), R(4), B(Mov), R(context), R(5), B(Mov), R(context), R(6), - /* 55 S> */ B(LdaSmi), U8(1), + /* 55 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Jump), U8(24), B(Star), R(7), @@ -132,7 +132,7 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(6), B(PushContext), R(1), - /* 74 S> */ B(LdaSmi), U8(2), + /* 74 S> */ B(LdaSmi), I8(2), B(Star), R(0), B(PopContext), R(1), B(Jump), U8(24), @@ -144,10 +144,10 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(5), B(PushContext), R(1), - /* 95 S> */ B(LdaSmi), U8(20), + /* 95 S> */ B(LdaSmi), I8(20), B(Star), R(0), B(PopContext), R(1), - B(LdaSmi), U8(-1), + B(LdaSmi), I8(-1), B(Star), R(2), B(Jump), U8(7), B(Star), R(3), @@ -156,7 +156,7 @@ bytecodes: [ B(LdaTheHole), /* 97 E> */ B(SetPendingMessage), B(Star), R(4), - /* 114 S> */ B(LdaSmi), U8(3), + /* 114 S> */ B(LdaSmi), I8(3), B(Star), R(0), B(Ldar), R(4), /* 116 E> */ B(SetPendingMessage), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden index d5ab090594..ecf9ed6d64 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden @@ -19,7 +19,7 @@ parameter count: 1 bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 24 S> */ B(LdaSmi), U8(13), + /* 24 S> */ B(LdaSmi), I8(13), B(Star), R(0), /* 29 S> */ B(TypeOf), /* 47 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 1620f93f5e..b94144d76b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden @@ -20,14 +20,14 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 54 S> */ B(LdaSmi), U8(10), + /* 54 S> */ B(LdaSmi), I8(10), /* 54 E> */ B(TestEqual), R(0), U8(2), B(JumpIfTrue), U8(13), /* 45 E> */ B(StackCheck), - /* 65 S> */ B(LdaSmi), U8(10), + /* 65 S> */ B(LdaSmi), I8(10), /* 71 E> */ B(Add), R(0), U8(3), B(Star), R(0), - B(JumpLoop), U8(-15), U8(0), + B(JumpLoop), U8(15), I8(0), /* 79 S> */ B(Ldar), R(0), /* 89 S> */ B(Return), ] @@ -58,7 +58,7 @@ bytecodes: [ /* 74 S> */ B(LdaFalse), /* 74 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(5), - B(JumpLoop), U8(-12), U8(0), + B(JumpLoop), U8(12), I8(0), /* 85 S> */ B(Ldar), R(0), /* 95 S> */ B(Return), ] @@ -77,9 +77,9 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(101), + /* 42 S> */ B(LdaSmi), I8(101), B(Star), R(0), - /* 47 S> */ B(LdaSmi), U8(3), + /* 47 S> */ B(LdaSmi), I8(3), /* 61 E> */ B(Mul), R(0), U8(2), B(LdaUndefined), /* 67 S> */ B(Return), @@ -100,12 +100,12 @@ parameter count: 1 bytecode array length: 22 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), + /* 42 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), /* 56 S> */ B(Nop), /* 64 E> */ B(Mul), R(0), U8(2), B(Star), R(2), - /* 68 E> */ B(SubSmi), U8(1), R(2), U8(3), + /* 68 E> */ B(SubSmi), I8(1), R(2), U8(3), B(LdaUndefined), B(Star), R(1), /* 74 S> */ B(Nop), @@ -126,9 +126,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(13), + /* 42 S> */ B(LdaSmi), I8(13), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(-1), + /* 46 S> */ B(LdaSmi), I8(-1), /* 53 E> */ B(BitwiseXor), R(0), U8(2), /* 57 S> */ B(Return), ] @@ -147,9 +147,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(13), + /* 42 S> */ B(LdaSmi), I8(13), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(1), + /* 46 S> */ B(LdaSmi), I8(1), /* 53 E> */ B(Mul), R(0), U8(2), /* 57 S> */ B(Return), ] @@ -168,9 +168,9 @@ parameter count: 1 bytecode array length: 11 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(LdaSmi), U8(13), + /* 42 S> */ B(LdaSmi), I8(13), B(Star), R(0), - /* 46 S> */ B(LdaSmi), U8(-1), + /* 46 S> */ B(LdaSmi), I8(-1), /* 53 E> */ B(Mul), R(0), U8(2), /* 57 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden index fc7d322e60..402b9aea80 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden @@ -524,7 +524,7 @@ parameter count: 1 bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 1494 S> */ B(LdaSmi), U8(3), + /* 1494 S> */ B(LdaSmi), I8(3), /* 1501 E> */ B(TestGreaterThan), R(2), U8(2), B(JumpIfFalse), U8(7), /* 1508 S> */ B(Wide), B(Ldar), R16(129), @@ -708,12 +708,12 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 1503 S> */ B(LdaZero), B(Star), R(0), - /* 1506 S> */ B(LdaSmi), U8(3), + /* 1506 S> */ B(LdaSmi), I8(3), /* 1515 E> */ B(Wide), B(TestEqual), R16(129), U16(2), B(JumpIfFalse), U8(10), /* 1534 S> */ B(Wide), B(Mov), R16(0), R16(129), B(Ldar), R(0), - /* 1540 S> */ B(LdaSmi), U8(3), + /* 1540 S> */ B(LdaSmi), I8(3), /* 1547 E> */ B(TestGreaterThan), R(2), U8(3), B(JumpIfFalse), U8(5), /* 1554 S> */ B(Ldar), R(0), @@ -900,7 +900,7 @@ bytecodes: [ B(Star), R(1), /* 1523 S> */ B(LdaZero), B(Wide), B(Star), R16(128), - /* 1538 S> */ B(LdaSmi), U8(64), + /* 1538 S> */ B(LdaSmi), I8(64), /* 1538 E> */ B(Wide), B(TestLessThan), R16(128), U16(2), B(JumpIfFalse), U8(31), /* 1518 E> */ B(StackCheck), @@ -911,7 +911,7 @@ bytecodes: [ /* 1548 S> */ B(Wide), B(Ldar), R16(128), B(Inc), U8(3), B(Wide), B(Star), R16(128), - B(JumpLoop), U8(-36), U8(0), + B(JumpLoop), U8(36), I8(0), /* 1567 S> */ B(Wide), B(Ldar), R16(128), /* 1580 S> */ B(Return), ] @@ -1088,7 +1088,7 @@ parameter count: 1 bytecode array length: 85 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 1503 S> */ B(Wide), B(LdaSmi), U16(1234), + /* 1503 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), /* 1518 S> */ B(LdaZero), B(Star), R(1), @@ -1111,7 +1111,7 @@ bytecodes: [ B(Star), R(1), /* 1544 E> */ B(Wide), B(ForInStep), R16(161), B(Wide), B(Star), R16(161), - B(JumpLoop), U8(-48), U8(0), + B(JumpLoop), U8(48), I8(0), /* 1553 S> */ B(Ldar), R(1), /* 1564 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden index 963c71f184..93467600ef 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden @@ -14,7 +14,7 @@ parameter count: 1 bytecode array length: 22 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(1), B(Ldar), R(1), B(ToObject), R(1), B(Ldar), R(closure), diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc index e5dca853a5..172a3e9b8f 100644 --- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc +++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc @@ -43,6 +43,7 @@ class ProgramOptions final { module_(false), top_level_(false), do_expressions_(false), + async_iteration_(false), verbose_(false) {} bool Validate() const; @@ -61,6 +62,7 @@ class ProgramOptions final { bool module() const { return module_; } bool top_level() const { return top_level_; } bool do_expressions() const { return do_expressions_; } + bool async_iteration() const { return async_iteration_; } bool verbose() const { return verbose_; } bool suppress_runtime_errors() const { return rebaseline_ && !verbose_; } std::vector<std::string> input_filenames() const { return input_filenames_; } @@ -77,6 +79,7 @@ class ProgramOptions final { bool module_; bool top_level_; bool do_expressions_; + bool async_iteration_; bool verbose_; std::vector<std::string> input_filenames_; std::string output_filename_; @@ -165,6 +168,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) { options.top_level_ = true; } else if (strcmp(argv[i], "--do-expressions") == 0) { options.do_expressions_ = true; + } else if (strcmp(argv[i], "--async-iteration") == 0) { + options.async_iteration_ = true; } else if (strcmp(argv[i], "--verbose") == 0) { options.verbose_ = true; } else if (strncmp(argv[i], "--output=", 9) == 0) { @@ -267,6 +272,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { top_level_ = ParseBoolean(line.c_str() + 11); } else if (line.compare(0, 16, "do expressions: ") == 0) { do_expressions_ = ParseBoolean(line.c_str() + 16); + } else if (line.compare(0, 17, "async iteration: ") == 0) { + async_iteration_ = ParseBoolean(line.c_str() + 17); } else if (line == "---") { break; } else if (line.empty()) { @@ -289,6 +296,7 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT if (module_) stream << "\nmodule: yes"; if (top_level_) stream << "\ntop level: yes"; if (do_expressions_) stream << "\ndo expressions: yes"; + if (async_iteration_) stream << "\nasync iteration: yes"; stream << "\n\n"; } @@ -393,6 +401,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT } if (options.do_expressions()) i::FLAG_harmony_do_expressions = true; + if (options.async_iteration()) i::FLAG_harmony_async_iteration = true; stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n"; options.PrintHeader(stream); @@ -401,6 +410,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT } i::FLAG_harmony_do_expressions = false; + i::FLAG_harmony_async_iteration = false; } bool WriteExpectationsFile(const std::vector<std::string>& snippet_list, @@ -445,6 +455,7 @@ void PrintUsage(const char* exec_path) { "Specify the name of the test function.\n" " --top-level Process top level code, not the top-level function.\n" " --do-expressions Enable harmony_do_expressions flag.\n" + " --async-iteration Enable harmony_async_iteration flag.\n" " --output=file.name\n" " Specify the output file. If not specified, output goes to " "stdout.\n" diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.cc b/deps/v8/test/cctest/interpreter/interpreter-tester.cc index 23a1d2d45e..815c54233c 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.cc +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.cc @@ -18,24 +18,25 @@ MaybeHandle<Object> CallInterpreter(Isolate* isolate, InterpreterTester::InterpreterTester( Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode, - MaybeHandle<FeedbackVector> feedback_vector, const char* filter) + MaybeHandle<FeedbackMetadata> feedback_metadata, const char* filter) : isolate_(isolate), source_(source), bytecode_(bytecode), - feedback_vector_(feedback_vector) { + feedback_metadata_(feedback_metadata) { i::FLAG_ignition = true; i::FLAG_always_opt = false; } InterpreterTester::InterpreterTester( Isolate* isolate, Handle<BytecodeArray> bytecode, - MaybeHandle<FeedbackVector> feedback_vector, const char* filter) - : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {} + MaybeHandle<FeedbackMetadata> feedback_metadata, const char* filter) + : InterpreterTester(isolate, nullptr, bytecode, feedback_metadata, filter) { +} InterpreterTester::InterpreterTester(Isolate* isolate, const char* source, const char* filter) : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(), - MaybeHandle<FeedbackVector>(), filter) {} + MaybeHandle<FeedbackMetadata>(), filter) {} InterpreterTester::~InterpreterTester() {} diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.h b/deps/v8/test/cctest/interpreter/interpreter-tester.h index ce103fe6d1..f0a0aef6e3 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.h +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.h @@ -4,6 +4,7 @@ #include "src/v8.h" +#include "src/api.h" #include "src/execution.h" #include "src/handles.h" #include "src/interpreter/bytecode-array-builder.h" @@ -53,12 +54,12 @@ class InterpreterTester { public: InterpreterTester(Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode, - MaybeHandle<FeedbackVector> feedback_vector, + MaybeHandle<FeedbackMetadata> feedback_metadata, const char* filter); InterpreterTester(Isolate* isolate, Handle<BytecodeArray> bytecode, - MaybeHandle<FeedbackVector> feedback_vector = - MaybeHandle<FeedbackVector>(), + MaybeHandle<FeedbackMetadata> feedback_metadata = + MaybeHandle<FeedbackMetadata>(), const char* filter = kFunctionName); InterpreterTester(Isolate* isolate, const char* source, @@ -85,7 +86,7 @@ class InterpreterTester { Isolate* isolate_; const char* source_; MaybeHandle<BytecodeArray> bytecode_; - MaybeHandle<FeedbackVector> feedback_vector_; + MaybeHandle<FeedbackMetadata> feedback_metadata_; template <class... A> Handle<JSFunction> GetBytecodeFunction() { @@ -115,9 +116,11 @@ class InterpreterTester { if (!bytecode_.is_null()) { function->shared()->set_function_data(*bytecode_.ToHandleChecked()); } - if (!feedback_vector_.is_null()) { - function->literals()->set_feedback_vector( - *feedback_vector_.ToHandleChecked()); + if (!feedback_metadata_.is_null()) { + function->set_feedback_vector_cell(isolate_->heap()->undefined_cell()); + function->shared()->set_feedback_metadata( + *feedback_metadata_.ToHandleChecked()); + JSFunction::EnsureLiterals(function); } return function; } diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index b43384e946..5ee0a6fc3c 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -2343,6 +2343,73 @@ TEST(SuperCallAndSpread) { LoadGolden("SuperCallAndSpread.golden"))); } +TEST(CallAndSpread) { + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + const char* snippets[] = {"Math.max(...[1, 2, 3]);\n", + "Math.max(0, ...[1, 2, 3]);\n", + "Math.max(0, ...[1, 2, 3], 4);\n"}; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CallAndSpread.golden"))); +} + +TEST(NewAndSpread) { + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + const char* snippets[] = { + "class A { constructor(...args) { this.args = args; } }\n" + "new A(...[1, 2, 3]);\n", + + "class A { constructor(...args) { this.args = args; } }\n" + "new A(0, ...[1, 2, 3]);\n", + + "class A { constructor(...args) { this.args = args; } }\n" + "new A(0, ...[1, 2, 3], 4);\n"}; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("NewAndSpread.golden"))); +} + +TEST(ForAwaitOf) { + bool old_flag = i::FLAG_harmony_async_iteration; + i::FLAG_harmony_async_iteration = true; + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + printer.set_wrap(false); + printer.set_test_function_name("f"); + + const char* snippets[] = { + "async function f() {\n" + " for await (let x of [1, 2, 3]) {}\n" + "}\n" + "f();\n", + + "async function f() {\n" + " for await (let x of [1, 2, 3]) { return x; }\n" + "}\n" + "f();\n", + + "async function f() {\n" + " for await (let x of [10, 20, 30]) {\n" + " if (x == 10) continue;\n" + " if (x == 20) break;\n" + " }\n" + "}\n" + "f();\n", + + "async function f() {\n" + " var x = { 'a': 1, 'b': 2 };\n" + " for (x['a'] of [1,2,3]) { return x['a']; }\n" + "}\n" + "f();\n"}; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ForAwaitOf.golden"))); + + i::FLAG_harmony_async_iteration = old_flag; +} + } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc index 70051253cc..cad46547b4 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -5,6 +5,7 @@ #include "src/v8.h" #include "src/interpreter/interpreter-intrinsics.h" +#include "src/objects-inl.h" #include "test/cctest/interpreter/interpreter-tester.h" namespace v8 { @@ -225,27 +226,6 @@ TEST(IntrinsicAsStubCall) { ->SameValue(*sub_string_helper.NewObject("'bar'"))); } -TEST(ValueOf) { - HandleAndZoneScope handles; - Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), - Runtime::kInlineValueOf); - - CHECK_EQ(Smi::FromInt(1234), *helper.Invoke(helper.NewObject("1234"))); - CHECK_EQ(Smi::FromInt(5678), - *helper.Invoke(helper.NewObject("new Object(5678)"))); - - CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("true"))); - CHECK_EQ(*factory->false_value(), - *helper.Invoke(helper.NewObject("new Object(false)"))); - - CHECK(helper.Invoke(helper.NewObject("'foobar'")) - ->SameValue(*helper.NewObject("'foobar'"))); - CHECK(helper.Invoke(helper.NewObject("new Object('foobar')")) - ->SameValue(*helper.NewObject("'foobar'"))); -} - TEST(ClassOf) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index 70af275c8b..ae5ab33eb6 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -22,16 +22,17 @@ namespace v8 { namespace internal { namespace interpreter { -static int GetIndex(FeedbackVectorSlot slot) { +static int GetIndex(FeedbackSlot slot) { return FeedbackVector::GetIndex(slot); } TEST(InterpreterReturn) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> undefined_value = isolate->factory()->undefined_value(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -45,9 +46,10 @@ TEST(InterpreterReturn) { TEST(InterpreterLoadUndefined) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> undefined_value = isolate->factory()->undefined_value(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadUndefined().Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -61,9 +63,10 @@ TEST(InterpreterLoadUndefined) { TEST(InterpreterLoadNull) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> null_value = isolate->factory()->null_value(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadNull().Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -77,9 +80,10 @@ TEST(InterpreterLoadNull) { TEST(InterpreterLoadTheHole) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> the_hole_value = isolate->factory()->the_hole_value(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadTheHole().Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -93,9 +97,10 @@ TEST(InterpreterLoadTheHole) { TEST(InterpreterLoadTrue) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> true_value = isolate->factory()->true_value(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadTrue().Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -109,9 +114,10 @@ TEST(InterpreterLoadTrue) { TEST(InterpreterLoadFalse) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> false_value = isolate->factory()->false_value(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadFalse().Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -125,11 +131,11 @@ TEST(InterpreterLoadFalse) { TEST(InterpreterLoadLiteral) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); + Zone* zone = handles.main_zone(); // Small Smis. for (int i = -128; i < 128; i++) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadLiteral(Smi::FromInt(i)).Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -141,7 +147,7 @@ TEST(InterpreterLoadLiteral) { // Large Smis. { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadLiteral(Smi::FromInt(0x12345678)).Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -154,9 +160,14 @@ TEST(InterpreterLoadLiteral) { // Heap numbers. { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); + + builder.LoadLiteral(ast_factory.NewNumber(-2.1e19)).Return(); - builder.LoadLiteral(factory->NewHeapNumber(-2.1e19)).Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); @@ -167,16 +178,21 @@ TEST(InterpreterLoadLiteral) { // Strings. { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); - Handle<i::String> string = factory->NewStringFromAsciiChecked("String"); - builder.LoadLiteral(string).Return(); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); + + const AstRawString* raw_string = ast_factory.GetOneByteString("String"); + builder.LoadLiteral(raw_string).Return(); + + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); - CHECK(i::String::cast(*return_val)->Equals(*string)); + CHECK(i::String::cast(*return_val)->Equals(*raw_string->string())); } } @@ -184,9 +200,10 @@ TEST(InterpreterLoadLiteral) { TEST(InterpreterLoadStoreRegisters) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Handle<Object> true_value = isolate->factory()->true_value(); for (int i = 0; i <= kMaxInt8; i++) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, i + 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, i + 1); Register reg(i); builder.LoadTrue() @@ -269,14 +286,14 @@ TEST(InterpreterShiftOpsSmi) { for (size_t o = 0; o < arraysize(kShiftOperators); o++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0); int lhs = lhs_inputs[l]; @@ -288,7 +305,7 @@ TEST(InterpreterShiftOpsSmi) { .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); Handle<Object> expected_value = @@ -308,14 +325,14 @@ TEST(InterpreterBinaryOpsSmi) { for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0); int lhs = lhs_inputs[l]; @@ -323,12 +340,11 @@ TEST(InterpreterBinaryOpsSmi) { builder.LoadLiteral(Smi::FromInt(lhs)) .StoreAccumulatorInRegister(reg) .LoadLiteral(Smi::FromInt(rhs)) - .BinaryOperation(kArithmeticOperators[o], reg, - GetIndex(slot)) + .BinaryOperation(kArithmeticOperators[o], reg, GetIndex(slot)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); Handle<Object> expected_value = @@ -349,26 +365,29 @@ TEST(InterpreterBinaryOpsHeapNumber) { for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0); double lhs = lhs_inputs[l]; double rhs = rhs_inputs[r]; - builder.LoadLiteral(factory->NewNumber(lhs)) + builder.LoadLiteral(ast_factory.NewNumber(lhs)) .StoreAccumulatorInRegister(reg) - .LoadLiteral(factory->NewNumber(rhs)) + .LoadLiteral(ast_factory.NewNumber(rhs)) .BinaryOperation(kArithmeticOperators[o], reg, GetIndex(slot)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); Handle<Object> expected_value = @@ -383,51 +402,53 @@ TEST(InterpreterBinaryOpsHeapNumber) { TEST(InterpreterStringAdd) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); struct TestCase { - Handle<Object> lhs; - Handle<Object> rhs; + const AstRawString* lhs; + const AstValue* rhs; Handle<Object> expected_value; int32_t expected_feedback; } test_cases[] = { - {factory->NewStringFromStaticChars("a"), - factory->NewStringFromStaticChars("b"), + {ast_factory.GetOneByteString("a"), + ast_factory.NewString(ast_factory.GetOneByteString("b")), factory->NewStringFromStaticChars("ab"), BinaryOperationFeedback::kString}, - {factory->NewStringFromStaticChars("aaaaaa"), - factory->NewStringFromStaticChars("b"), + {ast_factory.GetOneByteString("aaaaaa"), + ast_factory.NewString(ast_factory.GetOneByteString("b")), factory->NewStringFromStaticChars("aaaaaab"), BinaryOperationFeedback::kString}, - {factory->NewStringFromStaticChars("aaa"), - factory->NewStringFromStaticChars("bbbbb"), + {ast_factory.GetOneByteString("aaa"), + ast_factory.NewString(ast_factory.GetOneByteString("bbbbb")), factory->NewStringFromStaticChars("aaabbbbb"), BinaryOperationFeedback::kString}, - {factory->NewStringFromStaticChars(""), - factory->NewStringFromStaticChars("b"), + {ast_factory.GetOneByteString(""), + ast_factory.NewString(ast_factory.GetOneByteString("b")), factory->NewStringFromStaticChars("b"), BinaryOperationFeedback::kString}, - {factory->NewStringFromStaticChars("a"), - factory->NewStringFromStaticChars(""), + {ast_factory.GetOneByteString("a"), + ast_factory.NewString(ast_factory.GetOneByteString("")), factory->NewStringFromStaticChars("a"), BinaryOperationFeedback::kString}, - {factory->NewStringFromStaticChars("1.11"), factory->NewHeapNumber(2.5), + {ast_factory.GetOneByteString("1.11"), ast_factory.NewNumber(2.5), factory->NewStringFromStaticChars("1.112.5"), BinaryOperationFeedback::kAny}, - {factory->NewStringFromStaticChars("-1.11"), factory->NewHeapNumber(2.56), + {ast_factory.GetOneByteString("-1.11"), ast_factory.NewNumber(2.56), factory->NewStringFromStaticChars("-1.112.56"), BinaryOperationFeedback::kAny}, - {factory->NewStringFromStaticChars(""), factory->NewHeapNumber(2.5), + {ast_factory.GetOneByteString(""), ast_factory.NewNumber(2.5), factory->NewStringFromStaticChars("2.5"), BinaryOperationFeedback::kAny}, }; for (size_t i = 0; i < arraysize(test_cases); i++) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0); builder.LoadLiteral(test_cases[i].lhs) @@ -435,14 +456,15 @@ TEST(InterpreterStringAdd) { .LoadLiteral(test_cases[i].rhs) .BinaryOperation(Token::Value::ADD, reg, GetIndex(slot)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*test_cases[i].expected_value)); - Object* feedback = vector->Get(slot); + Object* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); CHECK_EQ(test_cases[i].expected_feedback, static_cast<Smi*>(feedback)->value()); @@ -453,7 +475,8 @@ TEST(InterpreterStringAdd) { TEST(InterpreterParameter1) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadAccumulatorWithRegister(builder.Parameter(0)).Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -476,20 +499,22 @@ TEST(InterpreterParameter1) { TEST(InterpreterParameter8) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); - - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot5 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot6 = feedback_spec.AddInterpreterBinaryOpICSlot(); - - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + BytecodeArrayBuilder builder(isolate, zone, 8, 0, 0); + + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot5 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot6 = feedback_spec.AddInterpreterBinaryOpICSlot(); + + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); builder.LoadAccumulatorWithRegister(builder.Parameter(0)) .BinaryOperation(Token::Value::ADD, builder.Parameter(1), GetIndex(slot)) @@ -500,9 +525,10 @@ TEST(InterpreterParameter8) { .BinaryOperation(Token::Value::ADD, builder.Parameter(6), GetIndex(slot5)) .BinaryOperation(Token::Value::ADD, builder.Parameter(7), GetIndex(slot6)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); typedef Handle<Object> H; auto callable = tester.GetCallable<H, H, H, H, H, H, H, H>(); @@ -524,132 +550,122 @@ TEST(InterpreterParameter8) { TEST(InterpreterBinaryOpTypeFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); struct BinaryOpExpectation { Token::Value op; - Handle<Object> arg1; - Handle<Object> arg2; + const AstValue* arg1; + const AstValue* arg2; Handle<Object> result; int32_t feedback; }; BinaryOpExpectation const kTestCases[] = { // ADD - {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::ADD, ast_factory.NewSmi(2), ast_factory.NewSmi(3), Handle<Smi>(Smi::FromInt(5), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::ADD, Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate), - Handle<Smi>(Smi::FromInt(1), isolate), + {Token::Value::ADD, ast_factory.NewSmi(Smi::kMaxValue), + ast_factory.NewSmi(1), isolate->factory()->NewHeapNumber(Smi::kMaxValue + 1.0), BinaryOperationFeedback::kNumber}, - {Token::Value::ADD, isolate->factory()->NewHeapNumber(3.1415), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::ADD, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), isolate->factory()->NewHeapNumber(3.1415 + 3), BinaryOperationFeedback::kNumber}, - {Token::Value::ADD, isolate->factory()->NewHeapNumber(3.1415), - isolate->factory()->NewHeapNumber(1.4142), + {Token::Value::ADD, ast_factory.NewNumber(3.1415), + ast_factory.NewNumber(1.4142), isolate->factory()->NewHeapNumber(3.1415 + 1.4142), BinaryOperationFeedback::kNumber}, - {Token::Value::ADD, isolate->factory()->NewStringFromAsciiChecked("foo"), - isolate->factory()->NewStringFromAsciiChecked("bar"), + {Token::Value::ADD, + ast_factory.NewString(ast_factory.GetOneByteString("foo")), + ast_factory.NewString(ast_factory.GetOneByteString("bar")), isolate->factory()->NewStringFromAsciiChecked("foobar"), BinaryOperationFeedback::kString}, - {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), - isolate->factory()->NewStringFromAsciiChecked("2"), + {Token::Value::ADD, ast_factory.NewSmi(2), + ast_factory.NewString(ast_factory.GetOneByteString("2")), isolate->factory()->NewStringFromAsciiChecked("22"), BinaryOperationFeedback::kAny}, // SUB - {Token::Value::SUB, Handle<Smi>(Smi::FromInt(2), isolate), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::SUB, ast_factory.NewSmi(2), ast_factory.NewSmi(3), Handle<Smi>(Smi::FromInt(-1), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::SUB, Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate), - Handle<Smi>(Smi::FromInt(1), isolate), + {Token::Value::SUB, ast_factory.NewSmi(Smi::kMinValue), + ast_factory.NewSmi(1), isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0), BinaryOperationFeedback::kNumber}, - {Token::Value::SUB, isolate->factory()->NewHeapNumber(3.1415), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::SUB, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), isolate->factory()->NewHeapNumber(3.1415 - 3), BinaryOperationFeedback::kNumber}, - {Token::Value::SUB, isolate->factory()->NewHeapNumber(3.1415), - isolate->factory()->NewHeapNumber(1.4142), + {Token::Value::SUB, ast_factory.NewNumber(3.1415), + ast_factory.NewNumber(1.4142), isolate->factory()->NewHeapNumber(3.1415 - 1.4142), BinaryOperationFeedback::kNumber}, - {Token::Value::SUB, Handle<Smi>(Smi::FromInt(2), isolate), - isolate->factory()->NewStringFromAsciiChecked("1"), + {Token::Value::SUB, ast_factory.NewSmi(2), + ast_factory.NewString(ast_factory.GetOneByteString("1")), Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}, // MUL - {Token::Value::MUL, Handle<Smi>(Smi::FromInt(2), isolate), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::MUL, ast_factory.NewSmi(2), ast_factory.NewSmi(3), Handle<Smi>(Smi::FromInt(6), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::MUL, Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate), - Handle<Smi>(Smi::FromInt(2), isolate), + {Token::Value::MUL, ast_factory.NewSmi(Smi::kMinValue), + ast_factory.NewSmi(2), isolate->factory()->NewHeapNumber(Smi::kMinValue * 2.0), BinaryOperationFeedback::kNumber}, - {Token::Value::MUL, isolate->factory()->NewHeapNumber(3.1415), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::MUL, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), isolate->factory()->NewHeapNumber(3 * 3.1415), BinaryOperationFeedback::kNumber}, - {Token::Value::MUL, isolate->factory()->NewHeapNumber(3.1415), - isolate->factory()->NewHeapNumber(1.4142), + {Token::Value::MUL, ast_factory.NewNumber(3.1415), + ast_factory.NewNumber(1.4142), isolate->factory()->NewHeapNumber(3.1415 * 1.4142), BinaryOperationFeedback::kNumber}, - {Token::Value::MUL, Handle<Smi>(Smi::FromInt(2), isolate), - isolate->factory()->NewStringFromAsciiChecked("1"), + {Token::Value::MUL, ast_factory.NewSmi(2), + ast_factory.NewString(ast_factory.GetOneByteString("1")), Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny}, // DIV - {Token::Value::DIV, Handle<Smi>(Smi::FromInt(6), isolate), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::DIV, ast_factory.NewSmi(6), ast_factory.NewSmi(3), Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::DIV, Handle<Smi>(Smi::FromInt(3), isolate), - Handle<Smi>(Smi::FromInt(2), isolate), + {Token::Value::DIV, ast_factory.NewSmi(3), ast_factory.NewSmi(2), isolate->factory()->NewHeapNumber(3.0 / 2.0), BinaryOperationFeedback::kNumber}, - {Token::Value::DIV, isolate->factory()->NewHeapNumber(3.1415), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::DIV, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), isolate->factory()->NewHeapNumber(3.1415 / 3), BinaryOperationFeedback::kNumber}, - {Token::Value::DIV, isolate->factory()->NewHeapNumber(3.1415), - isolate->factory()->NewHeapNumber( - -std::numeric_limits<double>::infinity()), + {Token::Value::DIV, ast_factory.NewNumber(3.1415), + ast_factory.NewNumber(-std::numeric_limits<double>::infinity()), isolate->factory()->NewHeapNumber(-0.0), BinaryOperationFeedback::kNumber}, - {Token::Value::DIV, Handle<Smi>(Smi::FromInt(2), isolate), - isolate->factory()->NewStringFromAsciiChecked("1"), + {Token::Value::DIV, ast_factory.NewSmi(2), + ast_factory.NewString(ast_factory.GetOneByteString("1")), Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny}, // MOD - {Token::Value::MOD, Handle<Smi>(Smi::FromInt(5), isolate), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::MOD, ast_factory.NewSmi(5), ast_factory.NewSmi(3), Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::MOD, Handle<Smi>(Smi::FromInt(-4), isolate), - Handle<Smi>(Smi::FromInt(2), isolate), + {Token::Value::MOD, ast_factory.NewSmi(-4), ast_factory.NewSmi(2), isolate->factory()->NewHeapNumber(-0.0), BinaryOperationFeedback::kNumber}, - {Token::Value::MOD, isolate->factory()->NewHeapNumber(3.1415), - Handle<Smi>(Smi::FromInt(3), isolate), + {Token::Value::MOD, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), isolate->factory()->NewHeapNumber(fmod(3.1415, 3.0)), BinaryOperationFeedback::kNumber}, - {Token::Value::MOD, isolate->factory()->NewHeapNumber(-3.1415), - isolate->factory()->NewHeapNumber(-1.4142), + {Token::Value::MOD, ast_factory.NewNumber(-3.1415), + ast_factory.NewNumber(-1.4142), isolate->factory()->NewHeapNumber(fmod(-3.1415, -1.4142)), BinaryOperationFeedback::kNumber}, - {Token::Value::MOD, Handle<Smi>(Smi::FromInt(3), isolate), - isolate->factory()->NewStringFromAsciiChecked("-2"), + {Token::Value::MOD, ast_factory.NewSmi(3), + ast_factory.NewString(ast_factory.GetOneByteString("-2")), Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}}; for (const BinaryOpExpectation& test_case : kTestCases) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSpec feedback_spec(zone); + i::FeedbackSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - i::NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + i::NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0); builder.LoadLiteral(test_case.arg1) @@ -658,13 +674,14 @@ TEST(InterpreterBinaryOpTypeFeedback) { .BinaryOperation(test_case.op, reg, GetIndex(slot0)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); - Object* feedback0 = vector->Get(slot0); + Object* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value()); CHECK(Object::Equals(test_case.result, return_val).ToChecked()); @@ -674,11 +691,13 @@ TEST(InterpreterBinaryOpTypeFeedback) { TEST(InterpreterBinaryOpSmiTypeFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); struct BinaryOpExpectation { Token::Value op; - Handle<Object> arg1; + const AstValue* arg1; int32_t arg2; Handle<Object> result; int32_t feedback; @@ -686,74 +705,79 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { BinaryOpExpectation const kTestCases[] = { // ADD - {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), 42, + {Token::Value::ADD, ast_factory.NewSmi(2), 42, Handle<Smi>(Smi::FromInt(44), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), Smi::kMaxValue, + {Token::Value::ADD, ast_factory.NewSmi(2), Smi::kMaxValue, isolate->factory()->NewHeapNumber(Smi::kMaxValue + 2.0), BinaryOperationFeedback::kNumber}, - {Token::Value::ADD, isolate->factory()->NewHeapNumber(3.1415), 2, + {Token::Value::ADD, ast_factory.NewNumber(3.1415), 2, isolate->factory()->NewHeapNumber(3.1415 + 2.0), BinaryOperationFeedback::kNumber}, - {Token::Value::ADD, isolate->factory()->NewStringFromAsciiChecked("2"), 2, + {Token::Value::ADD, + ast_factory.NewString(ast_factory.GetOneByteString("2")), 2, isolate->factory()->NewStringFromAsciiChecked("22"), BinaryOperationFeedback::kAny}, // SUB - {Token::Value::SUB, Handle<Smi>(Smi::FromInt(2), isolate), 42, + {Token::Value::SUB, ast_factory.NewSmi(2), 42, Handle<Smi>(Smi::FromInt(-40), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::SUB, Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate), 1, + {Token::Value::SUB, ast_factory.NewSmi(Smi::kMinValue), 1, isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0), BinaryOperationFeedback::kNumber}, - {Token::Value::SUB, isolate->factory()->NewHeapNumber(3.1415), 2, + {Token::Value::SUB, ast_factory.NewNumber(3.1415), 2, isolate->factory()->NewHeapNumber(3.1415 - 2.0), BinaryOperationFeedback::kNumber}, - {Token::Value::SUB, isolate->factory()->NewStringFromAsciiChecked("2"), 2, + {Token::Value::SUB, + ast_factory.NewString(ast_factory.GetOneByteString("2")), 2, Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny}, // BIT_OR - {Token::Value::BIT_OR, Handle<Smi>(Smi::FromInt(4), isolate), 1, + {Token::Value::BIT_OR, ast_factory.NewSmi(4), 1, Handle<Smi>(Smi::FromInt(5), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::BIT_OR, isolate->factory()->NewHeapNumber(3.1415), 8, + {Token::Value::BIT_OR, ast_factory.NewNumber(3.1415), 8, Handle<Smi>(Smi::FromInt(11), isolate), BinaryOperationFeedback::kNumber}, - {Token::Value::BIT_OR, isolate->factory()->NewStringFromAsciiChecked("2"), - 1, Handle<Smi>(Smi::FromInt(3), isolate), BinaryOperationFeedback::kAny}, + {Token::Value::BIT_OR, + ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, + Handle<Smi>(Smi::FromInt(3), isolate), BinaryOperationFeedback::kAny}, // BIT_AND - {Token::Value::BIT_AND, Handle<Smi>(Smi::FromInt(3), isolate), 1, + {Token::Value::BIT_AND, ast_factory.NewSmi(3), 1, Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::BIT_AND, isolate->factory()->NewHeapNumber(3.1415), 2, + {Token::Value::BIT_AND, ast_factory.NewNumber(3.1415), 2, Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kNumber}, {Token::Value::BIT_AND, - isolate->factory()->NewStringFromAsciiChecked("2"), 1, + ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny}, // SHL - {Token::Value::SHL, Handle<Smi>(Smi::FromInt(3), isolate), 1, + {Token::Value::SHL, ast_factory.NewSmi(3), 1, Handle<Smi>(Smi::FromInt(6), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::SHL, isolate->factory()->NewHeapNumber(3.1415), 2, + {Token::Value::SHL, ast_factory.NewNumber(3.1415), 2, Handle<Smi>(Smi::FromInt(12), isolate), BinaryOperationFeedback::kNumber}, - {Token::Value::SHL, isolate->factory()->NewStringFromAsciiChecked("2"), 1, + {Token::Value::SHL, + ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, Handle<Smi>(Smi::FromInt(4), isolate), BinaryOperationFeedback::kAny}, // SAR - {Token::Value::SAR, Handle<Smi>(Smi::FromInt(3), isolate), 1, + {Token::Value::SAR, ast_factory.NewSmi(3), 1, Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kSignedSmall}, - {Token::Value::SAR, isolate->factory()->NewHeapNumber(3.1415), 2, + {Token::Value::SAR, ast_factory.NewNumber(3.1415), 2, Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kNumber}, - {Token::Value::SAR, isolate->factory()->NewStringFromAsciiChecked("2"), 1, + {Token::Value::SAR, + ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}}; for (const BinaryOpExpectation& test_case : kTestCases) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSpec feedback_spec(zone); + i::FeedbackSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - i::NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + i::NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0); builder.LoadLiteral(test_case.arg1) @@ -762,13 +786,14 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { .BinaryOperation(test_case.op, reg, GetIndex(slot0)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); - Object* feedback0 = vector->Get(slot0); + Object* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value()); CHECK(Object::Equals(test_case.result, return_val).ToChecked()); @@ -778,7 +803,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { TEST(InterpreterUnaryOpFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); Handle<Smi> smi_one = Handle<Smi>(Smi::FromInt(1), isolate); Handle<Smi> smi_max = Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate); @@ -797,16 +822,16 @@ TEST(InterpreterUnaryOpFeedback) { {Token::Value::ADD, smi_one, smi_max, number, str}, {Token::Value::SUB, smi_one, smi_min, number, str}}; for (TestCase const& test_case : kTestCases) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 4, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 4, 0, 0); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); - i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); - i::FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); - i::FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSpec feedback_spec(zone); + i::FeedbackSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - i::NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + i::NewFeedbackMetadata(isolate, &feedback_spec); builder.LoadAccumulatorWithRegister(builder.Parameter(0)) .CountOperation(test_case.op, GetIndex(slot0)) @@ -820,7 +845,7 @@ TEST(InterpreterUnaryOpFeedback) { Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); typedef Handle<Object> H; auto callable = tester.GetCallable<H, H, H, H>(); @@ -830,22 +855,22 @@ TEST(InterpreterUnaryOpFeedback) { test_case.number_feedback_value, test_case.any_feedback_value) .ToHandleChecked(); USE(return_val); - Object* feedback0 = vector->Get(slot0); + Object* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kSignedSmall, static_cast<Smi*>(feedback0)->value()); - Object* feedback1 = vector->Get(slot1); + Object* feedback1 = callable.vector()->Get(slot1); CHECK(feedback1->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kNumber, static_cast<Smi*>(feedback1)->value()); - Object* feedback2 = vector->Get(slot2); + Object* feedback2 = callable.vector()->Get(slot2); CHECK(feedback2->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kNumber, static_cast<Smi*>(feedback2)->value()); - Object* feedback3 = vector->Get(slot3); + Object* feedback3 = callable.vector()->Get(slot3); CHECK(feedback3->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kAny, static_cast<Smi*>(feedback3)->value()); @@ -855,21 +880,21 @@ TEST(InterpreterUnaryOpFeedback) { TEST(InterpreterBitwiseTypeFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); 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}; for (Token::Value op : kBitwiseBinaryOperators) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 4, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 4, 0, 0); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); - i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); - i::FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSpec feedback_spec(zone); + i::FeedbackSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - i::NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + i::NewFeedbackMetadata(isolate, &feedback_spec); builder.LoadAccumulatorWithRegister(builder.Parameter(0)) .BinaryOperation(op, builder.Parameter(1), GetIndex(slot0)) @@ -879,7 +904,7 @@ TEST(InterpreterBitwiseTypeFeedback) { Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); typedef Handle<Object> H; auto callable = tester.GetCallable<H, H, H, H>(); @@ -891,17 +916,17 @@ TEST(InterpreterBitwiseTypeFeedback) { Handle<Object> return_val = callable(arg1, arg2, arg3, arg4).ToHandleChecked(); USE(return_val); - Object* feedback0 = vector->Get(slot0); + Object* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kSignedSmall, static_cast<Smi*>(feedback0)->value()); - Object* feedback1 = vector->Get(slot1); + Object* feedback1 = callable.vector()->Get(slot1); CHECK(feedback1->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kNumber, static_cast<Smi*>(feedback1)->value()); - Object* feedback2 = vector->Get(slot2); + Object* feedback2 = callable.vector()->Get(slot2); CHECK(feedback2->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kAny, static_cast<Smi*>(feedback2)->value()); @@ -911,7 +936,8 @@ TEST(InterpreterBitwiseTypeFeedback) { TEST(InterpreterParameter1Assign) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadLiteral(Smi::FromInt(5)) .StoreAccumulatorInRegister(builder.Parameter(0)) @@ -1030,25 +1056,26 @@ TEST(InterpreterStoreUnallocated) { TEST(InterpreterLoadNamedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddLoadICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); - Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); - name = factory->string_table()->LookupString(isolate, name); + const AstRawString* name = ast_factory.GetOneByteString("val"); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadNamedProperty(builder.Parameter(0), name, GetIndex(slot)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); @@ -1083,26 +1110,27 @@ TEST(InterpreterLoadNamedProperty) { TEST(InterpreterLoadKeyedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddKeyedLoadICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); - Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); - key = factory->string_table()->LookupString(isolate, key); + const AstRawString* key = ast_factory.GetOneByteString("key"); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); builder.LoadLiteral(key) .LoadKeyedProperty(builder.Parameter(0), GetIndex(slot)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject("({ key : 123 })"); @@ -1125,44 +1153,48 @@ TEST(InterpreterLoadKeyedProperty) { TEST(InterpreterStoreNamedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddStoreICSlot(SLOPPY); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); - Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); - name = factory->string_table()->LookupString(isolate, name); + const AstRawString* name = ast_factory.GetOneByteString("val"); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 0); builder.LoadLiteral(Smi::FromInt(999)) .StoreNamedProperty(builder.Parameter(0), name, GetIndex(slot), STRICT) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); // Test IC miss. Handle<Object> result; callable(object).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); // Test transition to monomorphic IC. callable(object).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); // Test transition to polymorphic IC. Handle<Object> object2 = InterpreterTester::NewObject("({ val : 456, other : 123 })"); callable(object2).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object2, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object2, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); // Test transition to megamorphic IC. @@ -1175,7 +1207,8 @@ TEST(InterpreterStoreNamedProperty) { Handle<Object> object5 = InterpreterTester::NewObject("({ val : 789, val4 : 123 })"); callable(object5).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object5, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object5, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); } @@ -1183,19 +1216,19 @@ TEST(InterpreterStoreNamedProperty) { TEST(InterpreterStoreKeyedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddKeyedStoreICSlot(SLOPPY); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); - Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); - name = factory->string_table()->LookupString(isolate, name); + const AstRawString* name = ast_factory.GetOneByteString("val"); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); builder.LoadLiteral(name) .StoreAccumulatorInRegister(Register(0)) @@ -1203,52 +1236,57 @@ TEST(InterpreterStoreKeyedProperty) { .StoreKeyedProperty(builder.Parameter(0), Register(0), GetIndex(slot), i::SLOPPY) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); // Test IC miss. Handle<Object> result; callable(object).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); // Test transition to monomorphic IC. callable(object).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); // Test transition to megamorphic IC. Handle<Object> object2 = InterpreterTester::NewObject("({ val : 456, other : 123 })"); callable(object2).ToHandleChecked(); - CHECK(Runtime::GetObjectProperty(isolate, object2, name).ToHandle(&result)); + CHECK(Runtime::GetObjectProperty(isolate, object2, name->string()) + .ToHandle(&result)); CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); } static void TestInterpreterCall(TailCallMode tail_call_mode) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); - FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddLoadICSlot(); + FeedbackSlot call_slot = feedback_spec.AddCallICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); int slot_index = GetIndex(slot); int call_slot_index = -1; call_slot_index = GetIndex(call_slot); - Handle<i::String> name = factory->NewStringFromAsciiChecked("func"); - name = factory->string_table()->LookupString(isolate, name); + const AstRawString* name = ast_factory.GetOneByteString("func"); // Check with no args. { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); Register reg = builder.register_allocator()->NewRegister(); RegisterList args = builder.register_allocator()->NewRegisterList(1); builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) @@ -1258,9 +1296,10 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -1271,7 +1310,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check that receiver is passed properly. { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); Register reg = builder.register_allocator()->NewRegister(); RegisterList args = builder.register_allocator()->NewRegisterList(1); builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) @@ -1279,9 +1318,10 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .MoveRegister(builder.Parameter(0), args[0]); builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -1295,7 +1335,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with two parameters (+ receiver). { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 4); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 4); Register reg = builder.register_allocator()->NewRegister(); RegisterList args = builder.register_allocator()->NewRegisterList(3); @@ -1312,9 +1352,10 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -1327,7 +1368,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with 10 parameters (+ receiver). { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 12); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 12); Register reg = builder.register_allocator()->NewRegister(); RegisterList args = builder.register_allocator()->NewRegisterList(11); @@ -1335,34 +1376,35 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .StoreAccumulatorInRegister(reg) .LoadAccumulatorWithRegister(builder.Parameter(0)) .StoreAccumulatorInRegister(args[0]) - .LoadLiteral(factory->NewStringFromAsciiChecked("a")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("a"))) .StoreAccumulatorInRegister(args[1]) - .LoadLiteral(factory->NewStringFromAsciiChecked("b")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("b"))) .StoreAccumulatorInRegister(args[2]) - .LoadLiteral(factory->NewStringFromAsciiChecked("c")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("c"))) .StoreAccumulatorInRegister(args[3]) - .LoadLiteral(factory->NewStringFromAsciiChecked("d")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("d"))) .StoreAccumulatorInRegister(args[4]) - .LoadLiteral(factory->NewStringFromAsciiChecked("e")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("e"))) .StoreAccumulatorInRegister(args[5]) - .LoadLiteral(factory->NewStringFromAsciiChecked("f")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("f"))) .StoreAccumulatorInRegister(args[6]) - .LoadLiteral(factory->NewStringFromAsciiChecked("g")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("g"))) .StoreAccumulatorInRegister(args[7]) - .LoadLiteral(factory->NewStringFromAsciiChecked("h")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("h"))) .StoreAccumulatorInRegister(args[8]) - .LoadLiteral(factory->NewStringFromAsciiChecked("i")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("i"))) .StoreAccumulatorInRegister(args[9]) - .LoadLiteral(factory->NewStringFromAsciiChecked("j")) + .LoadLiteral(ast_factory.NewString(ast_factory.GetOneByteString("j"))) .StoreAccumulatorInRegister(args[10]); builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -1407,16 +1449,16 @@ static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder, TEST(InterpreterJumps) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 2); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0), scratch(1); BytecodeLabel label[3]; @@ -1435,7 +1477,7 @@ TEST(InterpreterJumps) { .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 7); @@ -1445,18 +1487,18 @@ TEST(InterpreterJumps) { TEST(InterpreterConditionalJumps) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 2); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0), scratch(1); BytecodeLabel label[2]; @@ -1485,7 +1527,7 @@ TEST(InterpreterConditionalJumps) { .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 7); @@ -1495,18 +1537,18 @@ 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_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 2); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); - FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0), scratch(1); BytecodeLabel label[2]; @@ -1535,7 +1577,7 @@ TEST(InterpreterConditionalJumps2) { .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 7); @@ -1544,14 +1586,15 @@ TEST(InterpreterConditionalJumps2) { TEST(InterpreterJumpConstantWith16BitOperand) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 257); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 257); - Zone zone(isolate->allocator(), ZONE_NAME); - - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register reg(0), scratch(256); BytecodeLabel done, fake; @@ -1560,7 +1603,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { builder.StoreAccumulatorInRegister(reg); // Consume all 8-bit operands for (int i = 1; i <= 256; i++) { - builder.LoadLiteral(isolate->factory()->NewNumber(i)); + builder.LoadLiteral(ast_factory.NewNumber(i + 0.5)); builder.BinaryOperation(Token::Value::ADD, reg, GetIndex(slot)); builder.StoreAccumulatorInRegister(reg); } @@ -1579,6 +1622,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { builder.LoadAccumulatorWithRegister(reg); builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); BytecodeArrayIterator iterator(bytecode_array); @@ -1593,31 +1637,38 @@ TEST(InterpreterJumpConstantWith16BitOperand) { } CHECK(found_16bit_constant_jump); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); - CHECK_EQ(Smi::cast(*return_value)->value(), 256.0 / 2 * (1 + 256)); + CHECK_EQ(Handle<HeapNumber>::cast(return_value)->value(), + 256.0 / 2 * (1.5 + 256.5)); } TEST(InterpreterJumpWith32BitOperand) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 1); Register reg(0); BytecodeLabel done; builder.LoadLiteral(Smi::kZero); builder.StoreAccumulatorInRegister(reg); - // Consume all 16-bit constant pool entries + // Consume all 16-bit constant pool entries. Make sure to use doubles so that + // the jump can't re-use an integer. for (int i = 1; i <= 65536; i++) { - builder.LoadLiteral(isolate->factory()->NewNumber(i)); + builder.LoadLiteral(ast_factory.NewNumber(i + 0.5)); } builder.Jump(&done); builder.LoadLiteral(Smi::kZero); builder.Bind(&done); builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + BytecodeArrayIterator iterator(bytecode_array); bool found_32bit_jump = false; @@ -1634,7 +1685,7 @@ TEST(InterpreterJumpWith32BitOperand) { InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); - CHECK_EQ(Smi::cast(*return_value)->value(), 65536.0); + CHECK_EQ(Handle<HeapNumber>::cast(return_value)->value(), 65536.5); } static const Token::Value kComparisonTypes[] = { @@ -1691,13 +1742,13 @@ TEST(InterpreterSmiComparisons) { for (size_t j = 0; j < arraysize(inputs); j++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 1); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register r0(0); builder.LoadLiteral(Smi::FromInt(inputs[i])) @@ -1707,13 +1758,13 @@ TEST(InterpreterSmiComparisons) { .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, inputs[i], inputs[j])); - Object* feedback = vector->Get(slot); + Object* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); CHECK_EQ(CompareOperationFeedback::kSignedSmall, static_cast<Smi*>(feedback)->value()); @@ -1737,30 +1788,33 @@ TEST(InterpreterHeapNumberComparisons) { for (size_t j = 0; j < arraysize(inputs); j++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 1); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); Register r0(0); - builder.LoadLiteral(factory->NewHeapNumber(inputs[i])) + builder.LoadLiteral(ast_factory.NewNumber(inputs[i])) .StoreAccumulatorInRegister(r0) - .LoadLiteral(factory->NewHeapNumber(inputs[j])) + .LoadLiteral(ast_factory.NewNumber(inputs[j])) .CompareOperation(comparison, r0, GetIndex(slot)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, inputs[i], inputs[j])); - Object* feedback = vector->Get(slot); + Object* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); CHECK_EQ(CompareOperationFeedback::kNumber, static_cast<Smi*>(feedback)->value()); @@ -1773,8 +1827,7 @@ TEST(InterpreterHeapNumberComparisons) { TEST(InterpreterStringComparisons) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - Zone zone(isolate->allocator(), ZONE_NAME); + Zone* zone = handles.main_zone(); std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; @@ -1782,31 +1835,35 @@ TEST(InterpreterStringComparisons) { Token::Value comparison = kComparisonTypes[c]; for (size_t i = 0; i < arraysize(inputs); i++) { for (size_t j = 0; j < arraysize(inputs); j++) { + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + CanonicalHandleScope canonical(isolate); const char* lhs = inputs[i].c_str(); const char* rhs = inputs[j].c_str(); - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 1); Register r0(0); - builder.LoadLiteral(factory->InternalizeUtf8String(lhs)) + builder.LoadLiteral(ast_factory.GetOneByteString(lhs)) .StoreAccumulatorInRegister(r0) - .LoadLiteral(factory->InternalizeUtf8String(rhs)) + .LoadLiteral(ast_factory.GetOneByteString(rhs)) .CompareOperation(comparison, r0, GetIndex(slot)) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, inputs[i], inputs[j])); - Object* feedback = vector->Get(slot); + Object* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); int const expected_feedback = Token::IsOrderedRelationalCompareOp(comparison) @@ -1818,6 +1875,19 @@ TEST(InterpreterStringComparisons) { } } +static void LoadStringAndAddSpace(BytecodeArrayBuilder* builder, + AstValueFactory* ast_factory, + const char* cstr, + FeedbackSlot string_add_slot) { + Register string_reg = builder->register_allocator()->NewRegister(); + + (*builder) + .LoadLiteral(ast_factory->NewString(ast_factory->GetOneByteString(cstr))) + .StoreAccumulatorInRegister(string_reg) + .LoadLiteral(ast_factory->NewString(ast_factory->GetOneByteString(" "))) + .BinaryOperation(Token::Value::ADD, string_reg, + GetIndex(string_add_slot)); +} TEST(InterpreterMixedComparisons) { // This test compares a HeapNumber with a String. The latter is @@ -1828,59 +1898,104 @@ TEST(InterpreterMixedComparisons) { UnicodeCache unicode_cache; + enum WhichSideString { kLhsIsString, kRhsIsString }; + + enum StringType { kInternalizedStringConstant, kComputedString }; + for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { Token::Value comparison = kComparisonTypes[c]; for (size_t i = 0; i < arraysize(inputs); i++) { for (size_t j = 0; j < arraysize(inputs); j++) { - for (int pass = 0; pass < 2; pass++) { - const char* lhs_cstr = inputs[i]; - const char* rhs_cstr = inputs[j]; - double lhs = StringToDouble(&unicode_cache, lhs_cstr, - ConversionFlags::NO_FLAGS); - double rhs = StringToDouble(&unicode_cache, rhs_cstr, - ConversionFlags::NO_FLAGS); - HandleAndZoneScope handles; - Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); - Zone zone(isolate->allocator(), ZONE_NAME); - - FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); - Handle<i::FeedbackVector> vector = - NewFeedbackVector(isolate, &feedback_spec); - - Register r0(0); - if (pass == 0) { - // Comparison with HeapNumber on the lhs and String on the rhs - builder.LoadLiteral(factory->NewNumber(lhs)) - .StoreAccumulatorInRegister(r0) - .LoadLiteral(factory->NewStringFromAsciiChecked(rhs_cstr)) - .CompareOperation(comparison, r0, GetIndex(slot)) - .Return(); - } else { - // Comparison with HeapNumber on the rhs and String on the lhs - builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs_cstr)) - .StoreAccumulatorInRegister(r0) - .LoadLiteral(factory->NewNumber(rhs)) - .CompareOperation(comparison, r0, GetIndex(slot)) + // We test the case where either the lhs or the rhs is a string... + for (WhichSideString which_side : {kLhsIsString, kRhsIsString}) { + // ... and the case when the string is internalized or computed. + for (StringType string_type : + {kInternalizedStringConstant, kComputedString}) { + const char* lhs_cstr = inputs[i]; + const char* rhs_cstr = inputs[j]; + double lhs = StringToDouble(&unicode_cache, lhs_cstr, + ConversionFlags::NO_FLAGS); + double rhs = StringToDouble(&unicode_cache, rhs_cstr, + ConversionFlags::NO_FLAGS); + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 0); + + FeedbackVectorSpec feedback_spec(zone); + FeedbackSlot string_add_slot = + feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); + + // lhs is in a register, rhs is in the accumulator. + Register lhs_reg = builder.register_allocator()->NewRegister(); + + if (which_side == kRhsIsString) { + // Comparison with HeapNumber on the lhs and String on the rhs. + + builder.LoadLiteral(ast_factory.NewNumber(lhs)) + .StoreAccumulatorInRegister(lhs_reg); + + if (string_type == kInternalizedStringConstant) { + // rhs string is internalized. + builder.LoadLiteral(ast_factory.NewString( + ast_factory.GetOneByteString(rhs_cstr))); + } else { + CHECK_EQ(string_type, kComputedString); + // rhs string is not internalized (append a space to the end). + LoadStringAndAddSpace(&builder, &ast_factory, rhs_cstr, + string_add_slot); + } + break; + } else { + CHECK_EQ(which_side, kLhsIsString); + // Comparison with String on the lhs and HeapNumber on the rhs. + + if (string_type == kInternalizedStringConstant) { + // lhs string is internalized + builder.LoadLiteral(ast_factory.NewString( + ast_factory.GetOneByteString(lhs_cstr))); + } else { + CHECK_EQ(string_type, kComputedString); + // lhs string is not internalized (append a space to the end). + LoadStringAndAddSpace(&builder, &ast_factory, lhs_cstr, + string_add_slot); + } + builder.StoreAccumulatorInRegister(lhs_reg); + + builder.LoadLiteral(ast_factory.NewNumber(rhs)); + } + + builder.CompareOperation(comparison, lhs_reg, GetIndex(slot)) .Return(); - } - Handle<BytecodeArray> bytecode_array = - builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array, vector); - auto callable = tester.GetCallable<>(); - Handle<Object> return_value = callable().ToHandleChecked(); - CHECK(return_value->IsBoolean()); - CHECK_EQ(return_value->BooleanValue(), - CompareC(comparison, lhs, rhs, true)); - Object* feedback = vector->Get(slot); - CHECK(feedback->IsSmi()); - // kNumber | kString gets converted to CompareOperationHint::kAny. - int expected_feedback = CompareOperationFeedback::kNumber | - CompareOperationFeedback::kString; - CHECK_EQ(expected_feedback, static_cast<Smi*>(feedback)->value()); + ast_factory.Internalize(isolate); + Handle<BytecodeArray> bytecode_array = + builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array, metadata); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->IsBoolean()); + CHECK_EQ(return_value->BooleanValue(), + CompareC(comparison, lhs, rhs, true)); + Object* feedback = callable.vector()->Get(slot); + CHECK(feedback->IsSmi()); + int expected_feedback = CompareOperationFeedback::kNumber; + if (string_type == kInternalizedStringConstant && + !Token::IsOrderedRelationalCompareOp(comparison)) { + // Non-ordering compares (i.e. equality/strict equality) have + // special type feedback specifically for internalized strings. + expected_feedback |= + CompareOperationFeedback::kInternalizedString; + } else { + expected_feedback |= CompareOperationFeedback::kString; + } + CHECK_EQ(expected_feedback, static_cast<Smi*>(feedback)->value()); + } } } } @@ -1962,6 +2077,7 @@ TEST(InterpreterStrictNotEqual) { TEST(InterpreterInstanceOf) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); Handle<i::String> name = factory->NewStringFromAsciiChecked("cons"); Handle<i::JSFunction> func = factory->NewFunction(name); @@ -1970,12 +2086,16 @@ TEST(InterpreterInstanceOf) { Handle<i::Object> cases[] = {Handle<i::Object>::cast(instance), other}; for (size_t i = 0; i < arraysize(cases); i++) { bool expected_value = (i == 0); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 1); Register r0(0); - builder.LoadLiteral(cases[i]); - builder.StoreAccumulatorInRegister(r0) - .LoadLiteral(func) + size_t case_entry = builder.AllocateDeferredConstantPoolEntry(); + builder.SetDeferredConstantPoolEntry(case_entry, cases[i]); + builder.LoadConstantPoolEntry(case_entry).StoreAccumulatorInRegister(r0); + + size_t func_entry = builder.AllocateDeferredConstantPoolEntry(); + builder.SetDeferredConstantPoolEntry(func_entry, func); + builder.LoadConstantPoolEntry(func_entry) .CompareOperation(Token::Value::INSTANCEOF, r0, 0) .Return(); @@ -1992,7 +2112,10 @@ TEST(InterpreterInstanceOf) { TEST(InterpreterTestIn) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); Factory* factory = isolate->factory(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); // Allocate an array Handle<i::JSArray> array = factory->NewJSArray(0, i::ElementsKind::FAST_SMI_ELEMENTS); @@ -2000,15 +2123,19 @@ TEST(InterpreterTestIn) { const char* properties[] = {"length", "fuzzle", "x", "0"}; for (size_t i = 0; i < arraysize(properties); i++) { bool expected_value = (i == 0); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 1); Register r0(0); - builder.LoadLiteral(factory->NewStringFromAsciiChecked(properties[i])) - .StoreAccumulatorInRegister(r0) - .LoadLiteral(Handle<Object>::cast(array)) + builder.LoadLiteral(ast_factory.GetOneByteString(properties[i])) + .StoreAccumulatorInRegister(r0); + + size_t array_entry = builder.AllocateDeferredConstantPoolEntry(); + builder.SetDeferredConstantPoolEntry(array_entry, array); + builder.LoadConstantPoolEntry(array_entry) .CompareOperation(Token::Value::IN, r0, 0) .Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); @@ -2022,9 +2149,10 @@ TEST(InterpreterTestIn) { TEST(InterpreterUnaryNot) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); for (size_t i = 1; i < 10; i++) { bool expected_value = ((i & 1) == 1); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 0); Register r0(0); builder.LoadFalse(); @@ -2042,56 +2170,34 @@ TEST(InterpreterUnaryNot) { } -static void LoadAny(BytecodeArrayBuilder* builder, - v8::internal::Factory* factory, Handle<Object> obj) { - if (obj->IsOddball()) { - if (obj->SameValue(*factory->true_value())) { - builder->LoadTrue(); - } else if (obj->SameValue(*factory->false_value())) { - builder->LoadFalse(); - } else if (obj->SameValue(*factory->the_hole_value())) { - builder->LoadTheHole(); - } else if (obj->SameValue(*factory->null_value())) { - builder->LoadNull(); - } else if (obj->SameValue(*factory->undefined_value())) { - builder->LoadUndefined(); - } else { - UNREACHABLE(); - } - } else if (obj->IsSmi()) { - builder->LoadLiteral(*Handle<Smi>::cast(obj)); - } else { - builder->LoadLiteral(obj); - } -} - - TEST(InterpreterUnaryNotNonBoolean) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - - std::pair<Handle<Object>, bool> object_type_tuples[] = { - std::make_pair(factory->undefined_value(), true), - std::make_pair(factory->null_value(), true), - std::make_pair(factory->false_value(), true), - std::make_pair(factory->true_value(), false), - std::make_pair(factory->NewNumber(9.1), false), - std::make_pair(factory->NewNumberFromInt(0), true), - std::make_pair( - Handle<Object>::cast(factory->NewStringFromStaticChars("hello")), - false), + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + + std::pair<const AstValue*, bool> object_type_tuples[] = { + std::make_pair(ast_factory.NewUndefined(), true), + std::make_pair(ast_factory.NewNull(), true), + std::make_pair(ast_factory.NewBoolean(false), true), + std::make_pair(ast_factory.NewBoolean(true), false), + std::make_pair(ast_factory.NewNumber(9.1), false), + std::make_pair(ast_factory.NewNumber(0), true), std::make_pair( - Handle<Object>::cast(factory->NewStringFromStaticChars("")), true), + ast_factory.NewString(ast_factory.GetOneByteString("hello")), false), + std::make_pair(ast_factory.NewString(ast_factory.GetOneByteString("")), + true), }; for (size_t i = 0; i < arraysize(object_type_tuples); i++) { - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 0); + BytecodeArrayBuilder builder(isolate, zone, 0, 0, 0); Register r0(0); - LoadAny(&builder, factory, object_type_tuples[i].first); + builder.LoadLiteral(object_type_tuples[i].first); builder.LogicalNot(); builder.Return(); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); @@ -2133,8 +2239,9 @@ TEST(InterpreterTypeof) { TEST(InterpreterCallRuntime) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 2); RegisterList args = builder.register_allocator()->NewRegisterList(2); builder.LoadLiteral(Smi::FromInt(15)) @@ -2155,8 +2262,9 @@ TEST(InterpreterCallRuntime) { TEST(InterpreterInvokeIntrinsic) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); - BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); + BytecodeArrayBuilder builder(isolate, zone, 1, 0, 2); builder.LoadLiteral(Smi::FromInt(15)) .StoreAccumulatorInRegister(Register(0)) diff --git a/deps/v8/test/cctest/parsing/test-preparser.cc b/deps/v8/test/cctest/parsing/test-preparser.cc new file mode 100644 index 0000000000..cb86d4f900 --- /dev/null +++ b/deps/v8/test/cctest/parsing/test-preparser.cc @@ -0,0 +1,567 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/ast/ast.h" +#include "src/compiler.h" +#include "src/objects-inl.h" +#include "src/parsing/parse-info.h" +#include "src/parsing/parsing.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/scope-test-helper.h" +#include "test/cctest/unicode-helpers.h" + +namespace { + +enum SkipStrict { + DONT_SKIP = 0, + // Skip if the test function declares itself strict, otherwise don't skip. + SKIP_STRICT_FUNCTION = 1, + // Skip if there's a "use strict" directive above the test. + SKIP_STRICT_OUTER = 1 << 1, + SKIP_STRICT = SKIP_STRICT_FUNCTION | SKIP_STRICT_OUTER +}; + +} // namespace + +TEST(PreParserScopeAnalysis) { + i::FLAG_lazy_inner_functions = true; + i::FLAG_preparser_scope_analysis = true; + i::Isolate* isolate = CcTest::i_isolate(); + i::Factory* factory = isolate->factory(); + i::HandleScope scope(isolate); + LocalContext env; + + /* Test the following cases: + 1) + (function outer() { + function test() { ... } + })(); + against: + (function outer() { + (function test() { ... })(); + })(); + + 2) + (function outer() { + function inner() { function test() { ... } } + })(); + against: + (function outer() { + (function inner() { function test() { ... } })(); + })(); + (Modified function is deeper inside the laziness boundary.) + + 3) + (function outer() { + function inner() { () => { ... } } + })(); + against: + (function outer() { + (function inner() { () => { ... } })(); + })(); + + Inner arrow functions are never lazy, so the corresponding case is missing. + */ + + struct { + const char* prefix; + const char* suffix; + const char* lazy_inner; + const char* eager_inner; + bool strict_outer; + bool strict_test_function; + } outers[] = { + // The scope start positions must match; note the extra space in + // lazy_inner. + {"(function outer() { ", "})();", " function test(%s) { %s }", + "(function test(%s) { %s })()", false, false}, + {"(function outer() { ", "})();", + " function inner() { function test(%s) { %s } }", + "(function inner() { function test(%s) { %s } })()", false, false}, + // FIXME(marja): enable test for arrow functions once it passes. + // {"(function outer() { ", "})();", + // " function inner() { (%s) => { %s } }", + // "(function inner() { (%s) => { %s } })()", false}, + {"(function outer() { 'use strict'; ", "})();", + " function test(%s) { %s }", "(function test(%s) { %s })()", true, + false}, + {"(function outer() { 'use strict'; ", "})();", + " function inner() { function test(%s) { %s } }", + "(function inner() { function test(%s) { %s } })()", true, false}, + {"(function outer() { ", "})();", + " function test(%s) { 'use strict'; %s }", + "(function test(%s) { 'use strict'; %s })()", false, true}, + {"(function outer() { ", "})();", + " function inner() { function test(%s) { 'use strict'; %s } }", + "(function inner() { function test(%s) { 'use strict'; %s } })()", false, + true}, + }; + + struct Inner { + Inner(const char* s) : source(s) {} // NOLINT + Inner(const char* s, SkipStrict skip) + : source(s), skip_in_strict_mode(skip) {} + Inner(const char* s, SkipStrict skip, bool precise) + : source(s), + skip_in_strict_mode(skip), + precise_maybe_assigned(precise) {} + + Inner(const char* p, const char* s) : params(p), source(s) {} + Inner(const char* p, const char* s, SkipStrict skip) + : params(p), source(s), skip_in_strict_mode(skip) {} + Inner(const char* p, const char* s, SkipStrict skip, bool precise) + : params(p), + source(s), + skip_in_strict_mode(skip), + precise_maybe_assigned(precise) {} + + const char* params = ""; + const char* source; + SkipStrict skip_in_strict_mode = DONT_SKIP; + bool precise_maybe_assigned = true; + } inners[] = { + // Simple cases + {"var1;"}, + {"var1 = 5;"}, + {"if (true) {}"}, + {"function f1() {}"}, + + // Var declarations and assignments. + {"var var1;"}, + {"var var1; var1 = 5;"}, + {"if (true) { var var1; }", DONT_SKIP, false}, + {"if (true) { var var1; var1 = 5; }"}, + {"var var1; function f() { var1; }"}, + {"var var1; var1 = 5; function f() { var1; }"}, + {"var var1; function f() { var1 = 5; }"}, + + // Let declarations and assignments. + {"let var1;"}, + {"let var1; var1 = 5;"}, + {"if (true) { let var1; }"}, + {"if (true) { let var1; var1 = 5; }"}, + {"let var1; function f() { var1; }"}, + {"let var1; var1 = 5; function f() { var1; }"}, + {"let var1; function f() { var1 = 5; }"}, + + // Const declarations. + {"const var1 = 5;"}, + {"if (true) { const var1 = 5; }"}, + {"const var1 = 5; function f() { var1; }"}, + + // Redeclarations. + {"var var1; var var1;"}, + {"var var1; var var1; var1 = 5;"}, + {"var var1; if (true) { var var1; }"}, + {"if (true) { var var1; var var1; }"}, + {"var var1; if (true) { var var1; var1 = 5; }"}, + {"if (true) { var var1; var var1; var1 = 5; }"}, + {"var var1; var var1; function f() { var1; }"}, + {"var var1; var var1; function f() { var1 = 5; }"}, + + // Shadowing declarations. + {"var var1; if (true) { var var1; }"}, + {"var var1; if (true) { let var1; }"}, + {"let var1; if (true) { let var1; }"}, + + {"var var1; if (true) { const var1 = 0; }"}, + {"const var1 = 0; if (true) { const var1 = 0; }"}, + + // Variables deeper in the subscopes (scopes without variables inbetween). + {"if (true) { if (true) { function f() { var var1 = 5; } } }"}, + + // Arguments and this. + {"arguments;"}, + {"arguments = 5;", SKIP_STRICT}, + {"if (true) { arguments; }"}, + {"if (true) { arguments = 5; }", SKIP_STRICT}, + + {"this;"}, + {"if (true) { this; }"}, + + // Variable called "arguments" + {"var arguments;", SKIP_STRICT}, + {"var arguments; arguments = 5;", SKIP_STRICT}, + {"if (true) { var arguments; }", SKIP_STRICT, false}, + {"if (true) { var arguments; arguments = 5; }", SKIP_STRICT}, + {"var arguments; function f() { arguments; }", SKIP_STRICT}, + {"var arguments; arguments = 5; function f() { arguments; }", + SKIP_STRICT}, + {"var arguments; function f() { arguments = 5; }", SKIP_STRICT}, + + {"let arguments;", SKIP_STRICT}, + {"let arguments; arguments = 5;", SKIP_STRICT}, + {"if (true) { let arguments; }", SKIP_STRICT}, + {"if (true) { let arguments; arguments = 5; }", SKIP_STRICT}, + {"let arguments; function f() { arguments; }", SKIP_STRICT}, + {"let arguments; arguments = 5; function f() { arguments; }", + SKIP_STRICT}, + {"let arguments; function f() { arguments = 5; }", SKIP_STRICT}, + + {"const arguments = 5;", SKIP_STRICT}, + {"if (true) { const arguments = 5; }", SKIP_STRICT}, + {"const arguments = 5; function f() { arguments; }", SKIP_STRICT}, + + // Destructuring declarations. + {"var [var1, var2] = [1, 2];"}, + {"var [var1, var2, [var3, var4]] = [1, 2, [3, 4]];"}, + {"var [{var1: var2}, {var3: var4}] = [{var1: 1}, {var3: 2}];"}, + {"var [var1, ...var2] = [1, 2, 3];"}, + + {"var {var1: var2, var3: var4} = {var1: 1, var3: 2};"}, + {"var {var1: var2, var3: {var4: var5}} = {var1: 1, var3: {var4: 2}};"}, + {"var {var1: var2, var3: [var4, var5]} = {var1: 1, var3: [2, 3]};"}, + + {"let [var1, var2] = [1, 2];"}, + {"let [var1, var2, [var3, var4]] = [1, 2, [3, 4]];"}, + {"let [{var1: var2}, {var3: var4}] = [{var1: 1}, {var3: 2}];"}, + {"let [var1, ...var2] = [1, 2, 3];"}, + + {"let {var1: var2, var3: var4} = {var1: 1, var3: 2};"}, + {"let {var1: var2, var3: {var4: var5}} = {var1: 1, var3: {var4: 2}};"}, + {"let {var1: var2, var3: [var4, var5]} = {var1: 1, var3: [2, 3]};"}, + + {"const [var1, var2] = [1, 2];"}, + {"const [var1, var2, [var3, var4]] = [1, 2, [3, 4]];"}, + {"const [{var1: var2}, {var3: var4}] = [{var1: 1}, {var3: 2}];"}, + {"const [var1, ...var2] = [1, 2, 3];"}, + + {"const {var1: var2, var3: var4} = {var1: 1, var3: 2};"}, + {"const {var1: var2, var3: {var4: var5}} = {var1: 1, var3: {var4: 2}};"}, + {"const {var1: var2, var3: [var4, var5]} = {var1: 1, var3: [2, 3]};"}, + + // Referencing the function variable. + {"test;"}, + {"function f1() { f1; }"}, + {"function f1() { function f2() { f1; } }"}, + {"function arguments() {}", SKIP_STRICT}, + {"function f1() {} function f1() {}", SKIP_STRICT}, + {"var f1; function f1() {}"}, + + // Assigning to the function variable. + {"test = 3;"}, + {"function f1() { f1 = 3; }"}, + {"function f1() { f1; } f1 = 3;"}, + {"function arguments() {} arguments = 8;", SKIP_STRICT}, + {"function f1() {} f1 = 3; function f1() {}", SKIP_STRICT}, + + // Evals. + {"var var1; eval('');"}, + {"var var1; function f1() { eval(''); }"}, + {"let var1; eval('');"}, + {"let var1; function f1() { eval(''); }"}, + {"const var1 = 10; eval('');"}, + {"const var1 = 10; function f1() { eval(''); }"}, + + // Standard for loops. + {"for (var var1 = 0; var1 < 10; ++var1) { }"}, + {"for (let var1 = 0; var1 < 10; ++var1) { }"}, + {"for (const var1 = 0; var1 < 10; ++var1) { }"}, + + {"for (var var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"}, + {"for (let var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"}, + {"for (const var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"}, + + // For of loops + {"for (var1 of [1, 2]) { }"}, + {"for (var var1 of [1, 2]) { }"}, + {"for (let var1 of [1, 2]) { }"}, + {"for (const var1 of [1, 2]) { }"}, + + {"for (var1 of [1, 2]) { var1; }"}, + {"for (var var1 of [1, 2]) { var1; }"}, + {"for (let var1 of [1, 2]) { var1; }"}, + {"for (const var1 of [1, 2]) { var1; }"}, + + {"for (var1 of [1, 2]) { var1 = 0; }"}, + {"for (var var1 of [1, 2]) { var1 = 0; }"}, + {"for (let var1 of [1, 2]) { var1 = 0; }"}, + {"for (const var1 of [1, 2]) { var1 = 0; }"}, + + {"for (var1 of [1, 2]) { function foo() { var1; } }"}, + {"for (var var1 of [1, 2]) { function foo() { var1; } }"}, + {"for (let var1 of [1, 2]) { function foo() { var1; } }"}, + {"for (const var1 of [1, 2]) { function foo() { var1; } }"}, + + {"for (var1 of [1, 2]) { function foo() { var1 = 0; } }"}, + {"for (var var1 of [1, 2]) { function foo() { var1 = 0; } }"}, + {"for (let var1 of [1, 2]) { function foo() { var1 = 0; } }"}, + {"for (const var1 of [1, 2]) { function foo() { var1 = 0; } }"}, + + // For in loops + {"for (var1 in {a: 6}) { }"}, + {"for (var var1 in {a: 6}) { }"}, + {"for (let var1 in {a: 6}) { }"}, + {"for (const var1 in {a: 6}) { }"}, + + {"for (var1 in {a: 6}) { var1; }"}, + {"for (var var1 in {a: 6}) { var1; }"}, + {"for (let var1 in {a: 6}) { var1; }"}, + {"for (const var1 in {a: 6}) { var1; }"}, + + {"for (var1 in {a: 6}) { var1 = 0; }"}, + {"for (var var1 in {a: 6}) { var1 = 0; }"}, + {"for (let var1 in {a: 6}) { var1 = 0; }"}, + {"for (const var1 in {a: 6}) { var1 = 0; }"}, + + {"for (var1 in {a: 6}) { function foo() { var1; } }"}, + {"for (var var1 in {a: 6}) { function foo() { var1; } }"}, + {"for (let var1 in {a: 6}) { function foo() { var1; } }"}, + {"for (const var1 in {a: 6}) { function foo() { var1; } }"}, + + {"for (var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + {"for (var var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + {"for (let var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + {"for (const var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + + {"for (var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + {"for (var var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + {"for (let var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + {"for (const var1 in {a: 6}) { function foo() { var1 = 0; } }"}, + + // Loops without declarations + {"var var1 = 0; for ( ; var1 < 2; ++var1) { }"}, + {"var var1 = 0; for ( ; var1 < 2; ++var1) { function foo() { var1; } }"}, + {"var var1 = 0; for ( ; var1 > 2; ) { }"}, + {"var var1 = 0; for ( ; var1 > 2; ) { function foo() { var1; } }"}, + {"var var1 = 0; for ( ; var1 > 2; ) { function foo() { var1 = 6; } }"}, + + {"var var1 = 0; for(var1; var1 < 2; ++var1) { }"}, + {"var var1 = 0; for (var1; var1 < 2; ++var1) { function foo() { var1; } " + "}"}, + {"var var1 = 0; for (var1; var1 > 2; ) { }"}, + {"var var1 = 0; for (var1; var1 > 2; ) { function foo() { var1; } }"}, + {"var var1 = 0; for (var1; var1 > 2; ) { function foo() { var1 = 6; } }"}, + + // Block functions (potentially sloppy). + {"if (true) { function f1() {} }"}, + {"if (true) { function f1() {} function f1() {} }", SKIP_STRICT}, + {"if (true) { if (true) { function f1() {} } }"}, + {"if (true) { if (true) { function f1() {} function f1() {} } }", + SKIP_STRICT}, + {"if (true) { function f1() {} f1 = 3; }"}, + + {"if (true) { function f1() {} function foo() { f1; } }"}, + {"if (true) { function f1() {} } function foo() { f1; }"}, + {"if (true) { function f1() {} function f1() {} function foo() { f1; } " + "}", + SKIP_STRICT}, + {"if (true) { function f1() {} function f1() {} } function foo() { f1; " + "}", + SKIP_STRICT}, + {"if (true) { if (true) { function f1() {} } function foo() { f1; } }"}, + {"if (true) { if (true) { function f1() {} function f1() {} } function " + "foo() { f1; } }", + SKIP_STRICT}, + {"if (true) { function f1() {} f1 = 3; function foo() { f1; } }"}, + {"if (true) { function f1() {} f1 = 3; } function foo() { f1; }"}, + + {"var f1 = 1; if (true) { function f1() {} }"}, + {"var f1 = 1; if (true) { function f1() {} } function foo() { f1; }"}, + + // Simple parameters. + {"var1", ""}, + {"var1", "var1;"}, + {"var1", "var1 = 9;"}, + {"var1", "function f1() { var1; }"}, + {"var1", "function f1() { var1 = 9; }"}, + + {"var1, var2", ""}, + {"var1, var2", "var2;"}, + {"var1, var2", "var2 = 9;"}, + {"var1, var2", "function f1() { var2; }"}, + {"var1, var2", "function f1() { var2 = 9; }"}, + {"var1, var2", "var1;"}, + {"var1, var2", "var1 = 9;"}, + {"var1, var2", "function f1() { var1; }"}, + {"var1, var2", "function f1() { var1 = 9; }"}, + + // Duplicate parameters. + {"var1, var1", "", SKIP_STRICT}, + {"var1, var1", "var1;", SKIP_STRICT}, + {"var1, var1", "var1 = 9;", SKIP_STRICT}, + {"var1, var1", "function f1() { var1; }", SKIP_STRICT}, + {"var1, var1", "function f1() { var1 = 9; }", SKIP_STRICT}, + + // If the function declares itself strict, non-simple parameters aren't + // allowed. + + // Rest parameter. + {"...var2", "", SKIP_STRICT_FUNCTION}, + {"...var2", "var2;", SKIP_STRICT_FUNCTION}, + {"...var2", "var2 = 9;", SKIP_STRICT_FUNCTION}, + {"...var2", "function f1() { var2; }", SKIP_STRICT_FUNCTION}, + {"...var2", "function f1() { var2 = 9; }", SKIP_STRICT_FUNCTION}, + + {"var1, ...var2", "", SKIP_STRICT_FUNCTION}, + {"var1, ...var2", "var2;", SKIP_STRICT_FUNCTION}, + {"var1, ...var2", "var2 = 9;", SKIP_STRICT_FUNCTION}, + {"var1, ...var2", "function f1() { var2; }", SKIP_STRICT_FUNCTION}, + {"var1, ...var2", "function f1() { var2 = 9; }", SKIP_STRICT_FUNCTION}, + + // Default parameters. + {"var1 = 3", "", SKIP_STRICT_FUNCTION}, + {"var1, var2 = var1", "", SKIP_STRICT_FUNCTION}, + {"var1, var2 = 4, ...var3", "", SKIP_STRICT_FUNCTION}, + + // Destructuring parameters. Because of the search space explosion, we + // cannot test all interesting cases. Let's try to test a relevant subset. + {"[]", "", SKIP_STRICT_FUNCTION}, + {"{}", "", SKIP_STRICT_FUNCTION}, + + {"[var1]", "", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "", SKIP_STRICT_FUNCTION}, + {"{var1}", "", SKIP_STRICT_FUNCTION}, + + {"[var1]", "var1;", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "var1;", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "name1;", SKIP_STRICT_FUNCTION}, + {"{var1}", "var1;", SKIP_STRICT_FUNCTION}, + + {"[var1]", "var1 = 16;", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "var1 = 16;", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "name1 = 16;", SKIP_STRICT_FUNCTION}, + {"{var1}", "var1 = 16;", SKIP_STRICT_FUNCTION}, + + {"[var1]", "() => { var1; }", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "() => { var1; }", SKIP_STRICT_FUNCTION}, + {"{name1: var1}", "() => { name1; }", SKIP_STRICT_FUNCTION}, + {"{var1}", "() => { var1; }", SKIP_STRICT_FUNCTION}, + + {"[var1, var2, var3]", "", SKIP_STRICT_FUNCTION}, + {"{name1: var1, name2: var2, name3: var3}", "", SKIP_STRICT_FUNCTION}, + {"{var1, var2, var3}", "", SKIP_STRICT_FUNCTION}, + + {"[var1, var2, var3]", "() => { var2 = 16;}", SKIP_STRICT_FUNCTION}, + {"{name1: var1, name2: var2, name3: var3}", "() => { var2 = 16;}", + SKIP_STRICT_FUNCTION}, + {"{name1: var1, name2: var2, name3: var3}", "() => { name2 = 16;}", + SKIP_STRICT_FUNCTION}, + {"{var1, var2, var3}", "() => { var2 = 16;}", SKIP_STRICT_FUNCTION}, + + // Nesting destructuring. + {"[var1, [var2, var3], {var4, name5: [var5, var6]}]", "", + SKIP_STRICT_FUNCTION}, + + // Complicated params. + {"var1, [var2], var3, [var4, var5], var6, {var7}, var8, {name9: var9, " + "name10: var10}, ...var11", + "", SKIP_STRICT_FUNCTION}, + + // Destructuring rest. Because we can. + {"var1, ...[var2]", "() => { }", SKIP_STRICT_FUNCTION}, + {"var1, ...[var2]", "() => { var2; }", SKIP_STRICT_FUNCTION}, + + // Default parameters for destruring parameters. + {"[var1 = 4, var2 = var1]", "", SKIP_STRICT_FUNCTION, false}, + {"{var1 = 4, var2 = var1}", "", SKIP_STRICT_FUNCTION, false}, + + // Locals shadowing parameters. + {"var1, var2", "var var1 = 16; () => { var1 = 17; }"}, + + // Locals shadowing destructuring parameters and the rest parameter. + {"[var1, var2]", "var var1 = 16; () => { var1 = 17; }", + SKIP_STRICT_FUNCTION}, + {"{var1, var2}", "var var1 = 16; () => { var1 = 17; }", + SKIP_STRICT_FUNCTION}, + {"var1, var2, ...var3", "var var3 = 16; () => { var3 = 17; }", + SKIP_STRICT_FUNCTION}, + {"var1, var2 = var1", "var var1 = 16; () => { var1 = 17; }", + SKIP_STRICT_FUNCTION}, + + // Hoisted sloppy block function shadowing a parameter. + {"var1, var2", "for (;;) { function var1() { } }"}, + + // Eval in default parameter. + {"var1, var2 = eval(''), var3", "let var4 = 0;", SKIP_STRICT_FUNCTION}, + {"var1, var2 = eval(''), var3 = eval('')", "let var4 = 0;", + SKIP_STRICT_FUNCTION}, + + // FIXME(marja): arguments parameter + }; + + for (unsigned outer_ix = 0; outer_ix < arraysize(outers); ++outer_ix) { + for (unsigned inner_ix = 0; inner_ix < arraysize(inners); ++inner_ix) { + if (outers[outer_ix].strict_outer && + (inners[inner_ix].skip_in_strict_mode & SKIP_STRICT_OUTER)) { + continue; + } + if (outers[outer_ix].strict_test_function && + (inners[inner_ix].skip_in_strict_mode & SKIP_STRICT_FUNCTION)) { + continue; + } + + const char* prefix = outers[outer_ix].prefix; + const char* suffix = outers[outer_ix].suffix; + int prefix_len = Utf8LengthHelper(prefix); + int suffix_len = Utf8LengthHelper(suffix); + + // First compile with the lazy inner function and extract the scope data. + const char* inner_function = outers[outer_ix].lazy_inner; + int inner_function_len = Utf8LengthHelper(inner_function) - 4; + + int params_len = Utf8LengthHelper(inners[inner_ix].params); + int source_len = Utf8LengthHelper(inners[inner_ix].source); + int len = prefix_len + inner_function_len + params_len + source_len + + suffix_len; + + i::ScopedVector<char> lazy_program(len + 1); + i::SNPrintF(lazy_program, "%s", prefix); + i::SNPrintF(lazy_program + prefix_len, inner_function, + inners[inner_ix].params, inners[inner_ix].source); + i::SNPrintF(lazy_program + prefix_len + inner_function_len + params_len + + source_len, + "%s", suffix); + + i::Handle<i::String> source = + factory->InternalizeUtf8String(lazy_program.start()); + source->PrintOn(stdout); + printf("\n"); + + i::Handle<i::Script> script = factory->NewScript(source); + i::ParseInfo lazy_info(script); + + // No need to run scope analysis; preparser scope data is produced when + // parsing. + CHECK(i::parsing::ParseProgram(&lazy_info)); + + // Then parse eagerly and check against the scope data. + inner_function = outers[outer_ix].eager_inner; + inner_function_len = Utf8LengthHelper(inner_function) - 4; + len = prefix_len + inner_function_len + params_len + source_len + + suffix_len; + + i::ScopedVector<char> eager_program(len + 1); + i::SNPrintF(eager_program, "%s", prefix); + i::SNPrintF(eager_program + prefix_len, inner_function, + inners[inner_ix].params, inners[inner_ix].source); + i::SNPrintF(eager_program + prefix_len + inner_function_len + params_len + + source_len, + "%s", suffix); + + source = factory->InternalizeUtf8String(eager_program.start()); + source->PrintOn(stdout); + printf("\n"); + + script = factory->NewScript(source); + i::ParseInfo eager_info(script); + eager_info.set_allow_lazy_parsing(false); + + CHECK(i::parsing::ParseProgram(&eager_info)); + CHECK(i::Compiler::Analyze(&eager_info)); + + i::Scope* scope = + eager_info.literal()->scope()->inner_scope()->inner_scope(); + DCHECK_NOT_NULL(scope); + DCHECK_NULL(scope->sibling()); + DCHECK(scope->is_function_scope()); + + size_t index = 0; + i::ScopeTestHelper::CompareScopeToData( + scope, lazy_info.preparsed_scope_data(), index, + inners[inner_ix].precise_maybe_assigned); + } + } +} diff --git a/deps/v8/test/cctest/scope-test-helper.h b/deps/v8/test/cctest/scope-test-helper.h new file mode 100644 index 0000000000..65d5c3f059 --- /dev/null +++ b/deps/v8/test/cctest/scope-test-helper.h @@ -0,0 +1,79 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_CCTEST_SCOPE_TEST_HELPER_H_ +#define V8_CCTEST_SCOPE_TEST_HELPER_H_ + +#include "src/ast/scopes.h" +#include "src/ast/variables.h" + +namespace v8 { +namespace internal { + +class ScopeTestHelper { + public: + static bool MustAllocateInContext(Variable* var) { + return var->scope()->MustAllocateInContext(var); + } + + static void CompareScopeToData(Scope* scope, const PreParsedScopeData* data, + size_t& index, bool precise_maybe_assigned) { + CHECK(PreParsedScopeData::HasVariablesWhichNeedAllocationData(scope)); + CHECK_GT(data->backing_store_.size(), index + 4); + CHECK_EQ(data->backing_store_[index++], scope->scope_type()); + CHECK_EQ(data->backing_store_[index++], scope->start_position()); + CHECK_EQ(data->backing_store_[index++], scope->end_position()); + + int inner_scope_count = 0; + for (Scope* inner = scope->inner_scope(); inner != nullptr; + inner = inner->sibling()) { + if (PreParsedScopeData::HasVariablesWhichNeedAllocationData(inner)) { + ++inner_scope_count; + } + } + CHECK_EQ(data->backing_store_[index++], inner_scope_count); + + int variable_count = 0; + for (Variable* local : scope->locals_) { + if (local->mode() == VAR || local->mode() == LET || + local->mode() == CONST) { + ++variable_count; + } + } + + CHECK_EQ(data->backing_store_[index++], variable_count); + + for (Variable* local : scope->locals_) { + if (local->mode() == VAR || local->mode() == LET || + local->mode() == CONST) { +#ifdef DEBUG + const AstRawString* local_name = local->raw_name(); + int name_length = data->backing_store_[index++]; + CHECK_EQ(name_length, local_name->length()); + for (int i = 0; i < name_length; ++i) { + CHECK_EQ(data->backing_store_[index++], local_name->raw_data()[i]); + } +#endif + CHECK_EQ(data->backing_store_[index++], local->location()); + if (precise_maybe_assigned) { + CHECK_EQ(data->backing_store_[index++], local->maybe_assigned()); + } else { + STATIC_ASSERT(kMaybeAssigned > kNotAssigned); + CHECK_GE(data->backing_store_[index++], local->maybe_assigned()); + } + } + } + + for (Scope* inner = scope->inner_scope(); inner != nullptr; + inner = inner->sibling()) { + if (PreParsedScopeData::HasVariablesWhichNeedAllocationData(inner)) { + CompareScopeToData(inner, data, index, precise_maybe_assigned); + } + } + } +}; +} // namespace internal +} // namespace v8 + +#endif // V8_CCTEST_SCOPE_TEST_HELPER_H_ diff --git a/deps/v8/test/cctest/test-access-checks.cc b/deps/v8/test/cctest/test-access-checks.cc index 727444b532..f260a15c6e 100644 --- a/deps/v8/test/cctest/test-access-checks.cc +++ b/deps/v8/test/cctest/test-access-checks.cc @@ -102,6 +102,23 @@ void IndexedEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { info.GetReturnValue().Set(names); } +void MethodGetter(v8::Local<v8::Name> property, + const v8::PropertyCallbackInfo<v8::Value>& info) { + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + + v8::Local<v8::External> data = info.Data().As<v8::External>(); + v8::Local<v8::FunctionTemplate>& function_template = + *reinterpret_cast<v8::Local<v8::FunctionTemplate>*>(data->Value()); + + info.GetReturnValue().Set( + function_template->GetFunction(context).ToLocalChecked()); +} + +void MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(8); +} + void NamedGetterThrowsException( v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { @@ -288,6 +305,44 @@ TEST(AccessCheckWithInterceptor) { CheckCrossContextAccess(isolate, context1, context0->Global()); } +TEST(CallFunctionWithRemoteContextReceiver) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::FunctionTemplate> global_template = + v8::FunctionTemplate::New(isolate); + + v8::Local<v8::Signature> signature = + v8::Signature::New(isolate, global_template); + v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New( + isolate, MethodCallback, v8::External::New(isolate, &function_template), + signature); + + global_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler( + AccessCheck, v8::NamedPropertyHandlerConfiguration( + MethodGetter, nullptr, nullptr, nullptr, nullptr, + v8::External::New(isolate, &function_template)), + v8::IndexedPropertyHandlerConfiguration()); + + v8::Local<v8::Object> accessed_object = + v8::Context::NewRemoteContext(isolate, + global_template->InstanceTemplate()) + .ToLocalChecked(); + v8::Local<v8::Context> accessing_context = + v8::Context::New(isolate, nullptr, global_template->InstanceTemplate()); + + v8::HandleScope handle_scope(isolate); + accessing_context->Global() + ->Set(accessing_context, v8_str("other"), accessed_object) + .FromJust(); + v8::Context::Scope context_scope(accessing_context); + + { + v8::TryCatch try_catch(isolate); + ExpectInt32("this.other.method()", 8); + CHECK(!try_catch.HasCaught()); + } +} + TEST(AccessCheckWithExceptionThrowingInterceptor) { v8::Isolate* isolate = CcTest::isolate(); isolate->SetFailedAccessCheckCallbackFunction([](v8::Local<v8::Object> target, diff --git a/deps/v8/test/cctest/test-accessor-assembler.cc b/deps/v8/test/cctest/test-accessor-assembler.cc index c129bbaf13..273cdd4ff0 100644 --- a/deps/v8/test/cctest/test-accessor-assembler.cc +++ b/deps/v8/test/cctest/test-accessor-assembler.cc @@ -5,8 +5,9 @@ #include "test/cctest/cctest.h" #include "src/base/utils/random-number-generator.h" -#include "src/ic/accessor-assembler-impl.h" +#include "src/ic/accessor-assembler.h" #include "src/ic/stub-cache.h" +#include "src/objects-inl.h" #include "test/cctest/compiler/code-assembler-tester.h" #include "test/cctest/compiler/function-tester.h" @@ -23,7 +24,7 @@ void TestStubCacheOffsetCalculation(StubCache::Table table) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester data(isolate, kNumParams); - AccessorAssemblerImpl m(data.state()); + AccessorAssembler m(data.state()); { Node* name = m.Parameter(0); @@ -121,7 +122,7 @@ TEST(TryProbeStubCache) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester data(isolate, kNumParams); - AccessorAssemblerImpl m(data.state()); + AccessorAssembler m(data.state()); Code::Kind ic_kind = Code::LOAD_IC; StubCache stub_cache(isolate, ic_kind); diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc index 63c25c5b8c..c38d77bd21 100644 --- a/deps/v8/test/cctest/test-accessors.cc +++ b/deps/v8/test/cctest/test-accessors.cc @@ -154,8 +154,8 @@ THREADED_TEST(GlobalVariableAccess) { v8::External::New(isolate, &baz)); LocalContext env(0, templ->InstanceTemplate()); v8_compile("foo = (++bar) + baz")->Run(env.local()).ToLocalChecked(); - CHECK_EQ(bar, -3); - CHECK_EQ(foo, 7); + CHECK_EQ(-3, bar); + CHECK_EQ(7, foo); } diff --git a/deps/v8/test/cctest/test-api-accessors.cc b/deps/v8/test/cctest/test-api-accessors.cc index cc0c7efb5f..921f54d466 100644 --- a/deps/v8/test/cctest/test-api-accessors.cc +++ b/deps/v8/test/cctest/test-api-accessors.cc @@ -249,6 +249,89 @@ TEST(CachedAccessorCrankshaft) { ExpectInt32("g()", 789); } +TEST(CachedAccessorOnGlobalObject) { + i::FLAG_allow_natives_syntax = true; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + v8::Local<v8::ObjectTemplate> object_template = templ->InstanceTemplate(); + v8::Local<v8::Private> priv = + v8::Private::ForApi(isolate, v8_str("Foo#draft")); + + object_template->SetAccessorProperty( + v8_str("draft"), + v8::FunctionTemplate::NewWithCache(isolate, UnreachableCallback, priv, + v8::Local<v8::Value>())); + + v8::Local<v8::Context> ctx = + v8::Context::New(CcTest::isolate(), nullptr, object_template); + v8::Local<v8::Object> obj = ctx->Global(); + + // Install the private property on the instance. + CHECK(obj->SetPrivate(isolate->GetCurrentContext(), priv, + v8::Undefined(isolate)) + .FromJust()); + + { + v8::Context::Scope context_scope(ctx); + + // Access surrogate accessor. + ExpectUndefined("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 = 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( + "var x = this;" + "function g() {" + " 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); + } +} + namespace { static void Setter(v8::Local<v8::String> name, v8::Local<v8::Value> value, diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc index 66f0a0b0eb..955b8f4df5 100644 --- a/deps/v8/test/cctest/test-api-interceptors.cc +++ b/deps/v8/test/cctest/test-api-interceptors.cc @@ -12,7 +12,9 @@ #include "src/base/platform/platform.h" #include "src/compilation-cache.h" #include "src/execution.h" +#include "src/objects-inl.h" #include "src/objects.h" +#include "src/runtime/runtime.h" #include "src/unicode-inl.h" #include "src/utils.h" @@ -403,12 +405,12 @@ THREADED_TEST(QueryInterceptor) { ->NewInstance(env.local()) .ToLocalChecked()) .FromJust(); - CHECK_EQ(query_counter_int, 0); + CHECK_EQ(0, query_counter_int); v8::Local<Value> result = v8_compile("Object.getOwnPropertyDescriptor(obj, 'x');") ->Run(env.local()) .ToLocalChecked(); - CHECK_EQ(query_counter_int, 1); + CHECK_EQ(1, query_counter_int); CHECK_EQ(v8::PropertyAttribute::None, static_cast<v8::PropertyAttribute>( result->Int32Value(env.local()).FromJust())); @@ -416,64 +418,64 @@ THREADED_TEST(QueryInterceptor) { v8_compile("Object.defineProperty(obj, 'not_enum', {value: 17});") ->Run(env.local()) .ToLocalChecked(); - CHECK_EQ(query_counter_int, 2); + CHECK_EQ(2, query_counter_int); v8_compile( "Object.defineProperty(obj, 'enum', {value: 17, enumerable: true, " "writable: true});") ->Run(env.local()) .ToLocalChecked(); - CHECK_EQ(query_counter_int, 3); + CHECK_EQ(3, query_counter_int); CHECK(v8_compile("obj.propertyIsEnumerable('enum');") ->Run(env.local()) .ToLocalChecked() ->BooleanValue(env.local()) .FromJust()); - CHECK_EQ(query_counter_int, 4); + CHECK_EQ(4, query_counter_int); CHECK(!v8_compile("obj.propertyIsEnumerable('not_enum');") ->Run(env.local()) .ToLocalChecked() ->BooleanValue(env.local()) .FromJust()); - CHECK_EQ(query_counter_int, 5); + CHECK_EQ(5, query_counter_int); CHECK(v8_compile("obj.hasOwnProperty('enum');") ->Run(env.local()) .ToLocalChecked() ->BooleanValue(env.local()) .FromJust()); - CHECK_EQ(query_counter_int, 5); + CHECK_EQ(5, query_counter_int); CHECK(v8_compile("obj.hasOwnProperty('not_enum');") ->Run(env.local()) .ToLocalChecked() ->BooleanValue(env.local()) .FromJust()); - CHECK_EQ(query_counter_int, 5); + CHECK_EQ(5, query_counter_int); CHECK(!v8_compile("obj.hasOwnProperty('x');") ->Run(env.local()) .ToLocalChecked() ->BooleanValue(env.local()) .FromJust()); - CHECK_EQ(query_counter_int, 6); + CHECK_EQ(6, query_counter_int); CHECK(!v8_compile("obj.propertyIsEnumerable('undef');") ->Run(env.local()) .ToLocalChecked() ->BooleanValue(env.local()) .FromJust()); - CHECK_EQ(query_counter_int, 7); + CHECK_EQ(7, query_counter_int); v8_compile("Object.defineProperty(obj, 'enum', {value: 42});") ->Run(env.local()) .ToLocalChecked(); - CHECK_EQ(query_counter_int, 8); + CHECK_EQ(8, query_counter_int); v8_compile("Object.isFrozen('obj.x');")->Run(env.local()).ToLocalChecked(); - CHECK_EQ(query_counter_int, 8); + CHECK_EQ(8, query_counter_int); } namespace { @@ -494,6 +496,12 @@ void SetterCallback(Local<Name> property, Local<Value> value, set_was_called_counter++; } +void InterceptingSetterCallback( + Local<Name> property, Local<Value> value, + const v8::PropertyCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(value); +} + } // namespace // Check that get callback is called in defineProperty with accessor descriptor. @@ -517,8 +525,8 @@ THREADED_TEST(DefinerCallbackAccessorInterceptor) { v8_compile("Object.defineProperty(obj, 'x', {set: function() {return 17;}});") ->Run(env.local()) .ToLocalChecked(); - CHECK_EQ(get_was_called, true); - CHECK_EQ(set_was_called, false); + CHECK(get_was_called); + CHECK(!set_was_called); } // Check that set callback is called for function declarations. @@ -544,7 +552,7 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptor) { .ToLocalChecked() ->Int32Value(ctx) .FromJust()); - CHECK_EQ(set_was_called_counter, 1); + CHECK_EQ(1, set_was_called_counter); // Redeclare function. code = v8_str("function x() {return 43;}; x();"); @@ -554,7 +562,7 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptor) { .ToLocalChecked() ->Int32Value(ctx) .FromJust()); - CHECK_EQ(set_was_called_counter, 2); + CHECK_EQ(2, set_was_called_counter); // Redefine function. code = v8_str("x = function() {return 44;}; x();"); @@ -564,7 +572,99 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptor) { .ToLocalChecked() ->Int32Value(ctx) .FromJust()); - CHECK_EQ(set_was_called_counter, 3); + CHECK_EQ(3, set_was_called_counter); +} + +namespace { +int descriptor_was_called; + +void PropertyDescriptorCallback( + Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { + // Intercept the callback by setting a different descriptor. + descriptor_was_called++; + const char* code = + "var desc = {value: 5};" + "desc;"; + Local<Value> descriptor = v8_compile(code) + ->Run(info.GetIsolate()->GetCurrentContext()) + .ToLocalChecked(); + info.GetReturnValue().Set(descriptor); +} +} // namespace + +// Check that the descriptor callback is called on the global object. +THREADED_TEST(DescriptorCallbackOnGlobalObject) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + + v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); + object_template->SetHandler(v8::NamedPropertyHandlerConfiguration( + nullptr, nullptr, PropertyDescriptorCallback, nullptr, nullptr, nullptr)); + v8::Local<v8::Context> ctx = + v8::Context::New(CcTest::isolate(), nullptr, object_template); + + descriptor_was_called = 0; + + // Declare function. + v8::Local<v8::String> code = v8_str( + "var x = 42; var desc = Object.getOwnPropertyDescriptor(this, 'x'); " + "desc.value;"); + CHECK_EQ(5, v8::Script::Compile(ctx, code) + .ToLocalChecked() + ->Run(ctx) + .ToLocalChecked() + ->Int32Value(ctx) + .FromJust()); + CHECK_EQ(1, descriptor_was_called); +} + +namespace { +void QueryCallbackSetDontDelete( + Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { + info.GetReturnValue().Set(v8::PropertyAttribute::DontDelete); +} + +} // namespace + +// Regression for a Node.js test that fails in debug mode. +THREADED_TEST(InterceptorFunctionRedeclareWithQueryCallback) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + + v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); + object_template->SetHandler(v8::NamedPropertyHandlerConfiguration( + nullptr, nullptr, QueryCallbackSetDontDelete)); + v8::Local<v8::Context> ctx = + v8::Context::New(CcTest::isolate(), nullptr, object_template); + + // Declare and redeclare function. + v8::Local<v8::String> code = v8_str( + "function x() {return 42;};" + "function x() {return 43;};"); + v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).ToLocalChecked(); +} + +// Regression test for chromium bug 656648. +// Do not crash on non-masking, intercepting setter callbacks. +THREADED_TEST(NonMaskingInterceptor) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + + v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); + object_template->SetHandler(v8::NamedPropertyHandlerConfiguration( + nullptr, InterceptingSetterCallback, nullptr, nullptr, nullptr, + Local<Value>(), v8::PropertyHandlerFlags::kNonMasking)); + v8::Local<v8::Context> ctx = + v8::Context::New(CcTest::isolate(), nullptr, object_template); + + v8::Local<v8::String> code = v8_str("function x() {return 43;};"); + v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).ToLocalChecked(); } // Check that function re-declarations throw if they are read-only. @@ -595,7 +695,7 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptorThrow) { ->Int32Value(ctx) .FromJust()); - CHECK_EQ(set_was_called, true); + CHECK(set_was_called); v8::TryCatch try_catch(CcTest::isolate()); set_was_called = false; @@ -605,51 +705,7 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptorThrow) { CHECK(v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_EQ(set_was_called, false); -} -namespace { -int descriptor_was_called; - -void PropertyDescriptorCallback( - Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { - // Intercept the callback by setting a different descriptor. - descriptor_was_called++; - const char* code = - "var desc = {value: 5};" - "desc;"; - Local<Value> descriptor = v8_compile(code) - ->Run(info.GetIsolate()->GetCurrentContext()) - .ToLocalChecked(); - info.GetReturnValue().Set(descriptor); -} -} // namespace - -// Check that the descriptor callback is called on the global object. -THREADED_TEST(DescriptorCallbackOnGlobalObject) { - v8::HandleScope scope(CcTest::isolate()); - LocalContext env; - v8::Local<v8::FunctionTemplate> templ = - v8::FunctionTemplate::New(CcTest::isolate()); - - v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); - object_template->SetHandler(v8::NamedPropertyHandlerConfiguration( - nullptr, nullptr, PropertyDescriptorCallback, nullptr, nullptr, nullptr)); - v8::Local<v8::Context> ctx = - v8::Context::New(CcTest::isolate(), nullptr, object_template); - - descriptor_was_called = 0; - - // Declare function. - v8::Local<v8::String> code = v8_str( - "var x = 42; var desc = Object.getOwnPropertyDescriptor(this, 'x'); " - "desc.value;"); - CHECK_EQ(5, v8::Script::Compile(ctx, code) - .ToLocalChecked() - ->Run(ctx) - .ToLocalChecked() - ->Int32Value(ctx) - .FromJust()); - CHECK_EQ(1, descriptor_was_called); + CHECK(!set_was_called); } @@ -661,14 +717,14 @@ bool define_was_called_in_order = false; void GetterCallbackOrder(Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { get_was_called_in_order = true; - CHECK_EQ(define_was_called_in_order, true); + CHECK(define_was_called_in_order); info.GetReturnValue().Set(property); } void DefinerCallbackOrder(Local<Name> property, const v8::PropertyDescriptor& desc, const v8::PropertyCallbackInfo<v8::Value>& info) { - CHECK_EQ(get_was_called_in_order, false); // Define called before get. + CHECK(!get_was_called_in_order); // Define called before get. define_was_called_in_order = true; } @@ -689,14 +745,14 @@ THREADED_TEST(DefinerCallbackGetAndDefine) { .ToLocalChecked()) .FromJust(); - CHECK_EQ(get_was_called_in_order, false); - CHECK_EQ(define_was_called_in_order, false); + CHECK(!get_was_called_in_order); + CHECK(!define_was_called_in_order); v8_compile("Object.defineProperty(obj, 'x', {set: function() {return 17;}});") ->Run(env.local()) .ToLocalChecked(); - CHECK_EQ(get_was_called_in_order, true); - CHECK_EQ(define_was_called_in_order, true); + CHECK(get_was_called_in_order); + CHECK(define_was_called_in_order); } namespace { // namespace for InObjectLiteralDefinitionWithInterceptor @@ -777,15 +833,15 @@ THREADED_TEST(InterceptorHasOwnProperty) { v8::Local<Value> value = CompileRun( "var o = new constructor();" "o.hasOwnProperty('ostehaps');"); - CHECK_EQ(false, value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(context.local()).FromJust()); value = CompileRun( "o.ostehaps = 42;" "o.hasOwnProperty('ostehaps');"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); value = CompileRun( "var p = new constructor();" "p.hasOwnProperty('ostehaps');"); - CHECK_EQ(false, value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(context.local()).FromJust()); } @@ -819,7 +875,7 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) { "var o = new constructor();" "o.__proto__ = new String(x);" "o.hasOwnProperty('ostehaps');"); - CHECK_EQ(false, value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(context.local()).FromJust()); } @@ -1295,7 +1351,7 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { " f();" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); value = CompileRun( "var f = function() { " @@ -1310,7 +1366,7 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { " f();" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); value = CompileRun( "var f = function() { " @@ -1325,7 +1381,7 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { " f();" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); } static void InterceptorLoadICGetter0( @@ -1492,9 +1548,9 @@ THREADED_TEST(NamedPropertyHandlerGetter) { ->NewInstance(env.local()) .ToLocalChecked()) .FromJust(); - CHECK_EQ(echo_named_call_count, 0); + CHECK_EQ(0, echo_named_call_count); v8_compile("obj.x")->Run(env.local()).ToLocalChecked(); - CHECK_EQ(echo_named_call_count, 1); + CHECK_EQ(1, echo_named_call_count); const char* code = "var str = 'oddle'; obj[str] + obj.poddle;"; v8::Local<Value> str = CompileRun(code); String::Utf8Value value(str); @@ -2044,11 +2100,10 @@ THREADED_TEST(IndexedPropertyHandlerGetter) { .ToLocalChecked()) .FromJust(); Local<Script> script = v8_compile("obj[900]"); - CHECK_EQ(script->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust(), - 900); + CHECK_EQ(900, script->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); } @@ -2674,7 +2729,7 @@ THREADED_TEST(NamedInterceptorMapTransitionRead) { CompileRun("var o = new F(); o.x = 23;"); // Create an instance of F and invoke the getter. The result should be 23. Local<Value> result = CompileRun("o = new F(); o.x"); - CHECK_EQ(result->Int32Value(context.local()).FromJust(), 23); + CHECK_EQ(23, result->Int32Value(context.local()).FromJust()); } @@ -3978,7 +4033,7 @@ THREADED_TEST(InterceptorICReferenceErrors) { " return false;" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); interceptor_call_count = 0; value = CompileRun( "function g() {" @@ -3988,7 +4043,7 @@ THREADED_TEST(InterceptorICReferenceErrors) { " return false;" "};" "g();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); } @@ -4034,7 +4089,7 @@ THREADED_TEST(InterceptorICGetterExceptions) { " return false;" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); interceptor_ic_exception_get_count = 0; value = CompileRun( "function f() {" @@ -4044,7 +4099,7 @@ THREADED_TEST(InterceptorICGetterExceptions) { " return false;" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); } @@ -4078,7 +4133,7 @@ THREADED_TEST(InterceptorICSetterExceptions) { " return false;" "};" "f();"); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); } @@ -4137,6 +4192,7 @@ THREADED_TEST(NamedPropertyHandlerGetterAttributes) { THREADED_TEST(Regress256330) { + if (!i::FLAG_crankshaft) return; i::FLAG_allow_natives_syntax = true; LocalContext context; v8::HandleScope scope(context->GetIsolate()); @@ -4152,7 +4208,10 @@ THREADED_TEST(Regress256330) { "f(o); f(o); f(o);" "%OptimizeFunctionOnNextCall(f);" "f(o);"); - ExpectBoolean("%GetOptimizationStatus(f) != 2", true); + int status = v8_run_int32value(v8_compile("%GetOptimizationStatus(f)")); + int mask = static_cast<int>(i::OptimizationStatus::kIsFunction) | + static_cast<int>(i::OptimizationStatus::kOptimized); + CHECK_EQ(mask, status & mask); } diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 24cbafbab1..2787e21d77 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -46,7 +46,9 @@ #include "src/debug/debug.h" #include "src/execution.h" #include "src/futex-emulation.h" -#include "src/objects.h" +#include "src/heap/incremental-marking.h" +#include "src/lookup.h" +#include "src/objects-inl.h" #include "src/parsing/preparse-data.h" #include "src/profiler/cpu-profiler.h" #include "src/unicode-inl.h" @@ -508,8 +510,8 @@ THREADED_TEST(ScriptMakingExternalString) { // Trigger GCs so that the newly allocated string moves to old gen. CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now - CHECK_EQ(source->IsExternal(), false); - CHECK_EQ(source->IsExternalOneByte(), false); + CHECK(!source->IsExternal()); + CHECK(!source->IsExternalOneByte()); String::Encoding encoding = String::UNKNOWN_ENCODING; CHECK(!source->GetExternalStringResourceBase(&encoding)); CHECK_EQ(String::ONE_BYTE_ENCODING, encoding); @@ -1722,7 +1724,7 @@ THREADED_TEST(BooleanObject) { v8::Local<v8::BooleanObject> as_boxed = boxed_boolean.As<v8::BooleanObject>(); CHECK(!as_boxed.IsEmpty()); bool the_boolean = as_boxed->ValueOf(); - CHECK_EQ(true, the_boolean); + CHECK(the_boolean); v8::Local<v8::Value> boxed_true = v8::BooleanObject::New(env->GetIsolate(), true); v8::Local<v8::Value> boxed_false = @@ -1730,9 +1732,9 @@ THREADED_TEST(BooleanObject) { CHECK(boxed_true->IsBooleanObject()); CHECK(boxed_false->IsBooleanObject()); as_boxed = boxed_true.As<v8::BooleanObject>(); - CHECK_EQ(true, as_boxed->ValueOf()); + CHECK(as_boxed->ValueOf()); as_boxed = boxed_false.As<v8::BooleanObject>(); - CHECK_EQ(false, as_boxed->ValueOf()); + CHECK(!as_boxed->ValueOf()); } @@ -2481,7 +2483,7 @@ THREADED_TEST(AccessorIsPreservedOnAttributeChange) { CHECK(a->map()->instance_descriptors()->IsFixedArray()); CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); CompileRun("Object.defineProperty(a, 'length', { writable: false });"); - CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); + CHECK_EQ(0, i::FixedArray::cast(a->map()->instance_descriptors())->length()); // But we should still have an AccessorInfo. i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR); @@ -3931,7 +3933,7 @@ THREADED_TEST(External) { Local<Value> reext_obj = CompileRun("this.ext"); v8::Local<v8::External> reext = reext_obj.As<v8::External>(); int* ptr = static_cast<int*>(reext->Value()); - CHECK_EQ(x, 3); + CHECK_EQ(3, x); *ptr = 10; CHECK_EQ(x, 10); @@ -3963,7 +3965,7 @@ THREADED_TEST(GlobalHandle) { } { v8::HandleScope scope(isolate); - CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); + CHECK_EQ(3, v8::Local<String>::New(isolate, global)->Length()); } global.Reset(); { @@ -3972,7 +3974,7 @@ THREADED_TEST(GlobalHandle) { } { v8::HandleScope scope(isolate); - CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); + CHECK_EQ(3, v8::Local<String>::New(isolate, global)->Length()); } global.Reset(); } @@ -3990,7 +3992,7 @@ THREADED_TEST(ResettingGlobalHandle) { int initial_handle_count = global_handles->global_handles_count(); { v8::HandleScope scope(isolate); - CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); + CHECK_EQ(3, v8::Local<String>::New(isolate, global)->Length()); } { v8::HandleScope scope(isolate); @@ -3999,7 +4001,7 @@ THREADED_TEST(ResettingGlobalHandle) { CHECK_EQ(global_handles->global_handles_count(), initial_handle_count); { v8::HandleScope scope(isolate); - CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6); + CHECK_EQ(6, v8::Local<String>::New(isolate, global)->Length()); } global.Reset(); CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1); @@ -4018,7 +4020,7 @@ THREADED_TEST(ResettingGlobalHandleToEmpty) { int initial_handle_count = global_handles->global_handles_count(); { v8::HandleScope scope(isolate); - CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3); + CHECK_EQ(3, v8::Local<String>::New(isolate, global)->Length()); } { v8::HandleScope scope(isolate); @@ -4416,29 +4418,29 @@ THREADED_TEST(HandleEquality) { global1.Reset(isolate, v8_str("str")); global2.Reset(isolate, v8_str("str2")); } - CHECK_EQ(global1 == global1, true); - CHECK_EQ(global1 != global1, false); + CHECK(global1 == global1); + CHECK(!(global1 != global1)); { v8::HandleScope scope(isolate); Local<String> local1 = Local<String>::New(isolate, global1); Local<String> local2 = Local<String>::New(isolate, global2); - CHECK_EQ(global1 == local1, true); - CHECK_EQ(global1 != local1, false); - CHECK_EQ(local1 == global1, true); - CHECK_EQ(local1 != global1, false); + CHECK(global1 == local1); + CHECK(!(global1 != local1)); + CHECK(local1 == global1); + CHECK(!(local1 != global1)); - CHECK_EQ(global1 == local2, false); - CHECK_EQ(global1 != local2, true); - CHECK_EQ(local2 == global1, false); - CHECK_EQ(local2 != global1, true); + CHECK(!(global1 == local2)); + CHECK(global1 != local2); + CHECK(!(local2 == global1)); + CHECK(local2 != global1); - CHECK_EQ(local1 == local2, false); - CHECK_EQ(local1 != local2, true); + CHECK(!(local1 == local2)); + CHECK(local1 != local2); Local<String> anotherLocal1 = Local<String>::New(isolate, global1); - CHECK_EQ(local1 == anotherLocal1, true); - CHECK_EQ(local1 != anotherLocal1, false); + CHECK(local1 == anotherLocal1); + CHECK(!(local1 != anotherLocal1)); } global1.Reset(); global2.Reset(); @@ -4449,7 +4451,7 @@ THREADED_TEST(LocalHandle) { v8::HandleScope scope(CcTest::isolate()); v8::Local<String> local = v8::Local<String>::New(CcTest::isolate(), v8_str("str")); - CHECK_EQ(local->Length(), 3); + CHECK_EQ(3, local->Length()); } @@ -6284,7 +6286,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { "obj, 'x');" "prop.configurable;"); Local<Value> result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true); + CHECK(result->BooleanValue(context.local()).FromJust()); // Redefine get - but still configurable Local<Script> script_define = v8_compile( @@ -6297,7 +6299,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { // Check that the accessor is still configurable result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true); + CHECK(result->BooleanValue(context.local()).FromJust()); // Redefine to a non-configurable script_define = v8_compile( @@ -6308,7 +6310,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { result = script_define->Run(context.local()).ToLocalChecked(); CHECK(result->Equals(context.local(), v8_num(43)).FromJust()); result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK_EQ(result->BooleanValue(context.local()).FromJust(), false); + CHECK(!result->BooleanValue(context.local()).FromJust()); // Make sure that it is not possible to redefine again v8::TryCatch try_catch(isolate); @@ -6337,7 +6339,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { "obj, 'x');" "prop.configurable;"); Local<Value> result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true); + CHECK(result->BooleanValue(context.local()).FromJust()); Local<Script> script_define = v8_compile( "var desc = {get: function(){return 42; }," @@ -6348,7 +6350,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { CHECK(result->Equals(context.local(), v8_num(42)).FromJust()); result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true); + CHECK(result->BooleanValue(context.local()).FromJust()); script_define = v8_compile( "var desc = {get: function(){return 43; }," @@ -6359,7 +6361,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { CHECK(result->Equals(context.local(), v8_num(43)).FromJust()); result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK_EQ(result->BooleanValue(context.local()).FromJust(), false); + CHECK(!result->BooleanValue(context.local()).FromJust()); v8::TryCatch try_catch(isolate); CHECK(script_define->Run(context.local()).IsEmpty()); @@ -6459,14 +6461,14 @@ THREADED_TEST(DefineAPIAccessorOnObject) { ExpectString("obj1.x", "z"); ExpectString("obj2.x", "z"); - CHECK(GetGlobalProperty(&context, "obj1") + CHECK(!GetGlobalProperty(&context, "obj1") ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL, v8_str("donut")) - .IsNothing()); - CHECK(GetGlobalProperty(&context, "obj2") + .FromJust()); + CHECK(!GetGlobalProperty(&context, "obj2") ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL, v8_str("donut")) - .IsNothing()); + .FromJust()); ExpectString("obj1.x", "z"); ExpectString("obj2.x", "z"); @@ -6500,14 +6502,14 @@ THREADED_TEST(DontDeleteAPIAccessorsCannotBeOverriden) { ExpectTrue("!Object.getOwnPropertyDescriptor(obj1, 'x').configurable"); ExpectTrue("!Object.getOwnPropertyDescriptor(obj2, 'x').configurable"); - CHECK(GetGlobalProperty(&context, "obj1") + CHECK(!GetGlobalProperty(&context, "obj1") ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL, v8_str("donut")) - .IsNothing()); - CHECK(GetGlobalProperty(&context, "obj2") + .FromJust()); + CHECK(!GetGlobalProperty(&context, "obj2") ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL, v8_str("donut")) - .IsNothing()); + .FromJust()); { v8::TryCatch try_catch(isolate); @@ -7459,7 +7461,8 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { FlagAndPersistent object_a, object_b; - size_t big_heap_size; + size_t big_heap_size = 0; + size_t big_array_size = 0; { v8::HandleScope handle_scope(iso); @@ -7476,9 +7479,13 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { } else { CcTest::CollectGarbage(i::NEW_SPACE); } - // We are relying on this creating a big flag array and reserving the space - // up front. - v8::Local<Value> big_array = CompileRun("new Array(5000)"); + v8::Local<Value> big_array = v8::Array::New(CcTest::isolate(), 5000); + // Verify that we created an array where the space was reserved up front. + big_array_size = + v8::internal::JSArray::cast(*v8::Utils::OpenHandle(*big_array)) + ->elements() + ->Size(); + CHECK_LE(20000, big_array_size); a->Set(context, v8_str("y"), big_array).FromJust(); big_heap_size = CcTest::heap()->SizeOfObjects(); } @@ -7500,8 +7507,7 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { } // A single GC should be enough to reclaim the memory, since we are using // phantom handles. - // BUG(5865): --expose-wasm with no snapshot builds requires a limit change. - CHECK_LT(CcTest::heap()->SizeOfObjects(), big_heap_size - 19000); + CHECK_GT(big_heap_size - big_array_size, CcTest::heap()->SizeOfObjects()); CHECK(object_a.flag); CHECK(object_b.flag); } @@ -7566,13 +7572,14 @@ void InternalFieldCallback(bool global_gc) { Trivial* t1; Trivial2* t2; instance_templ->SetInternalFieldCount(2); + v8::Persistent<v8::Object> handle; { v8::HandleScope scope(isolate); Local<v8::Object> obj = templ->GetFunction(env.local()) .ToLocalChecked() ->NewInstance(env.local()) .ToLocalChecked(); - v8::Persistent<v8::Object> handle(isolate, obj); + handle.Reset(isolate, obj); CHECK_EQ(2, obj->InternalFieldCount()); CHECK(obj->GetInternalField(0)->IsUndefined()); t1 = new Trivial(42); @@ -11085,7 +11092,7 @@ THREADED_TEST(ConstructorForObject) { value = CompileRun("(function() { var o = new obj(true); return o.a; })()"); CHECK(!try_catch.HasCaught()); CHECK(value->IsBoolean()); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); Local<Value> args3[] = {v8::True(isolate)}; Local<Value> value_obj3 = @@ -11095,7 +11102,7 @@ THREADED_TEST(ConstructorForObject) { value = object3->Get(context.local(), v8_str("a")).ToLocalChecked(); CHECK(!try_catch.HasCaught()); CHECK(value->IsBoolean()); - CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(context.local()).FromJust()); // Call the Object's constructor with undefined. Local<Value> args4[] = {v8::Undefined(isolate)}; @@ -13696,9 +13703,6 @@ static void CheckSurvivingGlobalObjectsCount(int expected) { CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CcTest::CollectAllGarbage(i::Heap::kMakeHeapIterableMask); int count = GetGlobalObjectsCount(); -#ifdef DEBUG - if (count != expected) CcTest::heap()->TracePathToGlobal(); -#endif CHECK_EQ(expected, count); } @@ -16156,7 +16160,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, "caught_exception;", element_count); result = CompileRun(test_buf.start()); - CHECK_EQ(false, result->BooleanValue(context).FromJust()); + CHECK(!result->BooleanValue(context).FromJust()); // Make sure out-of-range stores do not throw. i::SNPrintF(test_buf, @@ -16169,7 +16173,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, "caught_exception;", element_count); result = CompileRun(test_buf.start()); - CHECK_EQ(false, result->BooleanValue(context).FromJust()); + CHECK(!result->BooleanValue(context).FromJust()); // Check other boundary conditions, values and operations. result = CompileRun("for (var i = 0; i < 8; i++) {" @@ -16261,7 +16265,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, unsigned_data : (is_pixel_data ? pixel_data : signed_data))); result = CompileRun(test_buf.start()); - CHECK_EQ(true, result->BooleanValue(context).FromJust()); + CHECK(result->BooleanValue(context).FromJust()); } i::Handle<ExternalArrayClass> array(ExternalArrayClass::cast( @@ -17907,7 +17911,7 @@ TEST(PromiseHook) { CHECK(GetPromise("p")->Equals(env.local(), init_promise).FromJust()); auto init_promise_obj = v8::Local<v8::Promise>::Cast(init_promise); CHECK(init_promise_obj->State() == v8::Promise::PromiseState::kPending); - CHECK_EQ(false, init_promise_obj->HasHandler()); + CHECK(!init_promise_obj->HasHandler()); promise_hook_data->Reset(); promise_hook_data->promise_hook_value = "fulfilled"; @@ -18985,7 +18989,7 @@ THREADED_TEST(FunctionGetDebugName) { .ToLocalChecked(); v8::Local<v8::Value> error = env->Global()->Get(env.local(), v8_str("error")).ToLocalChecked(); - CHECK_EQ(false, error->BooleanValue(env.local()).FromJust()); + CHECK(!error->BooleanValue(env.local()).FromJust()); const char* functions[] = {"a", "display_a", "b", "display_b", "c", "c", @@ -19068,7 +19072,7 @@ THREADED_TEST(FunctionGetDisplayName) { env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked()); v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( env->Global()->Get(env.local(), v8_str("g")).ToLocalChecked()); - CHECK_EQ(false, error->BooleanValue(env.local()).FromJust()); + CHECK(!error->BooleanValue(env.local()).FromJust()); CHECK_EQ(0, strcmp("display_a", *v8::String::Utf8Value(a->GetDisplayName()))); CHECK_EQ(0, strcmp("display_b", *v8::String::Utf8Value(b->GetDisplayName()))); CHECK(c->GetDisplayName()->IsUndefined()); @@ -19915,10 +19919,10 @@ static void BreakArrayGuarantees(const char* script) { v8::Context::Scope context_scope(context); v8::internal::Isolate* i_isolate = reinterpret_cast<v8::internal::Isolate*>(isolate1); - CHECK_EQ(true, i_isolate->IsFastArrayConstructorPrototypeChainIntact()); + CHECK(i_isolate->IsFastArrayConstructorPrototypeChainIntact()); // Run something in new isolate. CompileRun(script); - CHECK_EQ(false, i_isolate->IsFastArrayConstructorPrototypeChainIntact()); + CHECK(!i_isolate->IsFastArrayConstructorPrototypeChainIntact()); } isolate1->Exit(); isolate1->Dispose(); @@ -20224,7 +20228,7 @@ static void InitializeTestHelper(InitDefaultIsolateThread::TestCase testCase) { InitDefaultIsolateThread thread(testCase); thread.Start(); thread.Join(); - CHECK_EQ(thread.result(), true); + CHECK(thread.result()); } @@ -21861,7 +21865,9 @@ namespace { const char* kMegamorphicTestProgram = "function CreateClass(name) {\n" " var src = \n" - " ` function ${name}() { this.a = 0; };` +\n" + // Disable constant tracking of "a" field by assigning different Smi values + // twice to ease megamorphic probes counting. + " ` function ${name}() { this.a = 0; this.a = 1; };` +\n" " ` ${name}.prototype.foo = function() {};` +\n" " ` ${name};\\n`;\n" " return (0, eval)(src);\n" @@ -22115,10 +22121,11 @@ static void CheckInstanceCheckedAccessors(bool expects_callbacks) { CheckInstanceCheckedResult(5, 5, expects_callbacks, &try_catch); // Cleanup so that closures start out fresh in next check. - CompileRun("%DeoptimizeFunction(test_get);" - "%ClearFunctionTypeFeedback(test_get);" - "%DeoptimizeFunction(test_set);" - "%ClearFunctionTypeFeedback(test_set);"); + CompileRun( + "%DeoptimizeFunction(test_get);" + "%ClearFunctionFeedback(test_get);" + "%DeoptimizeFunction(test_set);" + "%ClearFunctionFeedback(test_set);"); } @@ -24535,7 +24542,7 @@ void RunStreamingTest(const char** chunks, delete task; // Possible errors are only produced while compiling. - CHECK_EQ(false, try_catch.HasCaught()); + CHECK(!try_catch.HasCaught()); v8::ScriptOrigin origin(v8_str("http://foo.com")); char* full_source = TestSourceStream::FullSourceString(chunks); @@ -24943,7 +24950,7 @@ TEST(StreamingWithHarmonyScopes) { // Parsing should succeed (the script will be parsed and compiled in a context // independent way, so the error is not detected). - CHECK_EQ(false, try_catch.HasCaught()); + CHECK(!try_catch.HasCaught()); v8::ScriptOrigin origin(v8_str("http://foo.com")); char* full_source = TestSourceStream::FullSourceString(chunks); @@ -24952,7 +24959,7 @@ TEST(StreamingWithHarmonyScopes) { origin) .ToLocalChecked(); CHECK(!script.IsEmpty()); - CHECK_EQ(false, try_catch.HasCaught()); + CHECK(!try_catch.HasCaught()); // Running the script exposes the error. CHECK(script->Run(env.local()).IsEmpty()); @@ -25456,7 +25463,7 @@ TEST(ExtrasUtilsObject) { .ToLocalChecked() .As<v8::Symbol>(); i::Handle<i::Symbol> ips = v8::Utils::OpenHandle(*private_symbol); - CHECK_EQ(true, ips->IsPrivate()); + CHECK(ips->IsPrivate()); CompileRun("var result = 0; function store(x) { result = x; }"); auto store = CompileRun("store").As<v8::Function>(); @@ -25487,7 +25494,7 @@ TEST(ExtrasUtilsObject) { result->Get(env.local(), v8_str("rejectedButHandledPromise")) .ToLocalChecked() .As<v8::Promise>(); - CHECK_EQ(true, rejected_but_handled_promise->HasHandler()); + CHECK(rejected_but_handled_promise->HasHandler()); } @@ -25894,8 +25901,62 @@ TEST(AccessCheckedToStringTag) { CHECK_EQ(0, strcmp(*result_denied, "[object Object]")); } +TEST(ObjectTemplateArrayProtoIntrinsics) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + LocalContext env; + + Local<ObjectTemplate> object_template = v8::ObjectTemplate::New(isolate); + object_template->SetIntrinsicDataProperty(v8_str("prop_entries"), + v8::kArrayProto_entries); + object_template->SetIntrinsicDataProperty(v8_str("prop_forEach"), + v8::kArrayProto_forEach); + object_template->SetIntrinsicDataProperty(v8_str("prop_keys"), + v8::kArrayProto_keys); + object_template->SetIntrinsicDataProperty(v8_str("prop_values"), + v8::kArrayProto_values); + Local<Object> object = + object_template->NewInstance(env.local()).ToLocalChecked(); + CHECK(env->Global()->Set(env.local(), v8_str("obj1"), object).FromJust()); + + const struct { + const char* const object_property_name; + const char* const array_property_name; + } intrinsics_comparisons[] = { + {"prop_entries", "Array.prototype.entries"}, + {"prop_forEach", "Array.prototype.forEach"}, + {"prop_keys", "Array.prototype.keys"}, + {"prop_values", "Array.prototype[Symbol.iterator]"}, + }; + + for (unsigned i = 0; i < arraysize(intrinsics_comparisons); i++) { + i::ScopedVector<char> test_string(64); + + i::SNPrintF(test_string, "typeof obj1.%s", + intrinsics_comparisons[i].object_property_name); + ExpectString(test_string.start(), "function"); + + i::SNPrintF(test_string, "obj1.%s === %s", + intrinsics_comparisons[i].object_property_name, + intrinsics_comparisons[i].array_property_name); + ExpectTrue(test_string.start()); + + i::SNPrintF(test_string, "obj1.%s = 42", + intrinsics_comparisons[i].object_property_name); + CompileRun(test_string.start()); + + i::SNPrintF(test_string, "obj1.%s === %s", + intrinsics_comparisons[i].object_property_name, + intrinsics_comparisons[i].array_property_name); + ExpectFalse(test_string.start()); + + i::SNPrintF(test_string, "typeof obj1.%s", + intrinsics_comparisons[i].object_property_name); + ExpectString(test_string.start(), "number"); + } +} -TEST(ObjectTemplateIntrinsics) { +TEST(ObjectTemplatePerContextIntrinsics) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); LocalContext env; @@ -25913,7 +25974,7 @@ TEST(ObjectTemplateIntrinsics) { object->Get(env.local(), v8_str("values")).ToLocalChecked()); auto fn = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values)); auto ctx = v8::Utils::OpenHandle(*env.local()); - CHECK_EQ(fn->GetCreationContext(), *ctx); + CHECK_EQ(*fn->GetCreationContext(), *ctx); { LocalContext env2; @@ -25929,7 +25990,7 @@ TEST(ObjectTemplateIntrinsics) { object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); auto ctx2 = v8::Utils::OpenHandle(*env2.local()); - CHECK_EQ(fn2->GetCreationContext(), *ctx2); + CHECK_EQ(*fn2->GetCreationContext(), *ctx2); } } diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index 680b1233f7..ff268560f1 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -1299,8 +1299,12 @@ TEST(15) { uint32_t vmin_s8[4], vmin_u16[4], vmin_s32[4]; uint32_t vmax_s8[4], vmax_u16[4], vmax_s32[4]; uint32_t vadd8[4], vadd16[4], vadd32[4]; + uint32_t vqadd_s8[4], vqadd_u16[4], vqadd_s32[4]; uint32_t vsub8[4], vsub16[4], vsub32[4]; + uint32_t vqsub_u8[4], vqsub_s16[4], vqsub_u32[4]; uint32_t vmul8[4], vmul16[4], vmul32[4]; + uint32_t vshl8[4], vshl16[4], vshl32[5]; + uint32_t vshr_s8[4], vshr_u16[4], vshr_s32[5]; uint32_t vceq[4], vceqf[4], vcgef[4], vcgtf[4]; uint32_t vcge_s8[4], vcge_u16[4], vcge_s32[4]; uint32_t vcgt_s8[4], vcgt_u16[4], vcgt_s32[4]; @@ -1631,6 +1635,28 @@ TEST(15) { __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vadd32)))); __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + // vqadd. + __ mov(r4, Operand(0x81)); + __ vdup(Neon8, q0, r4); + __ mov(r4, Operand(0x82)); + __ vdup(Neon8, q1, r4); + __ vqadd(NeonS8, q1, q1, q0); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqadd_s8)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ mov(r4, Operand(0x8000)); + __ vdup(Neon16, q0, r4); + __ vdup(Neon16, q1, r4); + __ vqadd(NeonU16, q1, q1, q0); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqadd_u16)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ mov(r4, Operand(0x80000001)); + __ vdup(Neon32, q0, r4); + __ mov(r4, Operand(0x80000002)); + __ vdup(Neon32, q1, r4); + __ vqadd(NeonS32, q1, q1, q0); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqadd_s32)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + // vsub (integer). __ mov(r4, Operand(0x01)); __ vdup(Neon8, q0, r4); @@ -1654,6 +1680,29 @@ TEST(15) { __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vsub32)))); __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + // vqsub. + __ mov(r4, Operand(0x7f)); + __ vdup(Neon8, q0, r4); + __ mov(r4, Operand(0x3f)); + __ vdup(Neon8, q1, r4); + __ vqsub(NeonU8, q1, q1, q0); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqsub_u8)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ mov(r4, Operand(0x8000)); + __ vdup(Neon16, q0, r4); + __ mov(r4, Operand(0x7fff)); + __ vdup(Neon16, q1, r4); + __ vqsub(NeonS16, q1, q1, q0); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqsub_s16)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ mov(r4, Operand(0x80000001)); + __ vdup(Neon32, q0, r4); + __ mov(r4, Operand(0x80000000)); + __ vdup(Neon32, q1, r4); + __ vqsub(NeonU32, q1, q1, q0); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqsub_u32)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + // vmul (integer). __ mov(r4, Operand(0x02)); __ vdup(Neon8, q0, r4); @@ -1671,6 +1720,32 @@ TEST(15) { __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmul32)))); __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + // vshl. + __ mov(r4, Operand(0x55)); + __ vdup(Neon8, q0, r4); + __ vshl(NeonS8, q1, q0, 1); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vshl8)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ vshl(NeonU16, q1, q0, 9); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vshl16)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ vshl(NeonS32, q1, q0, 17); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vshl32)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + + // vshr.s, vshr.u. + __ mov(r4, Operand(0x80)); + __ vdup(Neon8, q0, r4); + __ vshr(NeonS8, q1, q0, 1); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vshr_s8)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ vshr(NeonU16, q1, q0, 9); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vshr_u16)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + __ vshr(NeonS32, q1, q0, 17); + __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vshr_s32)))); + __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); + // vceq. __ mov(r4, Operand(0x03)); __ vdup(Neon8, q0, r4); @@ -1920,12 +1995,24 @@ TEST(15) { CHECK_EQ_SPLAT(vadd8, 0x03030303u); CHECK_EQ_SPLAT(vadd16, 0x00030003u); CHECK_EQ_SPLAT(vadd32, 0x00000003u); + CHECK_EQ_SPLAT(vqadd_s8, 0x80808080u); + CHECK_EQ_SPLAT(vqadd_u16, 0xffffffffu); + CHECK_EQ_SPLAT(vqadd_s32, 0x80000000u); + CHECK_EQ_SPLAT(vqsub_u8, 0x00000000u); + CHECK_EQ_SPLAT(vqsub_s16, 0x7fff7fffu); + CHECK_EQ_SPLAT(vqsub_u32, 0x00000000u); CHECK_EQ_SPLAT(vsub8, 0xfefefefeu); CHECK_EQ_SPLAT(vsub16, 0xfffefffeu); CHECK_EQ_SPLAT(vsub32, 0xfffffffeu); CHECK_EQ_SPLAT(vmul8, 0x04040404u); CHECK_EQ_SPLAT(vmul16, 0x00040004u); CHECK_EQ_SPLAT(vmul32, 0x00000004u); + CHECK_EQ_SPLAT(vshl8, 0xaaaaaaaau); + CHECK_EQ_SPLAT(vshl16, 0xaa00aa00u); + CHECK_EQ_SPLAT(vshl32, 0xaaaa0000u); + CHECK_EQ_SPLAT(vshr_s8, 0xc0c0c0c0u); + CHECK_EQ_SPLAT(vshr_u16, 0x00400040u); + CHECK_EQ_SPLAT(vshr_s32, 0xffffc040u); CHECK_EQ_SPLAT(vceq, 0x00ff00ffu); // [0, 3, 0, 3, ...] >= [3, 3, 3, 3, ...] CHECK_EQ_SPLAT(vcge_s8, 0x00ff00ffu); diff --git a/deps/v8/test/cctest/test-assembler-ia32.cc b/deps/v8/test/cctest/test-assembler-ia32.cc index e4cac56c15..36889b2443 100644 --- a/deps/v8/test/cctest/test-assembler-ia32.cc +++ b/deps/v8/test/cctest/test-assembler-ia32.cc @@ -1535,7 +1535,7 @@ TEST(Regress621926) { #endif F0 f = FUNCTION_CAST<F0>(code->entry()); - CHECK_EQ(f(), 1); + CHECK_EQ(1, f()); } #undef __ diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc index 191589a73a..7bfd1e767e 100644 --- a/deps/v8/test/cctest/test-assembler-mips.cc +++ b/deps/v8/test/cctest/test-assembler-mips.cc @@ -1406,10 +1406,10 @@ TEST(seleqz_selnez) { (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(test.a, 1); - CHECK_EQ(test.b, 0); - CHECK_EQ(test.c, 0); - CHECK_EQ(test.d, 1); + CHECK_EQ(1, test.a); + CHECK_EQ(0, test.b); + CHECK_EQ(0, test.c); + CHECK_EQ(1, test.d); const int test_size = 3; const int input_size = 5; @@ -1433,18 +1433,18 @@ TEST(seleqz_selnez) { test.i = inputs_S[i]; test.j = tests_S[j]; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(test.g, outputs_D[i]); - CHECK_EQ(test.h, 0); - CHECK_EQ(test.k, outputs_S[i]); - CHECK_EQ(test.l, 0); + CHECK_EQ(outputs_D[i], test.g); + CHECK_EQ(0, test.h); + CHECK_EQ(outputs_S[i], test.k); + CHECK_EQ(0, test.l); test.f = tests_D[j+1]; test.j = tests_S[j+1]; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(test.g, 0); - CHECK_EQ(test.h, outputs_D[i]); - CHECK_EQ(test.k, 0); - CHECK_EQ(test.l, outputs_S[i]); + CHECK_EQ(0, test.g); + CHECK_EQ(outputs_D[i], test.h); + CHECK_EQ(0, test.k); + CHECK_EQ(outputs_S[i], test.l); } } } @@ -3191,7 +3191,7 @@ TEST(jump_tables1) { __ jr(ra); __ nop(); - CHECK_EQ(assm.UnboundLabelsCount(), 0); + CHECK_EQ(0, assm.UnboundLabelsCount()); CodeDesc desc; assm.GetCode(&desc); @@ -3670,14 +3670,14 @@ TEST(ABS) { test.a = std::numeric_limits<double>::quiet_NaN(); test.b = std::numeric_limits<float>::quiet_NaN(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isnan(test.a), true); - CHECK_EQ(std::isnan(test.b), true); + CHECK(std::isnan(test.a)); + CHECK(std::isnan(test.b)); test.a = std::numeric_limits<double>::signaling_NaN(); test.b = std::numeric_limits<float>::signaling_NaN(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isnan(test.a), true); - CHECK_EQ(std::isnan(test.b), true); + CHECK(std::isnan(test.a)); + CHECK(std::isnan(test.b)); } @@ -3737,16 +3737,16 @@ TEST(ADD_FMT) { test.fa = std::numeric_limits<float>::max(); test.fb = std::numeric_limits<float>::max(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isfinite(test.c), false); - CHECK_EQ(std::isfinite(test.fc), false); + CHECK(!std::isfinite(test.c)); + CHECK(!std::isfinite(test.fc)); test.a = 5.0; test.b = std::numeric_limits<double>::signaling_NaN(); test.fa = 5.0; test.fb = std::numeric_limits<float>::signaling_NaN(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isnan(test.c), true); - CHECK_EQ(std::isnan(test.fc), true); + CHECK(std::isnan(test.c)); + CHECK(std::isnan(test.fc)); } @@ -4278,8 +4278,8 @@ TEST(CVT) { CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); } if (IsFp64Mode()) { - CHECK_EQ(test.cvt_l_s_out, -1); - CHECK_EQ(test.cvt_l_d_out, -1); + CHECK_EQ(-1, test.cvt_l_s_out); + CHECK_EQ(-1, test.cvt_l_d_out); } CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); @@ -4287,9 +4287,8 @@ TEST(CVT) { IsFp64Mode()) { CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); } - CHECK_EQ(test.cvt_w_s_out, -1); - CHECK_EQ(test.cvt_w_d_out, -1); - + CHECK_EQ(-1, test.cvt_w_s_out); + CHECK_EQ(-1, test.cvt_w_d_out); test.cvt_d_s_in = 0.49; test.cvt_d_w_in = 1; @@ -4310,8 +4309,8 @@ TEST(CVT) { CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); } if (IsFp64Mode()) { - CHECK_EQ(test.cvt_l_s_out, 0); - CHECK_EQ(test.cvt_l_d_out, 0); + CHECK_EQ(0, test.cvt_l_s_out); + CHECK_EQ(0, test.cvt_l_d_out); } CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); @@ -4319,8 +4318,8 @@ TEST(CVT) { IsFp64Mode()) { CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); } - CHECK_EQ(test.cvt_w_s_out, 0); - CHECK_EQ(test.cvt_w_d_out, 0); + CHECK_EQ(0, test.cvt_w_s_out); + CHECK_EQ(0, test.cvt_w_d_out); test.cvt_d_s_in = std::numeric_limits<float>::max(); test.cvt_d_w_in = std::numeric_limits<int32_t>::max(); @@ -4412,8 +4411,8 @@ TEST(CVT) { CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); } if (IsFp64Mode()) { - CHECK_EQ(test.cvt_l_s_out, 0); - CHECK_EQ(test.cvt_l_d_out, 0); + CHECK_EQ(0, test.cvt_l_s_out); + CHECK_EQ(0, test.cvt_l_d_out); } CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); @@ -4421,8 +4420,8 @@ TEST(CVT) { IsFp64Mode()) { CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); } - CHECK_EQ(test.cvt_w_s_out, 0); - CHECK_EQ(test.cvt_w_d_out, 0); + CHECK_EQ(0, test.cvt_w_s_out); + CHECK_EQ(0, test.cvt_w_d_out); } @@ -4525,8 +4524,8 @@ TEST(DIV_FMT) { test.fOp2 = -0.0; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(false, std::isfinite(test.dRes)); - CHECK_EQ(false, std::isfinite(test.fRes)); + CHECK(!std::isfinite(test.dRes)); + CHECK(!std::isfinite(test.fRes)); test.dOp1 = 0.0; test.dOp2 = -0.0; @@ -4534,8 +4533,8 @@ TEST(DIV_FMT) { test.fOp2 = -0.0; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(true, std::isnan(test.dRes)); - CHECK_EQ(true, std::isnan(test.fRes)); + CHECK(std::isnan(test.dRes)); + CHECK(std::isnan(test.fRes)); test.dOp1 = std::numeric_limits<double>::quiet_NaN(); test.dOp2 = -5.0; @@ -4543,8 +4542,8 @@ TEST(DIV_FMT) { test.fOp2 = -5.0; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(true, std::isnan(test.dRes)); - CHECK_EQ(true, std::isnan(test.fRes)); + CHECK(std::isnan(test.dRes)); + CHECK(std::isnan(test.fRes)); } @@ -5383,7 +5382,7 @@ TEST(Trampoline) { int32_t res = reinterpret_cast<int32_t>( CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); - CHECK_EQ(res, 0); + CHECK_EQ(0, res); } template <class T> diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc index 0ec51723e9..5875f1e79d 100644 --- a/deps/v8/test/cctest/test-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-assembler-mips64.cc @@ -1589,10 +1589,10 @@ TEST(seleqz_selnez) { (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(test.a, 1); - CHECK_EQ(test.b, 0); - CHECK_EQ(test.c, 0); - CHECK_EQ(test.d, 1); + CHECK_EQ(1, test.a); + CHECK_EQ(0, test.b); + CHECK_EQ(0, test.c); + CHECK_EQ(1, test.d); const int test_size = 3; const int input_size = 5; @@ -1616,18 +1616,18 @@ TEST(seleqz_selnez) { test.i = inputs_S[i]; test.j = tests_S[j]; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(test.g, outputs_D[i]); - CHECK_EQ(test.h, 0); - CHECK_EQ(test.k, outputs_S[i]); - CHECK_EQ(test.l, 0); + CHECK_EQ(outputs_D[i], test.g); + CHECK_EQ(0, test.h); + CHECK_EQ(outputs_S[i], test.k); + CHECK_EQ(0, test.l); test.f = tests_D[j+1]; test.j = tests_S[j+1]; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(test.g, 0); - CHECK_EQ(test.h, outputs_D[i]); - CHECK_EQ(test.k, 0); - CHECK_EQ(test.l, outputs_S[i]); + CHECK_EQ(0, test.g); + CHECK_EQ(outputs_D[i], test.h); + CHECK_EQ(0, test.k); + CHECK_EQ(outputs_S[i], test.l); } } } @@ -3315,7 +3315,7 @@ TEST(jump_tables1) { __ jr(ra); __ nop(); - CHECK_EQ(assm.UnboundLabelsCount(), 0); + CHECK_EQ(0, assm.UnboundLabelsCount()); CodeDesc desc; assm.GetCode(&desc); @@ -3829,14 +3829,14 @@ TEST(ABS) { test.a = std::numeric_limits<double>::quiet_NaN(); test.b = std::numeric_limits<float>::quiet_NaN(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isnan(test.a), true); - CHECK_EQ(std::isnan(test.b), true); + CHECK(std::isnan(test.a)); + CHECK(std::isnan(test.b)); test.a = std::numeric_limits<double>::signaling_NaN(); test.b = std::numeric_limits<float>::signaling_NaN(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isnan(test.a), true); - CHECK_EQ(std::isnan(test.b), true); + CHECK(std::isnan(test.a)); + CHECK(std::isnan(test.b)); } @@ -3896,16 +3896,16 @@ TEST(ADD_FMT) { test.fa = std::numeric_limits<float>::max(); test.fb = std::numeric_limits<float>::max(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isfinite(test.c), false); - CHECK_EQ(std::isfinite(test.fc), false); + CHECK(!std::isfinite(test.c)); + CHECK(!std::isfinite(test.fc)); test.a = 5.0; test.b = std::numeric_limits<double>::signaling_NaN(); test.fa = 5.0; test.fb = std::numeric_limits<float>::signaling_NaN(); (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(std::isnan(test.c), true); - CHECK_EQ(std::isnan(test.fc), true); + CHECK(std::isnan(test.c)); + CHECK(std::isnan(test.fc)); } @@ -4425,14 +4425,13 @@ TEST(CVT) { CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); - CHECK_EQ(test.cvt_l_s_out, -1); - CHECK_EQ(test.cvt_l_d_out, -1); + CHECK_EQ(-1, test.cvt_l_s_out); + CHECK_EQ(-1, test.cvt_l_d_out); CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); - CHECK_EQ(test.cvt_w_s_out, -1); - CHECK_EQ(test.cvt_w_d_out, -1); - + CHECK_EQ(-1, test.cvt_w_s_out); + CHECK_EQ(-1, test.cvt_w_d_out); test.cvt_d_s_in = 0.49; test.cvt_d_w_in = 1; @@ -4449,13 +4448,13 @@ TEST(CVT) { CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); - CHECK_EQ(test.cvt_l_s_out, 0); - CHECK_EQ(test.cvt_l_d_out, 0); + CHECK_EQ(0, test.cvt_l_s_out); + CHECK_EQ(0, test.cvt_l_d_out); CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); - CHECK_EQ(test.cvt_w_s_out, 0); - CHECK_EQ(test.cvt_w_d_out, 0); + CHECK_EQ(0, test.cvt_w_s_out); + CHECK_EQ(0, test.cvt_w_d_out); test.cvt_d_s_in = std::numeric_limits<float>::max(); test.cvt_d_w_in = std::numeric_limits<int32_t>::max(); @@ -4527,13 +4526,13 @@ TEST(CVT) { CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); - CHECK_EQ(test.cvt_l_s_out, 0); - CHECK_EQ(test.cvt_l_d_out, 0); + CHECK_EQ(0, test.cvt_l_s_out); + CHECK_EQ(0, test.cvt_l_d_out); CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in)); CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in)); CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); - CHECK_EQ(test.cvt_w_s_out, 0); - CHECK_EQ(test.cvt_w_d_out, 0); + CHECK_EQ(0, test.cvt_w_s_out); + CHECK_EQ(0, test.cvt_w_d_out); } @@ -4634,8 +4633,8 @@ TEST(DIV_FMT) { test.fOp2 = -0.0; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(false, std::isfinite(test.dRes)); - CHECK_EQ(false, std::isfinite(test.fRes)); + CHECK(!std::isfinite(test.dRes)); + CHECK(!std::isfinite(test.fRes)); test.dOp1 = 0.0; test.dOp2 = -0.0; @@ -4643,8 +4642,8 @@ TEST(DIV_FMT) { test.fOp2 = -0.0; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(true, std::isnan(test.dRes)); - CHECK_EQ(true, std::isnan(test.fRes)); + CHECK(std::isnan(test.dRes)); + CHECK(std::isnan(test.fRes)); test.dOp1 = std::numeric_limits<double>::quiet_NaN(); test.dOp2 = -5.0; @@ -4652,8 +4651,8 @@ TEST(DIV_FMT) { test.fOp2 = -5.0; (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); - CHECK_EQ(true, std::isnan(test.dRes)); - CHECK_EQ(true, std::isnan(test.fRes)); + CHECK(std::isnan(test.dRes)); + CHECK(std::isnan(test.fRes)); } @@ -5931,7 +5930,7 @@ TEST(Trampoline) { int64_t res = reinterpret_cast<int64_t>( CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); - CHECK_EQ(res, 0); + CHECK_EQ(0, res); } template <class T> diff --git a/deps/v8/test/cctest/test-assembler-x64.cc b/deps/v8/test/cctest/test-assembler-x64.cc index 0ea854d7fe..1653851953 100644 --- a/deps/v8/test/cctest/test-assembler-x64.cc +++ b/deps/v8/test/cctest/test-assembler-x64.cc @@ -32,8 +32,10 @@ #include "src/base/platform/platform.h" #include "src/base/utils/random-number-generator.h" +#include "src/double.h" #include "src/factory.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "src/ostreams.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-assembler-x87.cc b/deps/v8/test/cctest/test-assembler-x87.cc index 3649b5bf88..d8285290fa 100644 --- a/deps/v8/test/cctest/test-assembler-x87.cc +++ b/deps/v8/test/cctest/test-assembler-x87.cc @@ -445,7 +445,7 @@ TEST(Regress621926) { #endif F0 f = FUNCTION_CAST<F0>(code->entry()); - CHECK_EQ(f(), 1); + CHECK_EQ(1, f()); } #undef __ diff --git a/deps/v8/test/cctest/test-code-layout.cc b/deps/v8/test/cctest/test-code-layout.cc index fb72554df4..e061dbd26d 100644 --- a/deps/v8/test/cctest/test-code-layout.cc +++ b/deps/v8/test/cctest/test-code-layout.cc @@ -42,7 +42,7 @@ TEST(CodeLayoutWithoutUnwindingInfo) { CHECK(!code->has_unwinding_info()); CHECK_EQ(code->instruction_size(), buffer_size); - CHECK_EQ(memcmp(code->instruction_start(), buffer, buffer_size), 0); + CHECK_EQ(0, memcmp(code->instruction_start(), buffer, buffer_size)); CHECK_EQ(code->instruction_end() - reinterpret_cast<byte*>(*code), Code::kHeaderSize + buffer_size - kHeapObjectTag); } @@ -79,7 +79,7 @@ TEST(CodeLayoutWithUnwindingInfo) { CHECK(code->has_unwinding_info()); CHECK_EQ(code->instruction_size(), buffer_size); - CHECK_EQ(memcmp(code->instruction_start(), buffer, buffer_size), 0); + CHECK_EQ(0, memcmp(code->instruction_start(), buffer, buffer_size)); CHECK(IsAligned(code->GetUnwindingInfoSizeOffset(), 8)); CHECK_EQ(code->unwinding_info_size(), unwinding_info_size); CHECK( diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 068ef9c3d1..afe34b62c6 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/api.h" #include "src/base/utils/random-number-generator.h" #include "src/builtins/builtins-promise.h" #include "src/code-factory.h" #include "src/code-stub-assembler.h" #include "src/compiler/node.h" +#include "src/debug/debug.h" #include "src/isolate.h" +#include "src/objects-inl.h" #include "test/cctest/compiler/code-assembler-tester.h" #include "test/cctest/compiler/function-tester.h" @@ -180,47 +183,6 @@ TEST(ToString) { } } -TEST(FlattenString) { - Isolate* isolate(CcTest::InitIsolateOnce()); - const int kNumParams = 1; - CodeAssemblerTester data(isolate, kNumParams); - CodeStubAssembler m(data.state()); - m.Return(m.FlattenString(m.Parameter(0))); - - Handle<Code> code = data.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 CodeAssemblerLabel Label; typedef CodeAssemblerVariable Variable; @@ -238,22 +200,26 @@ TEST(TryToName) { Label passed(&m), failed(&m); Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m); - Variable var_index(&m, MachineType::PointerRepresentation()); - - m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &if_bailout); - - m.Bind(&if_keyisindex); - m.GotoUnless( - m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsIndex))), - &failed); - m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()), &passed, - &failed); - - m.Bind(&if_keyisunique); - m.GotoUnless( - m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsUnique))), - &failed); - m.Branch(m.WordEqual(expected_arg, key), &passed, &failed); + { + Variable var_index(&m, MachineType::PointerRepresentation()); + Variable var_unique(&m, MachineRepresentation::kTagged); + + m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &var_unique, + &if_bailout); + + m.Bind(&if_keyisindex); + m.GotoIfNot(m.WordEqual(expected_result, + m.SmiConstant(Smi::FromInt(kKeyIsIndex))), + &failed); + m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()), + &passed, &failed); + + m.Bind(&if_keyisunique); + m.GotoIfNot(m.WordEqual(expected_result, + m.SmiConstant(Smi::FromInt(kKeyIsUnique))), + &failed); + m.Branch(m.WordEqual(expected_arg, var_unique.value()), &passed, &failed); + } m.Bind(&if_bailout); m.Branch( @@ -349,6 +315,23 @@ TEST(TryToName) { Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test"); ft.CheckTrue(key, expect_bailout); } + + if (FLAG_thin_strings) { + // TryToName(<thin string>) => internalized version. + Handle<String> s = isolate->factory()->NewStringFromAsciiChecked("foo"); + Handle<String> internalized = isolate->factory()->InternalizeString(s); + ft.CheckTrue(s, expect_unique, internalized); + } + + if (FLAG_thin_strings) { + // TryToName(<thin two-byte string>) => internalized version. + uc16 array1[] = {2001, 2002, 2003}; + Vector<const uc16> str1(array1); + Handle<String> s = + isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked(); + Handle<String> internalized = isolate->factory()->InternalizeString(s); + ft.CheckTrue(s, expect_unique, internalized); + } } namespace { @@ -409,7 +392,7 @@ void TestNameDictionaryLookup() { m.NameDictionaryLookup<Dictionary>(dictionary, unique_name, &if_found, &var_name_index, &if_not_found); m.Bind(&if_found); - m.GotoUnless( + m.GotoIfNot( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), &failed); m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_name_index.value()), @@ -516,7 +499,7 @@ void TestNumberDictionaryLookup() { m.NumberDictionaryLookup<Dictionary>(dictionary, key, &if_found, &var_entry, &if_not_found); m.Bind(&if_found); - m.GotoUnless( + m.GotoIfNot( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), &failed); m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_entry.value()), &passed, @@ -1526,7 +1509,7 @@ TEST(Arguments) { CodeAssemblerTester data(isolate, kNumParams); CodeStubAssembler m(data.state()); - CodeStubArguments arguments(&m, m.Int32Constant(3)); + CodeStubArguments arguments(&m, m.IntPtrConstant(3)); CSA_ASSERT( &m, m.WordEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12)))); @@ -1556,7 +1539,7 @@ TEST(ArgumentsForEach) { CodeAssemblerTester data(isolate, kNumParams); CodeStubAssembler m(data.state()); - CodeStubArguments arguments(&m, m.Int32Constant(3)); + CodeStubArguments arguments(&m, m.IntPtrConstant(3)); CodeAssemblerVariable sum(&m, MachineRepresentation::kTagged); CodeAssemblerVariableList list({&sum}, m.zone()); @@ -1599,7 +1582,7 @@ TEST(IsDebugActive) { CHECK(!code.is_null()); FunctionTester ft(code, kNumParams); - CHECK_EQ(false, isolate->debug()->is_active()); + CHECK(!isolate->debug()->is_active()); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(isolate->heap()->false_value(), *result); @@ -1636,7 +1619,7 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler { JSObject::SetElement(isolate, array, 1, Handle<Smi>(Smi::FromInt(2), isolate), SLOPPY) .Check(); - CodeStubArguments args(this, Int32Constant(kNumParams)); + CodeStubArguments args(this, IntPtrConstant(kNumParams)); Variable arg_index(this, MachineType::PointerRepresentation()); Label bailout(this); arg_index.Bind(IntPtrConstant(0)); @@ -1769,7 +1752,7 @@ TEST(IsPromiseHookEnabled) { CodeAssemblerTester data(isolate, kNumParams); CodeStubAssembler m(data.state()); - m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabled())); + m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabledOrDebugIsActive())); Handle<Code> code = data.GenerateCode(); CHECK(!code.is_null()); @@ -1867,7 +1850,6 @@ TEST(AllocatePromiseReactionJobInfo) { CHECK(promise_info->deferred_on_resolve()->IsUndefined(isolate)); CHECK(promise_info->deferred_on_reject()->IsUndefined(isolate)); CHECK(promise_info->context()->IsContext()); - CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id()); } TEST(AllocatePromiseResolveThenableJobInfo) { @@ -1906,7 +1888,6 @@ TEST(AllocatePromiseResolveThenableJobInfo) { CHECK(promise_info->then()->IsJSFunction()); CHECK(promise_info->resolve()->IsJSFunction()); CHECK(promise_info->reject()->IsJSFunction()); - CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id()); CHECK(promise_info->context()->IsContext()); } @@ -2138,7 +2119,7 @@ TEST(AllocateFunctionWithMapAndContext) { Handle<JSFunction> fun = Handle<JSFunction>::cast(result_obj); CHECK_EQ(isolate->heap()->empty_fixed_array(), fun->properties()); CHECK_EQ(isolate->heap()->empty_fixed_array(), fun->elements()); - CHECK_EQ(isolate->heap()->empty_literals_array(), fun->literals()); + CHECK_EQ(isolate->heap()->undefined_cell(), fun->feedback_vector_cell()); CHECK_EQ(isolate->heap()->the_hole_value(), fun->prototype_or_initial_map()); CHECK_EQ(*isolate->promise_resolve_shared_fun(), fun->shared()); CHECK_EQ(isolate->promise_resolve_shared_fun()->code(), fun->code()); diff --git a/deps/v8/test/cctest/test-code-stubs-x64.cc b/deps/v8/test/cctest/test-code-stubs-x64.cc index b9eddd6c57..62ef533ad8 100644 --- a/deps/v8/test/cctest/test-code-stubs-x64.cc +++ b/deps/v8/test/cctest/test-code-stubs-x64.cc @@ -33,6 +33,7 @@ #include "src/code-stubs.h" #include "src/factory.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "src/register-configuration.h" #include "test/cctest/cctest.h" #include "test/cctest/test-code-stubs.h" diff --git a/deps/v8/test/cctest/test-code-stubs.cc b/deps/v8/test/cctest/test-code-stubs.cc index 273f57ef0e..0a8b24e4d3 100644 --- a/deps/v8/test/cctest/test-code-stubs.cc +++ b/deps/v8/test/cctest/test-code-stubs.cc @@ -33,8 +33,10 @@ #include "src/base/platform/platform.h" #include "src/code-stubs.h" +#include "src/double.h" #include "src/factory.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/test-code-stubs.h" diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index 95db65bdee..57686d0ee5 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -65,7 +65,7 @@ static Handle<JSFunction> Compile(const char* source) { Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, - v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); + v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE); return isolate->factory()->NewFunctionFromSharedFunctionInfo( shared, isolate->native_context()); } @@ -312,7 +312,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { // Verify that we gathered feedback. CHECK(!feedback_vector->is_empty()); - FeedbackVectorSlot slot_for_a(0); + FeedbackSlot slot_for_a(0); Object* object = feedback_vector->Get(slot_for_a); CHECK(object->IsWeakCell() && WeakCell::cast(object)->value()->IsJSFunction()); @@ -361,7 +361,6 @@ TEST(FeedbackVectorUnaffectedByScopeChanges) { // If we are compiling lazily then it should not be compiled, and so no // feedback vector allocated yet. CHECK(!f->shared()->is_compiled()); - CHECK(f->feedback_vector()->is_empty()); CompileRun("morphing_call();"); @@ -386,10 +385,12 @@ TEST(OptimizedCodeSharing1) { " return function() { return x; };" "}" "var closure0 = MakeClosure();" + "var closure1 = MakeClosure();" // We only share optimized code + // if there are at least two closures. "%DebugPrint(closure0());" "%OptimizeFunctionOnNextCall(closure0);" "%DebugPrint(closure0());" - "var closure1 = MakeClosure(); closure1();" + "closure1();" "var closure2 = MakeClosure(); closure2();"); Handle<JSFunction> fun1 = Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 6ec71a2ab3..08f262d0e7 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -30,8 +30,10 @@ #include "src/v8.h" #include "include/v8-profiler.h" +#include "src/api.h" #include "src/base/platform/platform.h" #include "src/deoptimizer.h" +#include "src/objects-inl.h" #include "src/profiler/cpu-profiler-inl.h" #include "src/profiler/profiler-listener.h" #include "src/utils.h" @@ -78,7 +80,7 @@ static const char* reason(const i::DeoptimizeReason reason) { TEST(StartStop) { i::Isolate* isolate = CcTest::i_isolate(); CpuProfilesCollection profiles(isolate); - ProfileGenerator generator(isolate, &profiles); + ProfileGenerator generator(&profiles); std::unique_ptr<ProfilerEventsProcessor> processor( new ProfilerEventsProcessor(isolate, &generator, v8::base::TimeDelta::FromMicroseconds(100))); @@ -163,7 +165,7 @@ TEST(CodeEvents) { i::AbstractCode* args4_code = CreateCode(&env); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); + ProfileGenerator* generator = new ProfileGenerator(profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( isolate, generator, v8::base::TimeDelta::FromMicroseconds(100)); CpuProfiler profiler(isolate, profiles, generator, processor); @@ -231,7 +233,7 @@ TEST(TickEvents) { i::AbstractCode* frame3_code = CreateCode(&env); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); + ProfileGenerator* generator = new ProfileGenerator(profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(CcTest::i_isolate(), generator, v8::base::TimeDelta::FromMicroseconds(100)); @@ -304,7 +306,7 @@ TEST(Issue1398) { i::AbstractCode* code = CreateCode(&env); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); + ProfileGenerator* generator = new ProfileGenerator(profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(CcTest::i_isolate(), generator, v8::base::TimeDelta::FromMicroseconds(100)); @@ -1077,7 +1079,7 @@ static void TickLines(bool optimize) { CHECK(code_address); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); + ProfileGenerator* generator = new ProfileGenerator(profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(CcTest::i_isolate(), generator, v8::base::TimeDelta::FromMicroseconds(100)); diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 54904f9b84..8d06b1b66e 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -35,6 +35,7 @@ #include "src/debug/debug.h" #include "src/deoptimizer.h" #include "src/frames.h" +#include "src/objects-inl.h" #include "src/utils.h" #include "test/cctest/cctest.h" @@ -3756,43 +3757,6 @@ TEST(TryFinallyOriginalMessage) { } -TEST(EvalJSInDebugEventListenerOnNativeReThrownException) { - DebugLocalContext env; - v8::HandleScope scope(env->GetIsolate()); - env.ExposeDebug(); - - // Create functions for testing break on exception. - v8::Local<v8::Function> noThrowJS = CompileFunction( - &env, "function noThrowJS(){var a=[1]; a.push(2); return a.length;}", - "noThrowJS"); - - debug_event_listener_callback = noThrowJS; - debug_event_listener_callback_result = 2; - - env->GetIsolate()->AddMessageListener(MessageCallbackCount); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); - // Break on uncaught exception - ChangeBreakOnException(false, true); - DebugEventCounterClear(); - MessageCallbackCountClear(); - - // ReThrow native error - { - v8::TryCatch tryCatch(env->GetIsolate()); - env->GetIsolate()->ThrowException( - v8::Exception::TypeError(v8_str(env->GetIsolate(), "Type error"))); - CHECK(tryCatch.HasCaught()); - tryCatch.ReThrow(); - } - CHECK_EQ(1, exception_hit_count); - CHECK_EQ(1, uncaught_exception_hit_count); - CHECK_EQ(0, message_callback_count); // FIXME: Should it be 1 ? - CHECK(!debug_event_listener_callback.IsEmpty()); - - debug_event_listener_callback.Clear(); -} - - // Test break on exception from compiler errors. When compiling using // v8::Script::Compile there is no JavaScript stack whereas when compiling using // eval there are JavaScript frames. @@ -3822,16 +3786,18 @@ TEST(BreakOnCompileException) { // Throws SyntaxError: Unexpected end of input CHECK( v8::Script::Compile(context, v8_str(env->GetIsolate(), "+++")).IsEmpty()); - CHECK_EQ(1, exception_hit_count); - CHECK_EQ(1, uncaught_exception_hit_count); + // Exceptions with no stack are skipped. + CHECK_EQ(0, exception_hit_count); + CHECK_EQ(0, uncaught_exception_hit_count); CHECK_EQ(1, message_callback_count); CHECK_EQ(0, last_js_stack_height); // No JavaScript stack. // Throws SyntaxError: Unexpected identifier CHECK( v8::Script::Compile(context, v8_str(env->GetIsolate(), "x x")).IsEmpty()); - CHECK_EQ(2, exception_hit_count); - CHECK_EQ(2, uncaught_exception_hit_count); + // Exceptions with no stack are skipped. + CHECK_EQ(0, exception_hit_count); + CHECK_EQ(0, uncaught_exception_hit_count); CHECK_EQ(2, message_callback_count); CHECK_EQ(0, last_js_stack_height); // No JavaScript stack. @@ -3840,8 +3806,8 @@ TEST(BreakOnCompileException) { .ToLocalChecked() ->Run(context) .IsEmpty()); - CHECK_EQ(3, exception_hit_count); - CHECK_EQ(3, uncaught_exception_hit_count); + CHECK_EQ(1, exception_hit_count); + CHECK_EQ(1, uncaught_exception_hit_count); CHECK_EQ(3, message_callback_count); CHECK_EQ(1, last_js_stack_height); @@ -3850,8 +3816,8 @@ TEST(BreakOnCompileException) { .ToLocalChecked() ->Run(context) .IsEmpty()); - CHECK_EQ(4, exception_hit_count); - CHECK_EQ(4, uncaught_exception_hit_count); + CHECK_EQ(2, exception_hit_count); + CHECK_EQ(2, uncaught_exception_hit_count); CHECK_EQ(4, message_callback_count); CHECK_EQ(1, last_js_stack_height); } @@ -4422,7 +4388,7 @@ TEST(HiddenPrototypePropertyMirror) { .FromJust()); // The prototype (__proto__) for o0 should be o3 as o1 and o2 are hidden. - CHECK(CompileRun("o0_mirror.protoObject() == o3_mirror") + CHECK(CompileRun("o0_mirror.protoObject().value() == o3_mirror.value()") ->BooleanValue(context) .FromJust()); } @@ -6456,14 +6422,13 @@ TEST(BreakLocationIterator) { Handle<i::SharedFunctionInfo> shared(function->shared()); EnableDebugger(isolate); - CHECK(i_isolate->debug()->EnsureDebugInfo(shared, function)); + CHECK(i_isolate->debug()->EnsureDebugInfo(shared)); Handle<i::DebugInfo> debug_info(shared->GetDebugInfo()); Handle<i::AbstractCode> abstract_code(shared->abstract_code()); { - auto iterator = i::BreakIterator::GetIterator(debug_info, abstract_code, - i::ALL_BREAK_LOCATIONS); + auto iterator = i::BreakIterator::GetIterator(debug_info, abstract_code); CHECK(iterator->GetBreakLocation().IsDebuggerStatement()); CHECK_EQ(17, iterator->GetBreakLocation().position()); iterator->Next(); @@ -6482,18 +6447,6 @@ TEST(BreakLocationIterator) { CHECK(iterator->Done()); } - { - auto iterator = i::BreakIterator::GetIterator(debug_info, abstract_code, - i::CALLS_AND_RETURNS); - CHECK(iterator->GetBreakLocation().IsCall()); - CHECK_EQ(32, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->GetBreakLocation().IsReturn()); - CHECK_EQ(60, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->Done()); - } - DisableDebugger(isolate); } @@ -6642,7 +6595,7 @@ TEST(DebugStepOverFunctionWithCaughtException) { "foo();\n"); v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); - CHECK_EQ(break_point_hit_count, 4); + CHECK_EQ(4, break_point_hit_count); } bool out_of_memory_callback_called = false; @@ -6672,3 +6625,41 @@ UNINITIALIZED_TEST(DebugSetOutOfMemoryListener) { } isolate->Dispose(); } + +TEST(DebugCoverage) { + i::FLAG_always_opt = false; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + v8::debug::Coverage::TogglePrecise(isolate, true); + v8::Local<v8::String> source = v8_str( + "function f() {\n" + "}\n" + "f();\n" + "f();"); + CompileRun(source); + v8::debug::Coverage coverage = v8::debug::Coverage::Collect(isolate, false); + CHECK_EQ(1u, coverage.ScriptCount()); + v8::debug::Coverage::ScriptData script_data = coverage.GetScriptData(0); + v8::Local<v8::debug::Script> script = script_data.GetScript(); + CHECK(script->Source() + .ToLocalChecked() + ->Equals(env.local(), source) + .FromMaybe(false)); + + CHECK_EQ(2u, script_data.FunctionCount()); + v8::debug::Coverage::FunctionData function_data = + script_data.GetFunctionData(0); + CHECK_EQ(0, function_data.Start().GetLineNumber()); + CHECK_EQ(0, function_data.Start().GetColumnNumber()); + CHECK_EQ(3, function_data.End().GetLineNumber()); + CHECK_EQ(4, function_data.End().GetColumnNumber()); + CHECK_EQ(1, function_data.Count()); + + function_data = script_data.GetFunctionData(1); + CHECK_EQ(0, function_data.Start().GetLineNumber()); + CHECK_EQ(0, function_data.Start().GetColumnNumber()); + CHECK_EQ(1, function_data.End().GetLineNumber()); + CHECK_EQ(1, function_data.End().GetColumnNumber()); + CHECK_EQ(2, function_data.Count()); +} diff --git a/deps/v8/test/cctest/test-deoptimization.cc b/deps/v8/test/cctest/test-deoptimization.cc index 0d435c5e10..06d746b2e6 100644 --- a/deps/v8/test/cctest/test-deoptimization.cc +++ b/deps/v8/test/cctest/test-deoptimization.cc @@ -35,6 +35,7 @@ #include "src/debug/debug.h" #include "src/deoptimizer.h" #include "src/isolate.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" using ::v8::base::OS; diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc index d7344a142f..b0d429f5c8 100644 --- a/deps/v8/test/cctest/test-dictionary.cc +++ b/deps/v8/test/cctest/test-dictionary.cc @@ -33,8 +33,9 @@ #include "src/execution.h" #include "src/factory.h" #include "src/global-handles.h" +#include "src/heap/spaces.h" #include "src/macro-assembler.h" -#include "src/objects.h" +#include "src/objects-inl.h" #include "test/cctest/heap/heap-utils.h" using namespace v8::internal; @@ -50,27 +51,27 @@ static void TestHashMap(Handle<HashMap> table) { Handle<JSObject> a = factory->NewJSArray(7); Handle<JSObject> b = factory->NewJSArray(11); table = HashMap::Put(table, a, b); - CHECK_EQ(table->NumberOfElements(), 1); + CHECK_EQ(1, table->NumberOfElements()); CHECK_EQ(table->Lookup(a), *b); // When the key does not exist in the map, Lookup returns the hole. CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value()); // Keys still have to be valid after objects were moved. CcTest::CollectGarbage(NEW_SPACE); - CHECK_EQ(table->NumberOfElements(), 1); + CHECK_EQ(1, table->NumberOfElements()); CHECK_EQ(table->Lookup(a), *b); CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value()); // Keys that are overwritten should not change number of elements. table = HashMap::Put(table, a, factory->NewJSArray(13)); - CHECK_EQ(table->NumberOfElements(), 1); + CHECK_EQ(1, table->NumberOfElements()); CHECK_NE(table->Lookup(a), *b); // Keys that have been removed are mapped to the hole. bool was_present = false; table = HashMap::Remove(table, a, &was_present); CHECK(was_present); - CHECK_EQ(table->NumberOfElements(), 0); + CHECK_EQ(0, table->NumberOfElements()); CHECK_EQ(table->Lookup(a), CcTest::heap()->the_hole_value()); // Keys should map back to their respective values and also should get @@ -121,19 +122,19 @@ static void TestHashSet(Handle<HashSet> table) { Handle<JSObject> a = factory->NewJSArray(7); Handle<JSObject> b = factory->NewJSArray(11); table = HashSet::Add(table, a); - CHECK_EQ(table->NumberOfElements(), 1); + CHECK_EQ(1, table->NumberOfElements()); CHECK(table->Has(isolate, a)); CHECK(!table->Has(isolate, b)); // Keys still have to be valid after objects were moved. CcTest::CollectGarbage(NEW_SPACE); - CHECK_EQ(table->NumberOfElements(), 1); + CHECK_EQ(1, table->NumberOfElements()); CHECK(table->Has(isolate, a)); CHECK(!table->Has(isolate, b)); // Keys that are overwritten should not change number of elements. table = HashSet::Add(table, a); - CHECK_EQ(table->NumberOfElements(), 1); + CHECK_EQ(1, table->NumberOfElements()); CHECK(table->Has(isolate, a)); CHECK(!table->Has(isolate, b)); @@ -142,7 +143,7 @@ static void TestHashSet(Handle<HashSet> table) { // bool was_present = false; // table = HashSet::Remove(table, a, &was_present); // CHECK(was_present); - // CHECK_EQ(table->NumberOfElements(), 0); + // CHECK_EQ(0, table->NumberOfElements()); // CHECK(!table->Has(a)); // CHECK(!table->Has(b)); diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc index 3ba6bee8d4..0a3b8f1dec 100644 --- a/deps/v8/test/cctest/test-disasm-arm.cc +++ b/deps/v8/test/cctest/test-disasm-arm.cc @@ -1047,6 +1047,12 @@ TEST(Neon) { "f2142860 vadd.i16 q1, q2, q8"); COMPARE(vadd(Neon32, q15, q0, q8), "f260e860 vadd.i32 q15, q0, q8"); + COMPARE(vqadd(NeonU8, q0, q1, q2), + "f3020054 vqadd.u8 q0, q1, q2"); + COMPARE(vqadd(NeonS16, q1, q2, q8), + "f2142070 vqadd.s16 q1, q2, q8"); + COMPARE(vqadd(NeonU32, q15, q0, q8), + "f360e070 vqadd.u32 q15, q0, q8"); COMPARE(vsub(q15, q0, q8), "f260ed60 vsub.f32 q15, q0, q8"); COMPARE(vsub(Neon8, q0, q1, q2), @@ -1055,6 +1061,12 @@ TEST(Neon) { "f3142860 vsub.i16 q1, q2, q8"); COMPARE(vsub(Neon32, q15, q0, q8), "f360e860 vsub.i32 q15, q0, q8"); + COMPARE(vqsub(NeonU8, q0, q1, q2), + "f3020254 vqsub.u8 q0, q1, q2"); + COMPARE(vqsub(NeonS16, q1, q2, q8), + "f2142270 vqsub.s16 q1, q2, q8"); + COMPARE(vqsub(NeonU32, q15, q0, q8), + "f360e270 vqsub.u32 q15, q0, q8"); COMPARE(vmul(q0, q1, q2), "f3020d54 vmul.f32 q0, q1, q2"); COMPARE(vmul(Neon8, q0, q1, q2), @@ -1063,6 +1075,18 @@ TEST(Neon) { "f2142970 vmul.i16 q1, q2, q8"); COMPARE(vmul(Neon32, q15, q0, q8), "f260e970 vmul.i32 q15, q0, q8"); + COMPARE(vshl(NeonS8, q15, q0, 6), + "f2cee550 vshl.i8 q15, q0, #6"); + COMPARE(vshl(NeonU16, q15, q0, 10), + "f2dae550 vshl.i16 q15, q0, #10"); + COMPARE(vshl(NeonS32, q15, q0, 17), + "f2f1e550 vshl.i32 q15, q0, #17"); + COMPARE(vshr(NeonS8, q15, q0, 6), + "f2cae050 vshr.s8 q15, q0, #6"); + COMPARE(vshr(NeonU16, q15, q0, 10), + "f3d6e050 vshr.u16 q15, q0, #10"); + COMPARE(vshr(NeonS32, q15, q0, 17), + "f2efe050 vshr.s32 q15, q0, #17"); COMPARE(vrecpe(q15, q0), "f3fbe540 vrecpe.f32 q15, q0"); COMPARE(vrecps(q15, q0, q8), diff --git a/deps/v8/test/cctest/test-disasm-ia32.cc b/deps/v8/test/cctest/test-disasm-ia32.cc index 88471a26c8..73c9490d31 100644 --- a/deps/v8/test/cctest/test-disasm-ia32.cc +++ b/deps/v8/test/cctest/test-disasm-ia32.cc @@ -298,9 +298,6 @@ TEST(DisasmIa320) { __ jmp(&L1); __ jmp(Operand(ebx, ecx, times_4, 10000)); - ExternalReference after_break_target = - ExternalReference::debug_after_break_target_address(isolate); - __ jmp(Operand::StaticVariable(after_break_target)); __ jmp(ic, RelocInfo::CODE_TARGET); __ nop(); diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc index af8beaaa83..e65ccc55e7 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -34,6 +34,7 @@ #include "src/disasm.h" #include "src/disassembler.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -290,9 +291,6 @@ TEST(DisasmX64) { __ jmp(&L1); // TODO(mstarzinger): The following is protected. // __ jmp(Operand(rbx, rcx, times_4, 10000)); - ExternalReference after_break_target = - ExternalReference::debug_after_break_target_address(isolate); - USE(after_break_target); __ jmp(ic, RelocInfo::CODE_TARGET); __ nop(); @@ -386,6 +384,7 @@ TEST(DisasmX64) { __ cvtsd2ss(xmm0, xmm1); __ cvtsd2ss(xmm0, Operand(rbx, rcx, times_4, 10000)); __ movaps(xmm0, xmm1); + __ shufps(xmm0, xmm9, 0x0); // logic operation __ andps(xmm0, xmm1); diff --git a/deps/v8/test/cctest/test-elements-kind.cc b/deps/v8/test/cctest/test-elements-kind.cc index ee1f09d0a0..3478fca1cd 100644 --- a/deps/v8/test/cctest/test-elements-kind.cc +++ b/deps/v8/test/cctest/test-elements-kind.cc @@ -14,7 +14,7 @@ #include "src/factory.h" #include "src/global-handles.h" #include "src/ic/stub-cache.h" -#include "src/objects.h" +#include "src/objects-inl.h" using namespace v8::internal; @@ -78,7 +78,7 @@ TEST(JSObjectAddingProperties) { Handle<JSObject> object = factory->NewJSObject(function); Handle<Map> previous_map(object->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK(EQUALS(object->elements(), empty_fixed_array)); @@ -88,7 +88,7 @@ TEST(JSObjectAddingProperties) { JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE) .Check(); CHECK_NE(object->map(), *previous_map); - CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind()); CHECK_LE(1, object->properties()->length()); CHECK(EQUALS(object->elements(), empty_fixed_array)); } @@ -109,7 +109,7 @@ TEST(JSObjectInObjectAddingProperties) { Handle<JSObject> object = factory->NewJSObject(function); Handle<Map> previous_map(object->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK(EQUALS(object->elements(), empty_fixed_array)); @@ -121,7 +121,7 @@ TEST(JSObjectInObjectAddingProperties) { .Check(); } CHECK_NE(object->map(), *previous_map); - CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK(EQUALS(object->elements(), empty_fixed_array)); @@ -132,7 +132,7 @@ TEST(JSObjectInObjectAddingProperties) { JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE) .Check(); CHECK_NE(object->map(), *previous_map); - CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind()); // there must be at least 1 element in the properies store CHECK_LE(1, object->properties()->length()); CHECK(EQUALS(object->elements(), empty_fixed_array)); @@ -152,7 +152,7 @@ TEST(JSObjectAddingElements) { Handle<JSObject> object = factory->NewJSObject(function); Handle<Map> previous_map(object->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK(EQUALS(object->elements(), empty_fixed_array)); @@ -162,7 +162,7 @@ TEST(JSObjectAddingElements) { .Check(); // no change in elements_kind => no map transition CHECK_EQ(object->map(), *previous_map); - CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK_LE(1, object->elements()->length()); @@ -175,7 +175,7 @@ TEST(JSObjectAddingElements) { } // no change in elements_kind => no map transition CHECK_EQ(object->map(), *previous_map); - CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK_LE(non_dict_backing_store_limit, object->elements()->length()); @@ -186,7 +186,7 @@ TEST(JSObjectAddingElements) { .Check(); // change in elements_kind => map transition CHECK_NE(object->map(), *previous_map); - CHECK_EQ(object->map()->elements_kind(), DICTIONARY_ELEMENTS); + CHECK_EQ(DICTIONARY_ELEMENTS, object->map()->elements_kind()); CHECK(EQUALS(object->properties(), empty_fixed_array)); CHECK_LE(non_dict_backing_store_limit, object->elements()->length()); } @@ -204,10 +204,10 @@ TEST(JSArrayAddingProperties) { Handle<JSArray> array = factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0); Handle<Map> previous_map(array->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_SMI_ELEMENTS); + CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind()); CHECK(EQUALS(array->properties(), empty_fixed_array)); CHECK(EQUALS(array->elements(), empty_fixed_array)); - CHECK_EQ(Smi::cast(array->length())->value(), 0); + CHECK_EQ(0, Smi::cast(array->length())->value()); // for the default constructor function no in-object properties are reserved // hence adding a single property will initialize the property-array @@ -216,10 +216,10 @@ TEST(JSArrayAddingProperties) { .Check(); // No change in elements_kind but added property => new map CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS); + CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind()); CHECK_LE(1, array->properties()->length()); CHECK(EQUALS(array->elements(), empty_fixed_array)); - CHECK_EQ(Smi::cast(array->length())->value(), 0); + CHECK_EQ(0, Smi::cast(array->length())->value()); } @@ -236,10 +236,10 @@ TEST(JSArrayAddingElements) { Handle<JSArray> array = factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0); Handle<Map> previous_map(array->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_SMI_ELEMENTS); + CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind()); CHECK(EQUALS(array->properties(), empty_fixed_array)); CHECK(EQUALS(array->elements(), empty_fixed_array)); - CHECK_EQ(Smi::cast(array->length())->value(), 0); + CHECK_EQ(0, Smi::cast(array->length())->value()); // Adding an indexed element initializes the elements array name = MakeString("0"); @@ -247,7 +247,7 @@ TEST(JSArrayAddingElements) { .Check(); // no change in elements_kind => no map transition CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS); + CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind()); CHECK(EQUALS(array->properties(), empty_fixed_array)); CHECK_LE(1, array->elements()->length()); CHECK_EQ(1, Smi::cast(array->length())->value()); @@ -261,7 +261,7 @@ TEST(JSArrayAddingElements) { } // no change in elements_kind => no map transition CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS); + CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind()); CHECK(EQUALS(array->properties(), empty_fixed_array)); CHECK_LE(non_dict_backing_store_limit, array->elements()->length()); CHECK_EQ(non_dict_backing_store_limit, Smi::cast(array->length())->value()); @@ -274,7 +274,7 @@ TEST(JSArrayAddingElements) { .Check(); // change in elements_kind => map transition CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), DICTIONARY_ELEMENTS); + CHECK_EQ(DICTIONARY_ELEMENTS, array->map()->elements_kind()); CHECK(EQUALS(array->properties(), empty_fixed_array)); CHECK_LE(non_dict_backing_store_limit, array->elements()->length()); CHECK_LE(array->elements()->length(), index); @@ -296,8 +296,8 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) { Handle<JSArray> array = factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0); Handle<Map> previous_map(array->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_SMI_ELEMENTS); - CHECK_EQ(Smi::cast(array->length())->value(), 0); + CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind()); + CHECK_EQ(0, Smi::cast(array->length())->value()); // `array[0] = smi_value` doesn't change the elements_kind name = MakeString("0"); @@ -306,14 +306,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) { .Check(); // no change in elements_kind => no map transition CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS); + CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(1, Smi::cast(array->length())->value()); // `delete array[0]` does not alter length, but changes the elments_kind name = MakeString("0"); CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false)); CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_SMI_ELEMENTS); + CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(1, Smi::cast(array->length())->value()); previous_map = handle(array->map()); @@ -327,7 +327,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) { NONE) .Check(); CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_SMI_ELEMENTS); + CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); // Adding a string to the array changes from FAST_HOLEY_SMI to FAST_HOLEY @@ -336,7 +336,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) { NONE) .Check(); CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); previous_map = handle(array->map()); @@ -369,8 +369,8 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) { Handle<JSArray> array = factory->NewJSArray(ElementsKind::FAST_ELEMENTS, 0, 0); Handle<Map> previous_map(array->map()); - CHECK_EQ(previous_map->elements_kind(), FAST_ELEMENTS); - CHECK_EQ(Smi::cast(array->length())->value(), 0); + CHECK_EQ(FAST_ELEMENTS, previous_map->elements_kind()); + CHECK_EQ(0, Smi::cast(array->length())->value()); // `array[0] = smi_value` doesn't change the elements_kind name = MakeString("0"); @@ -379,14 +379,14 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) { .Check(); // no change in elements_kind => no map transition CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_ELEMENTS); + CHECK_EQ(FAST_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(1, Smi::cast(array->length())->value()); // `delete array[0]` does not alter length, but changes the elments_kind name = MakeString("0"); CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false)); CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(1, Smi::cast(array->length())->value()); previous_map = handle(array->map()); @@ -400,7 +400,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) { NONE) .Check(); CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); } @@ -426,7 +426,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) { NONE) .Check(); CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_DOUBLE_ELEMENTS); + CHECK_EQ(FAST_DOUBLE_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(1, Smi::cast(array->length())->value()); previous_map = handle(array->map()); @@ -436,14 +436,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) { NONE) .Check(); CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_DOUBLE_ELEMENTS); + CHECK_EQ(FAST_DOUBLE_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); // `delete array[0]` does not alter length, but changes the elments_kind name = MakeString("0"); CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false)); CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_DOUBLE_ELEMENTS); + CHECK_EQ(FAST_HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); previous_map = handle(array->map()); @@ -453,7 +453,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) { NONE) .Check(); CHECK_EQ(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_DOUBLE_ELEMENTS); + CHECK_EQ(FAST_HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); // Adding a string to the array changes to elements_kind FAST_ELEMENTS @@ -462,7 +462,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) { NONE) .Check(); CHECK_NE(array->map(), *previous_map); - CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS); + CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind()); CHECK_EQ(2, Smi::cast(array->length())->value()); previous_map = handle(array->map()); diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index 254a150af0..0d6fc55911 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -11,7 +11,7 @@ #include "src/factory.h" #include "src/global-handles.h" #include "src/macro-assembler.h" -#include "src/objects.h" +#include "src/objects-inl.h" #include "test/cctest/test-feedback-vector.h" using namespace v8::internal; @@ -38,13 +38,7 @@ TEST(VectorStructure) { Factory* factory = isolate->factory(); Zone zone(isolate->allocator(), ZONE_NAME); - // Empty vectors are the empty fixed array. - StaticFeedbackVectorSpec empty; - Handle<FeedbackVector> vector = NewFeedbackVector(isolate, &empty); - CHECK(Handle<FixedArray>::cast(vector).is_identical_to( - factory->empty_feedback_vector())); - // Which can nonetheless be queried. - CHECK(vector->is_empty()); + Handle<FeedbackVector> vector; { FeedbackVectorSpec one_slot(&zone); @@ -84,30 +78,28 @@ TEST(VectorStructure) { CHECK_EQ(helper.slot(3), vector->ToSlot(index)); index = vector->GetIndex(helper.slot(7)); - CHECK_EQ( - FeedbackVector::kReservedIndexCount + 3 + - 4 * FeedbackMetadata::GetSlotSize(FeedbackVectorSlotKind::CALL_IC), - index); + CHECK_EQ(FeedbackVector::kReservedIndexCount + 3 + + 4 * FeedbackMetadata::GetSlotSize(FeedbackSlotKind::kCall), + index); CHECK_EQ(helper.slot(7), vector->ToSlot(index)); - CHECK_EQ( - FeedbackVector::kReservedIndexCount + 3 + - 5 * FeedbackMetadata::GetSlotSize(FeedbackVectorSlotKind::CALL_IC), - vector->length()); + CHECK_EQ(FeedbackVector::kReservedIndexCount + 3 + + 5 * FeedbackMetadata::GetSlotSize(FeedbackSlotKind::kCall), + vector->length()); } { FeedbackVectorSpec spec(&zone); spec.AddGeneralSlot(); - spec.AddCreateClosureSlot(5); + spec.AddCreateClosureSlot(); spec.AddGeneralSlot(); vector = NewFeedbackVector(isolate, &spec); FeedbackVectorHelper helper(vector); - CHECK_EQ(1, FeedbackMetadata::GetSlotSize( - FeedbackVectorSlotKind::CREATE_CLOSURE)); - FeedbackVectorSlot slot = helper.slot(1); - FixedArray* array = FixedArray::cast(vector->Get(slot)); - CHECK_EQ(array, *factory->empty_literals_array()); + CHECK_EQ(1, + FeedbackMetadata::GetSlotSize(FeedbackSlotKind::kCreateClosure)); + FeedbackSlot slot = helper.slot(1); + Cell* cell = Cell::cast(vector->Get(slot)); + CHECK_EQ(cell->value(), *factory->undefined_value()); } } @@ -144,23 +136,23 @@ TEST(VectorICMetadata) { // Meanwhile set some feedback values and type feedback values to // verify the data structure remains intact. - vector->Set(FeedbackVectorSlot(0), *vector); + vector->Set(FeedbackSlot(0), *vector); // Verify the metadata is correctly set up from the spec. for (int i = 0; i < 40; i++) { - FeedbackVectorSlotKind kind = vector->GetKind(helper.slot(i)); + FeedbackSlotKind kind = vector->GetKind(helper.slot(i)); switch (i % 4) { case 0: - CHECK_EQ(FeedbackVectorSlotKind::GENERAL, kind); + CHECK_EQ(FeedbackSlotKind::kGeneral, kind); break; case 1: - CHECK_EQ(FeedbackVectorSlotKind::CALL_IC, kind); + CHECK_EQ(FeedbackSlotKind::kCall, kind); break; case 2: - CHECK_EQ(FeedbackVectorSlotKind::LOAD_IC, kind); + CHECK_EQ(FeedbackSlotKind::kLoadProperty, kind); break; case 3: - CHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind); + CHECK_EQ(FeedbackSlotKind::kLoadKeyed, kind); break; } } @@ -174,9 +166,11 @@ TEST(VectorSlotClearing) { Factory* factory = isolate->factory(); Zone zone(isolate->allocator(), ZONE_NAME); - // We only test clearing FeedbackVectorSlots, not FeedbackVectorSlots. - // The reason is that FeedbackVectorSlots need a full code environment - // to fully test (See VectorICProfilerStatistics test below). + CompileRun("function f() {};"); + Handle<JSFunction> f = GetFunction("f"); + + // We only test clearing of a FeedbackSlotKind::kGeneral slots because all + // the other slot kinds require a host function for clearing. FeedbackVectorSpec spec(&zone); for (int i = 0; i < 5; i++) { spec.AddGeneralSlot(); @@ -191,12 +185,7 @@ TEST(VectorSlotClearing) { Handle<AllocationSite> site = factory->NewAllocationSite(); vector->Set(helper.slot(2), *site); - // GC time clearing leaves slots alone. - vector->ClearSlotsAtGCTime(NULL); - Object* obj = vector->Get(helper.slot(1)); - CHECK(obj->IsWeakCell() && !WeakCell::cast(obj)->cleared()); - - vector->ClearSlots(NULL); + vector->ClearSlots(*f); // The feedback vector slots are cleared. AllocationSites are still granted // an exemption from clearing, as are smis. @@ -221,7 +210,7 @@ TEST(VectorCallICStates) { // There should be one IC. Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); CallICNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); // CallIC doesn't return map feedback. @@ -249,7 +238,7 @@ TEST(VectorCallFeedbackForArray) { // There should be one IC. Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); CallICNexus nexus(feedback_vector, slot); // A call to Array is special, it contains an AllocationSite as feedback. @@ -276,7 +265,7 @@ TEST(VectorCallCounts) { // There should be one IC. Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); CallICNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); @@ -305,7 +294,7 @@ TEST(VectorConstructCounts) { Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); CallICNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); @@ -336,7 +325,7 @@ TEST(VectorLoadICStates) { // There should be one IC. Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); LoadICNexus nexus(feedback_vector, slot); CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback()); @@ -374,32 +363,38 @@ TEST(VectorLoadICStates) { CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); } - -TEST(VectorLoadICSlotSharing) { +TEST(VectorLoadGlobalICSlotSharing) { if (i::FLAG_always_opt) return; CcTest::InitializeVM(); LocalContext context; v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); - // Function f has 3 LoadICs, one for each o, but the ICs share the same - // feedback vector IC slot. + // Function f has 5 LoadGlobalICs: 3 for {o} references outside of "typeof" + // operator and 2 for {o} references inside "typeof" operator. CompileRun( "o = 10;" "function f() {" " var x = o || 10;" - " return o , x , o;" + " var y = typeof o;" + " return o , typeof o, x , y, o;" "}" "f();"); Handle<JSFunction> f = GetFunction("f"); - // There should be one IC slot. + // There should be two IC slots for {o} references outside and inside + // typeof operator respectively. Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); FeedbackVectorHelper helper(feedback_vector); - CHECK_EQ(1, helper.slot_count()); - FeedbackVectorSlot slot(0); - LoadGlobalICNexus nexus(feedback_vector, slot); - CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); + CHECK_EQ(2, helper.slot_count()); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kLoadGlobalInsideTypeof); + FeedbackSlot slot1 = helper.slot(0); + FeedbackSlot slot2 = helper.slot(1); + CHECK_EQ(MONOMORPHIC, + LoadGlobalICNexus(feedback_vector, slot1).StateFromFeedback()); + CHECK_EQ(MONOMORPHIC, + LoadGlobalICNexus(feedback_vector, slot2).StateFromFeedback()); } @@ -419,7 +414,7 @@ TEST(VectorLoadICOnSmi) { // There should be one IC. Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(f->feedback_vector(), isolate); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); LoadICNexus nexus(feedback_vector, slot); CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback()); @@ -486,15 +481,16 @@ TEST(ReferenceContextAllocatesNoSlots) { handle(f->feedback_vector(), isolate); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(4, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::STORE_IC); - CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); - CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::STORE_IC); - CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kStoreNamedSloppy); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 2, FeedbackSlotKind::kStoreNamedSloppy); + CHECK_SLOT_KIND(helper, 3, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); } { CompileRun( "function testprop(x) {" + " 'use strict';" " x.blue = a;" "}" "testprop({ blue: 3 });"); @@ -505,8 +501,8 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<FeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(2, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); - CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::STORE_IC); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreNamedStrict); } { @@ -525,11 +521,11 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<FeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(5, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::CALL_IC); - CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); - CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::STORE_IC); - CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::CALL_IC); - CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kCall); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 2, FeedbackSlotKind::kStoreNamedSloppy); + CHECK_SLOT_KIND(helper, 3, FeedbackSlotKind::kCall); + CHECK_SLOT_KIND(helper, 4, FeedbackSlotKind::kLoadProperty); } { @@ -547,14 +543,36 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<FeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(3, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); - CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::KEYED_STORE_IC); - CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::KEYED_LOAD_IC); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreKeyedSloppy); + CHECK_SLOT_KIND(helper, 2, FeedbackSlotKind::kLoadKeyed); + } + + { + CompileRun( + "function testkeyedprop(x) {" + " 'use strict';" + " x[0] = a;" + " return x[0];" + "}" + "testkeyedprop([0, 1, 2]);"); + + Handle<JSFunction> f = GetFunction("testkeyedprop"); + + // There should be 1 LOAD_GLOBAL_ICs for the load of a, and one + // KEYED_LOAD_IC for the load of x[0] in the return statement. + Handle<FeedbackVector> feedback_vector(f->feedback_vector()); + FeedbackVectorHelper helper(feedback_vector); + CHECK_EQ(3, helper.slot_count()); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreKeyedStrict); + CHECK_SLOT_KIND(helper, 2, FeedbackSlotKind::kLoadKeyed); } { CompileRun( "function testcompound(x) {" + " 'use strict';" " x.old = x.young = x.in_between = a;" " return x.old + x.young;" "}" @@ -567,13 +585,13 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<FeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(7, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); - CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::STORE_IC); - CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::STORE_IC); - CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::STORE_IC); - CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC); - CHECK_SLOT_KIND(helper, 5, FeedbackVectorSlotKind::LOAD_IC); - CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreNamedStrict); + CHECK_SLOT_KIND(helper, 2, FeedbackSlotKind::kStoreNamedStrict); + CHECK_SLOT_KIND(helper, 3, FeedbackSlotKind::kStoreNamedStrict); + CHECK_SLOT_KIND(helper, 4, FeedbackSlotKind::kLoadProperty); + CHECK_SLOT_KIND(helper, 5, FeedbackSlotKind::kLoadProperty); + CHECK_SLOT_KIND(helper, 6, FeedbackSlotKind::kBinaryOp); } } @@ -598,9 +616,34 @@ TEST(VectorStoreICBasic) { Handle<FeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(1, helper.slot_count()); - FeedbackVectorSlot slot(0); + FeedbackSlot slot(0); StoreICNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); } +TEST(StoreOwnIC) { + if (i::FLAG_always_opt) return; + + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + + CompileRun( + "function f(v) {" + " return {a: 0, b: v, c: 0};" + "}" + "f(1);" + "f(2);" + "f(3);"); + Handle<JSFunction> f = GetFunction("f"); + // There should be one IC slot. + Handle<FeedbackVector> feedback_vector(f->feedback_vector()); + FeedbackVectorHelper helper(feedback_vector); + CHECK_EQ(2, helper.slot_count()); + CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLiteral); + CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreOwnNamed); + StoreOwnICNexus nexus(feedback_vector, helper.slot(1)); + CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); +} + } // namespace diff --git a/deps/v8/test/cctest/test-feedback-vector.h b/deps/v8/test/cctest/test-feedback-vector.h index c73ad01c51..6bae553c85 100644 --- a/deps/v8/test/cctest/test-feedback-vector.h +++ b/deps/v8/test/cctest/test-feedback-vector.h @@ -21,7 +21,7 @@ class FeedbackVectorHelper { slots_.reserve(slot_count); FeedbackMetadataIterator iter(vector->metadata()); while (iter.HasNext()) { - FeedbackVectorSlot slot = iter.Next(); + FeedbackSlot slot = iter.Next(); slots_.push_back(slot); } } @@ -29,22 +29,29 @@ class FeedbackVectorHelper { Handle<FeedbackVector> vector() { return vector_; } // Returns slot identifier by numerical index. - FeedbackVectorSlot slot(int index) const { return slots_[index]; } + FeedbackSlot slot(int index) const { return slots_[index]; } // Returns the number of slots in the feedback vector. int slot_count() const { return static_cast<int>(slots_.size()); } private: Handle<FeedbackVector> vector_; - std::vector<FeedbackVectorSlot> slots_; + std::vector<FeedbackSlot> slots_; }; template <typename Spec> Handle<FeedbackVector> NewFeedbackVector(Isolate* isolate, Spec* spec) { Handle<FeedbackMetadata> metadata = FeedbackMetadata::New(isolate, spec); - return FeedbackVector::New(isolate, metadata); + Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo( + isolate->factory()->empty_string(), MaybeHandle<Code>(), false); + shared->set_feedback_metadata(*metadata); + return FeedbackVector::New(isolate, shared); } +template <typename Spec> +Handle<FeedbackMetadata> NewFeedbackMetadata(Isolate* isolate, Spec* spec) { + return FeedbackMetadata::New(isolate, spec); +} } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index 4abde16cd6..04e23790ad 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -18,13 +18,16 @@ #include "src/global-handles.h" #include "src/ic/stub-cache.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" +#include "src/property.h" +#include "src/transitions.h" using namespace v8::internal; // TODO(ishell): fix this once TransitionToPrototype stops generalizing // all field representations (similar to crbug/448711 where elements kind -// and observed transitions caused generalization of all field representations). +// and observed transitions caused generalization of all fields). const bool IS_PROTO_TRANS_ISSUE_FIXED = false; @@ -79,6 +82,7 @@ class Expectations { ElementsKind elements_kind_; PropertyKind kinds_[MAX_PROPERTIES]; PropertyLocation locations_[MAX_PROPERTIES]; + PropertyConstness constnesses_[MAX_PROPERTIES]; PropertyAttributes attributes_[MAX_PROPERTIES]; Representation representations_[MAX_PROPERTIES]; // FieldType for kField, value for DATA_CONSTANT and getter for @@ -100,11 +104,12 @@ class Expectations { isolate->object_function()->initial_map()->elements_kind()) {} void Init(int index, PropertyKind kind, PropertyAttributes attributes, - PropertyLocation location, Representation representation, - Handle<Object> value) { + PropertyConstness constness, PropertyLocation location, + Representation representation, Handle<Object> value) { CHECK(index < MAX_PROPERTIES); kinds_[index] = kind; locations_[index] = location; + constnesses_[index] = constness; attributes_[index] = attributes; representations_[index] = representation; values_[index] = value; @@ -126,6 +131,7 @@ class Expectations { } os << " ("; + if (constnesses_[i] == kConst) os << "const "; os << (kinds_[i] == kData ? "data " : "accessor "); if (locations_[i] == kField) { os << "field" @@ -149,18 +155,20 @@ class Expectations { } void SetDataField(int index, PropertyAttributes attrs, - Representation representation, + PropertyConstness constness, Representation representation, Handle<FieldType> field_type) { - Init(index, kData, attrs, kField, representation, field_type); + Init(index, kData, attrs, constness, kField, representation, field_type); } - void SetDataField(int index, Representation representation, + void SetDataField(int index, PropertyConstness constness, + Representation representation, Handle<FieldType> field_type) { - SetDataField(index, attributes_[index], representation, field_type); + SetDataField(index, attributes_[index], constness, representation, + field_type); } void SetAccessorField(int index, PropertyAttributes attrs) { - Init(index, kAccessor, attrs, kDescriptor, Representation::Tagged(), + Init(index, kAccessor, attrs, kConst, kDescriptor, Representation::Tagged(), FieldType::Any(isolate_)); } @@ -170,7 +178,15 @@ class Expectations { void SetDataConstant(int index, PropertyAttributes attrs, Handle<JSFunction> value) { - Init(index, kData, attrs, kDescriptor, Representation::HeapObject(), value); + if (FLAG_track_constant_fields) { + Handle<FieldType> field_type(FieldType::Class(value->map()), isolate_); + Init(index, kData, attrs, kConst, kField, Representation::HeapObject(), + field_type); + + } else { + Init(index, kData, attrs, kConst, kDescriptor, + Representation::HeapObject(), value); + } } void SetDataConstant(int index, Handle<JSFunction> value) { @@ -179,7 +195,7 @@ class Expectations { void SetAccessorConstant(int index, PropertyAttributes attrs, Handle<Object> getter, Handle<Object> setter) { - Init(index, kAccessor, attrs, kDescriptor, Representation::Tagged(), + Init(index, kAccessor, attrs, kConst, kDescriptor, Representation::Tagged(), getter); setter_values_[index] = setter; } @@ -215,7 +231,7 @@ class Expectations { SetAccessorConstant(index, getter, setter); } - void GeneralizeRepresentation(int index) { + void GeneralizeField(int index) { CHECK(index < number_of_properties_); representations_[index] = Representation::Tagged(); if (locations_[index] == kField) { @@ -223,12 +239,12 @@ class Expectations { } } - bool Check(DescriptorArray* descriptors, int descriptor) const { PropertyDetails details = descriptors->GetDetails(descriptor); if (details.kind() != kinds_[descriptor]) return false; if (details.location() != locations_[descriptor]) return false; + if (details.constness() != constnesses_[descriptor]) return false; PropertyAttributes expected_attributes = attributes_[descriptor]; if (details.attributes() != expected_attributes) return false; @@ -250,6 +266,7 @@ class Expectations { } else { // kDescriptor if (details.kind() == kData) { + CHECK(!FLAG_track_constant_fields); return value == expected_value; } else { // kAccessor @@ -300,15 +317,17 @@ class Expectations { } Handle<Map> AddDataField(Handle<Map> map, PropertyAttributes attributes, + PropertyConstness constness, Representation representation, Handle<FieldType> heap_type) { CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors()); int property_index = number_of_properties_++; - SetDataField(property_index, attributes, representation, heap_type); + SetDataField(property_index, attributes, constness, representation, + heap_type); Handle<String> name = MakeName("prop", property_index); - return Map::CopyWithField(map, name, heap_type, attributes, representation, - INSERT_TRANSITION) + return Map::CopyWithField(map, name, heap_type, attributes, constness, + representation, INSERT_TRANSITION) .ToHandleChecked(); } @@ -326,16 +345,19 @@ class Expectations { Handle<Map> TransitionToDataField(Handle<Map> map, PropertyAttributes attributes, + PropertyConstness constness, Representation representation, Handle<FieldType> heap_type, Handle<Object> value) { CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors()); int property_index = number_of_properties_++; - SetDataField(property_index, attributes, representation, heap_type); + SetDataField(property_index, attributes, constness, representation, + heap_type); Handle<String> name = MakeName("prop", property_index); return Map::TransitionToDataProperty( - map, name, value, attributes, Object::CERTAINLY_NOT_STORE_FROM_KEYED); + map, name, value, attributes, constness, + Object::CERTAINLY_NOT_STORE_FROM_KEYED); } Handle<Map> TransitionToDataConstant(Handle<Map> map, @@ -347,16 +369,19 @@ class Expectations { Handle<String> name = MakeName("prop", property_index); return Map::TransitionToDataProperty( - map, name, value, attributes, Object::CERTAINLY_NOT_STORE_FROM_KEYED); + map, name, value, attributes, kConst, + Object::CERTAINLY_NOT_STORE_FROM_KEYED); } Handle<Map> FollowDataTransition(Handle<Map> map, PropertyAttributes attributes, + PropertyConstness constness, Representation representation, Handle<FieldType> heap_type) { CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors()); int property_index = number_of_properties_++; - SetDataField(property_index, attributes, representation, heap_type); + SetDataField(property_index, attributes, constness, representation, + heap_type); Handle<String> name = MakeName("prop", property_index); Map* target = @@ -461,7 +486,9 @@ TEST(ReconfigureAccessorToNonExistingDataField) { CHECK(!map->is_stable()); CHECK(expectations.Check(*map)); - expectations.SetDataField(0, NONE, Representation::None(), none_type); + // Property kind reconfiguration always makes the field mutable. + expectations.SetDataField(0, NONE, kMutable, Representation::None(), + none_type); CHECK(!new_map->is_deprecated()); CHECK(new_map->is_stable()); @@ -472,11 +499,12 @@ TEST(ReconfigureAccessorToNonExistingDataField) { CHECK_EQ(*new_map, *new_map2); Handle<Object> value(Smi::kZero, isolate); - Handle<Map> prepared_map = Map::PrepareForDataProperty(new_map, 0, value); + Handle<Map> prepared_map = + Map::PrepareForDataProperty(new_map, 0, kConst, value); // None to Smi generalization is trivial, map does not change. CHECK_EQ(*new_map, *prepared_map); - expectations.SetDataField(0, NONE, Representation::Smi(), any_type); + expectations.SetDataField(0, NONE, kMutable, Representation::Smi(), any_type); CHECK(prepared_map->is_stable()); CHECK(expectations.Check(*prepared_map)); @@ -534,12 +562,19 @@ TEST(ReconfigureAccessorToNonExistingDataFieldHeavy) { //////////////////////////////////////////////////////////////////////////////// -// A set of tests for representation generalization case. +// A set of tests for field generalization case. // -// This test ensures that representation/field type generalization at -// |property_index| is done correctly independently of the fact that the |map| -// is detached from transition tree or not. +// <Constness, Representation, FieldType> data. +struct CRFTData { + PropertyConstness constness; + Representation representation; + Handle<FieldType> type; +}; + +// This test ensures that field generalization at |property_index| is done +// correctly independently of the fact that the |map| is detached from +// transition tree or not. // // {} - p0 - p1 - p2: |detach_point_map| // | @@ -549,12 +584,11 @@ TEST(ReconfigureAccessorToNonExistingDataFieldHeavy) { // // Detaching does not happen if |detach_property_at_index| is -1. // -static void TestGeneralizeRepresentation( - int detach_property_at_index, int property_index, - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type, - bool expected_deprecation, bool expected_field_type_dependency) { +static void TestGeneralizeField(int detach_property_at_index, + int property_index, const CRFTData& from, + const CRFTData& to, const CRFTData& expected, + bool expected_deprecation, + bool expected_field_type_dependency) { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); @@ -573,11 +607,11 @@ static void TestGeneralizeRepresentation( Handle<Map> detach_point_map; for (int i = 0; i < kPropCount; i++) { if (i == property_index) { - map = - expectations.AddDataField(map, NONE, from_representation, from_type); + map = expectations.AddDataField(map, NONE, from.constness, + from.representation, from.type); } else { - map = - expectations.AddDataField(map, NONE, Representation::Smi(), any_type); + map = expectations.AddDataField(map, NONE, kDefaultFieldConstness, + Representation::Smi(), any_type); if (i == detach_property_at_index) { detach_point_map = map; } @@ -593,7 +627,7 @@ static void TestGeneralizeRepresentation( detach_point_map = Map::ReconfigureProperty( detach_point_map, detach_property_at_index, kData, NONE, Representation::Tagged(), any_type); - expectations.SetDataField(detach_property_at_index, + expectations.SetDataField(detach_property_at_index, kDefaultFieldConstness, Representation::Tagged(), any_type); CHECK(map->is_deprecated()); CHECK(expectations.Check(*detach_point_map, @@ -608,10 +642,10 @@ static void TestGeneralizeRepresentation( dependencies.AssumeFieldOwner(field_owner); Handle<Map> new_map = Map::ReconfigureProperty( - map, property_index, kData, NONE, to_representation, to_type); + map, property_index, kData, NONE, to.representation, to.type); - expectations.SetDataField(property_index, expected_representation, - expected_type); + expectations.SetDataField(property_index, expected.constness, + expected.representation, expected.type); CHECK(!new_map->is_deprecated()); CHECK(expectations.Check(*new_map)); @@ -656,84 +690,65 @@ static void TestGeneralizeRepresentation( CHECK_EQ(*new_map, *updated_map); } -static void TestGeneralizeRepresentation( - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type, - bool expected_deprecation, bool expected_field_type_dependency) { +static void TestGeneralizeField(const CRFTData& from, const CRFTData& to, + const CRFTData& expected, + bool expected_deprecation, + bool expected_field_type_dependency) { // Check the cases when the map being reconfigured is a part of the // transition tree. STATIC_ASSERT(kPropCount > 4); int indices[] = {0, 2, kPropCount - 1}; for (int i = 0; i < static_cast<int>(arraysize(indices)); i++) { - TestGeneralizeRepresentation( - -1, indices[i], from_representation, from_type, to_representation, - to_type, expected_representation, expected_type, expected_deprecation, - expected_field_type_dependency); + TestGeneralizeField(-1, indices[i], from, to, expected, + expected_deprecation, expected_field_type_dependency); } - if (!from_representation.IsNone()) { + if (!from.representation.IsNone()) { // Check the cases when the map being reconfigured is NOT a part of the // transition tree. "None -> anything" representation changes make sense // only for "attached" maps. int indices[] = {0, kPropCount - 1}; for (int i = 0; i < static_cast<int>(arraysize(indices)); i++) { - TestGeneralizeRepresentation( - indices[i], 2, from_representation, from_type, to_representation, - to_type, expected_representation, expected_type, expected_deprecation, - expected_field_type_dependency); + TestGeneralizeField(indices[i], 2, from, to, expected, + expected_deprecation, expected_field_type_dependency); } // Check that reconfiguration to the very same field works correctly. - Representation representation = from_representation; - Handle<FieldType> type = from_type; - TestGeneralizeRepresentation(-1, 2, representation, type, representation, - type, representation, type, false, false); + CRFTData data = from; + TestGeneralizeField(-1, 2, data, data, data, false, false); } } -static void TestGeneralizeRepresentation(Representation from_representation, - Handle<FieldType> from_type, - Representation to_representation, - Handle<FieldType> to_type, - Representation expected_representation, - Handle<FieldType> expected_type) { +static void TestGeneralizeField(const CRFTData& from, const CRFTData& to, + const CRFTData& expected) { const bool expected_deprecation = true; const bool expected_field_type_dependency = false; - TestGeneralizeRepresentation( - from_representation, from_type, to_representation, to_type, - expected_representation, expected_type, expected_deprecation, - expected_field_type_dependency); + TestGeneralizeField(from, to, expected, expected_deprecation, + expected_field_type_dependency); } -static void TestGeneralizeRepresentationTrivial( - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type, +static void TestGeneralizeFieldTrivial( + const CRFTData& from, const CRFTData& to, const CRFTData& expected, bool expected_field_type_dependency = true) { const bool expected_deprecation = false; - TestGeneralizeRepresentation( - from_representation, from_type, to_representation, to_type, - expected_representation, expected_type, expected_deprecation, - expected_field_type_dependency); + TestGeneralizeField(from, to, expected, expected_deprecation, + expected_field_type_dependency); } - -TEST(GeneralizeRepresentationSmiToDouble) { +TEST(GeneralizeSmiFieldToDouble) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); - TestGeneralizeRepresentation(Representation::Smi(), any_type, - Representation::Double(), any_type, - Representation::Double(), any_type); + TestGeneralizeField({kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); } - -TEST(GeneralizeRepresentationSmiToTagged) { +TEST(GeneralizeSmiFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -741,13 +756,12 @@ TEST(GeneralizeRepresentationSmiToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestGeneralizeRepresentation(Representation::Smi(), any_type, - Representation::HeapObject(), value_type, - Representation::Tagged(), any_type); + TestGeneralizeField({kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } - -TEST(GeneralizeRepresentationDoubleToTagged) { +TEST(GeneralizeDoubleFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -755,13 +769,12 @@ TEST(GeneralizeRepresentationDoubleToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestGeneralizeRepresentation(Representation::Double(), any_type, - Representation::HeapObject(), value_type, - Representation::Tagged(), any_type); + TestGeneralizeField({kMutable, Representation::Double(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } - -TEST(GeneralizeRepresentationHeapObjectToTagged) { +TEST(GeneralizeHeapObjectFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -769,13 +782,12 @@ TEST(GeneralizeRepresentationHeapObjectToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestGeneralizeRepresentation(Representation::HeapObject(), value_type, - Representation::Smi(), any_type, - Representation::Tagged(), any_type); + TestGeneralizeField({kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Tagged(), any_type}); } - -TEST(GeneralizeRepresentationHeapObjectToHeapObject) { +TEST(GeneralizeHeapObjectFieldToHeapObject) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -789,21 +801,21 @@ TEST(GeneralizeRepresentationHeapObjectToHeapObject) { Handle<FieldType> expected_type = any_type; - TestGeneralizeRepresentationTrivial( - Representation::HeapObject(), current_type, - Representation::HeapObject(), new_type, Representation::HeapObject(), - expected_type); - current_type = expected_type; + TestGeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), current_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); + current_type = expected_type; - new_type = FieldType::Class(Map::Create(isolate, 0), isolate); + new_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestGeneralizeRepresentationTrivial( - Representation::HeapObject(), any_type, Representation::HeapObject(), - new_type, Representation::HeapObject(), any_type, false); + TestGeneralizeFieldTrivial({kMutable, Representation::HeapObject(), any_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}, + false); } - -TEST(GeneralizeRepresentationNoneToSmi) { +TEST(GeneralizeNoneFieldToSmi) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -811,13 +823,12 @@ TEST(GeneralizeRepresentationNoneToSmi) { Handle<FieldType> any_type = FieldType::Any(isolate); // None -> Smi representation change is trivial. - TestGeneralizeRepresentationTrivial(Representation::None(), none_type, - Representation::Smi(), any_type, - Representation::Smi(), any_type); + TestGeneralizeFieldTrivial({kMutable, Representation::None(), none_type}, + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Smi(), any_type}); } - -TEST(GeneralizeRepresentationNoneToDouble) { +TEST(GeneralizeNoneFieldToDouble) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -825,13 +836,12 @@ TEST(GeneralizeRepresentationNoneToDouble) { Handle<FieldType> any_type = FieldType::Any(isolate); // None -> Double representation change is NOT trivial. - TestGeneralizeRepresentation(Representation::None(), none_type, - Representation::Double(), any_type, - Representation::Double(), any_type); + TestGeneralizeField({kMutable, Representation::None(), none_type}, + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); } - -TEST(GeneralizeRepresentationNoneToHeapObject) { +TEST(GeneralizeNoneFieldToHeapObject) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -840,13 +850,13 @@ TEST(GeneralizeRepresentationNoneToHeapObject) { FieldType::Class(Map::Create(isolate, 0), isolate); // None -> HeapObject representation change is trivial. - TestGeneralizeRepresentationTrivial(Representation::None(), none_type, - Representation::HeapObject(), value_type, - Representation::HeapObject(), value_type); + TestGeneralizeFieldTrivial( + {kMutable, Representation::None(), none_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::HeapObject(), value_type}); } - -TEST(GeneralizeRepresentationNoneToTagged) { +TEST(GeneralizeNoneFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -854,18 +864,17 @@ TEST(GeneralizeRepresentationNoneToTagged) { Handle<FieldType> any_type = FieldType::Any(isolate); // None -> HeapObject representation change is trivial. - TestGeneralizeRepresentationTrivial(Representation::None(), none_type, - Representation::Tagged(), any_type, - Representation::Tagged(), any_type); + TestGeneralizeFieldTrivial({kMutable, Representation::None(), none_type}, + {kMutable, Representation::Tagged(), any_type}, + {kMutable, Representation::Tagged(), any_type}); } //////////////////////////////////////////////////////////////////////////////// -// A set of tests for representation generalization case with kAccessor -// properties. +// A set of tests for field generalization case with kAccessor properties. // -TEST(GeneralizeRepresentationWithAccessorProperties) { +TEST(GeneralizeFieldWithAccessorProperties) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -882,8 +891,8 @@ TEST(GeneralizeRepresentationWithAccessorProperties) { if (i == kAccessorProp) { map = expectations.AddAccessorConstant(map, NONE, pair); } else { - map = - expectations.AddDataField(map, NONE, Representation::Smi(), any_type); + map = expectations.AddDataField(map, NONE, kMutable, + Representation::Smi(), any_type); } } CHECK(!map->is_deprecated()); @@ -902,7 +911,7 @@ TEST(GeneralizeRepresentationWithAccessorProperties) { map, i, kData, NONE, Representation::Double(), any_type); maps[i] = new_map; - expectations.SetDataField(i, Representation::Double(), any_type); + expectations.SetDataField(i, kMutable, Representation::Double(), any_type); CHECK(!map->is_stable()); CHECK(map->is_deprecated()); @@ -930,8 +939,8 @@ TEST(GeneralizeRepresentationWithAccessorProperties) { // A set of tests for attribute reconfiguration case. // -// This test ensures that representation/field type generalization is correctly -// propagated from one branch of transition tree (|map2|) to another (|map|). +// This test ensures that field generalization is correctly propagated from one +// branch of transition tree (|map2|) to another (|map|). // // + - p2B - p3 - p4: |map2| // | @@ -939,10 +948,8 @@ TEST(GeneralizeRepresentationWithAccessorProperties) { // // where "p2A" and "p2B" differ only in the attributes. // -static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type) { +static void TestReconfigureDataFieldAttribute_GeneralizeField( + const CRFTData& from, const CRFTData& to, const CRFTData& expected) { Isolate* isolate = CcTest::i_isolate(); Expectations expectations(isolate); @@ -951,7 +958,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( Handle<Map> initial_map = Map::Create(isolate, 0); Handle<Map> map = initial_map; for (int i = 0; i < kPropCount; i++) { - map = expectations.AddDataField(map, NONE, from_representation, from_type); + map = expectations.AddDataField(map, NONE, from.constness, + from.representation, from.type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -965,14 +973,15 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( Handle<Map> map2 = initial_map; for (int i = 0; i < kSplitProp; i++) { - map2 = expectations2.FollowDataTransition(map2, NONE, from_representation, - from_type); + map2 = expectations2.FollowDataTransition(map2, NONE, from.constness, + from.representation, from.type); } - map2 = - expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); + map2 = expectations2.AddDataField(map2, READ_ONLY, to.constness, + to.representation, to.type); for (int i = kSplitProp + 1; i < kPropCount; i++) { - map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); + map2 = expectations2.AddDataField(map2, NONE, to.constness, + to.representation, to.type); } CHECK(!map2->is_deprecated()); CHECK(map2->is_stable()); @@ -997,7 +1006,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( // |map| should be deprecated and |new_map| should match new expectations. for (int i = kSplitProp; i < kPropCount; i++) { - expectations.SetDataField(i, expected_representation, expected_type); + expectations.SetDataField(i, expected.constness, expected.representation, + expected.type); } CHECK(map->is_deprecated()); CHECK(!dependencies.HasAborted()); @@ -1012,10 +1022,9 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( CHECK_EQ(*new_map, *updated_map); } - -// This test ensures that trivial representation/field type generalization -// (from HeapObject to HeapObject) is correctly propagated from one branch of -// transition tree (|map2|) to another (|map|). +// This test ensures that trivial field generalization (from HeapObject to +// HeapObject) is correctly propagated from one branch of transition tree +// (|map2|) to another (|map|). // // + - p2B - p3 - p4: |map2| // | @@ -1023,10 +1032,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( // // where "p2A" and "p2B" differ only in the attributes. // -static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type, +static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + const CRFTData& from, const CRFTData& to, const CRFTData& expected, bool expected_field_type_dependency = true) { Isolate* isolate = CcTest::i_isolate(); @@ -1036,7 +1043,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( Handle<Map> initial_map = Map::Create(isolate, 0); Handle<Map> map = initial_map; for (int i = 0; i < kPropCount; i++) { - map = expectations.AddDataField(map, NONE, from_representation, from_type); + map = expectations.AddDataField(map, NONE, from.constness, + from.representation, from.type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -1050,14 +1058,15 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( Handle<Map> map2 = initial_map; for (int i = 0; i < kSplitProp; i++) { - map2 = expectations2.FollowDataTransition(map2, NONE, from_representation, - from_type); + map2 = expectations2.FollowDataTransition(map2, NONE, from.constness, + from.representation, from.type); } - map2 = - expectations2.AddDataField(map2, READ_ONLY, to_representation, to_type); + map2 = expectations2.AddDataField(map2, READ_ONLY, to.constness, + to.representation, to.type); for (int i = kSplitProp + 1; i < kPropCount; i++) { - map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); + map2 = expectations2.AddDataField(map2, NONE, to.constness, + to.representation, to.type); } CHECK(!map2->is_deprecated()); CHECK(map2->is_stable()); @@ -1085,7 +1094,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( // respective code dependencies should be invalidated. |map| should be NOT // deprecated and it should match new expectations. for (int i = kSplitProp; i < kPropCount; i++) { - expectations.SetDataField(i, expected_representation, expected_type); + expectations.SetDataField(i, expected.constness, expected.representation, + expected.type); } CHECK(!map->is_deprecated()); CHECK_EQ(*map, *new_map); @@ -1099,20 +1109,36 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( CHECK_EQ(*new_map, *updated_map); } - -TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationSmiToDouble) { +TEST(ReconfigureDataFieldAttribute_GeneralizeSmiFieldToDouble) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); - TestReconfigureDataFieldAttribute_GeneralizeRepresentation( - Representation::Smi(), any_type, Representation::Double(), any_type, - Representation::Double(), any_type); -} + if (FLAG_track_constant_fields) { + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kConst, Representation::Double(), any_type}, + {kConst, Representation::Double(), any_type}); + + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); + + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kConst, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); + } + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); +} -TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationSmiToTagged) { +TEST(ReconfigureDataFieldAttribute_GeneralizeSmiFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1120,13 +1146,30 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationSmiToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureDataFieldAttribute_GeneralizeRepresentation( - Representation::Smi(), any_type, Representation::HeapObject(), value_type, - Representation::Tagged(), any_type); -} + if (FLAG_track_constant_fields) { + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kConst, Representation::Tagged(), any_type}); + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + } -TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationDoubleToTagged) { + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); +} + +TEST(ReconfigureDataFieldAttribute_GeneralizeDoubleFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1134,13 +1177,30 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationDoubleToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureDataFieldAttribute_GeneralizeRepresentation( - Representation::Double(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); -} + if (FLAG_track_constant_fields) { + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::Double(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kConst, Representation::Tagged(), any_type}); + + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::Double(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::Double(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + } + + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); +} -TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationHeapObjToHeapObj) { +TEST(ReconfigureDataFieldAttribute_GeneralizeHeapObjFieldToHeapObj) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1154,20 +1214,59 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationHeapObjToHeapObj) { Handle<FieldType> expected_type = any_type; - TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( - Representation::HeapObject(), current_type, Representation::HeapObject(), - new_type, Representation::HeapObject(), expected_type); + // Check generalizations that trigger deopts. + if (FLAG_track_constant_fields) { + TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + {kConst, Representation::HeapObject(), current_type}, + {kConst, Representation::HeapObject(), new_type}, + {kConst, Representation::HeapObject(), expected_type}); + + // Currently, kConst to kMutable migration causes map change, therefore + // non-trivial generalization. + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::HeapObject(), current_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); + + TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), current_type}, + {kConst, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); + } + TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), current_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); current_type = expected_type; + // Check generalizations that do not trigger deopts. new_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( - Representation::HeapObject(), any_type, Representation::HeapObject(), - new_type, Representation::HeapObject(), any_type, false); + if (FLAG_track_constant_fields) { + TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + {kConst, Representation::HeapObject(), any_type}, + {kConst, Representation::HeapObject(), new_type}, + {kConst, Representation::HeapObject(), any_type}, false); + + // Currently, kConst to kMutable migration causes map change, therefore + // non-trivial generalization. + TestReconfigureDataFieldAttribute_GeneralizeField( + {kConst, Representation::HeapObject(), any_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}); + + TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), any_type}, + {kConst, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}, false); + } + TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), any_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}, false); } - -TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationHeapObjectToTagged) { +TEST(ReconfigureDataFieldAttribute_GeneralizeHeapObjectFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1175,9 +1274,10 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationHeapObjectToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureDataFieldAttribute_GeneralizeRepresentation( - Representation::HeapObject(), value_type, Representation::Smi(), any_type, - Representation::Tagged(), any_type); + TestReconfigureDataFieldAttribute_GeneralizeField( + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Tagged(), any_type}); } @@ -1243,7 +1343,7 @@ struct CheckCopyGeneralizeAllFields { CHECK(new_map->GetBackPointer()->IsUndefined(map->GetIsolate())); for (int i = 0; i < kPropCount; i++) { - expectations.GeneralizeRepresentation(i); + expectations.GeneralizeField(i); } CHECK(!new_map->is_deprecated()); @@ -1251,9 +1351,8 @@ struct CheckCopyGeneralizeAllFields { } }; - -// This test ensures that representation/field type generalization is correctly -// propagated from one branch of transition tree (|map2|) to another (|map1|). +// This test ensures that field generalization is correctly propagated from one +// branch of transition tree (|map2|) to another (|map1|). // // + - p2B - p3 - p4: |map2| // | @@ -1277,13 +1376,15 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( const int kSplitProp = 2; CHECK(kSplitProp < kCustomPropIndex); + const PropertyConstness constness = kMutable; const Representation representation = Representation::Smi(); // Create common part of transition tree. Handle<Map> initial_map = Map::Create(isolate, 0); Handle<Map> map = initial_map; for (int i = 0; i < kSplitProp; i++) { - map = expectations.AddDataField(map, NONE, representation, any_type); + map = expectations.AddDataField(map, NONE, constness, representation, + any_type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -1294,11 +1395,13 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( Handle<Map> map1 = map; Expectations expectations1 = expectations; for (int i = kSplitProp; i < kCustomPropIndex; i++) { - map1 = expectations1.AddDataField(map1, NONE, representation, any_type); + map1 = expectations1.AddDataField(map1, NONE, constness, representation, + any_type); } map1 = config.AddPropertyAtBranch(1, expectations1, map1); for (int i = kCustomPropIndex + 1; i < kPropCount; i++) { - map1 = expectations1.AddDataField(map1, NONE, representation, any_type); + map1 = expectations1.AddDataField(map1, NONE, constness, representation, + any_type); } CHECK(!map1->is_deprecated()); CHECK(map1->is_stable()); @@ -1309,13 +1412,16 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( // has different attributes), initialize expectations. Handle<Map> map2 = map; Expectations expectations2 = expectations; - map2 = expectations2.AddDataField(map2, READ_ONLY, representation, any_type); + map2 = expectations2.AddDataField(map2, READ_ONLY, constness, representation, + any_type); for (int i = kSplitProp + 1; i < kCustomPropIndex; i++) { - map2 = expectations2.AddDataField(map2, NONE, representation, any_type); + map2 = expectations2.AddDataField(map2, NONE, constness, representation, + any_type); } map2 = config.AddPropertyAtBranch(2, expectations2, map2); for (int i = kCustomPropIndex + 1; i < kPropCount; i++) { - map2 = expectations2.AddDataField(map2, NONE, representation, any_type); + map2 = expectations2.AddDataField(map2, NONE, constness, representation, + any_type); } CHECK(!map2->is_deprecated()); CHECK(map2->is_stable()); @@ -1403,15 +1509,23 @@ TEST(ReconfigureDataFieldAttribute_DataConstantToDataFieldAfterTargetMap) { } void UpdateExpectations(int property_index, Expectations& expectations) { - expectations.SetDataField(property_index, Representation::HeapObject(), - function_type_); + PropertyConstness expected_constness = + FLAG_track_constant_fields ? kConst : kMutable; + expectations.SetDataField(property_index, expected_constness, + Representation::HeapObject(), function_type_); } }; TestConfig config; - // Two branches are "incompatible" so the |map1| should be deprecated. - CheckDeprecated checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + if (FLAG_track_constant_fields) { + CheckSameMap checker; + TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + + } else { + // Two branches are "incompatible" so the |map1| should be deprecated. + CheckDeprecated checker; + TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + } } @@ -1534,8 +1648,8 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) { } else { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); - return expectations.AddDataField(map, NONE, Representation::Smi(), - any_type); + return expectations.AddDataField(map, NONE, kDefaultFieldConstness, + Representation::Smi(), any_type); } } @@ -1553,8 +1667,8 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) { // A set of tests for elements kind reconfiguration case. // -// This test ensures that representation/field type generalization is correctly -// propagated from one branch of transition tree (|map2) to another (|map|). +// This test ensures that field generalization is correctly propagated from one +// branch of transition tree (|map2) to another (|map|). // // + - p0 - p1 - p2A - p3 - p4: |map| // | @@ -1564,10 +1678,8 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) { // // where "p2A" and "p2B" differ only in the representation/field type. // -static void TestReconfigureElementsKind_GeneralizeRepresentation( - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type) { +static void TestReconfigureElementsKind_GeneralizeField( + const CRFTData& from, const CRFTData& to, const CRFTData& expected) { Isolate* isolate = CcTest::i_isolate(); Expectations expectations(isolate, FAST_SMI_ELEMENTS); @@ -1579,7 +1691,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( Handle<Map> map = initial_map; map = expectations.AsElementsKind(map, FAST_ELEMENTS); for (int i = 0; i < kPropCount; i++) { - map = expectations.AddDataField(map, NONE, from_representation, from_type); + map = expectations.AddDataField(map, NONE, from.constness, + from.representation, from.type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -1593,10 +1706,11 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( Handle<Map> map2 = initial_map; for (int i = 0; i < kPropCount; i++) { if (i == kDiffProp) { - map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); + map2 = expectations2.AddDataField(map2, NONE, to.constness, + to.representation, to.type); } else { - map2 = expectations2.AddDataField(map2, NONE, from_representation, - from_type); + map2 = expectations2.AddDataField(map2, NONE, from.constness, + from.representation, from.type); } } CHECK(!map2->is_deprecated()); @@ -1620,7 +1734,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( CHECK(expectations2.Check(*map2)); // |map| should be deprecated and |new_map| should match new expectations. - expectations.SetDataField(kDiffProp, expected_representation, expected_type); + expectations.SetDataField(kDiffProp, expected.constness, + expected.representation, expected.type); CHECK(map->is_deprecated()); CHECK(!dependencies.HasAborted()); @@ -1644,9 +1759,9 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( } } -// This test ensures that trivial representation/field type generalization -// (from HeapObject to HeapObject) is correctly propagated from one branch of -// transition tree (|map2|) to another (|map|). +// This test ensures that trivial field generalization (from HeapObject to +// HeapObject) is correctly propagated from one branch of transition tree +// (|map2|) to another (|map|). // // + - p0 - p1 - p2A - p3 - p4: |map| // | @@ -1656,10 +1771,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( // // where "p2A" and "p2B" differ only in the representation/field type. // -static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( - Representation from_representation, Handle<FieldType> from_type, - Representation to_representation, Handle<FieldType> to_type, - Representation expected_representation, Handle<FieldType> expected_type, +static void TestReconfigureElementsKind_GeneralizeFieldTrivial( + const CRFTData& from, const CRFTData& to, const CRFTData& expected, bool expected_field_type_dependency = true) { Isolate* isolate = CcTest::i_isolate(); @@ -1672,7 +1785,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( Handle<Map> map = initial_map; map = expectations.AsElementsKind(map, FAST_ELEMENTS); for (int i = 0; i < kPropCount; i++) { - map = expectations.AddDataField(map, NONE, from_representation, from_type); + map = expectations.AddDataField(map, NONE, from.constness, + from.representation, from.type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -1686,10 +1800,11 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( Handle<Map> map2 = initial_map; for (int i = 0; i < kPropCount; i++) { if (i == kDiffProp) { - map2 = expectations2.AddDataField(map2, NONE, to_representation, to_type); + map2 = expectations2.AddDataField(map2, NONE, to.constness, + to.representation, to.type); } else { - map2 = expectations2.AddDataField(map2, NONE, from_representation, - from_type); + map2 = expectations2.AddDataField(map2, NONE, from.constness, + from.representation, from.type); } } CHECK(!map2->is_deprecated()); @@ -1716,7 +1831,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( // kind reconfiguration, respective field types should be generalized and // respective code dependencies should be invalidated. |map| should be NOT // deprecated and it should match new expectations. - expectations.SetDataField(kDiffProp, expected_representation, expected_type); + expectations.SetDataField(kDiffProp, expected.constness, + expected.representation, expected.type); CHECK(!map->is_deprecated()); CHECK_EQ(*map, *new_map); CHECK_EQ(expected_field_type_dependency, dependencies.HasAborted()); @@ -1738,18 +1854,35 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( } } -TEST(ReconfigureElementsKind_GeneralizeRepresentationSmiToDouble) { +TEST(ReconfigureElementsKind_GeneralizeSmiFieldToDouble) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); - TestReconfigureElementsKind_GeneralizeRepresentation( - Representation::Smi(), any_type, Representation::Double(), any_type, - Representation::Double(), any_type); + if (FLAG_track_constant_fields) { + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kConst, Representation::Double(), any_type}, + {kConst, Representation::Double(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kConst, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); + } + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::Double(), any_type}); } -TEST(ReconfigureElementsKind_GeneralizeRepresentationSmiToTagged) { +TEST(ReconfigureElementsKind_GeneralizeSmiFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1757,12 +1890,29 @@ TEST(ReconfigureElementsKind_GeneralizeRepresentationSmiToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureElementsKind_GeneralizeRepresentation( - Representation::Smi(), any_type, Representation::HeapObject(), value_type, - Representation::Tagged(), any_type); + if (FLAG_track_constant_fields) { + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kConst, Representation::Tagged(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + } + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } -TEST(ReconfigureElementsKind_GeneralizeRepresentationDoubleToTagged) { +TEST(ReconfigureElementsKind_GeneralizeDoubleFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1770,12 +1920,29 @@ TEST(ReconfigureElementsKind_GeneralizeRepresentationDoubleToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureElementsKind_GeneralizeRepresentation( - Representation::Double(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); + if (FLAG_track_constant_fields) { + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::Double(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kConst, Representation::Tagged(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::Double(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::Double(), any_type}, + {kConst, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); + } + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::Double(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } -TEST(ReconfigureElementsKind_GeneralizeRepresentationHeapObjToHeapObj) { +TEST(ReconfigureElementsKind_GeneralizeHeapObjFieldToHeapObj) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1789,19 +1956,59 @@ TEST(ReconfigureElementsKind_GeneralizeRepresentationHeapObjToHeapObj) { Handle<FieldType> expected_type = any_type; - TestReconfigureElementsKind_GeneralizeRepresentationTrivial( - Representation::HeapObject(), current_type, Representation::HeapObject(), - new_type, Representation::HeapObject(), expected_type); + // Check generalizations that trigger deopts. + if (FLAG_track_constant_fields) { + TestReconfigureElementsKind_GeneralizeFieldTrivial( + {kConst, Representation::HeapObject(), current_type}, + {kConst, Representation::HeapObject(), new_type}, + {kConst, Representation::HeapObject(), expected_type}); + + // Currently, kConst to kMutable migration causes map change, therefore + // non-trivial generalization. + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::HeapObject(), current_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); + + TestReconfigureElementsKind_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), current_type}, + {kConst, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); + } + TestReconfigureElementsKind_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), current_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), expected_type}); current_type = expected_type; + // Check generalizations that do not trigger deopts. new_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureElementsKind_GeneralizeRepresentationTrivial( - Representation::HeapObject(), any_type, Representation::HeapObject(), - new_type, Representation::HeapObject(), any_type, false); + if (FLAG_track_constant_fields) { + TestReconfigureElementsKind_GeneralizeFieldTrivial( + {kConst, Representation::HeapObject(), any_type}, + {kConst, Representation::HeapObject(), new_type}, + {kConst, Representation::HeapObject(), any_type}, false); + + // Currently, kConst to kMutable migration causes map change, therefore + // non-trivial generalization. + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::HeapObject(), any_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}); + + TestReconfigureElementsKind_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), any_type}, + {kConst, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}, false); + } + TestReconfigureElementsKind_GeneralizeFieldTrivial( + {kMutable, Representation::HeapObject(), any_type}, + {kMutable, Representation::HeapObject(), new_type}, + {kMutable, Representation::HeapObject(), any_type}, false); } -TEST(ReconfigureElementsKind_GeneralizeRepresentationHeapObjectToTagged) { +TEST(ReconfigureElementsKind_GeneralizeHeapObjectFieldToTagged) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); @@ -1809,9 +2016,26 @@ TEST(ReconfigureElementsKind_GeneralizeRepresentationHeapObjectToTagged) { Handle<FieldType> value_type = FieldType::Class(Map::Create(isolate, 0), isolate); - TestReconfigureElementsKind_GeneralizeRepresentation( - Representation::HeapObject(), value_type, Representation::Smi(), any_type, - Representation::Tagged(), any_type); + if (FLAG_track_constant_fields) { + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::HeapObject(), value_type}, + {kConst, Representation::Smi(), any_type}, + {kConst, Representation::Tagged(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kConst, Representation::HeapObject(), value_type}, + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Tagged(), any_type}); + + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::HeapObject(), value_type}, + {kConst, Representation::Smi(), any_type}, + {kMutable, Representation::Tagged(), any_type}); + } + TestReconfigureElementsKind_GeneralizeField( + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::Tagged(), any_type}); } //////////////////////////////////////////////////////////////////////////////// @@ -1830,7 +2054,8 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { Handle<Map> initial_map = Map::Create(isolate, 0); Handle<Map> map = initial_map; for (int i = 0; i < kPropCount; i++) { - map = expectations.AddDataField(map, NONE, Representation::Smi(), any_type); + map = expectations.AddDataField(map, NONE, kMutable, Representation::Smi(), + any_type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -1854,7 +2079,8 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE, Representation::Double(), any_type); - expectations.SetDataField(kSplitProp, Representation::Double(), any_type); + expectations.SetDataField(kSplitProp, kMutable, Representation::Double(), + any_type); CHECK(expectations.Check(*split_map, kSplitProp)); CHECK(expectations.Check(*map2, kSplitProp + 1)); @@ -1871,8 +2097,8 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { for (int i = 0; i < TransitionArray::kMaxNumberOfTransitions; i++) { CHECK(TransitionArray::CanHaveMoreTransitions(map2)); Handle<String> name = MakeName("foo", i); - Map::CopyWithField(map2, name, any_type, NONE, Representation::Smi(), - INSERT_TRANSITION) + Map::CopyWithField(map2, name, any_type, NONE, kMutable, + Representation::Smi(), INSERT_TRANSITION) .ToHandleChecked(); } CHECK(!TransitionArray::CanHaveMoreTransitions(map2)); @@ -1883,7 +2109,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { CHECK(updated_map->GetBackPointer()->IsUndefined(isolate)); for (int i = 0; i < kPropCount; i++) { - expectations.SetDataField(i, Representation::Tagged(), any_type); + expectations.SetDataField(i, kMutable, Representation::Tagged(), any_type); } CHECK(expectations.Check(*updated_map)); } @@ -1894,8 +2120,8 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { // transition, observed transition or prototype transition). // -// This test ensures that representation/field type generalization is correctly -// propagated from one branch of transition tree (|map2|) to another (|map|). +// This test ensures that field generalization is correctly propagated from one +// branch of transition tree (|map2|) to another (|map|). // // p4B: |map2| // | @@ -1906,15 +2132,14 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { // where "p4A" and "p4B" are exactly the same properties. // // TODO(ishell): unify this test template with -// TestReconfigureDataFieldAttribute_GeneralizeRepresentation once +// TestReconfigureDataFieldAttribute_GeneralizeField once // IS_PROTO_TRANS_ISSUE_FIXED and IS_NON_EQUIVALENT_TRANSITION_SUPPORTED are // fixed. template <typename TestConfig> -static void TestGeneralizeRepresentationWithSpecialTransition( - TestConfig& config, Representation from_representation, - Handle<FieldType> from_type, Representation to_representation, - Handle<FieldType> to_type, Representation expected_representation, - Handle<FieldType> expected_type) { +static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config, + const CRFTData& from, + const CRFTData& to, + const CRFTData& expected) { Isolate* isolate = CcTest::i_isolate(); Expectations expectations(isolate); @@ -1923,7 +2148,8 @@ static void TestGeneralizeRepresentationWithSpecialTransition( Handle<Map> initial_map = Map::Create(isolate, 0); Handle<Map> map = initial_map; for (int i = 0; i < kPropCount; i++) { - map = expectations.AddDataField(map, NONE, from_representation, from_type); + map = expectations.AddDataField(map, NONE, from.constness, + from.representation, from.type); } CHECK(!map->is_deprecated()); CHECK(map->is_stable()); @@ -1941,7 +2167,7 @@ static void TestGeneralizeRepresentationWithSpecialTransition( if (config.generalizes_representations()) { for (int i = 0; i < kPropCount; i++) { - expectations2.GeneralizeRepresentation(i); + expectations2.GeneralizeField(i); } } @@ -1953,10 +2179,11 @@ static void TestGeneralizeRepresentationWithSpecialTransition( Handle<Map> maps[kPropCount]; for (int i = 0; i < kPropCount; i++) { Handle<Map> new_map = Map::ReconfigureProperty(map, i, kData, NONE, - to_representation, to_type); + to.representation, to.type); maps[i] = new_map; - expectations.SetDataField(i, expected_representation, expected_type); + expectations.SetDataField(i, expected.constness, expected.representation, + expected.type); CHECK(map->is_deprecated()); CHECK_NE(*map, *new_map); @@ -1978,7 +2205,7 @@ static void TestGeneralizeRepresentationWithSpecialTransition( // In case of non-equivalent transition currently we generalize all // representations. for (int i = 0; i < kPropCount; i++) { - expectations2.GeneralizeRepresentation(i); + expectations2.GeneralizeField(i); } CHECK(new_map2->GetBackPointer()->IsUndefined(isolate)); CHECK(expectations2.Check(*new_map2)); @@ -2021,9 +2248,10 @@ TEST(ElementsKindTransitionFromMapOwningDescriptor) { bool is_non_equevalent_transition() const { return true; } }; TestConfig config; - TestGeneralizeRepresentationWithSpecialTransition( - config, Representation::Smi(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); + TestGeneralizeFieldWithSpecialTransition( + config, {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } @@ -2043,7 +2271,7 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) { // Add one more transition to |map| in order to prevent descriptors // ownership. CHECK(map->owns_descriptors()); - Map::CopyWithField(map, MakeString("foo"), any_type, NONE, + Map::CopyWithField(map, MakeString("foo"), any_type, NONE, kMutable, Representation::Smi(), INSERT_TRANSITION) .ToHandleChecked(); CHECK(!map->owns_descriptors()); @@ -2058,9 +2286,10 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) { bool is_non_equevalent_transition() const { return true; } }; TestConfig config; - TestGeneralizeRepresentationWithSpecialTransition( - config, Representation::Smi(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); + TestGeneralizeFieldWithSpecialTransition( + config, {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } @@ -2092,9 +2321,10 @@ TEST(PrototypeTransitionFromMapOwningDescriptor) { bool is_non_equevalent_transition() const { return true; } }; TestConfig config; - TestGeneralizeRepresentationWithSpecialTransition( - config, Representation::Smi(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); + TestGeneralizeFieldWithSpecialTransition( + config, {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } @@ -2123,7 +2353,7 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) { // Add one more transition to |map| in order to prevent descriptors // ownership. CHECK(map->owns_descriptors()); - Map::CopyWithField(map, MakeString("foo"), any_type, NONE, + Map::CopyWithField(map, MakeString("foo"), any_type, NONE, kMutable, Representation::Smi(), INSERT_TRANSITION) .ToHandleChecked(); CHECK(!map->owns_descriptors()); @@ -2137,9 +2367,10 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) { bool is_non_equevalent_transition() const { return true; } }; TestConfig config; - TestGeneralizeRepresentationWithSpecialTransition( - config, Representation::Smi(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); + TestGeneralizeFieldWithSpecialTransition( + config, {kMutable, Representation::Smi(), any_type}, + {kMutable, Representation::HeapObject(), value_type}, + {kMutable, Representation::Tagged(), any_type}); } @@ -2148,23 +2379,26 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) { // struct TransitionToDataFieldOperator { + PropertyConstness constness_; Representation representation_; PropertyAttributes attributes_; Handle<FieldType> heap_type_; Handle<Object> value_; - TransitionToDataFieldOperator(Representation representation, + TransitionToDataFieldOperator(PropertyConstness constness, + Representation representation, Handle<FieldType> heap_type, Handle<Object> value, PropertyAttributes attributes = NONE) - : representation_(representation), + : constness_(constness), + representation_(representation), attributes_(attributes), heap_type_(heap_type), value_(value) {} Handle<Map> DoTransition(Expectations& expectations, Handle<Map> map) { - return expectations.TransitionToDataField(map, attributes_, representation_, - heap_type_, value_); + return expectations.TransitionToDataField( + map, attributes_, constness_, representation_, heap_type_, value_); } }; @@ -2213,7 +2447,8 @@ struct ReconfigureAsDataPropertyOperator { heap_type_(heap_type) {} Handle<Map> DoTransition(Expectations& expectations, Handle<Map> map) { - expectations.SetDataField(descriptor_, representation_, heap_type_); + expectations.SetDataField(descriptor_, kMutable, representation_, + heap_type_); return Map::ReconfigureExistingProperty(map, descriptor_, kData, attributes_); } @@ -2235,18 +2470,20 @@ struct ReconfigureAsAccessorPropertyOperator { } }; - -// Checks that representation/field type generalization happened. +// Checks that field generalization happened. struct FieldGeneralizationChecker { int descriptor_; + PropertyConstness constness_; Representation representation_; PropertyAttributes attributes_; Handle<FieldType> heap_type_; - FieldGeneralizationChecker(int descriptor, Representation representation, + FieldGeneralizationChecker(int descriptor, PropertyConstness constness, + Representation representation, Handle<FieldType> heap_type, PropertyAttributes attributes = NONE) : descriptor_(descriptor), + constness_(constness), representation_(representation), attributes_(attributes), heap_type_(heap_type) {} @@ -2259,8 +2496,8 @@ struct FieldGeneralizationChecker { Handle<Map> updated_map = Map::Update(map1); CHECK_EQ(*map2, *updated_map); - expectations2.SetDataField(descriptor_, attributes_, representation_, - heap_type_); + expectations2.SetDataField(descriptor_, attributes_, constness_, + representation_, heap_type_); CHECK(expectations2.Check(*map2)); } }; @@ -2315,7 +2552,8 @@ static void TestTransitionTo(TransitionOp1& transition_op1, Handle<Map> initial_map = Map::Create(isolate, 0); Handle<Map> map = initial_map; for (int i = 0; i < kPropCount - 1; i++) { - map = expectations.AddDataField(map, NONE, Representation::Smi(), any_type); + map = expectations.AddDataField(map, NONE, kMutable, Representation::Smi(), + any_type); } CHECK(expectations.Check(*map)); @@ -2338,15 +2576,15 @@ TEST(TransitionDataFieldToDataField) { Handle<FieldType> any_type = FieldType::Any(isolate); Handle<Object> value1 = handle(Smi::kZero, isolate); - TransitionToDataFieldOperator transition_op1(Representation::Smi(), any_type, - value1); + TransitionToDataFieldOperator transition_op1(kMutable, Representation::Smi(), + any_type, value1); Handle<Object> value2 = isolate->factory()->NewHeapNumber(0); - TransitionToDataFieldOperator transition_op2(Representation::Double(), - any_type, value2); + TransitionToDataFieldOperator transition_op2( + kMutable, Representation::Double(), any_type, value2); - FieldGeneralizationChecker checker(kPropCount - 1, Representation::Double(), - any_type); + FieldGeneralizationChecker checker(kPropCount - 1, kMutable, + Representation::Double(), any_type); TestTransitionTo(transition_op1, transition_op2, checker); } @@ -2386,9 +2624,15 @@ TEST(TransitionDataConstantToAnotherDataConstant) { factory->NewFunction(sloppy_map, info, isolate->native_context()); TransitionToDataConstantOperator transition_op2(js_func2); - FieldGeneralizationChecker checker( - kPropCount - 1, Representation::HeapObject(), function_type); - TestTransitionTo(transition_op1, transition_op2, checker); + if (FLAG_track_constant_fields) { + SameMapChecker checker; + TestTransitionTo(transition_op1, transition_op2, checker); + + } else { + FieldGeneralizationChecker checker( + kPropCount - 1, kMutable, Representation::HeapObject(), function_type); + TestTransitionTo(transition_op1, transition_op2, checker); + } } @@ -2403,11 +2647,11 @@ TEST(TransitionDataConstantToDataField) { TransitionToDataConstantOperator transition_op1(js_func1); Handle<Object> value2 = isolate->factory()->NewHeapNumber(0); - TransitionToDataFieldOperator transition_op2(Representation::Double(), - any_type, value2); + TransitionToDataFieldOperator transition_op2( + kMutable, Representation::Double(), any_type, value2); - FieldGeneralizationChecker checker(kPropCount - 1, Representation::Tagged(), - any_type); + FieldGeneralizationChecker checker(kPropCount - 1, kMutable, + Representation::Tagged(), any_type); TestTransitionTo(transition_op1, transition_op2, checker); } @@ -2436,3 +2680,31 @@ TEST(FieldTypeConvertSimple) { // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. // TEST(TransitionAccessorConstantToAnotherAccessorConstant) + +TEST(HoleyMutableHeapNumber) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Isolate* isolate = CcTest::i_isolate(); + + Handle<HeapNumber> mhn = isolate->factory()->NewMutableHeapNumber(); + CHECK_EQ(kHoleNanInt64, mhn->value_as_bits()); + + mhn = isolate->factory()->NewHeapNumber(0.0, MUTABLE); + CHECK_EQ(V8_UINT64_C(0), mhn->value_as_bits()); + + mhn->set_value_as_bits(kHoleNanInt64); + CHECK_EQ(kHoleNanInt64, mhn->value_as_bits()); + + // Ensure that new storage for uninitialized value or mutable heap number + // with uninitialized sentinel (kHoleNanInt64) is a mutable heap number + // with uninitialized sentinel. + Handle<Object> obj = + Object::NewStorageFor(isolate, isolate->factory()->uninitialized_value(), + Representation::Double()); + CHECK(obj->IsMutableHeapNumber()); + CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits()); + + obj = Object::NewStorageFor(isolate, mhn, Representation::Double()); + CHECK(obj->IsMutableHeapNumber()); + CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits()); +} diff --git a/deps/v8/test/cctest/test-flags.cc b/deps/v8/test/cctest/test-flags.cc index 230b3d1dd0..0abbca6909 100644 --- a/deps/v8/test/cctest/test-flags.cc +++ b/deps/v8/test/cctest/test-flags.cc @@ -257,5 +257,5 @@ TEST(FlagsRemoveIncomplete) { const_cast<char **>(argv), true)); CHECK(argv[1]); - CHECK_EQ(argc, 2); + CHECK_EQ(2, argc); } diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc index 8c43bbfa54..e5ccbc3275 100644 --- a/deps/v8/test/cctest/test-func-name-inference.cc +++ b/deps/v8/test/cctest/test-func-name-inference.cc @@ -31,6 +31,7 @@ #include "src/api.h" #include "src/debug/debug.h" +#include "src/objects-inl.h" #include "src/string-search.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-hashing.cc b/deps/v8/test/cctest/test-hashing.cc index d6f055e321..ef1b363560 100644 --- a/deps/v8/test/cctest/test-hashing.cc +++ b/deps/v8/test/cctest/test-hashing.cc @@ -32,7 +32,7 @@ #include "src/code-stubs.h" #include "src/factory.h" #include "src/macro-assembler.h" -#include "src/objects.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" #ifdef USE_SIMULATOR diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 9780b3f519..7855f75b38 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -34,9 +34,11 @@ #include "src/v8.h" #include "include/v8-profiler.h" +#include "src/api.h" #include "src/base/hashmap.h" #include "src/collector.h" #include "src/debug/debug.h" +#include "src/objects-inl.h" #include "src/profiler/allocation-tracker.h" #include "src/profiler/heap-profiler.h" #include "src/profiler/heap-snapshot-generator-inl.h" @@ -476,48 +478,6 @@ TEST(HeapSnapshotSymbol) { CHECK(v8_str("mySymbol")->Equals(env.local(), name->GetName()).FromJust()); } - -void CheckSimdSnapshot(const char* program, const char* var_name) { - i::FLAG_harmony_simd = true; - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); - v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); - - CompileRun(program); - // The TakeHeapSnapshot function does not do enough GCs to ensure - // that all garbage is collected. We perform addition GC here - // to reclaim a floating AllocationSite and to fix the following failure: - // # Check failed: ValidateSnapshot(snapshot). - // Stdout: - // 28 @ 13523 entry with no retainer: /hidden/ system / AllocationSite - // 44 @ 767 $map: /hidden/ system / Map - // 44 @ 59 $map: /hidden/ system / Map - CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - - const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); - CHECK(ValidateSnapshot(snapshot)); - const v8::HeapGraphNode* global = GetGlobalObject(snapshot); - const v8::HeapGraphNode* var = - GetProperty(global, v8::HeapGraphEdge::kProperty, var_name); - CHECK(var); - CHECK_EQ(var->GetType(), v8::HeapGraphNode::kSimdValue); -} - - -TEST(HeapSnapshotSimd) { - CheckSimdSnapshot("a = SIMD.Float32x4();\n", "a"); - CheckSimdSnapshot("a = SIMD.Int32x4();\n", "a"); - CheckSimdSnapshot("a = SIMD.Uint32x4();\n", "a"); - CheckSimdSnapshot("a = SIMD.Bool32x4();\n", "a"); - CheckSimdSnapshot("a = SIMD.Int16x8();\n", "a"); - CheckSimdSnapshot("a = SIMD.Uint16x8();\n", "a"); - CheckSimdSnapshot("a = SIMD.Bool16x8();\n", "a"); - CheckSimdSnapshot("a = SIMD.Int8x16();\n", "a"); - CheckSimdSnapshot("a = SIMD.Uint8x16();\n", "a"); - CheckSimdSnapshot("a = SIMD.Bool8x16();\n", "a"); -} - - TEST(HeapSnapshotWeakCollection) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); @@ -2252,15 +2212,19 @@ TEST(AllocationSitesAreVisible) { const v8::HeapGraphNode* fun_code = GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); CHECK(fun_code); - const v8::HeapGraphNode* literals = - GetProperty(fun_code, v8::HeapGraphEdge::kInternal, "literals"); - CHECK(literals); - CHECK_EQ(v8::HeapGraphNode::kArray, literals->GetType()); - CHECK_EQ(1, literals->GetChildrenCount()); - - // The first value in the literals array should be the boilerplate, + const v8::HeapGraphNode* vector_cell = GetProperty( + fun_code, v8::HeapGraphEdge::kInternal, "feedback_vector_cell"); + // TODO(mvstanton): I'm not sure if this is the best way to expose + // literals. Is it too much to expose the Cell? + CHECK(vector_cell); + const v8::HeapGraphNode* vector = + GetProperty(vector_cell, v8::HeapGraphEdge::kInternal, "value"); + CHECK_EQ(v8::HeapGraphNode::kArray, vector->GetType()); + CHECK_EQ(3, vector->GetChildrenCount()); + + // The first value in the feedback vector should be the boilerplate, // after an AllocationSite. - const v8::HeapGraphEdge* prop = literals->GetChild(0); + const v8::HeapGraphEdge* prop = vector->GetChild(2); const v8::HeapGraphNode* allocation_site = prop->GetToNode(); v8::String::Utf8Value name(allocation_site->GetName()); CHECK_EQ(0, strcmp("system / AllocationSite", *name)); @@ -2703,33 +2667,6 @@ TEST(ArrayBufferSharedBackingStore) { } -TEST(BoxObject) { - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - LocalContext env; - v8::Local<v8::Object> global_proxy = env->Global(); - v8::Local<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); - - i::Factory* factory = CcTest::i_isolate()->factory(); - i::Handle<i::String> string = factory->NewStringFromStaticChars("string"); - i::Handle<i::Object> box = factory->NewBox(string); - global->Set(env.local(), 0, v8::ToApiHandle<v8::Object>(box)).FromJust(); - - v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); - const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); - CHECK(ValidateSnapshot(snapshot)); - const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); - const v8::HeapGraphNode* box_node = - GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); - CHECK(box_node); - v8::String::Utf8Value box_node_name(box_node->GetName()); - CHECK_EQ(0, strcmp("system / Box", *box_node_name)); - const v8::HeapGraphNode* box_value = - GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); - CHECK(box_value); -} - - TEST(WeakContainers) { i::FLAG_allow_natives_syntax = true; LocalContext env; diff --git a/deps/v8/test/cctest/test-identity-map.cc b/deps/v8/test/cctest/test-identity-map.cc index aac39827c0..aca09103d3 100644 --- a/deps/v8/test/cctest/test-identity-map.cc +++ b/deps/v8/test/cctest/test-identity-map.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <set> + #include "src/factory.h" #include "src/identity-map.h" #include "src/isolate.h" @@ -24,9 +26,9 @@ namespace internal { // "move" objects to simulate GC for testing the internals of the map. class IdentityMapTester : public HandleAndZoneScope { public: - IdentityMap<void*> map; + IdentityMap<void*, ZoneAllocationPolicy> map; - IdentityMapTester() : map(heap(), main_zone()) {} + IdentityMapTester() : map(heap(), ZoneAllocationPolicy(main_zone())) {} Heap* heap() { return isolate()->heap(); } Isolate* isolate() { return main_isolate(); } @@ -79,6 +81,63 @@ class IdentityMapTester : public HandleAndZoneScope { } } + void TestFindDelete(Handle<Object> key1, void* val1, Handle<Object> key2, + void* val2) { + CHECK_NULL(map.Find(key1)); + CHECK_NULL(map.Find(key2)); + + // Set {key1} and {key2} for the first time. + void** entry1 = map.Get(key1); + CHECK_NOT_NULL(entry1); + *entry1 = val1; + void** entry2 = map.Get(key2); + CHECK_NOT_NULL(entry2); + *entry2 = val2; + + for (int i = 0; i < 3; i++) { // Find {key1} and {key2} 3 times. + { + void** nentry = map.Find(key2); + CHECK_EQ(val2, *nentry); + } + { + void** nentry = map.Find(key1); + CHECK_EQ(val1, *nentry); + } + } + + // Delete {key1} + void* deleted_entry_1 = map.Delete(key1); + CHECK_NOT_NULL(deleted_entry_1); + deleted_entry_1 = val1; + + for (int i = 0; i < 3; i++) { // Find {key1} and not {key2} 3 times. + { + void** nentry = map.Find(key1); + CHECK_NULL(nentry); + } + { + void** nentry = map.Find(key2); + CHECK_EQ(val2, *nentry); + } + } + + // Delete {key2} + void* deleted_entry_2 = map.Delete(key2); + CHECK_NOT_NULL(deleted_entry_2); + deleted_entry_2 = val2; + + for (int i = 0; i < 3; i++) { // Don't find {key1} and {key2} 3 times. + { + void** nentry = map.Find(key1); + CHECK_NULL(nentry); + } + { + void** nentry = map.Find(key2); + CHECK_NULL(nentry); + } + } + } + Handle<Smi> smi(int value) { return Handle<Smi>(Smi::FromInt(value), isolate()); } @@ -88,7 +147,7 @@ class IdentityMapTester : public HandleAndZoneScope { } void SimulateGCByIncrementingSmisBy(int shift) { - for (int i = 0; i < map.size_; i++) { + for (int i = 0; i < map.capacity_; i++) { if (map.keys_[i]->IsSmi()) { map.keys_[i] = Smi::FromInt(Smi::cast(map.keys_[i])->value() + shift); } @@ -108,16 +167,22 @@ class IdentityMapTester : public HandleAndZoneScope { CHECK_EQ(value, *entry); } + void CheckDelete(Handle<Object> key, void* value) { + void* entry = map.Delete(key); + CHECK_NOT_NULL(entry); + CHECK_EQ(value, entry); + } + void PrintMap() { PrintF("{\n"); - for (int i = 0; i < map.size_; i++) { + for (int i = 0; i < map.capacity_; i++) { PrintF(" %3d: %p => %p\n", i, reinterpret_cast<void*>(map.keys_[i]), reinterpret_cast<void*>(map.values_[i])); } PrintF("}\n"); } - void Resize() { map.Resize(); } + void Resize() { map.Resize(map.capacity_ * 4); } void Rehash() { map.Rehash(); } }; @@ -138,18 +203,46 @@ TEST(Find_num_not_found) { } } +TEST(Delete_smi_not_found) { + IdentityMapTester t; + for (int i = 0; i < 100; i++) { + CHECK_NULL(t.map.Delete(t.smi(i))); + } +} + +TEST(Delete_num_not_found) { + IdentityMapTester t; + for (int i = 0; i < 100; i++) { + CHECK_NULL(t.map.Delete(t.num(i + 0.2))); + } +} + +TEST(GetFind_smi_0) { + IdentityMapTester t; + t.TestGetFind(t.smi(0), t.isolate(), t.smi(1), t.heap()); +} TEST(GetFind_smi_13) { IdentityMapTester t; t.TestGetFind(t.smi(13), t.isolate(), t.smi(17), t.heap()); } - TEST(GetFind_num_13) { IdentityMapTester t; t.TestGetFind(t.num(13.1), t.isolate(), t.num(17.1), t.heap()); } +TEST(Delete_smi_13) { + IdentityMapTester t; + t.TestFindDelete(t.smi(13), t.isolate(), t.smi(17), t.heap()); + CHECK(t.map.empty()); +} + +TEST(Delete_num_13) { + IdentityMapTester t; + t.TestFindDelete(t.num(13.1), t.isolate(), t.num(17.1), t.heap()); + CHECK(t.map.empty()); +} TEST(GetFind_smi_17m) { const int kInterval = 17; @@ -179,6 +272,32 @@ TEST(GetFind_smi_17m) { } } +TEST(Delete_smi_17m) { + const int kInterval = 17; + const int kShift = 1099; + IdentityMapTester t; + + for (int i = 1; i < 100; i += kInterval) { + t.map.Set(t.smi(i), reinterpret_cast<void*>(i + kShift)); + } + + for (int i = 1; i < 100; i += kInterval) { + t.CheckFind(t.smi(i), reinterpret_cast<void*>(i + kShift)); + } + + for (int i = 1; i < 100; i += kInterval) { + t.CheckDelete(t.smi(i), reinterpret_cast<void*>(i + kShift)); + for (int j = 1; j < 100; j += kInterval) { + void** entry = t.map.Find(t.smi(j)); + if (j <= i) { + CHECK_NULL(entry); + } else { + CHECK_NOT_NULL(entry); + CHECK_EQ(reinterpret_cast<void*>(j + kShift), *entry); + } + } + } +} TEST(GetFind_num_1000) { const int kPrime = 137; @@ -191,6 +310,41 @@ TEST(GetFind_num_1000) { } } +TEST(Delete_num_1000) { + const int kPrime = 137; + IdentityMapTester t; + + for (int i = 0; i < 1000; i++) { + t.map.Set(t.smi(i * kPrime), reinterpret_cast<void*>(i * kPrime)); + } + + // Delete every second value in reverse. + for (int i = 999; i >= 0; i -= 2) { + void* entry = t.map.Delete(t.smi(i * kPrime)); + CHECK_EQ(reinterpret_cast<void*>(i * kPrime), entry); + } + + for (int i = 0; i < 1000; i++) { + void** entry = t.map.Find(t.smi(i * kPrime)); + if (i % 2) { + CHECK_NULL(entry); + } else { + CHECK_NOT_NULL(entry); + CHECK_EQ(reinterpret_cast<void*>(i * kPrime), *entry); + } + } + + // Delete the rest. + for (int i = 0; i < 1000; i += 2) { + void* entry = t.map.Delete(t.smi(i * kPrime)); + CHECK_EQ(reinterpret_cast<void*>(i * kPrime), entry); + } + + for (int i = 0; i < 1000; i++) { + void** entry = t.map.Find(t.smi(i * kPrime)); + CHECK_NULL(entry); + } +} TEST(GetFind_smi_gc) { const int kKey = 33; @@ -203,6 +357,15 @@ TEST(GetFind_smi_gc) { t.CheckGet(t.smi(kKey + kShift), &t); } +TEST(Delete_smi_gc) { + const int kKey = 33; + const int kShift = 1211; + IdentityMapTester t; + + t.map.Set(t.smi(kKey), &t); + t.SimulateGCByIncrementingSmisBy(kShift); + t.CheckDelete(t.smi(kKey + kShift), &t); +} TEST(GetFind_smi_gc2) { int kKey1 = 1; @@ -219,6 +382,18 @@ TEST(GetFind_smi_gc2) { t.CheckGet(t.smi(kKey2 + kShift), &kKey2); } +TEST(Delete_smi_gc2) { + int kKey1 = 1; + int kKey2 = 33; + const int kShift = 1211; + IdentityMapTester t; + + t.map.Set(t.smi(kKey1), &kKey1); + t.map.Set(t.smi(kKey2), &kKey2); + t.SimulateGCByIncrementingSmisBy(kShift); + t.CheckDelete(t.smi(kKey1 + kShift), &kKey1); + t.CheckDelete(t.smi(kKey2 + kShift), &kKey2); +} TEST(GetFind_smi_gc_n) { const int kShift = 12011; @@ -245,6 +420,22 @@ TEST(GetFind_smi_gc_n) { } } +TEST(Delete_smi_gc_n) { + const int kShift = 12011; + IdentityMapTester t; + int keys[12] = {1, 2, 7, 8, 15, 23, + 1 + 32, 2 + 32, 7 + 32, 8 + 32, 15 + 32, 23 + 32}; + // Initialize the map first. + for (size_t i = 0; i < arraysize(keys); i++) { + t.map.Set(t.smi(keys[i]), &keys[i]); + } + // Simulate a GC by "moving" the smis in the internal keys array. + t.SimulateGCByIncrementingSmisBy(kShift); + // Check that deleting for the incremented smis finds the same values. + for (size_t i = 0; i < arraysize(keys); i++) { + t.CheckDelete(t.smi(keys[i] + kShift), &keys[i]); + } +} TEST(GetFind_smi_num_gc_n) { const int kShift = 12019; @@ -285,6 +476,158 @@ TEST(GetFind_smi_num_gc_n) { } } +TEST(Delete_smi_num_gc_n) { + const int kShift = 12019; + IdentityMapTester t; + int smi_keys[] = {1, 2, 7, 15, 23}; + Handle<Object> num_keys[] = {t.num(1.1), t.num(2.2), t.num(3.3), t.num(4.4), + t.num(5.5), t.num(6.6), t.num(7.7), t.num(8.8), + t.num(9.9), t.num(10.1)}; + // Initialize the map first. + for (size_t i = 0; i < arraysize(smi_keys); i++) { + t.map.Set(t.smi(smi_keys[i]), &smi_keys[i]); + } + for (size_t i = 0; i < arraysize(num_keys); i++) { + t.map.Set(num_keys[i], &num_keys[i]); + } + + // Simulate a GC by moving SMIs. + // Ironically the SMIs "move", but the heap numbers don't! + t.SimulateGCByIncrementingSmisBy(kShift); + + // Check that deleting for the incremented smis finds the same values. + for (size_t i = 0; i < arraysize(smi_keys); i++) { + t.CheckDelete(t.smi(smi_keys[i] + kShift), &smi_keys[i]); + } + + // Check that deleting the numbers finds the same values. + for (size_t i = 0; i < arraysize(num_keys); i++) { + t.CheckDelete(num_keys[i], &num_keys[i]); + } +} + +TEST(Delete_smi_resizes) { + const int kKeyCount = 1024; + const int kValueOffset = 27; + IdentityMapTester t; + + // Insert one element to initialize map. + t.map.Set(t.smi(0), reinterpret_cast<void*>(kValueOffset)); + + int initial_capacity = t.map.capacity(); + CHECK_LT(initial_capacity, kKeyCount); + + // Insert another kKeyCount - 1 keys. + for (int i = 1; i < kKeyCount; i++) { + t.map.Set(t.smi(i), reinterpret_cast<void*>(i + kValueOffset)); + } + + // Check capacity increased. + CHECK_GT(t.map.capacity(), initial_capacity); + CHECK_GE(t.map.capacity(), kKeyCount); + + // Delete all the keys. + for (int i = 0; i < kKeyCount; i++) { + t.CheckDelete(t.smi(i), reinterpret_cast<void*>(i + kValueOffset)); + } + + // Should resize back to initial capacity. + CHECK_EQ(t.map.capacity(), initial_capacity); +} + +TEST(Iterator_smi_num) { + IdentityMapTester t; + int smi_keys[] = {1, 2, 7, 15, 23}; + Handle<Object> num_keys[] = {t.num(1.1), t.num(2.2), t.num(3.3), t.num(4.4), + t.num(5.5), t.num(6.6), t.num(7.7), t.num(8.8), + t.num(9.9), t.num(10.1)}; + // Initialize the map. + for (size_t i = 0; i < arraysize(smi_keys); i++) { + t.map.Set(t.smi(smi_keys[i]), reinterpret_cast<void*>(i)); + } + for (size_t i = 0; i < arraysize(num_keys); i++) { + t.map.Set(num_keys[i], reinterpret_cast<void*>(i + 5)); + } + + // Check iterator sees all values. + std::set<intptr_t> seen; + { + IdentityMap<void*, ZoneAllocationPolicy>::IteratableScope it_scope(&t.map); + for (auto it = it_scope.begin(); it != it_scope.end(); ++it) { + seen.insert(reinterpret_cast<intptr_t>(**it)); + } + } + for (intptr_t i = 0; i < 15; i++) { + CHECK(seen.find(i) != seen.end()); + } +} + +TEST(Iterator_smi_num_gc) { + const int kShift = 16039; + IdentityMapTester t; + int smi_keys[] = {1, 2, 7, 15, 23}; + Handle<Object> num_keys[] = {t.num(1.1), t.num(2.2), t.num(3.3), t.num(4.4), + t.num(5.5), t.num(6.6), t.num(7.7), t.num(8.8), + t.num(9.9), t.num(10.1)}; + // Initialize the map. + for (size_t i = 0; i < arraysize(smi_keys); i++) { + t.map.Set(t.smi(smi_keys[i]), reinterpret_cast<void*>(i)); + } + for (size_t i = 0; i < arraysize(num_keys); i++) { + t.map.Set(num_keys[i], reinterpret_cast<void*>(i + 5)); + } + + // Simulate GC by moving the SMIs. + t.SimulateGCByIncrementingSmisBy(kShift); + + // Check iterator sees all values. + std::set<intptr_t> seen; + { + IdentityMap<void*, ZoneAllocationPolicy>::IteratableScope it_scope(&t.map); + for (auto it = it_scope.begin(); it != it_scope.end(); ++it) { + seen.insert(reinterpret_cast<intptr_t>(**it)); + } + } + for (intptr_t i = 0; i < 15; i++) { + CHECK(seen.find(i) != seen.end()); + } +} + +TEST(Iterator_smi_delete) { + IdentityMapTester t; + int smi_keys[] = {1, 2, 7, 15, 23}; + + // Initialize the map. + for (size_t i = 0; i < arraysize(smi_keys); i++) { + t.map.Set(t.smi(smi_keys[i]), reinterpret_cast<void*>(i)); + } + + // Iterate and delete half the elements. + std::set<intptr_t> deleted; + { + int i = 0; + IdentityMap<void*, ZoneAllocationPolicy>::IteratableScope it_scope(&t.map); + for (auto it = it_scope.begin(); it != it_scope.end();) { + if (i % 2) { + deleted.insert(reinterpret_cast<intptr_t>(**it)); + it.DeleteAndIncrement(); + } else { + ++it; + } + } + } + + // Check values in map are correct. + for (intptr_t i = 0; i < 5; i++) { + void** entry = t.map.Find(t.smi(smi_keys[i])); + if (deleted.find(i) != deleted.end()) { + CHECK_NULL(entry); + } else { + CHECK_NOT_NULL(entry); + CHECK_EQ(reinterpret_cast<void*>(i), *entry); + } + } +} void CollisionTest(int stride, bool rehash = false, bool resize = false) { for (int load = 15; load <= 120; load = load * 2) { @@ -313,7 +656,6 @@ void CollisionTest(int stride, bool rehash = false, bool resize = false) { } } - TEST(Collisions_1) { CollisionTest(1); } TEST(Collisions_2) { CollisionTest(2); } TEST(Collisions_3) { CollisionTest(3); } diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc index 3c46fbee06..650770e055 100644 --- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc +++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc @@ -724,6 +724,132 @@ TEST(InobjectPropetiesCountOverflowInSubclass) { TestClassHierarchy(hierarchy_desc, kNoOverflowCount); } +static void CheckExpectedProperties(int expected, std::ostringstream& os) { + Handle<HeapObject> obj = Handle<HeapObject>::cast( + v8::Utils::OpenHandle(*CompileRun(os.str().c_str()))); + CHECK_EQ(expected, obj->map()->GetInObjectProperties()); +} + +TEST(ObjectLiteralPropertyBackingStoreSize) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + + std::ostringstream os; + + // An index key does not require space in the property backing store. + os << "(function() {\n" + " function f() {\n" + " var o = {\n" + " '-1': 42,\n" // Allocate for non-index key. + " 1: 42,\n" // Do not allocate for index key. + " '2': 42\n" // Do not allocate for index key. + " };\n" + " return o;\n" + " }\n" + "\n" + " return f();\n" + "} )();"; + CheckExpectedProperties(1, os); + + // Avoid over-/under-allocation for computed property names. + os << "(function() {\n" + " 'use strict';\n" + " function f(x) {\n" + " var o = {\n" + " 1: 42,\n" // Do not allocate for index key. + " '2': 42,\n" // Do not allocate for index key. + " [x]: 42,\n" // Allocate for property with computed name. + " 3: 42,\n" // Do not allocate for index key. + " '4': 42\n" // Do not allocate for index key. + " };\n" + " return o;\n" + " }\n" + "\n" + " var x = 'hello'\n" + "\n" + " return f(x);\n" + "} )();"; + CheckExpectedProperties(1, os); + + // Conversion to index key. + os << "(function() {\n" + " function f(x) {\n" + " var o = {\n" + " 1: 42,\n" // Do not allocate for index key. + " '2': 42,\n" // Do not allocate for index key. + " [x]: 42,\n" // Allocate for property with computed name. + " 3: 42,\n" // Do not allocate for index key. + " get 12() {}\n" // Do not allocate for index key. + " };\n" + " return o;\n" + " }\n" + "\n" + " var x = 'hello'\n" + "\n" + " return f(x);\n" + "} )();"; + CheckExpectedProperties(1, os); + + os << "(function() {\n" + " function f() {\n" + " var o = {};\n" + " return o;\n" + " }\n" + "\n" + " return f();\n" + "} )();"; + // Empty objects have slack for 4 properties. + CheckExpectedProperties(4, os); + + os << "(function() {\n" + " function f(x) {\n" + " var o = {\n" + " a: 42,\n" // Allocate for constant property. + " [x]: 42,\n" // Allocate for property with computed name. + " b: 42\n" // Allocate for constant property. + " };\n" + " return o;\n" + " }\n" + "\n" + " var x = 'hello'\n" + "\n" + " return f(x);\n" + "} )();"; + CheckExpectedProperties(3, os); + + os << "(function() {\n" + " function f(x) {\n" + " var o = {\n" + " a: 42,\n" // Allocate for constant property. + " __proto__: 42,\n" // Do not allocate for __proto__. + " [x]: 42\n" // Allocate for property with computed name. + " };\n" + " return o;\n" + " }\n" + "\n" + " var x = 'hello'\n" + "\n" + " return f(x);\n" + "} )();"; + // __proto__ is not allocated in the backing store. + CheckExpectedProperties(2, os); + + os << "(function() {\n" + " function f(x) {\n" + " var o = {\n" + " a: 42,\n" // Allocate for constant property. + " [x]: 42,\n" // Allocate for property with computed name. + " __proto__: 42\n" // Do not allocate for __proto__. + " };\n" + " return o;\n" + " }\n" + "\n" + " var x = 'hello'\n" + "\n" + " return f(x);\n" + "} )();"; + CheckExpectedProperties(2, os); +} TEST(SlowModeSubclass) { // Avoid eventual completion of in-object slack tracking. diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc index 09257bcda2..02feb64536 100644 --- a/deps/v8/test/cctest/test-log-stack-tracer.cc +++ b/deps/v8/test/cctest/test-log-stack-tracer.cc @@ -35,6 +35,7 @@ #include "src/disassembler.h" #include "src/isolate.h" #include "src/log.h" +#include "src/objects-inl.h" #include "src/v8.h" #include "src/vm-state-inl.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc index cfcdeb2d40..9527e620bd 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc @@ -193,7 +193,7 @@ TEST(LoadAddress) { __ bind(&skip); __ li(a4, Operand(masm->jump_address(&to_jump)), ADDRESS_LOAD); int check_size = masm->InstructionsGeneratedSince(&skip); - CHECK_EQ(check_size, 4); + CHECK_EQ(4, check_size); __ jr(a4); __ nop(); __ stop("invalid"); diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc index 1f6c247288..05beed1dd1 100644 --- a/deps/v8/test/cctest/test-macro-assembler-x64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc @@ -32,6 +32,7 @@ #include "src/base/platform/platform.h" #include "src/factory.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" #include "test/cctest/cctest.h" namespace i = v8::internal; diff --git a/deps/v8/test/cctest/test-managed.cc b/deps/v8/test/cctest/test-managed.cc new file mode 100644 index 0000000000..21452b32f8 --- /dev/null +++ b/deps/v8/test/cctest/test-managed.cc @@ -0,0 +1,78 @@ +// 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/managed.h" + +#include "src/objects-inl.h" +#include "test/cctest/cctest.h" + +using namespace v8::base; +using namespace v8::internal; + +class DeleteRecorder { + public: + explicit DeleteRecorder(bool* deleted) : deleted_(deleted) { + *deleted_ = false; + } + ~DeleteRecorder() { *deleted_ = true; } + static void Deleter(void* value) { + delete reinterpret_cast<DeleteRecorder*>(value); + } + + private: + bool* deleted_; +}; + +TEST(ManagedCollect) { + Isolate* isolate = CcTest::InitIsolateOnce(); + bool deleted1 = false; + bool deleted2 = false; + DeleteRecorder* d1 = new DeleteRecorder(&deleted1); + DeleteRecorder* d2 = new DeleteRecorder(&deleted2); + Isolate::ManagedObjectFinalizer* finalizer = + isolate->RegisterForReleaseAtTeardown(d2, DeleteRecorder::Deleter); + { + HandleScope scope(isolate); + auto handle = Managed<DeleteRecorder>::New(isolate, d1); + USE(handle); + } + + CcTest::CollectAllAvailableGarbage(); + + CHECK(deleted1); + CHECK(!deleted2); + isolate->UnregisterFromReleaseAtTeardown(&finalizer); + CHECK_NULL(finalizer); + delete d2; + CHECK(deleted2); +} + +TEST(DisposeCollect) { + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = + CcTest::InitIsolateOnce()->array_buffer_allocator(); + + v8::Isolate* isolate = v8::Isolate::New(create_params); + isolate->Enter(); + Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + bool deleted1 = false; + bool deleted2 = false; + DeleteRecorder* d1 = new DeleteRecorder(&deleted1); + DeleteRecorder* d2 = new DeleteRecorder(&deleted2); + { + HandleScope scope(i_isolate); + auto handle = Managed<DeleteRecorder>::New(i_isolate, d1); + USE(handle); + } + i_isolate->RegisterForReleaseAtTeardown(d2, DeleteRecorder::Deleter); + + isolate->Exit(); + isolate->Dispose(); + CHECK(deleted1); + CHECK(deleted2); +} diff --git a/deps/v8/test/cctest/test-modules.cc b/deps/v8/test/cctest/test-modules.cc index e086a407f9..9a9bfef990 100644 --- a/deps/v8/test/cctest/test-modules.cc +++ b/deps/v8/test/cctest/test-modules.cc @@ -19,6 +19,14 @@ using v8::ScriptOrigin; using v8::String; using v8::Value; +ScriptOrigin ModuleOrigin(Local<v8::Value> resource_name, Isolate* isolate) { + ScriptOrigin origin(resource_name, Local<v8::Integer>(), Local<v8::Integer>(), + Local<v8::Boolean>(), Local<v8::Integer>(), + Local<v8::Value>(), Local<v8::Boolean>(), + Local<v8::Boolean>(), True(isolate)); + return origin; +} + MaybeLocal<Module> AlwaysEmptyResolveCallback(Local<Context> context, Local<String> specifier, Local<Module> referrer) { @@ -31,7 +39,7 @@ MaybeLocal<Module> FailOnSecondCallResolveCallback(Local<Context> context, Local<Module> referrer) { if (g_count++ > 0) return MaybeLocal<Module>(); Local<String> source_text = v8_str(""); - ScriptOrigin origin(v8_str("module.js")); + ScriptOrigin origin = ModuleOrigin(v8_str("module.js"), CcTest::isolate()); ScriptCompiler::Source source(source_text, origin); return ScriptCompiler::CompileModule(CcTest::isolate(), &source) .ToLocalChecked(); @@ -45,7 +53,7 @@ TEST(ModuleInstantiationFailures) { Local<String> source_text = v8_str( "import './foo.js';" "export {} from './bar.js';"); - ScriptOrigin origin(v8_str("file.js")); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); ScriptCompiler::Source source(source_text, origin); Local<Module> module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); @@ -66,7 +74,7 @@ TEST(ModuleInstantiationFailures) { static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( Local<Context> context, Local<String> specifier, Local<Module> referrer) { - ScriptOrigin origin(v8_str("module.js")); + ScriptOrigin origin = ModuleOrigin(v8_str("module.js"), CcTest::isolate()); ScriptCompiler::Source source(specifier, origin); return ScriptCompiler::CompileModule(CcTest::isolate(), &source) .ToLocalChecked(); @@ -80,7 +88,7 @@ TEST(ModuleEvaluation) { Local<String> source_text = v8_str( "import 'Object.expando = 5';" "import 'Object.expando *= 2';"); - ScriptOrigin origin(v8_str("file.js")); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); ScriptCompiler::Source source(source_text, origin); Local<Module> module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc index cade4284ae..71681b87d1 100644 --- a/deps/v8/test/cctest/test-object.cc +++ b/deps/v8/test/cctest/test-object.cc @@ -58,9 +58,6 @@ TEST(NoSideEffectsToString) { CheckObject(isolate, factory->undefined_value(), "undefined"); CheckObject(isolate, factory->null_value(), "null"); - int lanes[] = {0, 1, 2, 3}; - CheckObject(isolate, factory->NewInt32x4(lanes), "SIMD.Int32x4(0, 1, 2, 3)"); - CheckObject(isolate, factory->error_to_string(), "[object Error]"); CheckObject(isolate, factory->stack_trace_symbol(), "Symbol(stack_trace_symbol)"); diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index fd904b110c..f2e90ae259 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -53,6 +53,8 @@ #include "src/utils.h" #include "test/cctest/cctest.h" +#include "test/cctest/scope-test-helper.h" +#include "test/cctest/unicode-helpers.h" TEST(ScanKeywords) { struct KeywordToken { @@ -702,29 +704,6 @@ TEST(RegExpScanning) { TestScanRegExp("/=?/", "=?"); } -static int Ucs2CharLength(unibrow::uchar c) { - if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) { - return 0; - } else if (c < 0xffff) { - return 1; - } else { - return 2; - } -} - -static int Utf8LengthHelper(const char* s) { - unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty); - int length = 0; - for (; *s != '\0'; s++) { - unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(*s, &buffer); - length += Ucs2CharLength(tmp); - } - unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&buffer); - length += Ucs2CharLength(tmp); - return length; -} - - TEST(ScopeUsesArgumentsSuperThis) { static const struct { const char* prefix; @@ -825,8 +804,7 @@ TEST(ScopeUsesArgumentsSuperThis) { factory->NewStringFromUtf8(i::CStrVector(program.start())) .ToHandleChecked(); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); // The information we're checking is only produced when eager parsing. info.set_allow_lazy_parsing(false); CHECK(i::parsing::ParseProgram(&info)); @@ -882,7 +860,7 @@ static void CheckParsesToNumber(const char* source, bool with_dot) { i::Handle<i::Script> script = factory->NewScript(source_code); - i::ParseInfo info(handles.main_zone(), script); + i::ParseInfo info(script); i::Parser parser(&info); info.set_allow_lazy_parsing(false); info.set_toplevel(true); @@ -1180,8 +1158,7 @@ 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(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); info.set_language_mode(source_data[i].language_mode); i::parsing::ParseProgram(&info); CHECK_NOT_NULL(info.literal()); @@ -1189,7 +1166,7 @@ TEST(ScopePositions) { // Check scope types and positions. i::Scope* scope = info.literal()->scope(); CHECK(scope->is_script_scope()); - CHECK_EQ(scope->start_position(), 0); + CHECK_EQ(0, scope->start_position()); CHECK_EQ(scope->end_position(), kProgramSize); i::Scope* inner_scope = scope->inner_scope(); @@ -1227,8 +1204,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(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); i::parsing::ParseProgram(&info); function = info.literal(); CHECK_NOT_NULL(function); @@ -1284,7 +1260,10 @@ enum ParserFlag { kAllowHarmonyRestrictiveGenerators, kAllowHarmonyTrailingCommas, kAllowHarmonyClassFields, - kAllowHarmonyObjectSpread, + kAllowHarmonyObjectRestSpread, + kAllowHarmonyDynamicImport, + kAllowHarmonyAsyncIteration, + kAllowHarmonyTemplateEscapes, }; enum ParserSyncTestResult { @@ -1300,7 +1279,12 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) { flags.Contains(kAllowHarmonyRestrictiveGenerators); i::FLAG_harmony_trailing_commas = flags.Contains(kAllowHarmonyTrailingCommas); i::FLAG_harmony_class_fields = flags.Contains(kAllowHarmonyClassFields); - i::FLAG_harmony_object_spread = flags.Contains(kAllowHarmonyObjectSpread); + i::FLAG_harmony_object_rest_spread = + flags.Contains(kAllowHarmonyObjectRestSpread); + i::FLAG_harmony_dynamic_import = flags.Contains(kAllowHarmonyDynamicImport); + i::FLAG_harmony_async_iteration = flags.Contains(kAllowHarmonyAsyncIteration); + i::FLAG_harmony_template_escapes = + flags.Contains(kAllowHarmonyTemplateEscapes); } void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { @@ -1313,21 +1297,25 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { flags.Contains(kAllowHarmonyTrailingCommas)); parser->set_allow_harmony_class_fields( flags.Contains(kAllowHarmonyClassFields)); - parser->set_allow_harmony_object_spread( - flags.Contains(kAllowHarmonyObjectSpread)); + parser->set_allow_harmony_object_rest_spread( + flags.Contains(kAllowHarmonyObjectRestSpread)); + parser->set_allow_harmony_dynamic_import( + flags.Contains(kAllowHarmonyDynamicImport)); + parser->set_allow_harmony_async_iteration( + flags.Contains(kAllowHarmonyAsyncIteration)); + parser->set_allow_harmony_template_escapes( + flags.Contains(kAllowHarmonyTemplateEscapes)); } void TestParserSyncWithFlags(i::Handle<i::String> source, i::EnumSet<ParserFlag> flags, ParserSyncTestResult result, - bool is_module = false, - bool test_preparser = true) { + bool is_module = false, bool test_preparser = true, + bool ignore_error_msg = false) { i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); uintptr_t stack_limit = isolate->stack_guard()->real_climit(); - int preparser_materialized_literals = -1; - int parser_materialized_literals = -2; // Preparse the data. i::PendingCompilationErrorHandler pending_error_handler; @@ -1344,8 +1332,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, isolate->counters()->runtime_call_stats()); SetParserFlags(&preparser, flags); scanner.Initialize(stream.get()); - i::PreParser::PreParseResult result = - preparser.PreParseProgram(&preparser_materialized_literals, is_module); + i::PreParser::PreParseResult result = preparser.PreParseProgram(is_module); CHECK_EQ(i::PreParser::kPreParseSuccess, result); } @@ -1353,16 +1340,12 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, i::FunctionLiteral* function; { i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); info.set_allow_lazy_parsing(flags.Contains(kAllowLazy)); SetGlobalFlags(flags); if (is_module) info.set_module(); i::parsing::ParseProgram(&info); function = info.literal(); - if (function) { - parser_materialized_literals = function->materialized_literal_count(); - } } // Check that preparsing fails iff parsing fails. @@ -1398,7 +1381,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, CHECK(false); } // Check that preparser and parser produce the same error. - if (test_preparser) { + if (test_preparser && !ignore_error_msg) { i::Handle<i::String> preparser_message = pending_error_handler.FormatMessage(CcTest::i_isolate()); if (!i::String::Equals(message_string, preparser_message)) { @@ -1432,20 +1415,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, "However, parser and preparser succeeded", source->ToCString().get()); CHECK(false); - } else if (test_preparser && - preparser_materialized_literals != parser_materialized_literals) { - v8::base::OS::Print( - "Preparser materialized literals (%d) differ from Parser materialized " - "literals (%d) on:\n" - "\t%s\n" - "However, parser and preparser succeeded", - preparser_materialized_literals, parser_materialized_literals, - source->ToCString().get()); - CHECK(false); } } - void TestParserSync(const char* source, const ParserFlag* varying_flags, size_t varying_flags_length, ParserSyncTestResult result = kSuccessOrError, @@ -1453,7 +1425,8 @@ void TestParserSync(const char* source, const ParserFlag* varying_flags, size_t always_true_flags_length = 0, const ParserFlag* always_false_flags = NULL, size_t always_false_flags_length = 0, - bool is_module = false, bool test_preparser = true) { + bool is_module = false, bool test_preparser = true, + bool ignore_error_msg = false) { i::Handle<i::String> str = CcTest::i_isolate()->factory()->NewStringFromAsciiChecked(source); for (int bits = 0; bits < (1 << varying_flags_length); bits++) { @@ -1470,7 +1443,8 @@ void TestParserSync(const char* source, const ParserFlag* varying_flags, ++flag_index) { flags.Remove(always_false_flags[flag_index]); } - TestParserSyncWithFlags(str, flags, result, is_module, test_preparser); + TestParserSyncWithFlags(str, flags, result, is_module, test_preparser, + ignore_error_msg); } } @@ -1610,16 +1584,13 @@ TEST(StrictOctal) { *exception)); } - -void RunParserSyncTest(const char* context_data[][2], - const char* statement_data[], - ParserSyncTestResult result, - const ParserFlag* flags = NULL, int flags_len = 0, - const ParserFlag* always_true_flags = NULL, - int always_true_len = 0, - const ParserFlag* always_false_flags = NULL, - int always_false_len = 0, bool is_module = false, - bool test_preparser = true) { +void RunParserSyncTest( + const char* context_data[][2], const char* statement_data[], + ParserSyncTestResult result, const ParserFlag* flags = NULL, + int flags_len = 0, const ParserFlag* always_true_flags = NULL, + int always_true_len = 0, const ParserFlag* always_false_flags = NULL, + int always_false_len = 0, bool is_module = false, + bool test_preparser = true, bool ignore_error_msg = false) { v8::HandleScope handles(CcTest::isolate()); v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); @@ -1674,25 +1645,23 @@ void RunParserSyncTest(const char* context_data[][2], CHECK(length == kProgramSize); TestParserSync(program.start(), flags, flags_len, result, always_true_flags, always_true_len, always_false_flags, - always_false_len, is_module, test_preparser); + always_false_len, is_module, test_preparser, + ignore_error_msg); } } delete[] generated_flags; } - -void RunModuleParserSyncTest(const char* context_data[][2], - const char* statement_data[], - ParserSyncTestResult result, - const ParserFlag* flags = NULL, int flags_len = 0, - const ParserFlag* always_true_flags = NULL, - int always_true_len = 0, - const ParserFlag* always_false_flags = NULL, - int always_false_len = 0, - bool test_preparser = true) { +void RunModuleParserSyncTest( + const char* context_data[][2], const char* statement_data[], + ParserSyncTestResult result, const ParserFlag* flags = NULL, + int flags_len = 0, const ParserFlag* always_true_flags = NULL, + int always_true_len = 0, const ParserFlag* always_false_flags = NULL, + int always_false_len = 0, bool test_preparser = true, + bool ignore_error_msg = false) { RunParserSyncTest(context_data, statement_data, result, flags, flags_len, always_true_flags, always_true_len, always_false_flags, - always_false_len, true, test_preparser); + always_false_len, true, test_preparser, ignore_error_msg); } @@ -2485,8 +2454,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(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); i::ScriptData* sd = NULL; info.set_cached_data(&sd); info.set_compile_options(v8::ScriptCompiler::kProduceParserCache); @@ -3373,7 +3341,6 @@ TEST(InnerAssignment) { i::SNPrintF(program, "%s%s%s%s%s", prefix, outer, midfix, inner, suffix); - i::Zone zone(isolate->allocator(), ZONE_NAME); std::unique_ptr<i::ParseInfo> info; if (lazy) { printf("%s\n", program.start()); @@ -3381,7 +3348,7 @@ TEST(InnerAssignment) { 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)); + info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared)); CHECK(i::parsing::ParseFunction(info.get())); } else { i::Handle<i::String> source = @@ -3389,7 +3356,7 @@ TEST(InnerAssignment) { source->PrintOn(stdout); printf("\n"); i::Handle<i::Script> script = factory->NewScript(source); - info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script)); + info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script)); info->set_allow_lazy_parsing(false); CHECK(i::parsing::ParseProgram(info.get())); } @@ -3488,14 +3455,13 @@ TEST(MaybeAssignedParameters) { i::ScopedVector<char> program(Utf8LengthHelper(source) + Utf8LengthHelper(suffix) + 1); i::SNPrintF(program, "%s%s", source, suffix); - i::Zone zone(isolate->allocator(), ZONE_NAME); std::unique_ptr<i::ParseInfo> info; 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)); + info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared)); info->set_allow_lazy_parsing(allow_lazy); CHECK(i::parsing::ParseFunction(info.get())); CHECK(i::Compiler::Analyze(info.get())); @@ -3515,64 +3481,433 @@ TEST(MaybeAssignedParameters) { } } +struct Input { + bool assigned; + std::string source; + std::vector<unsigned> location; // "Directions" to the relevant scope. +}; + +static void TestMaybeAssigned(Input input, const char* variable, bool module, + bool allow_lazy_parsing) { + i::Factory* factory = CcTest::i_isolate()->factory(); + i::Handle<i::String> string = + factory->InternalizeUtf8String(input.source.c_str()); + string->PrintOn(stdout); + printf("\n"); + i::Handle<i::Script> script = factory->NewScript(string); + + std::unique_ptr<i::ParseInfo> info; + info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script)); + info->set_module(module); + info->set_allow_lazy_parsing(allow_lazy_parsing); + + CHECK(i::parsing::ParseProgram(info.get())); + CHECK(i::Compiler::Analyze(info.get())); + + CHECK_NOT_NULL(info->literal()); + i::Scope* scope = info->literal()->scope(); + CHECK(!scope->AsDeclarationScope()->was_lazily_parsed()); + CHECK_NULL(scope->sibling()); + CHECK(module ? scope->is_module_scope() : scope->is_script_scope()); + + i::Variable* var; + { + // Find the variable. + for (auto it = input.location.begin(); it != input.location.end(); ++it) { + unsigned n = *it; + scope = scope->inner_scope(); + while (n-- > 0) { + scope = scope->sibling(); + } + } + CHECK_NOT_NULL(scope); + const i::AstRawString* var_name = + info->ast_value_factory()->GetOneByteString(variable); + var = scope->Lookup(var_name); + } + + CHECK(var->is_used()); + STATIC_ASSERT(true == i::kMaybeAssigned); + CHECK_EQ(input.assigned, var->maybe_assigned() == i::kMaybeAssigned); +} + +static Input wrap(Input input) { + Input result; + result.assigned = input.assigned; + result.source = "function WRAPPED() { " + input.source + " }"; + result.location.push_back(0); + for (auto n : input.location) { + result.location.push_back(n); + } + return result; +} + +TEST(MaybeAssignedInsideLoop) { + i::Isolate* isolate = CcTest::i_isolate(); + i::HandleScope scope(isolate); + LocalContext env; + + std::vector<unsigned> top; // Can't use {} in initializers below. + + Input module_and_script_tests[] = { + {1, "for (j=x; j<10; ++j) { foo = j }", top}, + {1, "for (j=x; j<10; ++j) { [foo] = [j] }", top}, + {1, "for (j=x; j<10; ++j) { var foo = j }", top}, + {1, "for (j=x; j<10; ++j) { var [foo] = [j] }", top}, + {0, "for (j=x; j<10; ++j) { let foo = j }", {0}}, + {0, "for (j=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {0, "for (j=x; j<10; ++j) { const foo = j }", {0}}, + {0, "for (j=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {0, "for (j=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {1, "for ({j}=x; j<10; ++j) { foo = j }", top}, + {1, "for ({j}=x; j<10; ++j) { [foo] = [j] }", top}, + {1, "for ({j}=x; j<10; ++j) { var foo = j }", top}, + {1, "for ({j}=x; j<10; ++j) { var [foo] = [j] }", top}, + {0, "for ({j}=x; j<10; ++j) { let foo = j }", {0}}, + {0, "for ({j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {0, "for ({j}=x; j<10; ++j) { const foo = j }", {0}}, + {0, "for ({j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {0, "for ({j}=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {1, "for (var j=x; j<10; ++j) { foo = j }", top}, + {1, "for (var j=x; j<10; ++j) { [foo] = [j] }", top}, + {1, "for (var j=x; j<10; ++j) { var foo = j }", top}, + {1, "for (var j=x; j<10; ++j) { var [foo] = [j] }", top}, + {0, "for (var j=x; j<10; ++j) { let foo = j }", {0}}, + {0, "for (var j=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {0, "for (var j=x; j<10; ++j) { const foo = j }", {0}}, + {0, "for (var j=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {0, "for (var j=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {1, "for (var {j}=x; j<10; ++j) { foo = j }", top}, + {1, "for (var {j}=x; j<10; ++j) { [foo] = [j] }", top}, + {1, "for (var {j}=x; j<10; ++j) { var foo = j }", top}, + {1, "for (var {j}=x; j<10; ++j) { var [foo] = [j] }", top}, + {0, "for (var {j}=x; j<10; ++j) { let foo = j }", {0}}, + {0, "for (var {j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {0, "for (var {j}=x; j<10; ++j) { const foo = j }", {0}}, + {0, "for (var {j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {0, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {1, "for (let j=x; j<10; ++j) { foo = j }", top}, + {1, "for (let j=x; j<10; ++j) { [foo] = [j] }", top}, + {1, "for (let j=x; j<10; ++j) { var foo = j }", top}, + {1, "for (let j=x; j<10; ++j) { var [foo] = [j] }", top}, + {0, "for (let j=x; j<10; ++j) { let foo = j }", {0, 0, 0}}, + {0, "for (let j=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, + {0, "for (let j=x; j<10; ++j) { const foo = j }", {0, 0, 0}}, + {0, "for (let j=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, + {0, "for (let j=x; j<10; ++j) { function foo() {return j} }", {0, 0, 0}}, + + {1, "for (let {j}=x; j<10; ++j) { foo = j }", top}, + {1, "for (let {j}=x; j<10; ++j) { [foo] = [j] }", top}, + {1, "for (let {j}=x; j<10; ++j) { var foo = j }", top}, + {1, "for (let {j}=x; j<10; ++j) { var [foo] = [j] }", top}, + {0, "for (let {j}=x; j<10; ++j) { let foo = j }", {0, 0, 0}}, + {0, "for (let {j}=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, + {0, "for (let {j}=x; j<10; ++j) { const foo = j }", {0, 0, 0}}, + {0, "for (let {j}=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, + {0, "for (let {j}=x; j<10; ++j) { function foo(){return j} }", {0, 0, 0}}, + + {1, "for (j of x) { foo = j }", top}, + {1, "for (j of x) { [foo] = [j] }", top}, + {1, "for (j of x) { var foo = j }", top}, + {1, "for (j of x) { var [foo] = [j] }", top}, + {0, "for (j of x) { let foo = j }", {0}}, + {0, "for (j of x) { let [foo] = [j] }", {0}}, + {0, "for (j of x) { const foo = j }", {0}}, + {0, "for (j of x) { const [foo] = [j] }", {0}}, + {0, "for (j of x) { function foo() {return j} }", {0}}, + + {1, "for ({j} of x) { foo = j }", top}, + {1, "for ({j} of x) { [foo] = [j] }", top}, + {1, "for ({j} of x) { var foo = j }", top}, + {1, "for ({j} of x) { var [foo] = [j] }", top}, + {0, "for ({j} of x) { let foo = j }", {0}}, + {0, "for ({j} of x) { let [foo] = [j] }", {0}}, + {0, "for ({j} of x) { const foo = j }", {0}}, + {0, "for ({j} of x) { const [foo] = [j] }", {0}}, + {0, "for ({j} of x) { function foo() {return j} }", {0}}, + + {1, "for (var j of x) { foo = j }", top}, + {1, "for (var j of x) { [foo] = [j] }", top}, + {1, "for (var j of x) { var foo = j }", top}, + {1, "for (var j of x) { var [foo] = [j] }", top}, + {0, "for (var j of x) { let foo = j }", {0}}, + {0, "for (var j of x) { let [foo] = [j] }", {0}}, + {0, "for (var j of x) { const foo = j }", {0}}, + {0, "for (var j of x) { const [foo] = [j] }", {0}}, + {0, "for (var j of x) { function foo() {return j} }", {0}}, + + {1, "for (var {j} of x) { foo = j }", top}, + {1, "for (var {j} of x) { [foo] = [j] }", top}, + {1, "for (var {j} of x) { var foo = j }", top}, + {1, "for (var {j} of x) { var [foo] = [j] }", top}, + {0, "for (var {j} of x) { let foo = j }", {0}}, + {0, "for (var {j} of x) { let [foo] = [j] }", {0}}, + {0, "for (var {j} of x) { const foo = j }", {0}}, + {0, "for (var {j} of x) { const [foo] = [j] }", {0}}, + {0, "for (var {j} of x) { function foo() {return j} }", {0}}, + + {1, "for (let j of x) { foo = j }", top}, + {1, "for (let j of x) { [foo] = [j] }", top}, + {1, "for (let j of x) { var foo = j }", top}, + {1, "for (let j of x) { var [foo] = [j] }", top}, + {0, "for (let j of x) { let foo = j }", {0, 2, 0}}, + {0, "for (let j of x) { let [foo] = [j] }", {0, 2, 0}}, + {0, "for (let j of x) { const foo = j }", {0, 2, 0}}, + {0, "for (let j of x) { const [foo] = [j] }", {0, 2, 0}}, + {0, "for (let j of x) { function foo() {return j} }", {0, 2, 0}}, + + {1, "for (let {j} of x) { foo = j }", top}, + {1, "for (let {j} of x) { [foo] = [j] }", top}, + {1, "for (let {j} of x) { var foo = j }", top}, + {1, "for (let {j} of x) { var [foo] = [j] }", top}, + {0, "for (let {j} of x) { let foo = j }", {0, 2, 0}}, + {0, "for (let {j} of x) { let [foo] = [j] }", {0, 2, 0}}, + {0, "for (let {j} of x) { const foo = j }", {0, 2, 0}}, + {0, "for (let {j} of x) { const [foo] = [j] }", {0, 2, 0}}, + {0, "for (let {j} of x) { function foo() {return j} }", {0, 2, 0}}, + + {1, "for (const j of x) { foo = j }", top}, + {1, "for (const j of x) { [foo] = [j] }", top}, + {1, "for (const j of x) { var foo = j }", top}, + {1, "for (const j of x) { var [foo] = [j] }", top}, + {0, "for (const j of x) { let foo = j }", {0, 2, 0}}, + {0, "for (const j of x) { let [foo] = [j] }", {0, 2, 0}}, + {0, "for (const j of x) { const foo = j }", {0, 2, 0}}, + {0, "for (const j of x) { const [foo] = [j] }", {0, 2, 0}}, + {0, "for (const j of x) { function foo() {return j} }", {0, 2, 0}}, + + {1, "for (const {j} of x) { foo = j }", top}, + {1, "for (const {j} of x) { [foo] = [j] }", top}, + {1, "for (const {j} of x) { var foo = j }", top}, + {1, "for (const {j} of x) { var [foo] = [j] }", top}, + {0, "for (const {j} of x) { let foo = j }", {0, 2, 0}}, + {0, "for (const {j} of x) { let [foo] = [j] }", {0, 2, 0}}, + {0, "for (const {j} of x) { const foo = j }", {0, 2, 0}}, + {0, "for (const {j} of x) { const [foo] = [j] }", {0, 2, 0}}, + {0, "for (const {j} of x) { function foo() {return j} }", {0, 2, 0}}, + + {1, "for (j in x) { foo = j }", top}, + {1, "for (j in x) { [foo] = [j] }", top}, + {1, "for (j in x) { var foo = j }", top}, + {1, "for (j in x) { var [foo] = [j] }", top}, + {0, "for (j in x) { let foo = j }", {0}}, + {0, "for (j in x) { let [foo] = [j] }", {0}}, + {0, "for (j in x) { const foo = j }", {0}}, + {0, "for (j in x) { const [foo] = [j] }", {0}}, + {0, "for (j in x) { function foo() {return j} }", {0}}, + + {1, "for ({j} in x) { foo = j }", top}, + {1, "for ({j} in x) { [foo] = [j] }", top}, + {1, "for ({j} in x) { var foo = j }", top}, + {1, "for ({j} in x) { var [foo] = [j] }", top}, + {0, "for ({j} in x) { let foo = j }", {0}}, + {0, "for ({j} in x) { let [foo] = [j] }", {0}}, + {0, "for ({j} in x) { const foo = j }", {0}}, + {0, "for ({j} in x) { const [foo] = [j] }", {0}}, + {0, "for ({j} in x) { function foo() {return j} }", {0}}, + + {1, "for (var j in x) { foo = j }", top}, + {1, "for (var j in x) { [foo] = [j] }", top}, + {1, "for (var j in x) { var foo = j }", top}, + {1, "for (var j in x) { var [foo] = [j] }", top}, + {0, "for (var j in x) { let foo = j }", {0}}, + {0, "for (var j in x) { let [foo] = [j] }", {0}}, + {0, "for (var j in x) { const foo = j }", {0}}, + {0, "for (var j in x) { const [foo] = [j] }", {0}}, + {0, "for (var j in x) { function foo() {return j} }", {0}}, + + {1, "for (var {j} in x) { foo = j }", top}, + {1, "for (var {j} in x) { [foo] = [j] }", top}, + {1, "for (var {j} in x) { var foo = j }", top}, + {1, "for (var {j} in x) { var [foo] = [j] }", top}, + {0, "for (var {j} in x) { let foo = j }", {0}}, + {0, "for (var {j} in x) { let [foo] = [j] }", {0}}, + {0, "for (var {j} in x) { const foo = j }", {0}}, + {0, "for (var {j} in x) { const [foo] = [j] }", {0}}, + {0, "for (var {j} in x) { function foo() {return j} }", {0}}, + + {1, "for (let j in x) { foo = j }", top}, + {1, "for (let j in x) { [foo] = [j] }", top}, + {1, "for (let j in x) { var foo = j }", top}, + {1, "for (let j in x) { var [foo] = [j] }", top}, + {0, "for (let j in x) { let foo = j }", {0, 0, 0}}, + {0, "for (let j in x) { let [foo] = [j] }", {0, 0, 0}}, + {0, "for (let j in x) { const foo = j }", {0, 0, 0}}, + {0, "for (let j in x) { const [foo] = [j] }", {0, 0, 0}}, + {0, "for (let j in x) { function foo() {return j} }", {0, 0, 0}}, + + {1, "for (let {j} in x) { foo = j }", top}, + {1, "for (let {j} in x) { [foo] = [j] }", top}, + {1, "for (let {j} in x) { var foo = j }", top}, + {1, "for (let {j} in x) { var [foo] = [j] }", top}, + {0, "for (let {j} in x) { let foo = j }", {0, 0, 0}}, + {0, "for (let {j} in x) { let [foo] = [j] }", {0, 0, 0}}, + {0, "for (let {j} in x) { const foo = j }", {0, 0, 0}}, + {0, "for (let {j} in x) { const [foo] = [j] }", {0, 0, 0}}, + {0, "for (let {j} in x) { function foo() {return j} }", {0, 0, 0}}, + + {1, "for (const j in x) { foo = j }", top}, + {1, "for (const j in x) { [foo] = [j] }", top}, + {1, "for (const j in x) { var foo = j }", top}, + {1, "for (const j in x) { var [foo] = [j] }", top}, + {0, "for (const j in x) { let foo = j }", {0, 0, 0}}, + {0, "for (const j in x) { let [foo] = [j] }", {0, 0, 0}}, + {0, "for (const j in x) { const foo = j }", {0, 0, 0}}, + {0, "for (const j in x) { const [foo] = [j] }", {0, 0, 0}}, + {0, "for (const j in x) { function foo() {return j} }", {0, 0, 0}}, + + {1, "for (const {j} in x) { foo = j }", top}, + {1, "for (const {j} in x) { [foo] = [j] }", top}, + {1, "for (const {j} in x) { var foo = j }", top}, + {1, "for (const {j} in x) { var [foo] = [j] }", top}, + {0, "for (const {j} in x) { let foo = j }", {0, 0, 0}}, + {0, "for (const {j} in x) { let [foo] = [j] }", {0, 0, 0}}, + {0, "for (const {j} in x) { const foo = j }", {0, 0, 0}}, + {0, "for (const {j} in x) { const [foo] = [j] }", {0, 0, 0}}, + {0, "for (const {j} in x) { function foo() {return j} }", {0, 0, 0}}, + + {1, "while (j) { foo = j }", top}, + {1, "while (j) { [foo] = [j] }", top}, + {1, "while (j) { var foo = j }", top}, + {1, "while (j) { var [foo] = [j] }", top}, + {0, "while (j) { let foo = j }", {0}}, + {0, "while (j) { let [foo] = [j] }", {0}}, + {0, "while (j) { const foo = j }", {0}}, + {0, "while (j) { const [foo] = [j] }", {0}}, + {0, "while (j) { function foo() {return j} }", {0}}, + + {1, "do { foo = j } while (j)", top}, + {1, "do { [foo] = [j] } while (j)", top}, + {1, "do { var foo = j } while (j)", top}, + {1, "do { var [foo] = [j] } while (j)", top}, + {0, "do { let foo = j } while (j)", {0}}, + {0, "do { let [foo] = [j] } while (j)", {0}}, + {0, "do { const foo = j } while (j)", {0}}, + {0, "do { const [foo] = [j] } while (j)", {0}}, + {0, "do { function foo() {return j} } while (j)", {0}}, + }; + + Input script_only_tests[] = { + {1, "for (j=x; j<10; ++j) { function foo() {return j} }", top}, + {1, "for ({j}=x; j<10; ++j) { function foo() {return j} }", top}, + {1, "for (var j=x; j<10; ++j) { function foo() {return j} }", top}, + {1, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", top}, + {1, "for (let j=x; j<10; ++j) { function foo() {return j} }", top}, + {1, "for (let {j}=x; j<10; ++j) { function foo() {return j} }", top}, + {1, "for (j of x) { function foo() {return j} }", top}, + {1, "for ({j} of x) { function foo() {return j} }", top}, + {1, "for (var j of x) { function foo() {return j} }", top}, + {1, "for (var {j} of x) { function foo() {return j} }", top}, + {1, "for (let j of x) { function foo() {return j} }", top}, + {1, "for (let {j} of x) { function foo() {return j} }", top}, + {1, "for (const j of x) { function foo() {return j} }", top}, + {1, "for (const {j} of x) { function foo() {return j} }", top}, + {1, "for (j in x) { function foo() {return j} }", top}, + {1, "for ({j} in x) { function foo() {return j} }", top}, + {1, "for (var j in x) { function foo() {return j} }", top}, + {1, "for (var {j} in x) { function foo() {return j} }", top}, + {1, "for (let j in x) { function foo() {return j} }", top}, + {1, "for (let {j} in x) { function foo() {return j} }", top}, + {1, "for (const j in x) { function foo() {return j} }", top}, + {1, "for (const {j} in x) { function foo() {return j} }", top}, + {1, "while (j) { function foo() {return j} }", top}, + {1, "do { function foo() {return j} } while (j)", top}, + }; + + for (unsigned i = 0; i < arraysize(module_and_script_tests); ++i) { + Input input = module_and_script_tests[i]; + for (unsigned module = 0; module <= 1; ++module) { + for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1; + ++allow_lazy_parsing) { + TestMaybeAssigned(input, "foo", module, allow_lazy_parsing); + } + TestMaybeAssigned(wrap(input), "foo", module, false); + } + } + + for (unsigned i = 0; i < arraysize(script_only_tests); ++i) { + Input input = script_only_tests[i]; + for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1; + ++allow_lazy_parsing) { + TestMaybeAssigned(input, "foo", false, allow_lazy_parsing); + } + TestMaybeAssigned(wrap(input), "foo", false, false); + } +} + TEST(MaybeAssignedTopLevel) { i::Isolate* isolate = CcTest::i_isolate(); i::HandleScope scope(isolate); LocalContext env; - i::Factory* factory = isolate->factory(); const char* prefixes[] = { - "let foo; ", "let foo = 0; ", - "let [foo] = [1]; ", "let {foo} = {foo: 2}; ", + "let foo; ", + "let foo = 0; ", + "let [foo] = [1]; ", + "let {foo} = {foo: 2}; ", "let {foo=3} = {}; ", - }; - const char* sources[] = { + "var foo; ", + "var foo = 0; ", + "var [foo] = [1]; ", + "var {foo} = {foo: 2}; ", + "var {foo=3} = {}; ", + "{ var foo; }; ", + "{ var foo = 0; }; ", + "{ var [foo] = [1]; }; ", + "{ var {foo} = {foo: 2}; }; ", + "{ var {foo=3} = {}; }; ", + "function foo() {}; ", + "function* foo() {}; ", + "async function foo() {}; ", + "class foo {}; ", + "class foo extends null {}; ", + }; + + const char* module_and_script_tests[] = { "function bar() {foo = 42}; ext(bar); ext(foo)", "ext(function() {foo++}); ext(foo)", "bar = () => --foo; ext(bar); ext(foo)", "function* bar() {eval(ext)}; ext(bar); ext(foo)", }; - for (unsigned i = 0; i < arraysize(prefixes); ++i) { - const char* prefix = prefixes[i]; - for (unsigned j = 0; j < arraysize(sources); ++j) { - const char* source = sources[j]; - i::ScopedVector<char> program(Utf8LengthHelper(prefix) + - Utf8LengthHelper(source) + 1); - i::SNPrintF(program, "%s%s", prefix, source); - i::Zone zone(isolate->allocator(), ZONE_NAME); - - i::Handle<i::String> string = - factory->InternalizeUtf8String(program.start()); - string->PrintOn(stdout); - printf("\n"); - i::Handle<i::Script> script = factory->NewScript(string); - - for (unsigned allow_lazy = 0; allow_lazy < 2; ++allow_lazy) { - for (unsigned module = 0; module < 2; ++module) { - std::unique_ptr<i::ParseInfo> info; - info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script)); - info->set_module(module); - info->set_allow_lazy_parsing(allow_lazy); + const char* script_only_tests[] = { + "", + "{ function foo() {}; }; ", + "{ function* foo() {}; }; ", + "{ async function foo() {}; }; ", + }; - CHECK(i::parsing::ParseProgram(info.get())); - CHECK(i::Compiler::Analyze(info.get())); - - CHECK_NOT_NULL(info->literal()); - i::Scope* scope = info->literal()->scope(); - CHECK(!scope->AsDeclarationScope()->was_lazily_parsed()); - CHECK_NULL(scope->sibling()); - CHECK(module ? scope->is_module_scope() : scope->is_script_scope()); - - const i::AstRawString* var_name = - info->ast_value_factory()->GetOneByteString("foo"); - i::Variable* var = scope->Lookup(var_name); - CHECK(var->is_used()); - CHECK(var->maybe_assigned() == i::kMaybeAssigned); + for (unsigned i = 0; i < arraysize(prefixes); ++i) { + for (unsigned j = 0; j < arraysize(module_and_script_tests); ++j) { + std::string source(prefixes[i]); + source += module_and_script_tests[j]; + std::vector<unsigned> top; + Input input({true, source, top}); + for (unsigned module = 0; module <= 1; ++module) { + for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1; + ++allow_lazy_parsing) { + TestMaybeAssigned(input, "foo", module, allow_lazy_parsing); } } } } + + for (unsigned i = 0; i < arraysize(prefixes); ++i) { + for (unsigned j = 0; j < arraysize(script_only_tests); ++j) { + std::string source(prefixes[i]); + source += script_only_tests[j]; + std::vector<unsigned> top; + Input input({true, source, top}); + for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1; + ++allow_lazy_parsing) { + TestMaybeAssigned(input, "foo", false, allow_lazy_parsing); + } + } + } } namespace { @@ -4141,6 +4476,140 @@ TEST(SuperErrors) { RunParserSyncTest(context_data, expression_data, kError); } +TEST(ImportExpressionSuccess) { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {NULL, NULL} + }; + + const char* data[] = { + "import(1)", + "import(y=x)", + "f(...[import(y=x)])", + "x = {[import(y=x)]: 1}", + "var {[import(y=x)]: x} = {}", + "({[import(y=x)]: x} = {})", + "async () => { await import(x) }", + "() => { import(x) }", + "(import(y=x))", + "{import(y=x)}", + "import(import(x))", + "x = import(x)", + "var x = import(x)", + "let x = import(x)", + "for(x of import(x)) {}", + "import(x).then()", + NULL + }; + + // clang-format on + + // We ignore test error messages because the error message from the + // parser/preparser is different for the same data depending on the + // context. + // For example, a top level "import(" is parsed as an + // import declaration. The parser parses the import token correctly + // and then shows an "Unexpected token (" error message. The + // preparser does not understand the import keyword (this test is + // run without kAllowHarmonyDynamicImport flag), so this results in + // an "Unexpected token import" error. + RunParserSyncTest(context_data, data, kError); + RunModuleParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0, NULL, 0, + true, true); + static const ParserFlag flags[] = {kAllowHarmonyDynamicImport}; + RunParserSyncTest(context_data, data, kSuccess, NULL, 0, flags, + arraysize(flags)); + RunModuleParserSyncTest(context_data, data, kSuccess, NULL, 0, flags, + arraysize(flags)); +} + +TEST(ImportExpressionErrors) { + { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {"var ", ""}, + {"let ", ""}, + {"new ", ""}, + {NULL, NULL} + }; + + const char* data[] = { + "import(", + "import)", + "import()", + "import('x", + "import('x']", + "import['x')", + "import = x", + "import[", + "import[]", + "import]", + "import[x]", + "import{", + "import{x", + "import{x}", + "import(x, y)", + "import(...y)", + "import(x,)", + "import(,)", + "import(,y)", + "import(;)", + "[import]", + "{import}", + "import+", + "import = 1", + "import.wat", + "new import(x)", + NULL + }; + + // clang-format on + RunParserSyncTest(context_data, data, kError); + // We ignore the error messages for the reason explained in the + // ImportExpressionSuccess test. + RunModuleParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0, NULL, + 0, true, true); + static const ParserFlag flags[] = {kAllowHarmonyDynamicImport}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + + // We ignore test error messages because the error message from + // the parser/preparser is different for the same data depending + // on the context. For example, a top level "import{" is parsed + // as an import declaration. The parser parses the import token + // correctly and then shows an "Unexpected end of input" error + // message because of the '{'. The preparser shows an "Unexpected + // token {" because it's not a valid token in a CallExpression. + RunModuleParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags), NULL, 0, true, true); + } + + { + // clang-format off + const char* context_data[][2] = { + {"var ", ""}, + {"let ", ""}, + {NULL, NULL} + }; + + const char* data[] = { + "import('x')", + NULL + }; + + // clang-format on + RunParserSyncTest(context_data, data, kError); + RunModuleParserSyncTest(context_data, data, kError); + + static const ParserFlag flags[] = {kAllowHarmonyDynamicImport}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + RunModuleParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + } +} TEST(SuperCall) { const char* context_data[][2] = {{"", ""}, @@ -5870,8 +6339,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(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); info.set_module(); if (!i::parsing::ParseProgram(&info)) { i::Handle<i::JSObject> exception_handle( @@ -5895,8 +6363,7 @@ TEST(BasicImportExportParsing) { // And that parsing a script does not. { i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); CHECK(!i::parsing::ParseProgram(&info)); isolate->clear_pending_exception(); } @@ -5986,8 +6453,7 @@ TEST(ImportExportParsingErrors) { factory->NewStringFromAsciiChecked(kErrorSources[i]); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); info.set_module(); CHECK(!i::parsing::ParseProgram(&info)); isolate->clear_pending_exception(); @@ -6023,8 +6489,7 @@ TEST(ModuleTopLevelFunctionDecl) { factory->NewStringFromAsciiChecked(kErrorSources[i]); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); info.set_module(); CHECK(!i::parsing::ParseProgram(&info)); isolate->clear_pending_exception(); @@ -6221,8 +6686,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(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); info.set_module(); CHECK(i::parsing::ParseProgram(&info)); CHECK(i::Compiler::Analyze(&info)); @@ -6329,15 +6793,15 @@ TEST(ModuleParsingInternals) { 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); + CHECK_EQ(0, elem.second); else if (elem.first->IsOneByteEqualTo("n.js")) - CHECK_EQ(elem.second, 1); + CHECK_EQ(1, elem.second); else if (elem.first->IsOneByteEqualTo("p.js")) - CHECK_EQ(elem.second, 2); + CHECK_EQ(2, elem.second); else if (elem.first->IsOneByteEqualTo("q.js")) - CHECK_EQ(elem.second, 3); + CHECK_EQ(3, elem.second); else if (elem.first->IsOneByteEqualTo("bar.js")) - CHECK_EQ(elem.second, 4); + CHECK_EQ(4, elem.second); else CHECK(false); } @@ -6481,8 +6945,7 @@ void TestLanguageMode(const char* source, i::Handle<i::Script> script = factory->NewScript(factory->NewStringFromAsciiChecked(source)); - i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); i::parsing::ParseProgram(&info); CHECK(info.literal() != NULL); CHECK_EQ(expected_language_mode, info.literal()->language_mode()); @@ -6609,66 +7072,183 @@ TEST(ObjectSpreadPositiveTests) { "{ ...async () => { }}", "{ ...new Foo()}", NULL}; + // clang-format on - static const ParserFlag flags[] = {kAllowHarmonyObjectSpread}; + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; RunParserSyncTest(context_data, data, kSuccess, NULL, 0, flags, arraysize(flags)); } TEST(ObjectSpreadNegativeTests) { - { - const char* context_data[][2] = {{"x = ", ""}, - {"'use strict'; x = ", ""}, - {NULL, NULL}}; + const char* context_data[][2] = {{"x = ", ""}, + {"'use strict'; x = ", ""}, + {NULL, NULL}}; - // clang-format off - const char* data[] = { - "{ ...var z = y}", - "{ ...var}", - "{ ...foo bar}", - NULL}; + // clang-format off + const char* data[] = { + "{ ...var z = y}", + "{ ...var}", + "{ ...foo bar}", + NULL}; - static const ParserFlag flags[] = {kAllowHarmonyObjectSpread}; - RunParserSyncTest(context_data, data, kError, NULL, 0, flags, - arraysize(flags)); - } + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); +} - // Destructuring tests - { - const char* context_data[][2] = { - {"var ", " = {};"}, - {"( ", " = {});"}, - {"'use strict'; const ", " = {};"}, - {"function f(", ") {}"}, - {"function f(argument1, ", ") {}"}, - {"var f = (", ") => {};"}, - {"var f = (argument1,", ") => {};"}, - {"try {} catch(", ") {}"}, - {NULL, NULL}}; +TEST(TemplateEscapesPositiveTests) { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {"'use strict';", ""}, + {NULL, NULL}}; - // clang-format off - const char* data[] = { - "{ ...y }", - "{ a: 1, ...y }", - "{ b: 1, ...y }", - "{ y, ...y}", - "{ ...z = y}", - "{ ...y, y }", - "{ ...y, ...y}", - "{ a: 1, ...y, b: 1}", - "{ ...y, b: 1}", - "{ ...1}", - "{ ...null}", - "{ ...undefined}", - "{ ...unknown}", - "{ ...var z = y}", - "({ ...z = {})", - NULL}; + // clang-format off + const char* data[] = { + "tag`\\01`", + "tag`\\01${0}right`", + "tag`left${0}\\01`", + "tag`left${0}\\01${1}right`", + "tag`\\1`", + "tag`\\1${0}right`", + "tag`left${0}\\1`", + "tag`left${0}\\1${1}right`", + "tag`\\xg`", + "tag`\\xg${0}right`", + "tag`left${0}\\xg`", + "tag`left${0}\\xg${1}right`", + "tag`\\xAg`", + "tag`\\xAg${0}right`", + "tag`left${0}\\xAg`", + "tag`left${0}\\xAg${1}right`", + "tag`\\u0`", + "tag`\\u0${0}right`", + "tag`left${0}\\u0`", + "tag`left${0}\\u0${1}right`", + "tag`\\u0g`", + "tag`\\u0g${0}right`", + "tag`left${0}\\u0g`", + "tag`left${0}\\u0g${1}right`", + "tag`\\u00g`", + "tag`\\u00g${0}right`", + "tag`left${0}\\u00g`", + "tag`left${0}\\u00g${1}right`", + "tag`\\u000g`", + "tag`\\u000g${0}right`", + "tag`left${0}\\u000g`", + "tag`left${0}\\u000g${1}right`", + "tag`\\u{}`", + "tag`\\u{}${0}right`", + "tag`left${0}\\u{}`", + "tag`left${0}\\u{}${1}right`", + "tag`\\u{-0}`", + "tag`\\u{-0}${0}right`", + "tag`left${0}\\u{-0}`", + "tag`left${0}\\u{-0}${1}right`", + "tag`\\u{g}`", + "tag`\\u{g}${0}right`", + "tag`left${0}\\u{g}`", + "tag`left${0}\\u{g}${1}right`", + "tag`\\u{0`", + "tag`\\u{0${0}right`", + "tag`left${0}\\u{0`", + "tag`left${0}\\u{0${1}right`", + "tag`\\u{\\u{0}`", + "tag`\\u{\\u{0}${0}right`", + "tag`left${0}\\u{\\u{0}`", + "tag`left${0}\\u{\\u{0}${1}right`", + "tag`\\u{110000}`", + "tag`\\u{110000}${0}right`", + "tag`left${0}\\u{110000}`", + "tag`left${0}\\u{110000}${1}right`", + NULL}; + // clang-format on - static const ParserFlag flags[] = {kAllowHarmonyObjectSpread}; - RunParserSyncTest(context_data, data, kError, NULL, 0, flags, - arraysize(flags)); - } + // No error with flag + static const ParserFlag flags[] = {kAllowHarmonyTemplateEscapes}; + RunParserSyncTest(context_data, data, kSuccess, NULL, 0, flags, + arraysize(flags)); + + // Still an error without flag + RunParserSyncTest(context_data, data, kError); +} + +TEST(TemplateEscapesNegativeTests) { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {"'use strict';", ""}, + {NULL, NULL}}; + + // clang-format off + const char* data[] = { + "`\\01`", + "`\\01${0}right`", + "`left${0}\\01`", + "`left${0}\\01${1}right`", + "`\\1`", + "`\\1${0}right`", + "`left${0}\\1`", + "`left${0}\\1${1}right`", + "`\\xg`", + "`\\xg${0}right`", + "`left${0}\\xg`", + "`left${0}\\xg${1}right`", + "`\\xAg`", + "`\\xAg${0}right`", + "`left${0}\\xAg`", + "`left${0}\\xAg${1}right`", + "`\\u0`", + "`\\u0${0}right`", + "`left${0}\\u0`", + "`left${0}\\u0${1}right`", + "`\\u0g`", + "`\\u0g${0}right`", + "`left${0}\\u0g`", + "`left${0}\\u0g${1}right`", + "`\\u00g`", + "`\\u00g${0}right`", + "`left${0}\\u00g`", + "`left${0}\\u00g${1}right`", + "`\\u000g`", + "`\\u000g${0}right`", + "`left${0}\\u000g`", + "`left${0}\\u000g${1}right`", + "`\\u{}`", + "`\\u{}${0}right`", + "`left${0}\\u{}`", + "`left${0}\\u{}${1}right`", + "`\\u{-0}`", + "`\\u{-0}${0}right`", + "`left${0}\\u{-0}`", + "`left${0}\\u{-0}${1}right`", + "`\\u{g}`", + "`\\u{g}${0}right`", + "`left${0}\\u{g}`", + "`left${0}\\u{g}${1}right`", + "`\\u{0`", + "`\\u{0${0}right`", + "`left${0}\\u{0`", + "`left${0}\\u{0${1}right`", + "`\\u{\\u{0}`", + "`\\u{\\u{0}${0}right`", + "`left${0}\\u{\\u{0}`", + "`left${0}\\u{\\u{0}${1}right`", + "`\\u{110000}`", + "`\\u{110000}${0}right`", + "`left${0}\\u{110000}`", + "`left${0}\\u{110000}${1}right`", + "`\\1``\\2`", + NULL}; + // clang-format on + + // Error with flag + static const ParserFlag flags[] = {kAllowHarmonyTemplateEscapes}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + + // Still an error without flag + RunParserSyncTest(context_data, data, kError); } TEST(DestructuringPositiveTests) { @@ -6724,8 +7304,38 @@ TEST(DestructuringPositiveTests) { "{arguments: x}", "{eval: x}", NULL}; + + const char* rest_data[] = { + "{ x : y, ...z }", + "{ x : y = 1, ...z }", + "{ x : x, y : y, ...z }", + "{ x : x = 1, y : y, ...z }", + "{ x : x, y : y = 42, ...z }", + "[{x:x, y:y, ...z}, [a,b,c]]", + "[{x:x = 1, y:y = 2, ...z}, [a = 3, b = 4, c = 5]]", + "{...x}", + "{...{ x = 5} }", + "{x, ...y}", + "{x = 42, y = 15, ...z}", + "{42 : x = 42, ...y}", + "{'hi' : x, ...z}", + "{'hi' : x = 42, ...z}", + "{var: x = 42, ...z}", + "{[x] : z, ...y}", + "{[1+1] : z, ...x}", + "{arguments: x, ...z}", + "{ __proto__: x, __proto__: y, ...z}", + NULL}; + // clang-format on RunParserSyncTest(context_data, data, kSuccess); + RunParserSyncTest(context_data, rest_data, kError); + + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(context_data, data, kSuccess, NULL, 0, flags, + arraysize(flags)); + RunParserSyncTest(context_data, rest_data, kSuccess, NULL, 0, flags, + arraysize(flags)); // v8:5201 { @@ -6739,6 +7349,13 @@ TEST(DestructuringPositiveTests) { {"try {} catch(", ") {}"}, {NULL, NULL} }; + + const char* rest_data[] = { + "{...arguments}", + "{...eval}", + NULL + }; + const char* data[] = { "{arguments}", "{eval}", @@ -6750,6 +7367,12 @@ TEST(DestructuringPositiveTests) { }; // clang-format on RunParserSyncTest(sloppy_context_data, data, kSuccess); + RunParserSyncTest(sloppy_context_data, rest_data, kError); + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, flags, + arraysize(flags)); + RunParserSyncTest(sloppy_context_data, rest_data, kSuccess, NULL, 0, flags, + arraysize(flags)); } } @@ -6838,8 +7461,38 @@ TEST(DestructuringNegativeTests) { "{ method() {} }", "{ *method() {} }", NULL}; + + const char* rest_data[] = { + "...a++", + "...++a", + "...typeof a", + "...[a++]", + "...(x => y)", + "{ ...x, }", + "{ ...x, y }", + "{ y, ...x, y }", + "{ ...x, ...y }", + "{ ...x, ...x }", + "{ ...x, ...x = {} }", + "{ ...x, ...x = ...x }", + "{ ...x, ...x = ...{ x } }", + "{ ,, ...x }", + "{ ...get a() {} }", + "{ ...set a() {} }", + "{ ...method() {} }", + "{ ...function() {} }", + "{ ...*method() {} }", + NULL + }; + // clang-format on RunParserSyncTest(context_data, data, kError); + RunParserSyncTest(context_data, rest_data, kError); + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags, + arraysize(flags)); } { // All modes. @@ -6885,8 +7538,20 @@ TEST(DestructuringNegativeTests) { "{ arguments = false }" "{ eval = false }", NULL}; + + const char* rest_data[] = { + "{ ...eval }", + "{ ...arguments }", + NULL}; + // clang-format on RunParserSyncTest(context_data, data, kError); + RunParserSyncTest(context_data, rest_data, kError); + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags, + arraysize(flags)); } { // 'yield' in generators. @@ -6926,11 +7591,45 @@ TEST(DestructuringNegativeTests) { "{ a }", "[ a ]", NULL}; + const char* rest_data[] = { + "{ ...a }", + NULL}; // clang-format on RunParserSyncTest(context_data, data, kError); + RunParserSyncTest(context_data, rest_data, kError); + static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(context_data, data, kError, NULL, 0, flags, + arraysize(flags)); + RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags, + arraysize(flags)); } } +TEST(ObjectRestNegativeTestSlow) { + // clang-format off + const char* context_data[][2] = { + {"var { ", " } = { a: 1};"}, + { NULL, NULL } + }; + + using v8::internal::Code; + std::string statement; + for (int i = 0; i < Code::kMaxArguments; ++i) { + statement += std::to_string(i) + " : " + "x, "; + } + statement += "...y"; + + const char* statement_data[] = { + statement.c_str(), + NULL + }; + + // clang-format on + // The test is quite slow, so run it with a reduced set of flags. + static const ParserFlag flags[] = {kAllowLazy, kAllowHarmonyObjectRestSpread}; + RunParserSyncTest(context_data, statement_data, kError, NULL, 0, flags, + arraysize(flags)); +} TEST(DestructuringAssignmentPositiveTests) { const char* context_data[][2] = { @@ -8608,17 +9307,6 @@ TEST(ArgumentsRedeclaration) { } } -namespace v8 { -namespace internal { - -class ScopeTestHelper { - public: - static bool MustAllocateInContext(Variable* var) { - return var->scope()->MustAllocateInContext(var); - } -}; -} // namespace internal -} // namespace v8 // Test that lazily parsed inner functions don't result in overly pessimistic // context allocations. @@ -8646,13 +9334,26 @@ TEST(NoPessimisticContextAllocation) { // Context allocating because we need to: {"", "my_var;", true}, {"", "if (true) { let my_var; } my_var;", true}, - {"", "eval(\"foo\");", true}, + {"", "eval('foo');", true}, {"", "function inner2() { my_var; }", true}, - {"", "function inner2() { eval(\"foo\"); }", true}, + {"", "function inner2() { eval('foo'); }", true}, {"", "var {my_var : a} = {my_var};", true}, {"", "let {my_var : a} = {my_var};", true}, {"", "const {my_var : a} = {my_var};", true}, + {"", "var [a, b = my_var] = [1, 2];", true}, + {"", "var [a, b = my_var] = [1, 2]; my_var;", true}, + {"", "let [a, b = my_var] = [1, 2];", true}, + {"", "let [a, b = my_var] = [1, 2]; my_var;", true}, + {"", "const [a, b = my_var] = [1, 2];", true}, + {"", "const [a, b = my_var] = [1, 2]; my_var;", true}, + {"", "var {a = my_var} = {}", true}, + {"", "var {a: b = my_var} = {}", true}, + {"", "let {a = my_var} = {}", true}, + {"", "let {a: b = my_var} = {}", true}, + {"", "const {a = my_var} = {}", true}, + {"", "const {a: b = my_var} = {}", true}, {"a = my_var", "", true}, + {"a = my_var", "let my_var;", true}, {"", "function inner2(a = my_var) { }", true}, {"", "(a = my_var) => { }", true}, {"{a} = {a: my_var}", "", true}, @@ -8661,6 +9362,8 @@ TEST(NoPessimisticContextAllocation) { {"[a] = [my_var]", "", true}, {"", "function inner2([a] = [my_var]) { }", true}, {"", "([a] = [my_var]) => { }", true}, + {"", "function inner2(a = eval('')) { }", true}, + {"", "(a = eval('')) => { }", true}, {"", "try { } catch (my_var) { } my_var;", true}, {"", "for (my_var in {}) { my_var; }", true}, {"", "for (my_var in {}) { }", true}, @@ -8704,6 +9407,10 @@ TEST(NoPessimisticContextAllocation) { {"", "if (true) { let my_var; if (true) { function my_var() {} } } my_var;", true}, + {"", "function inner2(a = my_var) {}", true}, + {"", "function inner2(a = my_var) { let my_var; }", true}, + {"", "(a = my_var) => {}", true}, + {"", "(a = my_var) => { let my_var; }", true}, // No pessimistic context allocation: {"", "var my_var; my_var;", false}, {"", "var my_var;", false}, @@ -8873,8 +9580,7 @@ TEST(NoPessimisticContextAllocation) { printf("\n"); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(isolate->allocator(), ZONE_NAME); - i::ParseInfo info(&zone, script); + i::ParseInfo info(script); CHECK(i::parsing::ParseProgram(&info)); CHECK(i::Compiler::Analyze(&info)); @@ -8892,3 +9598,340 @@ TEST(NoPessimisticContextAllocation) { } } } + +TEST(EscapedStrictReservedWord) { + // Test that identifiers which are both escaped and only reserved in the + // strict mode are accepted in non-strict mode. + const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; + + const char* statement_data[] = {"if (true) l\u0065t: ;", + "function l\u0065t() { }", + "(function l\u0065t() { })", + "async function l\u0065t() { }", + "(async function l\u0065t() { })", + "l\u0065t => 42", + "async l\u0065t => 42", + NULL}; + + RunParserSyncTest(context_data, statement_data, kSuccess); +} + +TEST(ForAwaitOf) { + // clang-format off + const char* context_data[][2] = { + { "async function f() { for await ", " ; }" }, + { "async function f() { for await ", " { } }" }, + { "async function f() { 'use strict'; for await ", " ; }" }, + { "async function f() { 'use strict'; for await ", " { } }" }, + { "async function f() { for\nawait ", " ; }" }, + { "async function f() { for\nawait ", " { } }" }, + { "async function f() { 'use strict'; for\nawait ", " ; }" }, + { "async function f() { 'use strict'; for\nawait ", " { } }" }, + { "async function f() { 'use strict'; for\nawait ", " { } }" }, + { "async function f() { for await\n", " ; }" }, + { "async function f() { for await\n", " { } }" }, + { "async function f() { 'use strict'; for await\n", " ; }" }, + { "async function f() { 'use strict'; for await\n", " { } }" }, + { NULL, NULL } + }; + + const char* context_data2[][2] = { + { "async function f() { let a; for await ", " ; }" }, + { "async function f() { let a; for await ", " { } }" }, + { "async function f() { 'use strict'; let a; for await ", " ; }" }, + { "async function f() { 'use strict'; let a; for await ", " { } }" }, + { "async function f() { let a; for\nawait ", " ; }" }, + { "async function f() { let a; for\nawait ", " { } }" }, + { "async function f() { 'use strict'; let a; for\nawait ", " ; }" }, + { "async function f() { 'use strict'; let a; for\nawait ", " { } }" }, + { "async function f() { 'use strict'; let a; for\nawait ", " { } }" }, + { "async function f() { let a; for await\n", " ; }" }, + { "async function f() { let a; for await\n", " { } }" }, + { "async function f() { 'use strict'; let a; for await\n", " ; }" }, + { "async function f() { 'use strict'; let a; for await\n", " { } }" }, + { NULL, NULL } + }; + + const char* expr_data[] = { + // Primary Expressions + "(a of [])", + "(a.b of [])", + "([a] of [])", + "([a = 1] of [])", + "([a = 1, ...b] of [])", + "({a} of [])", + "({a: a} of [])", + "({'a': a} of [])", + "({\"a\": a} of [])", + "({[Symbol.iterator]: a} of [])", + "({0: a} of [])", + "({a = 1} of [])", + "({a: a = 1} of [])", + "({'a': a = 1} of [])", + "({\"a\": a = 1} of [])", + "({[Symbol.iterator]: a = 1} of [])", + "({0: a = 1} of [])", + NULL + }; + + const char* var_data[] = { + // VarDeclarations + "(var a of [])", + "(var [a] of [])", + "(var [a = 1] of [])", + "(var [a = 1, ...b] of [])", + "(var {a} of [])", + "(var {a: a} of [])", + "(var {'a': a} of [])", + "(var {\"a\": a} of [])", + "(var {[Symbol.iterator]: a} of [])", + "(var {0: a} of [])", + "(var {a = 1} of [])", + "(var {a: a = 1} of [])", + "(var {'a': a = 1} of [])", + "(var {\"a\": a = 1} of [])", + "(var {[Symbol.iterator]: a = 1} of [])", + "(var {0: a = 1} of [])", + NULL + }; + + const char* lexical_data[] = { + // LexicalDeclartions + "(let a of [])", + "(let [a] of [])", + "(let [a = 1] of [])", + "(let [a = 1, ...b] of [])", + "(let {a} of [])", + "(let {a: a} of [])", + "(let {'a': a} of [])", + "(let {\"a\": a} of [])", + "(let {[Symbol.iterator]: a} of [])", + "(let {0: a} of [])", + "(let {a = 1} of [])", + "(let {a: a = 1} of [])", + "(let {'a': a = 1} of [])", + "(let {\"a\": a = 1} of [])", + "(let {[Symbol.iterator]: a = 1} of [])", + "(let {0: a = 1} of [])", + + "(const a of [])", + "(const [a] of [])", + "(const [a = 1] of [])", + "(const [a = 1, ...b] of [])", + "(const {a} of [])", + "(const {a: a} of [])", + "(const {'a': a} of [])", + "(const {\"a\": a} of [])", + "(const {[Symbol.iterator]: a} of [])", + "(const {0: a} of [])", + "(const {a = 1} of [])", + "(const {a: a = 1} of [])", + "(const {'a': a = 1} of [])", + "(const {\"a\": a = 1} of [])", + "(const {[Symbol.iterator]: a = 1} of [])", + "(const {0: a = 1} of [])", + NULL + }; + // clang-format on + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; + RunParserSyncTest(context_data, expr_data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); + RunParserSyncTest(context_data2, expr_data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); + + RunParserSyncTest(context_data, var_data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); + // TODO(marja): PreParser doesn't report early errors. + // (https://bugs.chromium.org/p/v8/issues/detail?id=2728) + // RunParserSyncTest(context_data2, var_data, kError, NULL, 0, always_flags, + // arraysize(always_flags)); + + RunParserSyncTest(context_data, lexical_data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); + RunParserSyncTest(context_data2, lexical_data, kSuccess, NULL, 0, + always_flags, arraysize(always_flags)); +} + +TEST(ForAwaitOfErrors) { + // clang-format off + const char* context_data[][2] = { + { "async function f() { for await ", " ; }" }, + { "async function f() { for await ", " { } }" }, + { "async function f() { 'use strict'; for await ", " ; }" }, + { "async function f() { 'use strict'; for await ", " { } }" }, + { NULL, NULL } + }; + + const char* data[] = { + // Primary Expressions + "(a = 1 of [])", + "(a = 1) of [])", + "(a.b = 1 of [])", + "((a.b = 1) of [])", + "([a] = 1 of [])", + "(([a] = 1) of [])", + "([a = 1] = 1 of [])", + "(([a = 1] = 1) of [])", + "([a = 1 = 1, ...b] = 1 of [])", + "(([a = 1 = 1, ...b] = 1) of [])", + "({a} = 1 of [])", + "(({a} = 1) of [])", + "({a: a} = 1 of [])", + "(({a: a} = 1) of [])", + "({'a': a} = 1 of [])", + "(({'a': a} = 1) of [])", + "({\"a\": a} = 1 of [])", + "(({\"a\": a} = 1) of [])", + "({[Symbol.iterator]: a} = 1 of [])", + "(({[Symbol.iterator]: a} = 1) of [])", + "({0: a} = 1 of [])", + "(({0: a} = 1) of [])", + "({a = 1} = 1 of [])", + "(({a = 1} = 1) of [])", + "({a: a = 1} = 1 of [])", + "(({a: a = 1} = 1) of [])", + "({'a': a = 1} = 1 of [])", + "(({'a': a = 1} = 1) of [])", + "({\"a\": a = 1} = 1 of [])", + "(({\"a\": a = 1} = 1) of [])", + "({[Symbol.iterator]: a = 1} = 1 of [])", + "(({[Symbol.iterator]: a = 1} = 1) of [])", + "({0: a = 1} = 1 of [])", + "(({0: a = 1} = 1) of [])", + "(function a() {} of [])", + "([1] of [])", + "({a: 1} of [])" + + // VarDeclarations + "(var a = 1 of [])", + "(var a, b of [])", + "(var [a] = 1 of [])", + "(var [a], b of [])", + "(var [a = 1] = 1 of [])", + "(var [a = 1], b of [])", + "(var [a = 1 = 1, ...b] of [])", + "(var [a = 1, ...b], c of [])", + "(var {a} = 1 of [])", + "(var {a}, b of [])", + "(var {a: a} = 1 of [])", + "(var {a: a}, b of [])", + "(var {'a': a} = 1 of [])", + "(var {'a': a}, b of [])", + "(var {\"a\": a} = 1 of [])", + "(var {\"a\": a}, b of [])", + "(var {[Symbol.iterator]: a} = 1 of [])", + "(var {[Symbol.iterator]: a}, b of [])", + "(var {0: a} = 1 of [])", + "(var {0: a}, b of [])", + "(var {a = 1} = 1 of [])", + "(var {a = 1}, b of [])", + "(var {a: a = 1} = 1 of [])", + "(var {a: a = 1}, b of [])", + "(var {'a': a = 1} = 1 of [])", + "(var {'a': a = 1}, b of [])", + "(var {\"a\": a = 1} = 1 of [])", + "(var {\"a\": a = 1}, b of [])", + "(var {[Symbol.iterator]: a = 1} = 1 of [])", + "(var {[Symbol.iterator]: a = 1}, b of [])", + "(var {0: a = 1} = 1 of [])", + "(var {0: a = 1}, b of [])", + + // LexicalDeclartions + "(let a = 1 of [])", + "(let a, b of [])", + "(let [a] = 1 of [])", + "(let [a], b of [])", + "(let [a = 1] = 1 of [])", + "(let [a = 1], b of [])", + "(let [a = 1, ...b] = 1 of [])", + "(let [a = 1, ...b], c of [])", + "(let {a} = 1 of [])", + "(let {a}, b of [])", + "(let {a: a} = 1 of [])", + "(let {a: a}, b of [])", + "(let {'a': a} = 1 of [])", + "(let {'a': a}, b of [])", + "(let {\"a\": a} = 1 of [])", + "(let {\"a\": a}, b of [])", + "(let {[Symbol.iterator]: a} = 1 of [])", + "(let {[Symbol.iterator]: a}, b of [])", + "(let {0: a} = 1 of [])", + "(let {0: a}, b of [])", + "(let {a = 1} = 1 of [])", + "(let {a = 1}, b of [])", + "(let {a: a = 1} = 1 of [])", + "(let {a: a = 1}, b of [])", + "(let {'a': a = 1} = 1 of [])", + "(let {'a': a = 1}, b of [])", + "(let {\"a\": a = 1} = 1 of [])", + "(let {\"a\": a = 1}, b of [])", + "(let {[Symbol.iterator]: a = 1} = 1 of [])", + "(let {[Symbol.iterator]: a = 1}, b of [])", + "(let {0: a = 1} = 1 of [])", + "(let {0: a = 1}, b of [])", + + "(const a = 1 of [])", + "(const a, b of [])", + "(const [a] = 1 of [])", + "(const [a], b of [])", + "(const [a = 1] = 1 of [])", + "(const [a = 1], b of [])", + "(const [a = 1, ...b] = 1 of [])", + "(const [a = 1, ...b], b of [])", + "(const {a} = 1 of [])", + "(const {a}, b of [])", + "(const {a: a} = 1 of [])", + "(const {a: a}, b of [])", + "(const {'a': a} = 1 of [])", + "(const {'a': a}, b of [])", + "(const {\"a\": a} = 1 of [])", + "(const {\"a\": a}, b of [])", + "(const {[Symbol.iterator]: a} = 1 of [])", + "(const {[Symbol.iterator]: a}, b of [])", + "(const {0: a} = 1 of [])", + "(const {0: a}, b of [])", + "(const {a = 1} = 1 of [])", + "(const {a = 1}, b of [])", + "(const {a: a = 1} = 1 of [])", + "(const {a: a = 1}, b of [])", + "(const {'a': a = 1} = 1 of [])", + "(const {'a': a = 1}, b of [])", + "(const {\"a\": a = 1} = 1 of [])", + "(const {\"a\": a = 1}, b of [])", + "(const {[Symbol.iterator]: a = 1} = 1 of [])", + "(const {[Symbol.iterator]: a = 1}, b of [])", + "(const {0: a = 1} = 1 of [])", + "(const {0: a = 1}, b of [])", + + NULL + }; + // clang-format on + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; + RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, + arraysize(always_flags)); +} + +TEST(ForAwaitOfFunctionDeclaration) { + // clang-format off + const char* context_data[][2] = { + { "async function f() {", "}" }, + { "async function f() { 'use strict'; ", "}" }, + { NULL, NULL } + }; + + const char* data[] = { + "for await (x of []) function d() {};", + "for await (x of []) function d() {}; return d;", + "for await (x of []) function* g() {};", + "for await (x of []) function* g() {}; return g;", + // TODO(caitp): handle async function declarations in ParseScopedStatement. + // "for await (x of []) async function a() {};", + // "for await (x of []) async function a() {}; return a;", + NULL + }; + + // clang-format on + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; + RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, + arraysize(always_flags)); +} diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc index 71728924db..2f38f02c07 100644 --- a/deps/v8/test/cctest/test-profile-generator.cc +++ b/deps/v8/test/cctest/test-profile-generator.cc @@ -350,7 +350,7 @@ TEST(RecordTickSample) { CpuProfiler profiler(isolate); profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", false); - ProfileGenerator generator(isolate, &profiles); + ProfileGenerator generator(&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"); @@ -423,7 +423,7 @@ TEST(SampleIds) { CpuProfiler profiler(isolate); profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", true); - ProfileGenerator generator(isolate, &profiles); + ProfileGenerator generator(&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"); @@ -481,7 +481,7 @@ TEST(NoSamples) { CpuProfiler profiler(isolate); profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", false); - ProfileGenerator generator(isolate, &profiles); + ProfileGenerator generator(&profiles); CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); @@ -697,6 +697,8 @@ TEST(LineNumber) { } TEST(BailoutReason) { + i::FLAG_allow_natives_syntax = true; + i::FLAG_always_opt = false; v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); @@ -704,14 +706,21 @@ TEST(BailoutReason) { i::ProfilerExtension::set_profiler(iprofiler.get()); CHECK_EQ(0, iprofiler->GetProfilesCount()); - v8::Local<v8::Script> script = - v8_compile(v8_str("function Debugger() {\n" - " debugger;\n" - " startProfiling();\n" - "}\n" - "Debugger();\n" - "stopProfiling();")); - script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked(); + v8::Local<v8::Function> function = CompileRun( + "function Debugger() {\n" + " startProfiling();\n" + "}" + "Debugger") + .As<v8::Function>(); + i::Handle<i::JSFunction> i_function = + i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function)); + // Set a high opt count to trigger bail out. + i_function->shared()->set_opt_count(10000); + + CompileRun( + "%OptimizeFunctionOnNextCall(Debugger);" + "Debugger();" + "stopProfiling()"); CHECK_EQ(1, iprofiler->GetProfilesCount()); const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; CHECK(profile); @@ -721,11 +730,11 @@ TEST(BailoutReason) { // The tree should look like this: // (root) // "" - // kDebuggerStatement + // kFunctionBeingDebugged current = PickChild(current, ""); CHECK(const_cast<v8::CpuProfileNode*>(current)); current = PickChild(current, "Debugger"); CHECK(const_cast<v8::CpuProfileNode*>(current)); - CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); + CHECK(!strcmp("Deoptimized too many times", current->GetBailoutReason())); } diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index ee6a6c2ab7..c5a86c1395 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -199,8 +199,8 @@ void TestRegExpParser(bool lookbehind) { CheckParseEq("xyz{1,}?", "(: 'xy' (# 1 - n 'z'))"); CheckParseEq("a\\fb\\nc\\rd\\te\\vf", "'a\\x0cb\\x0ac\\x0dd\\x09e\\x0bf'"); CheckParseEq("a\\nb\\bc", "(: 'a\\x0ab' @b 'c')"); - CheckParseEq("(?:foo)", "'foo'"); - CheckParseEq("(?: foo )", "' foo '"); + CheckParseEq("(?:foo)", "(?: 'foo')"); + CheckParseEq("(?: foo )", "(?: ' foo ')"); CheckParseEq("(foo|bar|baz)", "(^ (| 'foo' 'bar' 'baz'))"); CheckParseEq("foo|(bar|baz)|quux", "(| 'foo' (^ (| 'bar' 'baz')) 'quux')"); CheckParseEq("foo(?=bar)baz", "(: 'foo' (-> + 'bar') 'baz')"); @@ -294,7 +294,7 @@ void TestRegExpParser(bool lookbehind) { CheckParseEq("(?!\\1(a\\1)\\1)\\1", "(: (-> - (: (<- 1) (^ 'a') (<- 1))) (<- 1))"); CheckParseEq("\\1\\2(a(?:\\1(b\\1\\2))\\2)\\1", - "(: (<- 1) (<- 2) (^ (: 'a' (^ 'b') (<- 2))) (<- 1))"); + "(: (<- 1) (<- 2) (^ (: 'a' (?: (^ 'b')) (<- 2))) (<- 1))"); if (lookbehind) { CheckParseEq("\\1\\2(a(?<=\\1(b\\1\\2))\\2)\\1", "(: (<- 1) (<- 2) (^ (: 'a' (<- + (^ 'b')) (<- 2))) (<- 1))"); 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 4fd186e565..1666b69a57 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc @@ -55,15 +55,10 @@ TEST(WasmRelocationArmMemoryReference) { // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemoryReference(mode)) { - // Dummy values of size used here as the objective of the test is to - // verify that the immediate is patched correctly - it.rinfo()->update_wasm_memory_reference( - it.rinfo()->wasm_memory_reference(), - it.rinfo()->wasm_memory_reference() + offset, 1, 2, - SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_reference( + it.rinfo()->wasm_memory_reference(), + it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); } // Call into relocated code object @@ -114,13 +109,10 @@ TEST(WasmRelocationArmMemorySizeReference) { int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemorySizeReference(mode)) { - it.rinfo()->update_wasm_memory_reference( - reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), - it.rinfo()->wasm_memory_size_reference(), - it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_size( + it.rinfo()->wasm_memory_size_reference(), + it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); } ret_value = runnable.Call(); 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 c59a01aaed..920efee600 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc @@ -57,15 +57,10 @@ TEST(WasmRelocationArm64MemoryReference) { // Relocating reference by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemoryReference(mode)) { - // Dummy values of size used here as the objective of the test is to - // verify that the immediate is patched correctly - it.rinfo()->update_wasm_memory_reference( - it.rinfo()->wasm_memory_reference(), - it.rinfo()->wasm_memory_reference() + offset, 1, 2, - SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_reference( + it.rinfo()->wasm_memory_reference(), + it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); } // Call into relocated code object @@ -117,13 +112,10 @@ TEST(WasmRelocationArm64MemorySizeReference) { int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemorySizeReference(mode)) { - it.rinfo()->update_wasm_memory_reference( - reinterpret_cast<Address>(0x1234), reinterpret_cast<Address>(0x1234), - it.rinfo()->wasm_memory_size_reference(), - it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_size( + it.rinfo()->wasm_memory_size_reference(), + it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); } ret_value = runnable.Call(); 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 f2241d5f92..0b3f061568 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc @@ -61,15 +61,10 @@ TEST(WasmRelocationIa32MemoryReference) { // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemoryReference(mode)) { - // Dummy values of size used here as the objective of the test is to - // verify that the immediate is patched correctly - it.rinfo()->update_wasm_memory_reference( - it.rinfo()->wasm_memory_reference(), - it.rinfo()->wasm_memory_reference() + offset, 1, 2, - SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_reference( + it.rinfo()->wasm_memory_reference(), + it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); } // Check if immediate is updated correctly @@ -128,13 +123,10 @@ TEST(WasmRelocationIa32MemorySizeReference) { int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemorySizeReference(mode)) { - it.rinfo()->update_wasm_memory_reference( - reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), - it.rinfo()->wasm_memory_size_reference(), - it.rinfo()->wasm_memory_size_reference() + offset, SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_size( + it.rinfo()->wasm_memory_size_reference(), + it.rinfo()->wasm_memory_size_reference() + offset, SKIP_ICACHE_FLUSH); } ret_value = runnable.Call(); 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 a5df703410..29491e8c87 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc @@ -11,6 +11,8 @@ #include "src/disassembler.h" #include "src/ic/ic.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" +#include "src/ostreams.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/c-signature.h" #include "test/cctest/compiler/call-tester.h" @@ -57,15 +59,10 @@ TEST(WasmRelocationX64MemoryReference) { // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemoryReference(mode)) { - // Dummy values of size used here as the objective of the test is to - // verify that the immediate is patched correctly - it.rinfo()->update_wasm_memory_reference( - it.rinfo()->wasm_memory_reference(), - it.rinfo()->wasm_memory_reference() + offset, 1, 2, - SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_reference( + it.rinfo()->wasm_memory_reference(), + it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); } // Check if immediate is updated correctly @@ -120,13 +117,10 @@ TEST(WasmRelocationX64WasmMemorySizeReference) { int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemorySizeReference(mode)) { - it.rinfo()->update_wasm_memory_reference( - reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), - it.rinfo()->wasm_memory_size_reference(), - it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_size( + it.rinfo()->wasm_memory_size_reference(), + it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); } ret_value = runnable.Call(); 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 17b340ac9e..77dc86e0fb 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc @@ -61,15 +61,10 @@ TEST(WasmRelocationX87MemoryReference) { // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { - RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemoryReference(mode)) { - // Dummy values of size used here as the objective of the test is to - // verify that the immediate is patched correctly - it.rinfo()->update_wasm_memory_reference( - it.rinfo()->wasm_memory_reference(), - it.rinfo()->wasm_memory_reference() + offset, 1, 2, - SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); + it.rinfo()->update_wasm_memory_reference( + it.rinfo()->wasm_memory_reference(), + it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); } // Check if immediate is updated correctly @@ -129,12 +124,10 @@ TEST(WasmRelocationX87MemorySizeReference) { int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { RelocInfo::Mode mode = it.rinfo()->rmode(); - if (RelocInfo::IsWasmMemorySizeReference(mode)) { - it.rinfo()->update_wasm_memory_reference( - reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), - it.rinfo()->wasm_memory_size_reference(), - it.rinfo()->wasm_memory_size_reference() + offset, SKIP_ICACHE_FLUSH); - } + DCHECK(RelocInfo::IsWasmMemorySizeReference(mode)); + it.rinfo()->update_wasm_memory_size( + it.rinfo()->wasm_memory_size_reference(), + it.rinfo()->wasm_memory_size_reference() + offset, SKIP_ICACHE_FLUSH); } ret_value = runnable.Call(); diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index 9644d09624..20085a23c0 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -31,13 +31,15 @@ #include "src/v8.h" +#include "src/api.h" +#include "src/assembler-inl.h" #include "src/bootstrapper.h" #include "src/compilation-cache.h" #include "src/compiler.h" #include "src/debug/debug.h" #include "src/heap/spaces.h" #include "src/macro-assembler.h" -#include "src/objects.h" +#include "src/objects-inl.h" #include "src/runtime/runtime.h" #include "src/snapshot/code-serializer.h" #include "src/snapshot/deserializer.h" @@ -262,10 +264,9 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out, isolate->bootstrapper()->SourceLookup<Natives>(i); } } - heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); - heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); + + heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); + heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); Object* raw_foo; { @@ -370,10 +371,10 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, isolate->bootstrapper()->SourceLookup<Natives>(i); } } + // If we don't do this then we end up with a stray root pointing at the // context even after we have disposed of env. - heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); + heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); { v8::HandleScope handle_scope(v8_isolate); @@ -931,7 +932,7 @@ static Handle<SharedFunctionInfo> CompileScript( return Compiler::GetSharedFunctionInfoForScript( source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, cached_data, options, - NOT_NATIVES_CODE, false); + NOT_NATIVES_CODE); } TEST(CodeSerializerOnePlusOne) { @@ -1005,11 +1006,11 @@ TEST(CodeSerializerPromotedToCompilationCache) { Handle<SharedFunctionInfo> copy = CompileScript( isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache); - CHECK(isolate->compilation_cache() - ->LookupScript(src, src, 0, 0, v8::ScriptOriginOptions(), - isolate->native_context(), SLOPPY) - .ToHandleChecked() - .is_identical_to(copy)); + InfoVectorPair pair = isolate->compilation_cache()->LookupScript( + src, src, 0, 0, v8::ScriptOriginOptions(), isolate->native_context(), + SLOPPY); + + CHECK(pair.shared() == *copy); delete cache; } @@ -1687,96 +1688,6 @@ TEST(CodeSerializerWithHarmonyScoping) { isolate2->Dispose(); } -TEST(CodeSerializerInternalReference) { -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 - return; -#endif - // 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 || FLAG_turbo) { - return; - } - // Disable experimental natives that are loaded after deserialization. - FLAG_function_context_specialization = false; - FLAG_always_opt = true; - const char* flag = "--turbo-filter=foo"; - FlagList::SetFlagsFromString(flag, StrLength(flag)); - - const char* source = - "var foo = (function(stdlib, foreign, heap) {" - " function foo(i) {" - " i = i|0;" - " var j = 0;" - " switch (i) {" - " case 0:" - " case 1: j = 1; break;" - " case 2:" - " case 3: j = 2; break;" - " case 4:" - " case 5: j = foo(3) + 1; break;" - " default: j = 0; break;" - " }" - " return j + 10;" - " }" - " return { foo: foo };" - "})(this, {}, undefined).foo;" - "foo(1);"; - - v8::StartupData data = v8::V8::CreateSnapshotDataBlob(source); - CHECK(data.data); - - v8::Isolate::CreateParams params; - params.snapshot_blob = &data; - params.array_buffer_allocator = CcTest::array_buffer_allocator(); - v8::Isolate* isolate = v8::Isolate::New(params); - { - v8::Isolate::Scope i_scope(isolate); - v8::HandleScope h_scope(isolate); - v8::Local<v8::Context> context = v8::Context::New(isolate); - delete[] data.data; // We can dispose of the snapshot blob now. - v8::Context::Scope c_scope(context); - v8::Local<v8::Function> foo = - v8::Local<v8::Function>::Cast(CompileRun("foo")); - - // There are at least 6 internal references. - int mask = RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | - RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED); - RelocIterator it( - Handle<JSFunction>::cast(v8::Utils::OpenHandle(*foo))->code(), mask); - for (int i = 0; i < 6; ++i) { - CHECK(!it.done()); - it.next(); - } - - CHECK(Handle<JSFunction>::cast(v8::Utils::OpenHandle(*foo)) - ->code() - ->is_turbofanned()); - CHECK_EQ(11, CompileRun("foo(0)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - CHECK_EQ(11, CompileRun("foo(1)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - CHECK_EQ(12, CompileRun("foo(2)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - CHECK_EQ(12, CompileRun("foo(3)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - CHECK_EQ(23, CompileRun("foo(4)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - CHECK_EQ(23, CompileRun("foo(5)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - CHECK_EQ(10, CompileRun("foo(6)") - ->Int32Value(isolate->GetCurrentContext()) - .FromJust()); - } - isolate->Dispose(); -} - TEST(CodeSerializerEagerCompilationAndPreAge) { if (FLAG_ignition || FLAG_turbo) return; @@ -1846,8 +1757,7 @@ TEST(Regress503552) { Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, - &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE, - false); + &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE); delete script_data; heap::SimulateIncrementalMarking(isolate->heap()); @@ -2078,6 +1988,7 @@ intptr_t original_external_references[] = { reinterpret_cast<intptr_t>(&NamedPropertyGetterForSerialization), reinterpret_cast<intptr_t>(&AccessorForSerialization), reinterpret_cast<intptr_t>(&SerializedExtension::FunctionCallback), + reinterpret_cast<intptr_t>(&serialized_static_field), // duplicate entry 0}; intptr_t replaced_external_references[] = { @@ -2086,6 +1997,7 @@ intptr_t replaced_external_references[] = { reinterpret_cast<intptr_t>(&NamedPropertyGetterForSerialization), reinterpret_cast<intptr_t>(&AccessorForSerialization), reinterpret_cast<intptr_t>(&SerializedExtension::FunctionCallback), + reinterpret_cast<intptr_t>(&serialized_static_field), 0}; TEST(SnapshotCreatorExternalReferences) { diff --git a/deps/v8/test/cctest/test-simd.cc b/deps/v8/test/cctest/test-simd.cc deleted file mode 100644 index 5394d2ad10..0000000000 --- a/deps/v8/test/cctest/test-simd.cc +++ /dev/null @@ -1,129 +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/v8.h" - -#include "src/factory.h" -#include "src/isolate.h" -#include "src/objects.h" -// FIXME(mstarzinger, marja): This is weird, but required because of the missing -// (disallowed) include: src/factory.h -> src/objects-inl.h -#include "src/objects-inl.h" -#include "src/ostreams.h" -// FIXME(mstarzinger, marja): This is weird, but required because of the missing -// (disallowed) include: src/feedback-vector.h -> -// src/feedback-vector-inl.h -#include "src/feedback-vector-inl.h" -#include "test/cctest/cctest.h" - -using namespace v8::internal; - -#define FLOAT_TEST(type, lane_count) \ - { \ - float nan = std::numeric_limits<float>::quiet_NaN(); \ - float lanes[lane_count] = {0}; \ - Handle<type> a = factory->New##type(lanes); \ - Handle<type> b = factory->New##type(lanes); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - for (int i = 0; i < lane_count; i++) { \ - a->set_lane(i, -0.0); \ - CHECK(!a->BitwiseEquals(*b)); \ - CHECK_NE(a->Hash(), b->Hash()); \ - CHECK(!a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - b->set_lane(i, -0.0); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - a->set_lane(i, nan); \ - CHECK(!a->BitwiseEquals(*b)); \ - CHECK(!a->SameValue(*b)); \ - CHECK(!a->SameValueZero(*b)); \ - CHECK_NE(a->Hash(), b->Hash()); \ - b->set_lane(i, nan); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - } \ - } - -#define INT_TEST(type, lane_count, lane_type) \ - { \ - lane_type lanes[lane_count] = {0}; \ - Handle<type> a = factory->New##type(lanes); \ - Handle<type> b = factory->New##type(lanes); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - for (int i = 0; i < lane_count; i++) { \ - a->set_lane(i, i + 1); \ - CHECK(!a->BitwiseEquals(*b)); \ - CHECK_NE(a->Hash(), b->Hash()); \ - CHECK(!a->SameValue(*b)); \ - CHECK(!a->SameValueZero(*b)); \ - b->set_lane(i, i + 1); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - a->set_lane(i, -(i + 1)); \ - CHECK(!a->BitwiseEquals(*b)); \ - CHECK_NE(a->Hash(), b->Hash()); \ - CHECK(!a->SameValue(*b)); \ - CHECK(!a->SameValueZero(*b)); \ - b->set_lane(i, -(i + 1)); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - } \ - } - -#define BOOL_TEST(type, lane_count) \ - { \ - bool lanes[lane_count] = {false}; \ - Handle<type> a = factory->New##type(lanes); \ - Handle<type> b = factory->New##type(lanes); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - for (int i = 0; i < lane_count; i++) { \ - a->set_lane(i, true); \ - CHECK(!a->BitwiseEquals(*b)); \ - CHECK_NE(a->Hash(), b->Hash()); \ - CHECK(!a->SameValue(*b)); \ - CHECK(!a->SameValueZero(*b)); \ - b->set_lane(i, true); \ - CHECK(a->BitwiseEquals(*b)); \ - CHECK_EQ(a->Hash(), b->Hash()); \ - CHECK(a->SameValue(*b)); \ - CHECK(a->SameValueZero(*b)); \ - } \ - } - -TEST(SimdTypes) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - Factory* factory = isolate->factory(); - - HandleScope sc(isolate); - - FLOAT_TEST(Float32x4, 4) - INT_TEST(Int32x4, 4, int32_t) - INT_TEST(Uint32x4, 4, uint32_t) - BOOL_TEST(Bool32x4, 4) - INT_TEST(Int16x8, 8, int16_t) - INT_TEST(Uint16x8, 8, uint16_t) - BOOL_TEST(Bool16x8, 8) - INT_TEST(Int8x16, 16, int8_t) - INT_TEST(Uint8x16, 16, uint8_t) - BOOL_TEST(Bool8x16, 16) -} diff --git a/deps/v8/test/cctest/test-simulator-arm.cc b/deps/v8/test/cctest/test-simulator-arm.cc new file mode 100644 index 0000000000..a34837665e --- /dev/null +++ b/deps/v8/test/cctest/test-simulator-arm.cc @@ -0,0 +1,387 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/v8.h" +#include "test/cctest/cctest.h" + +#include "src/arm/simulator-arm.h" +#include "src/disassembler.h" +#include "src/factory.h" +#include "src/macro-assembler.h" + +#if defined(USE_SIMULATOR) + +#ifndef V8_TARGET_LITTLE_ENDIAN +#error Expected ARM to be little-endian +#endif + +using namespace v8::base; +using namespace v8::internal; + +// Define these function prototypes to match JSEntryFunction in execution.cc. +typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); +typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); + +#define __ assm. + +struct MemoryAccess { + enum class Kind { + None, + Load, + LoadExcl, + Store, + StoreExcl, + }; + + enum class Size { + Byte, + HalfWord, + Word, + }; + + MemoryAccess() : kind(Kind::None) {} + MemoryAccess(Kind kind, Size size, size_t offset, int value = 0) + : kind(kind), size(size), offset(offset), value(value) {} + + Kind kind; + Size size; + size_t offset; + int value; +}; + +struct TestData { + explicit TestData(int w) : w(w) {} + + union { + int32_t w; + int16_t h; + int8_t b; + }; + int dummy; +}; + +static void AssembleMemoryAccess(Assembler* assembler, MemoryAccess access, + Register dest_reg, Register value_reg, + Register addr_reg) { + Assembler& assm = *assembler; + __ add(addr_reg, r0, Operand(access.offset)); + + switch (access.kind) { + case MemoryAccess::Kind::None: + break; + + case MemoryAccess::Kind::Load: + switch (access.size) { + case MemoryAccess::Size::Byte: + __ ldrb(value_reg, MemOperand(addr_reg)); + break; + + case MemoryAccess::Size::HalfWord: + __ ldrh(value_reg, MemOperand(addr_reg)); + break; + + case MemoryAccess::Size::Word: + __ ldr(value_reg, MemOperand(addr_reg)); + break; + } + break; + + case MemoryAccess::Kind::LoadExcl: + switch (access.size) { + case MemoryAccess::Size::Byte: + __ ldrexb(value_reg, addr_reg); + break; + + case MemoryAccess::Size::HalfWord: + __ ldrexh(value_reg, addr_reg); + break; + + case MemoryAccess::Size::Word: + __ ldrex(value_reg, addr_reg); + break; + } + break; + + case MemoryAccess::Kind::Store: + switch (access.size) { + case MemoryAccess::Size::Byte: + __ mov(value_reg, Operand(access.value)); + __ strb(value_reg, MemOperand(addr_reg)); + break; + + case MemoryAccess::Size::HalfWord: + __ mov(value_reg, Operand(access.value)); + __ strh(value_reg, MemOperand(addr_reg)); + break; + + case MemoryAccess::Size::Word: + __ mov(value_reg, Operand(access.value)); + __ str(value_reg, MemOperand(addr_reg)); + break; + } + break; + + case MemoryAccess::Kind::StoreExcl: + switch (access.size) { + case MemoryAccess::Size::Byte: + __ mov(value_reg, Operand(access.value)); + __ strexb(dest_reg, value_reg, addr_reg); + break; + + case MemoryAccess::Size::HalfWord: + __ mov(value_reg, Operand(access.value)); + __ strexh(dest_reg, value_reg, addr_reg); + break; + + case MemoryAccess::Size::Word: + __ mov(value_reg, Operand(access.value)); + __ strex(dest_reg, value_reg, addr_reg); + break; + } + break; + } +} + +static void AssembleLoadExcl(Assembler* assembler, MemoryAccess access, + Register value_reg, Register addr_reg) { + DCHECK(access.kind == MemoryAccess::Kind::LoadExcl); + AssembleMemoryAccess(assembler, access, no_reg, value_reg, addr_reg); +} + +static void AssembleStoreExcl(Assembler* assembler, MemoryAccess access, + Register dest_reg, Register value_reg, + Register addr_reg) { + DCHECK(access.kind == MemoryAccess::Kind::StoreExcl); + AssembleMemoryAccess(assembler, access, dest_reg, value_reg, addr_reg); +} + +static void TestInvalidateExclusiveAccess( + TestData initial_data, MemoryAccess access1, MemoryAccess access2, + MemoryAccess access3, int expected_res, TestData expected_data) { + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + Assembler assm(isolate, NULL, 0); + + AssembleLoadExcl(&assm, access1, r1, r1); + AssembleMemoryAccess(&assm, access2, r3, r2, r1); + AssembleStoreExcl(&assm, access3, r0, r3, r1); + + __ mov(pc, Operand(lr)); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + F3 f = FUNCTION_CAST<F3>(code->entry()); + TestData t = initial_data; + + int res = + reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0)); + CHECK_EQ(expected_res, res); + switch (access3.size) { + case MemoryAccess::Size::Byte: + CHECK_EQ(expected_data.b, t.b); + break; + + case MemoryAccess::Size::HalfWord: + CHECK_EQ(expected_data.h, t.h); + break; + + case MemoryAccess::Size::Word: + CHECK_EQ(expected_data.w, t.w); + break; + } +} + +TEST(simulator_invalidate_exclusive_access) { + using Kind = MemoryAccess::Kind; + using Size = MemoryAccess::Size; + + MemoryAccess ldrex_w(Kind::LoadExcl, Size::Word, offsetof(TestData, w)); + MemoryAccess strex_w(Kind::StoreExcl, Size::Word, offsetof(TestData, w), 7); + + // Address mismatch. + TestInvalidateExclusiveAccess( + TestData(1), ldrex_w, + MemoryAccess(Kind::LoadExcl, Size::Word, offsetof(TestData, dummy)), + strex_w, 1, TestData(1)); + + // Size mismatch. + TestInvalidateExclusiveAccess( + TestData(1), ldrex_w, MemoryAccess(), + MemoryAccess(Kind::StoreExcl, Size::HalfWord, offsetof(TestData, w), 7), + 1, TestData(1)); + + // Load between ldrex/strex. + TestInvalidateExclusiveAccess( + TestData(1), ldrex_w, + MemoryAccess(Kind::Load, Size::Word, offsetof(TestData, dummy)), strex_w, + 1, TestData(1)); + + // Store between ldrex/strex. + TestInvalidateExclusiveAccess( + TestData(1), ldrex_w, + MemoryAccess(Kind::Store, Size::Word, offsetof(TestData, dummy)), strex_w, + 1, TestData(1)); + + // Match + TestInvalidateExclusiveAccess(TestData(1), ldrex_w, MemoryAccess(), strex_w, + 0, TestData(7)); +} + +static int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, + MemoryAccess access) { + HandleScope scope(isolate); + Assembler assm(isolate, NULL, 0); + AssembleMemoryAccess(&assm, access, r0, r2, r1); + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + F3 f = FUNCTION_CAST<F3>(code->entry()); + + return reinterpret_cast<int>( + CALL_GENERATED_CODE(isolate, f, test_data, 0, 0, 0, 0)); +} + +class MemoryAccessThread : public v8::base::Thread { + public: + MemoryAccessThread() + : Thread(Options("MemoryAccessThread")), + test_data_(NULL), + is_finished_(false), + has_request_(false), + did_request_(false) {} + + virtual void Run() { + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + v8::Isolate* isolate = v8::Isolate::New(create_params); + Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + v8::Isolate::Scope scope(isolate); + + v8::base::LockGuard<v8::base::Mutex> lock_guard(&mutex_); + while (!is_finished_) { + while (!(has_request_ || is_finished_)) { + has_request_cv_.Wait(&mutex_); + } + + if (is_finished_) { + break; + } + + ExecuteMemoryAccess(i_isolate, test_data_, access_); + has_request_ = false; + did_request_ = true; + did_request_cv_.NotifyOne(); + } + } + + void NextAndWait(TestData* test_data, MemoryAccess access) { + DCHECK(!has_request_); + v8::base::LockGuard<v8::base::Mutex> lock_guard(&mutex_); + test_data_ = test_data; + access_ = access; + has_request_ = true; + has_request_cv_.NotifyOne(); + while (!did_request_) { + did_request_cv_.Wait(&mutex_); + } + did_request_ = false; + } + + void Finish() { + v8::base::LockGuard<v8::base::Mutex> lock_guard(&mutex_); + is_finished_ = true; + has_request_cv_.NotifyOne(); + } + + private: + TestData* test_data_; + MemoryAccess access_; + bool is_finished_; + bool has_request_; + bool did_request_; + v8::base::Mutex mutex_; + v8::base::ConditionVariable has_request_cv_; + v8::base::ConditionVariable did_request_cv_; +}; + +TEST(simulator_invalidate_exclusive_access_threaded) { + using Kind = MemoryAccess::Kind; + using Size = MemoryAccess::Size; + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + TestData test_data(1); + + MemoryAccessThread thread; + thread.Start(); + + MemoryAccess ldrex_w(Kind::LoadExcl, Size::Word, offsetof(TestData, w)); + MemoryAccess strex_w(Kind::StoreExcl, Size::Word, offsetof(TestData, w), 7); + + // Exclusive store completed by another thread first. + test_data = TestData(1); + thread.NextAndWait(&test_data, MemoryAccess(Kind::LoadExcl, Size::Word, + offsetof(TestData, w))); + ExecuteMemoryAccess(isolate, &test_data, ldrex_w); + thread.NextAndWait(&test_data, MemoryAccess(Kind::StoreExcl, Size::Word, + offsetof(TestData, w), 5)); + CHECK_EQ(1, ExecuteMemoryAccess(isolate, &test_data, strex_w)); + CHECK_EQ(5, test_data.w); + + // Exclusive store completed by another thread; different address, but masked + // to same + test_data = TestData(1); + ExecuteMemoryAccess(isolate, &test_data, ldrex_w); + thread.NextAndWait(&test_data, MemoryAccess(Kind::LoadExcl, Size::Word, + offsetof(TestData, dummy))); + thread.NextAndWait(&test_data, MemoryAccess(Kind::StoreExcl, Size::Word, + offsetof(TestData, dummy), 5)); + CHECK_EQ(1, ExecuteMemoryAccess(isolate, &test_data, strex_w)); + CHECK_EQ(1, test_data.w); + + // Test failure when store between ldrex/strex. + test_data = TestData(1); + ExecuteMemoryAccess(isolate, &test_data, ldrex_w); + thread.NextAndWait(&test_data, MemoryAccess(Kind::Store, Size::Word, + offsetof(TestData, dummy))); + CHECK_EQ(1, ExecuteMemoryAccess(isolate, &test_data, strex_w)); + CHECK_EQ(1, test_data.w); + + thread.Finish(); + thread.Join(); +} + +#undef __ + +#endif // USE_SIMULATOR diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index d7b51f8274..e4df339d8b 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -1195,6 +1195,33 @@ class OneByteVectorResource : public v8::String::ExternalOneByteStringResource { i::Vector<const char> data_; }; +TEST(InternalizeExternal) { + FLAG_thin_strings = true; + CcTest::InitializeVM(); + i::Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + // This won't leak; the external string mechanism will call Dispose() on it. + OneByteVectorResource* resource = + new OneByteVectorResource(i::Vector<const char>("prop", 4)); + { + v8::HandleScope scope(CcTest::isolate()); + v8::Local<v8::String> ext_string = + v8::String::NewExternalOneByte(CcTest::isolate(), resource) + .ToLocalChecked(); + Handle<String> string = v8::Utils::OpenHandle(*ext_string); + CHECK(string->IsExternalString()); + CHECK(!string->IsInternalizedString()); + CHECK(isolate->heap()->InNewSpace(*string)); + factory->InternalizeName(string); + CHECK(string->IsThinString()); + CcTest::CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); + CHECK(string->IsInternalizedString()); + CHECK(!isolate->heap()->InNewSpace(*string)); + } + CcTest::CollectGarbage(i::OLD_SPACE); + CcTest::CollectGarbage(i::OLD_SPACE); +} TEST(SliceFromExternal) { FLAG_string_slices = true; diff --git a/deps/v8/test/cctest/test-transitions.cc b/deps/v8/test/cctest/test-transitions.cc index 842a6ca47f..a38c6b2aa5 100644 --- a/deps/v8/test/cctest/test-transitions.cc +++ b/deps/v8/test/cctest/test-transitions.cc @@ -38,11 +38,13 @@ TEST(TransitionArray_SimpleFieldTransitions) { Handle<Map> map0 = Map::Create(isolate, 0); Handle<Map> map1 = Map::CopyWithField(map0, name1, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) + attributes, kMutable, Representation::Tagged(), + OMIT_TRANSITION) .ToHandleChecked(); Handle<Map> map2 = Map::CopyWithField(map0, name2, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) + attributes, kMutable, Representation::Tagged(), + OMIT_TRANSITION) .ToHandleChecked(); CHECK(map0->raw_transitions()->IsSmi()); @@ -89,11 +91,13 @@ TEST(TransitionArray_FullFieldTransitions) { Handle<Map> map0 = Map::Create(isolate, 0); Handle<Map> map1 = Map::CopyWithField(map0, name1, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) + attributes, kMutable, Representation::Tagged(), + OMIT_TRANSITION) .ToHandleChecked(); Handle<Map> map2 = Map::CopyWithField(map0, name2, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) + attributes, kMutable, Representation::Tagged(), + OMIT_TRANSITION) .ToHandleChecked(); CHECK(map0->raw_transitions()->IsSmi()); @@ -145,10 +149,11 @@ TEST(TransitionArray_DifferentFieldNames) { EmbeddedVector<char, 64> buffer; SNPrintF(buffer, "prop%d", i); Handle<String> name = factory->InternalizeUtf8String(buffer.start()); - Handle<Map> map = Map::CopyWithField( - map0, name, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) - .ToHandleChecked(); + Handle<Map> map = + Map::CopyWithField(map0, name, handle(FieldType::Any(), isolate), + attributes, kMutable, Representation::Tagged(), + OMIT_TRANSITION) + .ToHandleChecked(); names[i] = name; maps[i] = map; @@ -194,10 +199,10 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) { for (int i = 0; i < ATTRS_COUNT; i++) { PropertyAttributes attributes = static_cast<PropertyAttributes>(i); - Handle<Map> map = Map::CopyWithField( - map0, name, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) - .ToHandleChecked(); + Handle<Map> map = + Map::CopyWithField(map0, name, FieldType::Any(isolate), attributes, + kMutable, Representation::Tagged(), OMIT_TRANSITION) + .ToHandleChecked(); attr_maps[i] = map; TransitionArray::Insert(map0, name, map, PROPERTY_TRANSITION); @@ -239,7 +244,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) { Handle<String> name = factory->InternalizeUtf8String(buffer.start()); Handle<Map> map = Map::CopyWithField(map0, name, handle(FieldType::Any(), isolate), NONE, - Representation::Tagged(), OMIT_TRANSITION) + kMutable, Representation::Tagged(), OMIT_TRANSITION) .ToHandleChecked(); names[i] = name; maps[i] = map; @@ -256,10 +261,11 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) { for (int i = 0; i < ATTRS_COUNT; i++) { PropertyAttributes attributes = static_cast<PropertyAttributes>(i); - Handle<Map> map = Map::CopyWithField( - map0, name, handle(FieldType::Any(), isolate), - attributes, Representation::Tagged(), OMIT_TRANSITION) - .ToHandleChecked(); + Handle<Map> map = + Map::CopyWithField(map0, name, handle(FieldType::Any(), isolate), + attributes, kMutable, Representation::Tagged(), + OMIT_TRANSITION) + .ToHandleChecked(); attr_maps[i] = map; TransitionArray::Insert(map0, name, map, PROPERTY_TRANSITION); diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc index 582e2757fb..52d0455652 100644 --- a/deps/v8/test/cctest/test-unboxed-doubles.cc +++ b/deps/v8/test/cctest/test-unboxed-doubles.cc @@ -7,13 +7,20 @@ #include "src/v8.h" +#include "src/accessors.h" +#include "src/api.h" #include "src/compilation-cache.h" #include "src/execution.h" #include "src/factory.h" #include "src/field-type.h" #include "src/global-handles.h" +#include "src/heap/incremental-marking.h" +#include "src/heap/spaces.h" #include "src/ic/ic.h" +#include "src/layout-descriptor.h" #include "src/macro-assembler.h" +#include "src/objects-inl.h" +#include "src/property.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-utils.h" @@ -70,11 +77,16 @@ static double GetDoubleFieldValue(JSObject* obj, FieldIndex field_index) { } } -const int kNumberOfBits = 32; +void WriteToField(JSObject* object, int descriptor, Object* value) { + DescriptorArray* descriptors = object->map()->instance_descriptors(); + PropertyDetails details = descriptors->GetDetails(descriptor); + object->WriteToField(descriptor, details, value); +} +const int kNumberOfBits = 32; enum TestPropertyKind { - PROP_CONSTANT, + PROP_ACCESSOR_INFO, PROP_SMI, PROP_DOUBLE, PROP_TAGGED, @@ -91,9 +103,6 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate, int kPropsCount) { Factory* factory = isolate->factory(); - Handle<String> func_name = factory->InternalizeUtf8String("func"); - Handle<JSFunction> func = factory->NewFunction(func_name); - Handle<DescriptorArray> descriptors = DescriptorArray::Allocate(isolate, 0, kPropsCount); @@ -105,15 +114,20 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate, TestPropertyKind kind = props[i]; - if (kind == PROP_CONSTANT) { - Descriptor d = Descriptor::DataConstant(name, func, NONE); - descriptors->Append(&d); + Descriptor d; + if (kind == PROP_ACCESSOR_INFO) { + Handle<AccessorInfo> info = + Accessors::MakeAccessor(isolate, name, nullptr, nullptr, NONE); + d = Descriptor::AccessorConstant(name, info, NONE); } else { - Descriptor d = Descriptor::DataField(name, next_field_offset, NONE, - representations[kind]); - next_field_offset += d.GetDetails().field_width_in_words(); - descriptors->Append(&d); + d = Descriptor::DataField(name, next_field_offset, NONE, + representations[kind]); + } + descriptors->Append(&d); + PropertyDetails details = d.GetDetails(); + if (details.location() == kField) { + next_field_offset += details.field_width_in_words(); } } return descriptors; @@ -131,18 +145,18 @@ TEST(LayoutDescriptorBasicFast) { CHECK_EQ(kSmiValueSize, layout_desc->capacity()); for (int i = 0; i < kSmiValueSize + 13; i++) { - CHECK_EQ(true, layout_desc->IsTagged(i)); + CHECK(layout_desc->IsTagged(i)); } - CHECK_EQ(true, layout_desc->IsTagged(-1)); - CHECK_EQ(true, layout_desc->IsTagged(-12347)); - CHECK_EQ(true, layout_desc->IsTagged(15635)); + CHECK(layout_desc->IsTagged(-1)); + CHECK(layout_desc->IsTagged(-12347)); + CHECK(layout_desc->IsTagged(15635)); CHECK(layout_desc->IsFastPointerLayout()); for (int i = 0; i < kSmiValueSize; i++) { layout_desc = layout_desc->SetTaggedForTesting(i, false); - CHECK_EQ(false, layout_desc->IsTagged(i)); + CHECK(!layout_desc->IsTagged(i)); layout_desc = layout_desc->SetTaggedForTesting(i, true); - CHECK_EQ(true, layout_desc->IsTagged(i)); + CHECK(layout_desc->IsTagged(i)); } CHECK(layout_desc->IsFastPointerLayout()); @@ -151,7 +165,7 @@ TEST(LayoutDescriptorBasicFast) { &sequence_length)); CHECK_EQ(std::numeric_limits<int>::max(), sequence_length); - CHECK_EQ(true, layout_desc->IsTagged(0, 7, &sequence_length)); + CHECK(layout_desc->IsTagged(0, 7, &sequence_length)); CHECK_EQ(7, sequence_length); } @@ -197,9 +211,9 @@ TEST(LayoutDescriptorBasicSlow) { CHECK(!layout_descriptor->IsSlowLayout()); CHECK(!layout_descriptor->IsFastPointerLayout()); - CHECK_EQ(false, layout_descriptor->IsTagged(0)); + CHECK(!layout_descriptor->IsTagged(0)); for (int i = 1; i < kPropsCount; i++) { - CHECK_EQ(true, layout_descriptor->IsTagged(i)); + CHECK(layout_descriptor->IsTagged(i)); } InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor); } @@ -214,26 +228,26 @@ TEST(LayoutDescriptorBasicSlow) { CHECK(!layout_descriptor->IsFastPointerLayout()); CHECK(layout_descriptor->capacity() > kSmiValueSize); - CHECK_EQ(false, layout_descriptor->IsTagged(0)); - CHECK_EQ(false, layout_descriptor->IsTagged(kPropsCount - 1)); + CHECK(!layout_descriptor->IsTagged(0)); + CHECK(!layout_descriptor->IsTagged(kPropsCount - 1)); for (int i = 1; i < kPropsCount - 1; i++) { - CHECK_EQ(true, layout_descriptor->IsTagged(i)); + CHECK(layout_descriptor->IsTagged(i)); } InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor); // Here we have truly slow layout descriptor, so play with the bits. - CHECK_EQ(true, layout_descriptor->IsTagged(-1)); - CHECK_EQ(true, layout_descriptor->IsTagged(-12347)); - CHECK_EQ(true, layout_descriptor->IsTagged(15635)); + CHECK(layout_descriptor->IsTagged(-1)); + CHECK(layout_descriptor->IsTagged(-12347)); + CHECK(layout_descriptor->IsTagged(15635)); LayoutDescriptor* layout_desc = *layout_descriptor; // Play with the bits but leave it in consistent state with map at the end. for (int i = 1; i < kPropsCount - 1; i++) { layout_desc = layout_desc->SetTaggedForTesting(i, false); - CHECK_EQ(false, layout_desc->IsTagged(i)); + CHECK(!layout_desc->IsTagged(i)); layout_desc = layout_desc->SetTaggedForTesting(i, true); - CHECK_EQ(true, layout_desc->IsTagged(i)); + CHECK(layout_desc->IsTagged(i)); } CHECK(layout_desc->IsSlowLayout()); CHECK(!layout_desc->IsFastPointerLayout()); @@ -482,13 +496,13 @@ TEST(LayoutDescriptorCreateNewFast) { Handle<LayoutDescriptor> layout_descriptor; TestPropertyKind props[] = { - PROP_CONSTANT, + PROP_ACCESSOR_INFO, PROP_TAGGED, // field #0 - PROP_CONSTANT, + PROP_ACCESSOR_INFO, PROP_DOUBLE, // field #1 - PROP_CONSTANT, + PROP_ACCESSOR_INFO, PROP_TAGGED, // field #2 - PROP_CONSTANT, + PROP_ACCESSOR_INFO, }; const int kPropsCount = arraysize(props); @@ -514,10 +528,10 @@ TEST(LayoutDescriptorCreateNewFast) { layout_descriptor = LayoutDescriptor::New(map, descriptors, kPropsCount); CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor); CHECK(!layout_descriptor->IsSlowLayout()); - CHECK_EQ(true, layout_descriptor->IsTagged(0)); - CHECK_EQ(false, layout_descriptor->IsTagged(1)); - CHECK_EQ(true, layout_descriptor->IsTagged(2)); - CHECK_EQ(true, layout_descriptor->IsTagged(125)); + CHECK(layout_descriptor->IsTagged(0)); + CHECK(!layout_descriptor->IsTagged(1)); + CHECK(layout_descriptor->IsTagged(2)); + CHECK(layout_descriptor->IsTagged(125)); InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor); } } @@ -557,10 +571,10 @@ TEST(LayoutDescriptorCreateNewSlow) { layout_descriptor = LayoutDescriptor::New(map, descriptors, kPropsCount); CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor); CHECK(!layout_descriptor->IsSlowLayout()); - CHECK_EQ(true, layout_descriptor->IsTagged(0)); - CHECK_EQ(false, layout_descriptor->IsTagged(1)); - CHECK_EQ(true, layout_descriptor->IsTagged(2)); - CHECK_EQ(true, layout_descriptor->IsTagged(125)); + CHECK(layout_descriptor->IsTagged(0)); + CHECK(!layout_descriptor->IsTagged(1)); + CHECK(layout_descriptor->IsTagged(2)); + CHECK(layout_descriptor->IsTagged(125)); InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor); } @@ -577,7 +591,7 @@ TEST(LayoutDescriptorCreateNewSlow) { } // Every property after inobject_properties must be tagged. for (int i = inobject_properties; i < kPropsCount; i++) { - CHECK_EQ(true, layout_descriptor->IsTagged(i)); + CHECK(layout_descriptor->IsTagged(i)); } InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor); @@ -610,9 +624,6 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend( int kPropsCount) { Factory* factory = isolate->factory(); - Handle<String> func_name = factory->InternalizeUtf8String("func"); - Handle<JSFunction> func = factory->NewFunction(func_name); - Handle<DescriptorArray> descriptors = DescriptorArray::Allocate(isolate, 0, kPropsCount); @@ -628,20 +639,24 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend( Handle<LayoutDescriptor> layout_descriptor; TestPropertyKind kind = props[i]; - if (kind == PROP_CONSTANT) { - Descriptor d = Descriptor::DataConstant(name, func, NONE); - layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails()); - descriptors->Append(&d); + Descriptor d; + if (kind == PROP_ACCESSOR_INFO) { + Handle<AccessorInfo> info = + Accessors::MakeAccessor(isolate, name, nullptr, nullptr, NONE); + d = Descriptor::AccessorConstant(name, info, NONE); } else { - Descriptor d = Descriptor::DataField(name, next_field_offset, NONE, - representations[kind]); - int field_width_in_words = d.GetDetails().field_width_in_words(); + d = Descriptor::DataField(name, next_field_offset, NONE, + representations[kind]); + } + PropertyDetails details = d.GetDetails(); + layout_descriptor = LayoutDescriptor::ShareAppend(map, details); + descriptors->Append(&d); + if (details.location() == kField) { + int field_width_in_words = details.field_width_in_words(); next_field_offset += field_width_in_words; - layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails()); - descriptors->Append(&d); - int field_index = d.GetDetails().field_index(); + int field_index = details.field_index(); bool is_inobject = field_index < map->GetInObjectProperties(); for (int bit = 0; bit < field_width_in_words; bit++) { CHECK_EQ(is_inobject && (kind == PROP_DOUBLE), @@ -920,11 +935,11 @@ TEST(Regress436816) { HeapObject* fake_object = HeapObject::FromAddress(fake_address); CHECK(fake_object->IsHeapObject()); - double boom_value = bit_cast<double>(fake_object); + uint64_t boom_value = bit_cast<uint64_t>(fake_object); for (int i = 0; i < kPropsCount; i++) { FieldIndex index = FieldIndex::ForDescriptor(*map, i); CHECK(map->IsUnboxedDoubleField(index)); - object->RawFastDoublePropertyAtPut(index, boom_value); + object->RawFastDoublePropertyAsBitsAtPut(index, boom_value); } CHECK(object->HasFastProperties()); CHECK(!object->map()->HasFastPointerLayout()); @@ -952,13 +967,14 @@ TEST(DescriptorArrayTrimming) { Handle<FieldType> any_type = FieldType::Any(isolate); Handle<Map> map = Map::Create(isolate, kFieldCount); for (int i = 0; i < kSplitFieldIndex; i++) { - map = Map::CopyWithField(map, MakeName("prop", i), any_type, NONE, - Representation::Smi(), - INSERT_TRANSITION).ToHandleChecked(); + map = Map::CopyWithField(map, MakeName("prop", i), any_type, NONE, kMutable, + Representation::Smi(), INSERT_TRANSITION) + .ToHandleChecked(); } - map = Map::CopyWithField(map, MakeName("dbl", kSplitFieldIndex), any_type, - NONE, Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); + map = + Map::CopyWithField(map, MakeName("dbl", kSplitFieldIndex), any_type, NONE, + kMutable, Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); CHECK(map->layout_descriptor()->IsConsistentWithMap(*map, true)); CHECK(map->layout_descriptor()->IsSlowLayout()); CHECK(map->owns_descriptors()); @@ -971,8 +987,9 @@ TEST(DescriptorArrayTrimming) { Handle<Map> tmp_map = map; for (int i = kSplitFieldIndex + 1; i < kFieldCount; i++) { tmp_map = Map::CopyWithField(tmp_map, MakeName("dbl", i), any_type, NONE, - Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); + kMutable, Representation::Double(), + INSERT_TRANSITION) + .ToHandleChecked(); CHECK(tmp_map->layout_descriptor()->IsConsistentWithMap(*tmp_map, true)); } // Check that descriptors are shared. @@ -1010,13 +1027,15 @@ TEST(DescriptorArrayTrimming) { Handle<Map> tmp_map = map; for (int i = kSplitFieldIndex + 1; i < kFieldCount - 1; i++) { tmp_map = Map::CopyWithField(tmp_map, MakeName("tagged", i), any_type, - NONE, Representation::Tagged(), - INSERT_TRANSITION).ToHandleChecked(); + NONE, kMutable, Representation::Tagged(), + INSERT_TRANSITION) + .ToHandleChecked(); CHECK(tmp_map->layout_descriptor()->IsConsistentWithMap(*tmp_map, true)); } - tmp_map = Map::CopyWithField(tmp_map, MakeString("dbl"), any_type, NONE, - Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); + tmp_map = + Map::CopyWithField(tmp_map, MakeString("dbl"), any_type, NONE, kMutable, + Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); CHECK(tmp_map->layout_descriptor()->IsConsistentWithMap(*tmp_map, true)); // Check that descriptors are shared. CHECK(tmp_map->owns_descriptors()); @@ -1039,15 +1058,15 @@ TEST(DoScavenge) { Handle<FieldType> any_type = FieldType::Any(isolate); Handle<Map> map = Map::Create(isolate, 10); - map = Map::CopyWithField(map, MakeName("prop", 0), any_type, NONE, - Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); + map = Map::CopyWithField(map, MakeName("prop", 0), any_type, NONE, kMutable, + Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); // Create object in new space. Handle<JSObject> obj = factory->NewJSObjectFromMap(map, NOT_TENURED); Handle<HeapNumber> heap_number = factory->NewHeapNumber(42.5); - obj->WriteToField(0, *heap_number); + WriteToField(*obj, 0, *heap_number); { // Ensure the object is properly set up. @@ -1101,12 +1120,12 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { Handle<FieldType> any_type = FieldType::Any(isolate); Handle<Map> map = Map::Create(isolate, 10); - map = Map::CopyWithField(map, MakeName("prop", 0), any_type, NONE, - Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); - map = Map::CopyWithField(map, MakeName("prop", 1), any_type, NONE, - Representation::Tagged(), - INSERT_TRANSITION).ToHandleChecked(); + map = Map::CopyWithField(map, MakeName("prop", 0), any_type, NONE, kMutable, + Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); + map = Map::CopyWithField(map, MakeName("prop", 1), any_type, NONE, kMutable, + Representation::Tagged(), INSERT_TRANSITION) + .ToHandleChecked(); // Create |obj_value| in old space. Handle<HeapObject> obj_value; @@ -1123,8 +1142,8 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { Handle<JSObject> obj = factory->NewJSObjectFromMap(map, NOT_TENURED); Handle<HeapNumber> heap_number = factory->NewHeapNumber(42.5); - obj->WriteToField(0, *heap_number); - obj->WriteToField(1, *obj_value); + WriteToField(*obj, 0, *heap_number); + WriteToField(*obj, 1, *obj_value); { // Ensure the object is properly set up. @@ -1218,19 +1237,19 @@ static void TestLayoutDescriptorHelper(Isolate* isolate, if (end_of_region_offset < instance_size) { CHECK_EQ(!expected_tagged, helper.IsTagged(end_of_region_offset)); } else { - CHECK_EQ(true, helper.IsTagged(end_of_region_offset)); + CHECK(helper.IsTagged(end_of_region_offset)); } } for (int offset = 0; offset < JSObject::kHeaderSize; offset += kPointerSize) { // Header queries - CHECK_EQ(true, helper.IsTagged(offset)); + CHECK(helper.IsTagged(offset)); int end_of_region_offset; - CHECK_EQ(true, helper.IsTagged(offset, end_offset, &end_of_region_offset)); + CHECK(helper.IsTagged(offset, end_offset, &end_of_region_offset)); CHECK_EQ(first_non_tagged_field_offset, end_of_region_offset); // Out of bounds queries - CHECK_EQ(true, helper.IsTagged(offset + instance_size)); + CHECK(helper.IsTagged(offset + instance_size)); } CHECK_EQ(all_fields_tagged, helper.all_fields_tagged()); @@ -1329,12 +1348,14 @@ TEST(LayoutDescriptorSharing) { Handle<Map> map = Map::Create(isolate, 64); for (int i = 0; i < 32; i++) { Handle<String> name = MakeName("prop", i); - map = Map::CopyWithField(map, name, any_type, NONE, Representation::Smi(), - INSERT_TRANSITION).ToHandleChecked(); + map = Map::CopyWithField(map, name, any_type, NONE, kMutable, + Representation::Smi(), INSERT_TRANSITION) + .ToHandleChecked(); } - split_map = Map::CopyWithField(map, MakeString("dbl"), any_type, NONE, - Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); + split_map = + Map::CopyWithField(map, MakeString("dbl"), any_type, NONE, kMutable, + Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); } Handle<LayoutDescriptor> split_layout_descriptor( split_map->layout_descriptor(), isolate); @@ -1342,9 +1363,10 @@ TEST(LayoutDescriptorSharing) { CHECK(split_layout_descriptor->IsSlowLayout()); CHECK(split_map->owns_descriptors()); - Handle<Map> map1 = Map::CopyWithField(split_map, MakeString("foo"), any_type, - NONE, Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); + Handle<Map> map1 = + Map::CopyWithField(split_map, MakeString("foo"), any_type, NONE, kMutable, + Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); CHECK(!split_map->owns_descriptors()); CHECK_EQ(*split_layout_descriptor, split_map->layout_descriptor()); @@ -1353,9 +1375,10 @@ TEST(LayoutDescriptorSharing) { CHECK_EQ(*split_layout_descriptor, map1->layout_descriptor()); CHECK(map1->layout_descriptor()->IsConsistentWithMap(*map1, true)); - Handle<Map> map2 = Map::CopyWithField(split_map, MakeString("bar"), any_type, - NONE, Representation::Tagged(), - INSERT_TRANSITION).ToHandleChecked(); + Handle<Map> map2 = + Map::CopyWithField(split_map, MakeString("bar"), any_type, NONE, kMutable, + Representation::Tagged(), INSERT_TRANSITION) + .ToHandleChecked(); // Layout descriptors should not be shared with |split_map|. CHECK(map2->owns_descriptors()); @@ -1406,12 +1429,12 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map, JSObject::MigrateToMap(obj, new_map); Address fake_object = reinterpret_cast<Address>(*obj_value) + kPointerSize; - double boom_value = bit_cast<double>(fake_object); + uint64_t boom_value = bit_cast<uint64_t>(fake_object); FieldIndex double_field_index = FieldIndex::ForDescriptor(*new_map, double_descriptor); CHECK(obj->IsUnboxedDoubleField(double_field_index)); - obj->RawFastDoublePropertyAtPut(double_field_index, boom_value); + obj->RawFastDoublePropertyAsBitsAtPut(double_field_index, boom_value); // Trigger GC to evacuate all candidates. CcTest::CollectGarbage(NEW_SPACE); @@ -1421,7 +1444,7 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map, FieldIndex::ForDescriptor(*new_map, tagged_descriptor); CHECK_EQ(*obj_value, obj->RawFastPropertyAt(tagged_field_index)); } - CHECK_EQ(boom_value, obj->RawFastDoublePropertyAt(double_field_index)); + CHECK_EQ(boom_value, obj->RawFastDoublePropertyAsBitsAt(double_field_index)); } @@ -1485,12 +1508,12 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, // barrier. JSObject::MigrateToMap(obj, new_map); - double boom_value = bit_cast<double>(UINT64_C(0xbaad0176a37c28e1)); + uint64_t boom_value = UINT64_C(0xbaad0176a37c28e1); FieldIndex double_field_index = FieldIndex::ForDescriptor(*new_map, double_descriptor); CHECK(obj->IsUnboxedDoubleField(double_field_index)); - obj->RawFastDoublePropertyAtPut(double_field_index, boom_value); + obj->RawFastDoublePropertyAsBitsAtPut(double_field_index, boom_value); // Trigger GC to evacuate all candidates. CcTest::CollectGarbage(OLD_SPACE); @@ -1503,7 +1526,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, FieldIndex::ForDescriptor(*new_map, tagged_descriptor); CHECK_EQ(*obj_value, obj->RawFastPropertyAt(tagged_field_index)); } - CHECK_EQ(boom_value, obj->RawFastDoublePropertyAt(double_field_index)); + CHECK_EQ(boom_value, obj->RawFastDoublePropertyAsBitsAt(double_field_index)); } enum OldToWriteBarrierKind { @@ -1525,12 +1548,12 @@ static void TestWriteBarrierObjectShiftFieldsRight( Handle<Map> map = Map::Create(isolate, 10); map = Map::CopyWithConstant(map, MakeName("prop", 0), func, NONE, INSERT_TRANSITION).ToHandleChecked(); - map = Map::CopyWithField(map, MakeName("prop", 1), any_type, NONE, - Representation::Double(), - INSERT_TRANSITION).ToHandleChecked(); - map = Map::CopyWithField(map, MakeName("prop", 2), any_type, NONE, - Representation::Tagged(), - INSERT_TRANSITION).ToHandleChecked(); + map = Map::CopyWithField(map, MakeName("prop", 1), any_type, NONE, kMutable, + Representation::Double(), INSERT_TRANSITION) + .ToHandleChecked(); + map = Map::CopyWithField(map, MakeName("prop", 2), any_type, NONE, kMutable, + Representation::Tagged(), INSERT_TRANSITION) + .ToHandleChecked(); // Shift fields right by turning constant property to a field. Handle<Map> new_map = Map::ReconfigureProperty( diff --git a/deps/v8/test/cctest/test-utils.cc b/deps/v8/test/cctest/test-utils.cc index 463672ccc8..b38bae5ba6 100644 --- a/deps/v8/test/cctest/test-utils.cc +++ b/deps/v8/test/cctest/test-utils.cc @@ -88,11 +88,11 @@ TEST(BitSetComputer) { uint32_t data = 0; data = BoolComputer::encode(data, 1, true); data = BoolComputer::encode(data, 4, true); - CHECK_EQ(true, BoolComputer::decode(data, 1)); - CHECK_EQ(true, BoolComputer::decode(data, 4)); - CHECK_EQ(false, BoolComputer::decode(data, 0)); - CHECK_EQ(false, BoolComputer::decode(data, 2)); - CHECK_EQ(false, BoolComputer::decode(data, 3)); + CHECK(BoolComputer::decode(data, 1)); + CHECK(BoolComputer::decode(data, 4)); + CHECK(!BoolComputer::decode(data, 0)); + CHECK(!BoolComputer::decode(data, 2)); + CHECK(!BoolComputer::decode(data, 3)); // Lets store 2 bits per item with 3000 items and verify the values are // correct. diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc index d7a624f56a..79edee5577 100644 --- a/deps/v8/test/cctest/test-weakmaps.cc +++ b/deps/v8/test/cctest/test-weakmaps.cc @@ -111,13 +111,10 @@ TEST(Weakness) { 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements()); // Make the global reference to the key weak. - { - HandleScope scope(isolate); - std::pair<Handle<Object>*, int> handle_and_id(&key, 1234); - GlobalHandles::MakeWeak( - key.location(), reinterpret_cast<void*>(&handle_and_id), - &WeakPointerCallback, v8::WeakCallbackType::kParameter); - } + std::pair<Handle<Object>*, int> handle_and_id(&key, 1234); + GlobalHandles::MakeWeak( + key.location(), reinterpret_cast<void*>(&handle_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); CHECK(global_handles->IsWeak(key.location())); CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); diff --git a/deps/v8/test/cctest/test-weaksets.cc b/deps/v8/test/cctest/test-weaksets.cc index c11e32b263..13e3b65886 100644 --- a/deps/v8/test/cctest/test-weaksets.cc +++ b/deps/v8/test/cctest/test-weaksets.cc @@ -110,13 +110,10 @@ TEST(WeakSet_Weakness) { 0, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements()); // Make the global reference to the key weak. - { - HandleScope scope(isolate); - std::pair<Handle<Object>*, int> handle_and_id(&key, 1234); - GlobalHandles::MakeWeak( - key.location(), reinterpret_cast<void*>(&handle_and_id), - &WeakPointerCallback, v8::WeakCallbackType::kParameter); - } + std::pair<Handle<Object>*, int> handle_and_id(&key, 1234); + GlobalHandles::MakeWeak( + key.location(), reinterpret_cast<void*>(&handle_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); CHECK(global_handles->IsWeak(key.location())); CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); diff --git a/deps/v8/test/cctest/unicode-helpers.h b/deps/v8/test/cctest/unicode-helpers.h new file mode 100644 index 0000000000..a09a8cbb3e --- /dev/null +++ b/deps/v8/test/cctest/unicode-helpers.h @@ -0,0 +1,32 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_CCTEST_UNICODE_HELPERS_H_ +#define V8_CCTEST_UNICODE_HELPERS_H_ + +#include "src/unicode.h" + +static int Ucs2CharLength(unibrow::uchar c) { + if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) { + return 0; + } else if (c < 0xffff) { + return 1; + } else { + return 2; + } +} + +static int Utf8LengthHelper(const char* s) { + unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty); + int length = 0; + for (; *s != '\0'; s++) { + unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(*s, &buffer); + length += Ucs2CharLength(tmp); + } + unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&buffer); + length += Ucs2CharLength(tmp); + return length; +} + +#endif // V8_CCTEST_UNICODE_HELPERS_H_ diff --git a/deps/v8/test/cctest/wasm/test-managed.cc b/deps/v8/test/cctest/wasm/test-managed.cc deleted file mode 100644 index 00b1c9bb57..0000000000 --- a/deps/v8/test/cctest/wasm/test-managed.cc +++ /dev/null @@ -1,59 +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 <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 4571364980..55e7a00702 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -6,7 +6,9 @@ #include <stdlib.h> #include <string.h> +#include "src/assembler-inl.h" #include "src/base/bits.h" +#include "src/objects-inl.h" #include "src/wasm/wasm-macro-gen.h" #include "test/cctest/cctest.h" @@ -1319,6 +1321,9 @@ WASM_EXEC_TEST(I64ReinterpretF64) { } } +// Do not run this test in a simulator because of signalling NaN issues on ia32. +#ifndef USE_SIMULATOR + WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) { REQUIRE(I64ReinterpretF64); WasmRunner<int64_t> r(execution_mode); @@ -1328,6 +1333,7 @@ WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) { // This is a signalling nan. CHECK_EQ(0x7ff4000000000000, r.Call()); } +#endif WASM_EXEC_TEST(F64ReinterpretI64) { REQUIRE(F64ReinterpretI64); 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 38430f292c..4f7c9210f9 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc @@ -6,6 +6,7 @@ #include <stdlib.h> #include <string.h> +#include "src/assembler-inl.h" #include "src/base/platform/elapsed-timer.h" #include "src/wasm/wasm-macro-gen.h" 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 e355b68d19..559180cef9 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc @@ -8,10 +8,9 @@ #include <memory> -#include "src/wasm/wasm-macro-gen.h" - +#include "src/assembler-inl.h" #include "src/wasm/wasm-interpreter.h" - +#include "src/wasm/wasm-macro-gen.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" @@ -219,7 +218,7 @@ TEST(Breakpoint_I32Add) { } TEST(Step_I32Mul) { - static const int kTraceLength = 5; + static const int kTraceLength = 4; byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreted); @@ -343,57 +342,59 @@ TEST(GrowMemoryInvalidSize) { TEST(TestPossibleNondeterminism) { { - // F32Div may produced NaN - WasmRunner<float, float, float> r(kExecuteInterpreted); - BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - r.Call(1048575.5f, 2.5f); + WasmRunner<int32_t, float> r(kExecuteInterpreted); + BUILD(r, WASM_I32_REINTERPRET_F32(WASM_GET_LOCAL(0))); + r.Call(1048575.5f); CHECK(!r.possible_nondeterminism()); - r.Call(0.0f, 0.0f); + r.Call(std::numeric_limits<float>::quiet_NaN()); CHECK(r.possible_nondeterminism()); } { - // F32Sqrt may produced NaN - WasmRunner<float, float> r(kExecuteInterpreted); - BUILD(r, WASM_F32_SQRT(WASM_GET_LOCAL(0))); - r.Call(16.0f); + WasmRunner<int64_t, double> r(kExecuteInterpreted); + BUILD(r, WASM_I64_REINTERPRET_F64(WASM_GET_LOCAL(0))); + r.Call(16.0); CHECK(!r.possible_nondeterminism()); - r.Call(-1048575.5f); + r.Call(std::numeric_limits<double>::quiet_NaN()); CHECK(r.possible_nondeterminism()); } { - // F32Mul may produced NaN - WasmRunner<float, float, float> r(kExecuteInterpreted); - BUILD(r, WASM_F32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - r.Call(1048575.5f, 2.5f); + WasmRunner<float, float> r(kExecuteInterpreted); + BUILD(r, WASM_F32_COPYSIGN(WASM_F32(42.0f), WASM_GET_LOCAL(0))); + r.Call(16.0f); CHECK(!r.possible_nondeterminism()); - r.Call(std::numeric_limits<float>::infinity(), 0.0f); + r.Call(std::numeric_limits<double>::quiet_NaN()); CHECK(r.possible_nondeterminism()); } { - // F64Div may produced NaN - WasmRunner<double, double, double> r(kExecuteInterpreted); - BUILD(r, WASM_F64_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - r.Call(1048575.5, 2.5); + WasmRunner<double, double> r(kExecuteInterpreted); + BUILD(r, WASM_F64_COPYSIGN(WASM_F64(42.0), WASM_GET_LOCAL(0))); + r.Call(16.0); CHECK(!r.possible_nondeterminism()); - r.Call(0.0, 0.0); + r.Call(std::numeric_limits<double>::quiet_NaN()); CHECK(r.possible_nondeterminism()); } { - // F64Sqrt may produced NaN - WasmRunner<double, double> r(kExecuteInterpreted); - BUILD(r, WASM_F64_SQRT(WASM_GET_LOCAL(0))); - r.Call(1048575.5); + int32_t index = 16; + WasmRunner<int32_t, float> r(kExecuteInterpreted); + r.module().AddMemory(WasmModule::kPageSize); + BUILD(r, WASM_STORE_MEM(MachineType::Float32(), WASM_I32V(index), + WASM_GET_LOCAL(0)), + WASM_I32V(index)); + r.Call(1345.3456f); CHECK(!r.possible_nondeterminism()); - r.Call(-1048575.5); + r.Call(std::numeric_limits<float>::quiet_NaN()); CHECK(r.possible_nondeterminism()); } { - // F64Mul may produced NaN - WasmRunner<double, double, double> r(kExecuteInterpreted); - BUILD(r, WASM_F64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - r.Call(1048575.5, 2.5); + int32_t index = 16; + WasmRunner<int32_t, double> r(kExecuteInterpreted); + r.module().AddMemory(WasmModule::kPageSize); + BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_I32V(index), + WASM_GET_LOCAL(0)), + WASM_I32V(index)); + r.Call(1345.3456); CHECK(!r.possible_nondeterminism()); - r.Call(std::numeric_limits<double>::infinity(), 0.0); + r.Call(std::numeric_limits<double>::quiet_NaN()); CHECK(r.possible_nondeterminism()); } } 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 ee6b066282..add2b02fd4 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc @@ -7,8 +7,8 @@ #include <stdlib.h> #include <string.h> +#include "src/assembler-inl.h" #include "src/wasm/wasm-macro-gen.h" - #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" 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 468dc81159..03ffb7ac65 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -5,6 +5,7 @@ #include <stdlib.h> #include <string.h> +#include "src/objects-inl.h" #include "src/snapshot/code-serializer.h" #include "src/version.h" #include "src/wasm/module-decoder.h" @@ -270,9 +271,9 @@ class WasmSerializationTest { 0); } Handle<JSObject> instance = - WasmModule::Instantiate(current_isolate(), &thrower, module_object, - Handle<JSReceiver>::null(), - Handle<JSArrayBuffer>::null()) + SyncInstantiate(current_isolate(), &thrower, module_object, + Handle<JSReceiver>::null(), + MaybeHandle<JSArrayBuffer>()) .ToHandleChecked(); Handle<Object> params[1] = { Handle<Object>(Smi::FromInt(41), current_isolate())}; @@ -306,14 +307,6 @@ class WasmSerializationTest { } 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}; - EMIT_CODE_WITH_END(f, code); - f->ExportAs(CStrVector(kFunctionName)); - ZoneBuffer buffer(&zone_); WasmSerializationTest::BuildWireBytes(zone(), &buffer); @@ -325,19 +318,13 @@ class WasmSerializationTest { 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<WasmModuleObject> module_object = + SyncCompile(serialization_isolate, &thrower, + ModuleWireBytes(buffer.begin(), buffer.end())); - MaybeHandle<WasmCompiledModule> compiled_module = - decoding_result.val->CompileFunctions( - serialization_isolate, module_wrapper, &thrower, - ModuleWireBytes(buffer.begin(), buffer.end()), - Handle<Script>::null(), Vector<const byte>::empty()); + MaybeHandle<WasmCompiledModule> compiled_module( + module_object.ToHandleChecked()->compiled_module(), + serialization_isolate); CHECK(!compiled_module.is_null()); Handle<JSObject> module_obj = WasmModuleObject::New( serialization_isolate, compiled_module.ToHandleChecked()); @@ -444,10 +431,8 @@ TEST(BlockWasmCodeGen) { CcTest::isolate()->SetAllowCodeGenerationFromStringsCallback(False); ErrorThrower thrower(isolate, "block codegen"); - MaybeHandle<WasmModuleObject> ret = wasm::CreateModuleObjectFromBytes( - isolate, buffer.begin(), buffer.end(), &thrower, - wasm::ModuleOrigin::kWasmOrigin, Handle<v8::internal::Script>::null(), - Vector<const byte>::empty()); + MaybeHandle<WasmModuleObject> ret = wasm::SyncCompile( + isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end())); CcTest::isolate()->SetAllowCodeGenerationFromStringsCallback(nullptr); CHECK(ret.is_null()); CHECK(thrower.error()); 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 f34a1a323e..bd3d3ba39f 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc @@ -4,8 +4,9 @@ #include <stdlib.h> +#include "src/assembler-inl.h" +#include "src/objects-inl.h" #include "src/v8.h" - #include "test/cctest/cctest.h" #include "test/cctest/compiler/c-signature.h" #include "test/cctest/wasm/wasm-run-utils.h" diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc index 9764545d45..42b0a959f5 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/assembler-inl.h" #include "src/wasm/wasm-macro-gen.h" - #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" @@ -18,8 +18,24 @@ namespace { typedef float (*FloatUnOp)(float); typedef float (*FloatBinOp)(float, float); typedef int32_t (*FloatCompareOp)(float, float); +typedef int32_t (*Int32UnOp)(int32_t); typedef int32_t (*Int32BinOp)(int32_t, int32_t); +typedef int32_t (*Int32ShiftOp)(int32_t, int); +typedef int16_t (*Int16UnOp)(int16_t); +typedef int16_t (*Int16BinOp)(int16_t, int16_t); +typedef int16_t (*Int16ShiftOp)(int16_t, int); +typedef int8_t (*Int8UnOp)(int8_t); +typedef int8_t (*Int8BinOp)(int8_t, int8_t); +typedef int8_t (*Int8ShiftOp)(int8_t, int); + +#if V8_TARGET_ARCH_ARM +// Floating point specific value functions, only used by ARM so far. +int32_t Equal(float a, float b) { return a == b ? 1 : 0; } +int32_t NotEqual(float a, float b) { return a != b ? 1 : 0; } +#endif // V8_TARGET_ARCH_ARM + +// Generic expected value functions. template <typename T> T Negate(T a) { return -a; @@ -36,20 +52,160 @@ T Sub(T a, T b) { } template <typename T> -int32_t Equal(T a, T b) { - return a == b ? 0xFFFFFFFF : 0; +T Mul(T a, T b) { + return a * b; } template <typename T> -int32_t NotEqual(T a, T b) { - return a != b ? 0xFFFFFFFF : 0; +T Minimum(T a, T b) { + return a <= b ? a : b; } -#if V8_TARGET_ARCH_ARM -int32_t Equal(float a, float b) { return a == b ? 0xFFFFFFFF : 0; } +template <typename T> +T Maximum(T a, T b) { + return a >= b ? a : b; +} -int32_t NotEqual(float a, float b) { return a != b ? 0xFFFFFFFF : 0; } -#endif // V8_TARGET_ARCH_ARM +template <typename T> +T UnsignedMinimum(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) <= static_cast<UnsignedT>(b) ? a : b; +} + +template <typename T> +T UnsignedMaximum(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) >= static_cast<UnsignedT>(b) ? a : b; +} + +template <typename T> +T Equal(T a, T b) { + return a == b ? 1 : 0; +} + +template <typename T> +T NotEqual(T a, T b) { + return a != b ? 1 : 0; +} + +template <typename T> +T Greater(T a, T b) { + return a > b ? 1 : 0; +} + +template <typename T> +T GreaterEqual(T a, T b) { + return a >= b ? 1 : 0; +} + +template <typename T> +T Less(T a, T b) { + return a < b ? 1 : 0; +} + +template <typename T> +T LessEqual(T a, T b) { + return a <= b ? 1 : 0; +} + +template <typename T> +T UnsignedGreater(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) > static_cast<UnsignedT>(b) ? 1 : 0; +} + +template <typename T> +T UnsignedGreaterEqual(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) >= static_cast<UnsignedT>(b) ? 1 : 0; +} + +template <typename T> +T UnsignedLess(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) < static_cast<UnsignedT>(b) ? 1 : 0; +} + +template <typename T> +T UnsignedLessEqual(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) <= static_cast<UnsignedT>(b) ? 1 : 0; +} + +template <typename T> +T LogicalShiftLeft(T a, int shift) { + return a << shift; +} + +template <typename T> +T LogicalShiftRight(T a, int shift) { + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<UnsignedT>(a) >> shift; +} + +template <typename T> +int64_t Widen(T value) { + static_assert(sizeof(int64_t) > sizeof(T), "T must be int32_t or smaller"); + return static_cast<int64_t>(value); +} + +template <typename T> +int64_t UnsignedWiden(T value) { + static_assert(sizeof(int64_t) > sizeof(T), "T must be int32_t or smaller"); + using UnsignedT = typename std::make_unsigned<T>::type; + return static_cast<int64_t>(static_cast<UnsignedT>(value)); +} + +template <typename T> +T Clamp(int64_t value) { + static_assert(sizeof(int64_t) > sizeof(T), "T must be int32_t or smaller"); + int64_t min = static_cast<int64_t>(std::numeric_limits<T>::min()); + int64_t max = static_cast<int64_t>(std::numeric_limits<T>::max()); + int64_t clamped = std::max(min, std::min(max, value)); + return static_cast<T>(clamped); +} + +template <typename T> +T AddSaturate(T a, T b) { + return Clamp<T>(Widen(a) + Widen(b)); +} + +template <typename T> +T SubSaturate(T a, T b) { + return Clamp<T>(Widen(a) - Widen(b)); +} + +template <typename T> +T UnsignedAddSaturate(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return Clamp<UnsignedT>(UnsignedWiden(a) + UnsignedWiden(b)); +} + +template <typename T> +T UnsignedSubSaturate(T a, T b) { + using UnsignedT = typename std::make_unsigned<T>::type; + return Clamp<UnsignedT>(UnsignedWiden(a) - UnsignedWiden(b)); +} + +template <typename T> +T And(T a, T b) { + return a & b; +} + +template <typename T> +T Or(T a, T b) { + return a | b; +} + +template <typename T> +T Xor(T a, T b) { + return a ^ b; +} + +template <typename T> +T Not(T a) { + return ~a; +} } // namespace @@ -74,6 +230,44 @@ int32_t NotEqual(float a, float b) { return a != b ? 0xFFFFFFFF : 0; } #define WASM_SIMD_CHECK_SPLAT4(TYPE, value, LANE_TYPE, lv) \ WASM_SIMD_CHECK4(TYPE, value, LANE_TYPE, lv, lv, lv, lv) +#define WASM_SIMD_CHECK8(TYPE, value, LANE_TYPE, lv0, lv1, lv2, lv3, lv4, lv5, \ + lv6, lv7) \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv0, 0) \ + , WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv1, 1), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv2, 2), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv3, 3), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv4, 4), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv5, 5), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv6, 6), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv7, 7) + +#define WASM_SIMD_CHECK_SPLAT8(TYPE, value, LANE_TYPE, lv) \ + WASM_SIMD_CHECK8(TYPE, value, LANE_TYPE, lv, lv, lv, lv, lv, lv, lv, lv) + +#define WASM_SIMD_CHECK16(TYPE, value, LANE_TYPE, lv0, lv1, lv2, lv3, lv4, \ + lv5, lv6, lv7, lv8, lv9, lv10, lv11, lv12, lv13, \ + lv14, lv15) \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv0, 0) \ + , WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv1, 1), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv2, 2), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv3, 3), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv4, 4), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv5, 5), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv6, 6), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv7, 7), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv8, 8), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv9, 9), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv10, 10), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv11, 11), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv12, 12), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv13, 13), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv14, 14), \ + WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lv15, 15) + +#define WASM_SIMD_CHECK_SPLAT16(TYPE, value, LANE_TYPE, lv) \ + WASM_SIMD_CHECK16(TYPE, value, LANE_TYPE, lv, lv, lv, lv, lv, lv, lv, lv, \ + lv, lv, lv, lv, lv, lv, lv, lv) + #define WASM_SIMD_CHECK_F32_LANE(TYPE, value, lane_value, lane_index) \ WASM_IF( \ WASM_I32_NE(WASM_I32_REINTERPRET_F32(WASM_GET_LOCAL(lane_value)), \ @@ -90,6 +284,37 @@ int32_t NotEqual(float a, float b) { return a != b ? 0xFFFFFFFF : 0; } #define WASM_SIMD_CHECK_SPLAT4_F32(TYPE, value, lv) \ WASM_SIMD_CHECK4_F32(TYPE, value, lv, lv, lv, lv) +#define TO_BYTE(val) static_cast<byte>(val) +#define WASM_SIMD_OP(op) kSimdPrefix, TO_BYTE(op) +#define WASM_SIMD_SPLAT(Type, x) x, WASM_SIMD_OP(kExpr##Type##Splat) +#define WASM_SIMD_UNOP(op, x) x, WASM_SIMD_OP(op) +#define WASM_SIMD_BINOP(op, x, y) x, y, WASM_SIMD_OP(op) +#define WASM_SIMD_SHIFT_OP(op, shift, x) x, WASM_SIMD_OP(op), TO_BYTE(shift) +#define WASM_SIMD_SELECT(format, x, y, z) \ + x, y, z, WASM_SIMD_OP(kExprS##format##Select) +// Since boolean vectors can't be checked directly, materialize them into +// integer vectors using a Select operation. +#define WASM_SIMD_MATERIALIZE_BOOLS(format, x) \ + x, WASM_SIMD_I##format##_SPLAT(WASM_ONE), \ + WASM_SIMD_I##format##_SPLAT(WASM_ZERO), \ + WASM_SIMD_OP(kExprS##format##Select) + +#define WASM_SIMD_I16x8_SPLAT(x) x, WASM_SIMD_OP(kExprI16x8Splat) +#define WASM_SIMD_I16x8_EXTRACT_LANE(lane, x) \ + x, WASM_SIMD_OP(kExprI16x8ExtractLane), TO_BYTE(lane) +#define WASM_SIMD_I16x8_REPLACE_LANE(lane, x, y) \ + x, y, WASM_SIMD_OP(kExprI16x8ReplaceLane), TO_BYTE(lane) +#define WASM_SIMD_I8x16_SPLAT(x) x, WASM_SIMD_OP(kExprI8x16Splat) +#define WASM_SIMD_I8x16_EXTRACT_LANE(lane, x) \ + x, WASM_SIMD_OP(kExprI8x16ExtractLane), TO_BYTE(lane) +#define WASM_SIMD_I8x16_REPLACE_LANE(lane, x, y) \ + x, y, WASM_SIMD_OP(kExprI8x16ReplaceLane), TO_BYTE(lane) + +#define WASM_SIMD_F32x4_FROM_I32x4(x) x, WASM_SIMD_OP(kExprF32x4SConvertI32x4) +#define WASM_SIMD_F32x4_FROM_U32x4(x) x, WASM_SIMD_OP(kExprF32x4UConvertI32x4) +#define WASM_SIMD_I32x4_FROM_F32x4(x) x, WASM_SIMD_OP(kExprI32x4SConvertF32x4) +#define WASM_SIMD_U32x4_FROM_F32x4(x) x, WASM_SIMD_OP(kExprI32x4UConvertF32x4) + #if V8_TARGET_ARCH_ARM WASM_EXEC_TEST(F32x4Splat) { FLAG_wasm_simd_prototype = true; @@ -154,34 +379,6 @@ WASM_EXEC_TEST(F32x4FromInt32x4) { } } -WASM_EXEC_TEST(S32x4Select) { - FLAG_wasm_simd_prototype = true; - WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); - byte val1 = 0; - byte val2 = 1; - byte mask = r.AllocateLocal(kWasmS128); - byte src1 = r.AllocateLocal(kWasmS128); - byte src2 = r.AllocateLocal(kWasmS128); - BUILD(r, - - WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_SPLAT(WASM_ZERO)), - WASM_SET_LOCAL(src1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(val1))), - WASM_SET_LOCAL(src2, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(val2))), - WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_REPLACE_LANE( - 1, WASM_GET_LOCAL(mask), WASM_I32V(-1))), - WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_REPLACE_LANE( - 2, WASM_GET_LOCAL(mask), WASM_I32V(-1))), - WASM_SET_LOCAL(mask, WASM_SIMD_S32x4_SELECT(WASM_GET_LOCAL(mask), - WASM_GET_LOCAL(src1), - WASM_GET_LOCAL(src2))), - WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val2, 0), - WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val1, 1), - WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val1, 2), - WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val2, 3), WASM_ONE); - - CHECK_EQ(1, r.Call(0x1234, 0x5678)); -} - void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op) { FLAG_wasm_simd_prototype = true; WasmRunner<int32_t, float, float> r(kExecuteCompiled); @@ -189,8 +386,7 @@ void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op) { byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), - WASM_SET_LOCAL(simd, - WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))), + WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd, expected), WASM_ONE); FOR_FLOAT32_INPUTS(i) { @@ -212,9 +408,8 @@ void RunF32x4BinOpTest(WasmOpcode simd_op, FloatBinOp expected_op) { byte simd1 = r.AllocateLocal(kWasmS128); BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), - WASM_SET_LOCAL(simd1, - WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0), - WASM_GET_LOCAL(simd1))), + WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1))), WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected), WASM_ONE); FOR_FLOAT32_INPUTS(i) { @@ -245,8 +440,9 @@ void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), WASM_SET_LOCAL(simd1, - WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0), - WASM_GET_LOCAL(simd1))), + WASM_SIMD_MATERIALIZE_BOOLS( + 32x4, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1)))), WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE); FOR_FLOAT32_INPUTS(i) { @@ -317,6 +513,187 @@ WASM_EXEC_TEST(I32x4ReplaceLane) { #if V8_TARGET_ARCH_ARM +WASM_EXEC_TEST(I16x8Splat) { + FLAG_wasm_simd_prototype = true; + + WasmRunner<int32_t, int32_t> r(kExecuteCompiled); + byte lane_val = 0; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, + WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))), + WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE); + + FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } +} + +WASM_EXEC_TEST(I16x8ReplaceLane) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte old_val = 0; + byte new_val = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(old_val))), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(0, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(1, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, old_val, old_val, + old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(2, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, old_val, + old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(3, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val, + old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(4, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val, + new_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(5, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(6, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE); + + CHECK_EQ(1, r.Call(1, 2)); +} + +WASM_EXEC_TEST(I8x16Splat) { + FLAG_wasm_simd_prototype = true; + + WasmRunner<int32_t, int32_t> r(kExecuteCompiled); + byte lane_val = 0; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, + WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))), + WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE); + + FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } +} + +WASM_EXEC_TEST(I8x16ReplaceLane) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte old_val = 0; + byte new_val = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(old_val))), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(0, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(1, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(2, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(3, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + old_val, old_val, old_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(4, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, old_val, old_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(5, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, old_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(6, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, old_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(7, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, old_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(8, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, old_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(9, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, new_val, + old_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(10, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, new_val, + new_val, old_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(11, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, new_val, + new_val, new_val, old_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(12, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, old_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(13, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, old_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(14, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, new_val, + new_val, new_val, new_val, new_val, new_val, old_val), + WASM_SET_LOCAL(simd, + WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), + WASM_GET_LOCAL(new_val))), + WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); + + CHECK_EQ(1, r.Call(1, 2)); +} + // Determines if conversion from float to int will be valid. bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { const double max_uint = static_cast<double>(0xffffffffu); @@ -380,6 +757,23 @@ WASM_EXEC_TEST(I32x4FromFloat32x4) { CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value)); } } + +void RunI32x4UnOpTest(WasmOpcode simd_op, Int32UnOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte expected = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), + WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE); + + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } +} + +WASM_EXEC_TEST(I32x4Neg) { RunI32x4UnOpTest(kExprI32x4Neg, Negate); } + +WASM_EXEC_TEST(S128Not) { RunI32x4UnOpTest(kExprS128Not, Not); } #endif // V8_TARGET_ARCH_ARM void RunI32x4BinOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { @@ -392,9 +786,8 @@ void RunI32x4BinOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { byte simd1 = r.AllocateLocal(kWasmS128); BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(b))), - WASM_SET_LOCAL(simd1, - WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0), - WASM_GET_LOCAL(simd1))), + WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1))), WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE); FOR_INT32_INPUTS(i) { @@ -407,7 +800,438 @@ WASM_EXEC_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); } WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } #if V8_TARGET_ARCH_ARM -WASM_EXEC_TEST(I32x4Equal) { RunI32x4BinOpTest(kExprI32x4Eq, Equal); } +WASM_EXEC_TEST(I32x4Mul) { RunI32x4BinOpTest(kExprI32x4Mul, Mul); } + +WASM_EXEC_TEST(I32x4Min) { RunI32x4BinOpTest(kExprI32x4MinS, Minimum); } + +WASM_EXEC_TEST(I32x4Max) { RunI32x4BinOpTest(kExprI32x4MaxS, Maximum); } + +WASM_EXEC_TEST(Ui32x4Min) { + RunI32x4BinOpTest(kExprI32x4MinU, UnsignedMinimum); +} + +WASM_EXEC_TEST(Ui32x4Max) { + RunI32x4BinOpTest(kExprI32x4MaxU, UnsignedMaximum); +} + +WASM_EXEC_TEST(S128And) { RunI32x4BinOpTest(kExprS128And, And); } + +WASM_EXEC_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } + +WASM_EXEC_TEST(S128Xor) { RunI32x4BinOpTest(kExprS128Xor, Xor); } + +void RunI32x4CompareOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte b = 1; + byte expected = 2; + byte simd0 = r.AllocateLocal(kWasmS128); + byte simd1 = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(b))), + WASM_SET_LOCAL(simd1, + WASM_SIMD_MATERIALIZE_BOOLS( + 32x4, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1)))), + WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } + } +} + +WASM_EXEC_TEST(I32x4Equal) { RunI32x4CompareOpTest(kExprI32x4Eq, Equal); } + +WASM_EXEC_TEST(I32x4NotEqual) { RunI32x4CompareOpTest(kExprI32x4Ne, NotEqual); } + +WASM_EXEC_TEST(I32x4Greater) { RunI32x4CompareOpTest(kExprI32x4GtS, Greater); } + +WASM_EXEC_TEST(I32x4GreaterEqual) { + RunI32x4CompareOpTest(kExprI32x4GeS, GreaterEqual); +} + +WASM_EXEC_TEST(I32x4Less) { RunI32x4CompareOpTest(kExprI32x4LtS, Less); } + +WASM_EXEC_TEST(I32x4LessEqual) { + RunI32x4CompareOpTest(kExprI32x4LeS, LessEqual); +} + +WASM_EXEC_TEST(Ui32x4Greater) { + RunI32x4CompareOpTest(kExprI32x4GtU, UnsignedGreater); +} + +WASM_EXEC_TEST(Ui32x4GreaterEqual) { + RunI32x4CompareOpTest(kExprI32x4GeU, UnsignedGreaterEqual); +} + +WASM_EXEC_TEST(Ui32x4Less) { + RunI32x4CompareOpTest(kExprI32x4LtU, UnsignedLess); +} + +WASM_EXEC_TEST(Ui32x4LessEqual) { + RunI32x4CompareOpTest(kExprI32x4LeU, UnsignedLessEqual); +} + +void RunI32x4ShiftOpTest(WasmOpcode simd_op, Int32ShiftOp expected_op, + int shift) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte expected = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL( + simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), + WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE); + + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } +} + +WASM_EXEC_TEST(I32x4Shl) { + RunI32x4ShiftOpTest(kExprI32x4Shl, LogicalShiftLeft, 1); +} + +WASM_EXEC_TEST(I32x4ShrS) { + RunI32x4ShiftOpTest(kExprI32x4ShrS, ArithmeticShiftRight, 1); +} + +WASM_EXEC_TEST(I32x4ShrU) { + RunI32x4ShiftOpTest(kExprI32x4ShrU, LogicalShiftRight, 1); +} + +void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte expected = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), + WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE); + + FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } +} + +WASM_EXEC_TEST(I16x8Neg) { RunI16x8UnOpTest(kExprI16x8Neg, Negate); } + +void RunI16x8BinOpTest(WasmOpcode simd_op, Int16BinOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte b = 1; + byte expected = 2; + byte simd0 = r.AllocateLocal(kWasmS128); + byte simd1 = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(b))), + WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1))), + WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE); + + FOR_INT16_INPUTS(i) { + FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } + } +} + +WASM_EXEC_TEST(I16x8Add) { RunI16x8BinOpTest(kExprI16x8Add, Add); } + +WASM_EXEC_TEST(I16x8AddSaturate) { + RunI16x8BinOpTest(kExprI16x8AddSaturateS, AddSaturate); +} + +WASM_EXEC_TEST(I16x8Sub) { RunI16x8BinOpTest(kExprI16x8Sub, Sub); } + +WASM_EXEC_TEST(I16x8SubSaturate) { + RunI16x8BinOpTest(kExprI16x8SubSaturateS, SubSaturate); +} + +WASM_EXEC_TEST(I16x8Mul) { RunI16x8BinOpTest(kExprI16x8Mul, Mul); } + +WASM_EXEC_TEST(I16x8Min) { RunI16x8BinOpTest(kExprI16x8MinS, Minimum); } + +WASM_EXEC_TEST(I16x8Max) { RunI16x8BinOpTest(kExprI16x8MaxS, Maximum); } + +WASM_EXEC_TEST(Ui16x8AddSaturate) { + RunI16x8BinOpTest(kExprI16x8AddSaturateU, UnsignedAddSaturate); +} + +WASM_EXEC_TEST(Ui16x8SubSaturate) { + RunI16x8BinOpTest(kExprI16x8SubSaturateU, UnsignedSubSaturate); +} + +WASM_EXEC_TEST(Ui16x8Min) { + RunI16x8BinOpTest(kExprI16x8MinU, UnsignedMinimum); +} + +WASM_EXEC_TEST(Ui16x8Max) { + RunI16x8BinOpTest(kExprI16x8MaxU, UnsignedMaximum); +} + +void RunI16x8CompareOpTest(WasmOpcode simd_op, Int16BinOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte b = 1; + byte expected = 2; + byte simd0 = r.AllocateLocal(kWasmS128); + byte simd1 = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(b))), + WASM_SET_LOCAL(simd1, + WASM_SIMD_MATERIALIZE_BOOLS( + 16x8, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1)))), + WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE); + + FOR_INT16_INPUTS(i) { + FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } + } +} + +WASM_EXEC_TEST(I16x8Equal) { RunI16x8CompareOpTest(kExprI16x8Eq, Equal); } + +WASM_EXEC_TEST(I16x8NotEqual) { RunI16x8CompareOpTest(kExprI16x8Ne, NotEqual); } + +WASM_EXEC_TEST(I16x8Greater) { RunI16x8CompareOpTest(kExprI16x8GtS, Greater); } + +WASM_EXEC_TEST(I16x8GreaterEqual) { + RunI16x8CompareOpTest(kExprI16x8GeS, GreaterEqual); +} + +WASM_EXEC_TEST(I16x8Less) { RunI16x8CompareOpTest(kExprI16x8LtS, Less); } + +WASM_EXEC_TEST(I16x8LessEqual) { + RunI16x8CompareOpTest(kExprI16x8LeS, LessEqual); +} + +WASM_EXEC_TEST(Ui16x8Greater) { + RunI16x8CompareOpTest(kExprI16x8GtU, UnsignedGreater); +} + +WASM_EXEC_TEST(Ui16x8GreaterEqual) { + RunI16x8CompareOpTest(kExprI16x8GeU, UnsignedGreaterEqual); +} + +WASM_EXEC_TEST(Ui16x8Less) { + RunI16x8CompareOpTest(kExprI16x8LtU, UnsignedLess); +} + +WASM_EXEC_TEST(Ui16x8LessEqual) { + RunI16x8CompareOpTest(kExprI16x8LeU, UnsignedLessEqual); +} + +void RunI16x8ShiftOpTest(WasmOpcode simd_op, Int16ShiftOp expected_op, + int shift) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte expected = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL( + simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), + WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE); + + FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } +} + +WASM_EXEC_TEST(I16x8Shl) { + RunI16x8ShiftOpTest(kExprI16x8Shl, LogicalShiftLeft, 1); +} + +WASM_EXEC_TEST(I16x8ShrS) { + RunI16x8ShiftOpTest(kExprI16x8ShrS, ArithmeticShiftRight, 1); +} + +WASM_EXEC_TEST(I16x8ShrU) { + RunI16x8ShiftOpTest(kExprI16x8ShrU, LogicalShiftRight, 1); +} + +void RunI8x16UnOpTest(WasmOpcode simd_op, Int8UnOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte expected = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), + WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); + + FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } +} + +WASM_EXEC_TEST(I8x16Neg) { RunI8x16UnOpTest(kExprI8x16Neg, Negate); } + +void RunI8x16BinOpTest(WasmOpcode simd_op, Int8BinOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte b = 1; + byte expected = 2; + byte simd0 = r.AllocateLocal(kWasmS128); + byte simd1 = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(b))), + WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1))), + WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE); + + FOR_INT8_INPUTS(i) { + FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } + } +} + +WASM_EXEC_TEST(I8x16Add) { RunI8x16BinOpTest(kExprI8x16Add, Add); } + +WASM_EXEC_TEST(I8x16AddSaturate) { + RunI8x16BinOpTest(kExprI8x16AddSaturateS, AddSaturate); +} + +WASM_EXEC_TEST(I8x16Sub) { RunI8x16BinOpTest(kExprI8x16Sub, Sub); } + +WASM_EXEC_TEST(I8x16SubSaturate) { + RunI8x16BinOpTest(kExprI8x16SubSaturateS, SubSaturate); +} + +WASM_EXEC_TEST(I8x16Mul) { RunI8x16BinOpTest(kExprI8x16Mul, Mul); } + +WASM_EXEC_TEST(I8x16Min) { RunI8x16BinOpTest(kExprI8x16MinS, Minimum); } + +WASM_EXEC_TEST(I8x16Max) { RunI8x16BinOpTest(kExprI8x16MaxS, Maximum); } + +WASM_EXEC_TEST(Ui8x16AddSaturate) { + RunI8x16BinOpTest(kExprI8x16AddSaturateU, UnsignedAddSaturate); +} + +WASM_EXEC_TEST(Ui8x16SubSaturate) { + RunI8x16BinOpTest(kExprI8x16SubSaturateU, UnsignedSubSaturate); +} + +WASM_EXEC_TEST(Ui8x16Min) { + RunI8x16BinOpTest(kExprI8x16MinU, UnsignedMinimum); +} + +WASM_EXEC_TEST(Ui8x16Max) { + RunI8x16BinOpTest(kExprI8x16MaxU, UnsignedMaximum); +} + +void RunI8x16CompareOpTest(WasmOpcode simd_op, Int8BinOp expected_op) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte b = 1; + byte expected = 2; + byte simd0 = r.AllocateLocal(kWasmS128); + byte simd1 = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(b))), + WASM_SET_LOCAL(simd1, + WASM_SIMD_MATERIALIZE_BOOLS( + 8x16, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), + WASM_GET_LOCAL(simd1)))), + WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE); + + FOR_INT8_INPUTS(i) { + FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } + } +} + +WASM_EXEC_TEST(I8x16Equal) { RunI8x16CompareOpTest(kExprI8x16Eq, Equal); } + +WASM_EXEC_TEST(I8x16NotEqual) { RunI8x16CompareOpTest(kExprI8x16Ne, NotEqual); } + +WASM_EXEC_TEST(I8x16Greater) { RunI8x16CompareOpTest(kExprI8x16GtS, Greater); } + +WASM_EXEC_TEST(I8x16GreaterEqual) { + RunI8x16CompareOpTest(kExprI8x16GeS, GreaterEqual); +} + +WASM_EXEC_TEST(I8x16Less) { RunI8x16CompareOpTest(kExprI8x16LtS, Less); } + +WASM_EXEC_TEST(I8x16LessEqual) { + RunI8x16CompareOpTest(kExprI8x16LeS, LessEqual); +} + +WASM_EXEC_TEST(Ui8x16Greater) { + RunI8x16CompareOpTest(kExprI8x16GtU, UnsignedGreater); +} + +WASM_EXEC_TEST(Ui8x16GreaterEqual) { + RunI8x16CompareOpTest(kExprI8x16GeU, UnsignedGreaterEqual); +} + +WASM_EXEC_TEST(Ui8x16Less) { + RunI8x16CompareOpTest(kExprI8x16LtU, UnsignedLess); +} + +WASM_EXEC_TEST(Ui8x16LessEqual) { + RunI8x16CompareOpTest(kExprI8x16LeU, UnsignedLessEqual); +} + +void RunI8x16ShiftOpTest(WasmOpcode simd_op, Int8ShiftOp expected_op, + int shift) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); + byte a = 0; + byte expected = 1; + byte simd = r.AllocateLocal(kWasmS128); + BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), + WASM_SET_LOCAL( + simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), + WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); + + FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } +} + +WASM_EXEC_TEST(I8x16Shl) { + RunI8x16ShiftOpTest(kExprI8x16Shl, LogicalShiftLeft, 1); +} + +WASM_EXEC_TEST(I8x16ShrS) { + RunI8x16ShiftOpTest(kExprI8x16ShrS, ArithmeticShiftRight, 1); +} + +WASM_EXEC_TEST(I8x16ShrU) { + RunI8x16ShiftOpTest(kExprI8x16ShrU, LogicalShiftRight, 1); +} + +// Test Select by making a mask where the first two lanes are true and the rest +// false, and comparing for non-equality with zero to materialize a bool vector. +#define WASM_SIMD_SELECT_TEST(format) \ + WASM_EXEC_TEST(S##format##Select) { \ + FLAG_wasm_simd_prototype = true; \ + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); \ + byte val1 = 0; \ + byte val2 = 1; \ + byte src1 = r.AllocateLocal(kWasmS128); \ + byte src2 = r.AllocateLocal(kWasmS128); \ + byte zero = r.AllocateLocal(kWasmS128); \ + byte mask = r.AllocateLocal(kWasmS128); \ + BUILD(r, WASM_SET_LOCAL( \ + src1, WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val1))), \ + WASM_SET_LOCAL(src2, \ + WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val2))), \ + WASM_SET_LOCAL(zero, WASM_SIMD_I##format##_SPLAT(WASM_ZERO)), \ + WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE( \ + 1, WASM_GET_LOCAL(zero), WASM_I32V(-1))), \ + WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE( \ + 2, WASM_GET_LOCAL(mask), WASM_I32V(-1))), \ + WASM_SET_LOCAL( \ + mask, \ + WASM_SIMD_SELECT(format, WASM_SIMD_BINOP(kExprI##format##Ne, \ + WASM_GET_LOCAL(mask), \ + WASM_GET_LOCAL(zero)), \ + WASM_GET_LOCAL(src1), WASM_GET_LOCAL(src2))), \ + WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0), \ + WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 1), \ + WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2), \ + WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ + \ + CHECK_EQ(1, r.Call(0x12, 0x34)); \ + } -WASM_EXEC_TEST(I32x4NotEqual) { RunI32x4BinOpTest(kExprI32x4Ne, NotEqual); } +WASM_SIMD_SELECT_TEST(32x4) +WASM_SIMD_SELECT_TEST(16x8) +WASM_SIMD_SELECT_TEST(8x16) #endif // V8_TARGET_ARCH_ARM diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index 05370b5775..38af9d500f 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -6,10 +6,10 @@ #include <stdlib.h> #include <string.h> +#include "src/assembler-inl.h" #include "src/base/platform/elapsed-timer.h" #include "src/utils.h" #include "src/wasm/wasm-macro-gen.h" - #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" @@ -1047,6 +1047,9 @@ WASM_EXEC_TEST(I32ReinterpretF32) { } } +// Do not run this test in a simulator because of signalling NaN issues on ia32. +#ifndef USE_SIMULATOR + WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { WasmRunner<int32_t> r(execution_mode); @@ -1057,6 +1060,8 @@ WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { CHECK_EQ(0x7fa00000, r.Call()); } +#endif + WASM_EXEC_TEST_WITH_TRAP(LoadMaxUint32Offset) { WasmRunner<int32_t> r(execution_mode); r.module().AddMemoryElems<int32_t>(8); diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc index d2374a44c0..78e949b085 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc @@ -2,7 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/assembler-inl.h" #include "src/debug/debug-interface.h" +#include "src/frames-inl.h" +#include "src/property-descriptor.h" +#include "src/utils.h" #include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-objects.h" @@ -50,21 +54,236 @@ void CheckLocationsFail(WasmCompiledModule *compiled_module, CHECK(!success); } +class BreakHandler { + public: + enum Action { + Continue = StepAction::LastStepAction + 1, + StepNext = StepAction::StepNext, + StepIn = StepAction::StepIn, + StepOut = StepAction::StepOut + }; + struct BreakPoint { + int position; + Action action; + BreakPoint(int position, Action action) + : position(position), action(action) {} + }; + + explicit BreakHandler(Isolate* isolate, + std::initializer_list<BreakPoint> expected_breaks) + : isolate_(isolate), expected_breaks_(expected_breaks) { + current_handler = this; + v8::Debug::SetDebugEventListener(reinterpret_cast<v8::Isolate*>(isolate), + DebugEventListener); + } + ~BreakHandler() { + // Check that all expected breakpoints have been hit. + CHECK_EQ(count_, expected_breaks_.size()); + // BreakHandlers must be correctly stacked. + CHECK_EQ(this, current_handler); + current_handler = nullptr; + v8::Debug::SetDebugEventListener(reinterpret_cast<v8::Isolate*>(isolate_), + nullptr); + } + + int count() const { return count_; } + + private: + Isolate* isolate_; + int count_ = 0; + std::vector<BreakPoint> expected_breaks_; + + static BreakHandler* current_handler; + + void HandleBreak() { + printf("Break #%d\n", count_); + CHECK_GT(expected_breaks_.size(), count_); + + // Check the current position. + StackTraceFrameIterator frame_it(isolate_); + auto summ = FrameSummary::GetTop(frame_it.frame()).AsWasmInterpreted(); + CHECK_EQ(expected_breaks_[count_].position, summ.byte_offset()); + + Action next_action = expected_breaks_[count_].action; + switch (next_action) { + case Continue: + break; + case StepNext: + case StepIn: + case StepOut: + isolate_->debug()->PrepareStep(static_cast<StepAction>(next_action)); + break; + default: + UNREACHABLE(); + } + ++count_; + } + + static void DebugEventListener(const v8::Debug::EventDetails& event_details) { + if (event_details.GetEvent() != v8::DebugEvent::Break) return; + + CHECK_NOT_NULL(current_handler); + current_handler->HandleBreak(); + } +}; + +// static +BreakHandler* BreakHandler::current_handler = nullptr; + +Handle<JSObject> MakeFakeBreakpoint(Isolate* isolate, int position) { + Handle<JSObject> obj = + isolate->factory()->NewJSObject(isolate->object_function()); + // Generate an "isTriggered" method that always returns true. + // This can/must be refactored once we remove remaining JS parts from the + // debugger (bug 5530). + Handle<String> source = isolate->factory()->NewStringFromStaticChars("true"); + Handle<Context> context(isolate->context(), isolate); + Handle<JSFunction> triggered_fun = + Compiler::GetFunctionFromString(context, source, NO_PARSE_RESTRICTION, + kNoSourcePosition) + .ToHandleChecked(); + PropertyDescriptor desc; + desc.set_value(triggered_fun); + Handle<String> name = + isolate->factory()->InternalizeUtf8String(CStrVector("isTriggered")); + CHECK( + JSObject::DefineOwnProperty(isolate, obj, name, &desc, Object::DONT_THROW) + .FromMaybe(false)); + return obj; +} + +void SetBreakpoint(WasmRunnerBase& runner, int function_index, int byte_offset, + int expected_set_byte_offset = -1) { + int func_offset = + runner.module().module->functions[function_index].code_start_offset; + int code_offset = func_offset + byte_offset; + if (expected_set_byte_offset == -1) expected_set_byte_offset = byte_offset; + Handle<WasmInstanceObject> instance = runner.module().instance_object(); + Handle<WasmCompiledModule> compiled_module(instance->compiled_module()); + Handle<JSObject> fake_breakpoint_object = + MakeFakeBreakpoint(runner.main_isolate(), code_offset); + CHECK(WasmCompiledModule::SetBreakPoint(compiled_module, &code_offset, + fake_breakpoint_object)); + int set_byte_offset = code_offset - func_offset; + CHECK_EQ(expected_set_byte_offset, set_byte_offset); + // Also set breakpoint on the debug info of the instance directly, since the + // instance chain is not setup properly in tests. + Handle<WasmDebugInfo> debug_info = + WasmInstanceObject::GetOrCreateDebugInfo(instance); + WasmDebugInfo::SetBreakpoint(debug_info, function_index, set_byte_offset); +} + } // namespace -TEST(CollectPossibleBreakpoints) { +TEST(WasmCollectPossibleBreakpoints) { WasmRunner<int> runner(kExecuteCompiled); BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_ZERO, WASM_ONE)); Handle<WasmInstanceObject> instance = runner.module().instance_object(); std::vector<debug::Location> locations; + // Check all locations for function 0. CheckLocations(instance->compiled_module(), {0, 0}, {1, 0}, {{0, 1}, {0, 2}, {0, 4}, {0, 6}, {0, 7}}); + // Check a range ending at an instruction. CheckLocations(instance->compiled_module(), {0, 2}, {0, 4}, {{0, 2}}); + // Check a range ending one behind an instruction. CheckLocations(instance->compiled_module(), {0, 2}, {0, 5}, {{0, 2}, {0, 4}}); + // Check a range starting at an instruction. CheckLocations(instance->compiled_module(), {0, 7}, {0, 8}, {{0, 7}}); + // Check from an instruction to beginning of next function. CheckLocations(instance->compiled_module(), {0, 7}, {1, 0}, {{0, 7}}); + // Check from end of one function (no valid instruction position) to beginning + // of next function. Must be empty, but not fail. CheckLocations(instance->compiled_module(), {0, 8}, {1, 0}, {}); + // Check from one after the end of the function. Must fail. CheckLocationsFail(instance->compiled_module(), {0, 9}, {1, 0}); } + +TEST(WasmSimpleBreak) { + WasmRunner<int> runner(kExecuteCompiled); + Isolate* isolate = runner.main_isolate(); + + BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(3))); + + Handle<JSFunction> main_fun_wrapper = + runner.module().WrapCode(runner.function_index()); + SetBreakpoint(runner, runner.function_index(), 4, 4); + + BreakHandler count_breaks(isolate, {{4, BreakHandler::Continue}}); + + Handle<Object> global(isolate->context()->global_object(), isolate); + MaybeHandle<Object> retval = + Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr); + CHECK(!retval.is_null()); + int result; + CHECK(retval.ToHandleChecked()->ToInt32(&result)); + CHECK_EQ(14, result); +} + +TEST(WasmSimpleStepping) { + WasmRunner<int> runner(kExecuteCompiled); + BUILD(runner, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(3))); + + Isolate* isolate = runner.main_isolate(); + Handle<JSFunction> main_fun_wrapper = + runner.module().WrapCode(runner.function_index()); + + // Set breakpoint at the first I32Const. + SetBreakpoint(runner, runner.function_index(), 1, 1); + + BreakHandler count_breaks(isolate, + { + {1, BreakHandler::StepNext}, // I32Const + {3, BreakHandler::StepNext}, // I32Const + {5, BreakHandler::Continue} // I32Add + }); + + Handle<Object> global(isolate->context()->global_object(), isolate); + MaybeHandle<Object> retval = + Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr); + CHECK(!retval.is_null()); + int result; + CHECK(retval.ToHandleChecked()->ToInt32(&result)); + CHECK_EQ(14, result); +} + +TEST(WasmStepInAndOut) { + WasmRunner<int, int> runner(kExecuteCompiled); + WasmFunctionCompiler& f2 = runner.NewFunction<void>(); + f2.AllocateLocal(ValueType::kWord32); + + // Call f2 via indirect call, because a direct call requires f2 to exist when + // we compile main, but we need to compile main first so that the order of + // functions in the code section matches the function indexes. + + // return arg0 + BUILD(runner, WASM_RETURN1(WASM_GET_LOCAL(0))); + // for (int i = 0; i < 10; ++i) { f2(i); } + BUILD(f2, WASM_LOOP( + WASM_BR_IF(0, WASM_BINOP(kExprI32GeU, WASM_GET_LOCAL(0), + WASM_I32V_1(10))), + WASM_SET_LOCAL( + 0, WASM_BINOP(kExprI32Sub, WASM_GET_LOCAL(0), WASM_ONE)), + WASM_CALL_FUNCTION(runner.function_index(), WASM_GET_LOCAL(0)), + WASM_DROP, WASM_BR(1))); + + Isolate* isolate = runner.main_isolate(); + Handle<JSFunction> main_fun_wrapper = + runner.module().WrapCode(f2.function_index()); + + // Set first breakpoint on the GetLocal (offset 19) before the Call. + SetBreakpoint(runner, f2.function_index(), 19, 19); + + BreakHandler count_breaks(isolate, + { + {19, BreakHandler::StepIn}, // GetLocal + {21, BreakHandler::StepIn}, // Call + {1, BreakHandler::StepOut}, // in f2 + {23, BreakHandler::Continue} // After Call + }); + + Handle<Object> global(isolate->context()->global_object(), isolate); + CHECK(!Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr) + .is_null()); +} diff --git a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc new file mode 100644 index 0000000000..17ff5ae783 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc @@ -0,0 +1,232 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <cstdint> + +#include "src/objects-inl.h" +#include "src/wasm/wasm-macro-gen.h" +#include "src/wasm/wasm-objects.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/wasm-run-utils.h" + +using namespace v8::internal; +using namespace v8::internal::wasm; +namespace debug = v8::debug; + +/** + * We test the interface from Wasm compiled code to the Wasm interpreter by + * building a module with two functions. The external function is called from + * this test, and will be compiled code. It takes its arguments and passes them + * on to the internal function, which will be redirected to the interpreter. + * If the internal function has an i64 parameter, is has to be replaced by two + * i32 parameters on the external function. + * The internal function just converts all its arguments to f64, sums them up + * and returns the sum. + */ +namespace { + +template <typename T> +class ArgPassingHelper { + public: + ArgPassingHelper(WasmRunnerBase& runner, WasmFunctionCompiler& inner_compiler, + std::initializer_list<uint8_t> bytes_inner_function, + std::initializer_list<uint8_t> bytes_outer_function, + const T& expected_lambda) + : isolate_(runner.main_isolate()), + expected_lambda_(expected_lambda), + debug_info_(WasmInstanceObject::GetOrCreateDebugInfo( + runner.module().instance_object())) { + std::vector<uint8_t> inner_code{bytes_inner_function}; + inner_compiler.Build(inner_code.data(), + inner_code.data() + inner_code.size()); + + std::vector<uint8_t> outer_code{bytes_outer_function}; + runner.Build(outer_code.data(), outer_code.data() + outer_code.size()); + + WasmDebugInfo::RedirectToInterpreter(debug_info_, + inner_compiler.function_index()); + main_fun_wrapper_ = runner.module().WrapCode(runner.function_index()); + } + + template <typename... Args> + void CheckCall(Args... args) { + Handle<Object> arg_objs[] = {isolate_->factory()->NewNumber(args)...}; + + uint64_t num_interpreted_before = debug_info_->NumInterpretedCalls(); + Handle<Object> global(isolate_->context()->global_object(), isolate_); + MaybeHandle<Object> retval = Execution::Call( + isolate_, main_fun_wrapper_, global, arraysize(arg_objs), arg_objs); + uint64_t num_interpreted_after = debug_info_->NumInterpretedCalls(); + // Check that we really went through the interpreter. + CHECK_EQ(num_interpreted_before + 1, num_interpreted_after); + // Check the result. + double result = retval.ToHandleChecked()->Number(); + double expected = expected_lambda_(args...); + CHECK_DOUBLE_EQ(expected, result); + } + + private: + Isolate* isolate_; + T expected_lambda_; + Handle<WasmDebugInfo> debug_info_; + Handle<JSFunction> main_fun_wrapper_; +}; + +template <typename T> +static ArgPassingHelper<T> GetHelper( + WasmRunnerBase& runner, WasmFunctionCompiler& inner_compiler, + std::initializer_list<uint8_t> bytes_inner_function, + std::initializer_list<uint8_t> bytes_outer_function, + const T& expected_lambda) { + return ArgPassingHelper<T>(runner, inner_compiler, bytes_inner_function, + bytes_outer_function, expected_lambda); +} + +} // namespace + +TEST(TestArgumentPassing_int32) { + WasmRunner<int32_t, int32_t> runner(kExecuteCompiled); + WasmFunctionCompiler& f2 = runner.NewFunction<int32_t, int32_t>(); + + auto helper = GetHelper( + runner, f2, + {// Return 2*<0> + 1. + WASM_I32_ADD(WASM_I32_MUL(WASM_I32V_1(2), WASM_GET_LOCAL(0)), WASM_ONE)}, + {// Call f2 with param <0>. + WASM_GET_LOCAL(0), WASM_CALL_FUNCTION0(f2.function_index())}, + [](int32_t a) { return 2 * a + 1; }); + + std::vector<int32_t> test_values = compiler::ValueHelper::int32_vector(); + for (int32_t v : test_values) helper.CheckCall(v); +} + +TEST(TestArgumentPassing_int64) { + WasmRunner<double, int32_t, int32_t> runner(kExecuteCompiled); + WasmFunctionCompiler& f2 = runner.NewFunction<double, int64_t>(); + + auto helper = GetHelper( + runner, f2, + {// Return (double)<0>. + WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))}, + {// Call f2 with param (<0> | (<1> << 32)). + WASM_I64_IOR(WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)), + WASM_I64_SHL(WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(1)), + WASM_I64V_1(32))), + WASM_CALL_FUNCTION0(f2.function_index())}, + [](int32_t a, int32_t b) { + int64_t a64 = static_cast<int64_t>(a) & 0xffffffff; + int64_t b64 = static_cast<int64_t>(b) << 32; + return static_cast<double>(a64 | b64); + }); + + std::vector<int32_t> test_values_i32 = compiler::ValueHelper::int32_vector(); + for (int32_t v1 : test_values_i32) { + for (int32_t v2 : test_values_i32) { + helper.CheckCall(v1, v2); + } + } + + std::vector<int64_t> test_values_i64 = compiler::ValueHelper::int64_vector(); + for (int64_t v : test_values_i64) { + int32_t v1 = static_cast<int32_t>(v); + int32_t v2 = static_cast<int32_t>(v >> 32); + helper.CheckCall(v1, v2); + helper.CheckCall(v2, v1); + } +} + +TEST(TestArgumentPassing_float_double) { + WasmRunner<double, float> runner(kExecuteCompiled); + WasmFunctionCompiler& f2 = runner.NewFunction<double, float>(); + + auto helper = GetHelper( + runner, f2, + {// Return 2*(double)<0> + 1. + WASM_F64_ADD( + WASM_F64_MUL(WASM_F64(2), WASM_F64_CONVERT_F32(WASM_GET_LOCAL(0))), + WASM_F64(1))}, + {// Call f2 with param <0>. + WASM_GET_LOCAL(0), WASM_CALL_FUNCTION0(f2.function_index())}, + [](float f) { return 2. * static_cast<double>(f) + 1.; }); + + std::vector<float> test_values = compiler::ValueHelper::float32_vector(); + for (float f : test_values) helper.CheckCall(f); +} + +TEST(TestArgumentPassing_double_double) { + WasmRunner<double, double, double> runner(kExecuteCompiled); + WasmFunctionCompiler& f2 = runner.NewFunction<double, double, double>(); + + auto helper = GetHelper(runner, f2, + {// Return <0> + <1>. + WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}, + {// Call f2 with params <0>, <1>. + WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), + WASM_CALL_FUNCTION0(f2.function_index())}, + [](double a, double b) { return a + b; }); + + std::vector<double> test_values = compiler::ValueHelper::float64_vector(); + for (double d1 : test_values) { + for (double d2 : test_values) { + helper.CheckCall(d1, d2); + } + } +} + +TEST(TestArgumentPassing_AllTypes) { + // The second and third argument will be combined to an i64. + WasmRunner<double, int, int, int, float, double> runner(kExecuteCompiled); + WasmFunctionCompiler& f2 = + runner.NewFunction<double, int, int64_t, float, double>(); + + auto helper = GetHelper( + runner, f2, + { + // Convert all arguments to double, add them and return the sum. + WASM_F64_ADD( // <0+1+2> + <3> + WASM_F64_ADD( // <0+1> + <2> + WASM_F64_ADD( // <0> + <1> + WASM_F64_SCONVERT_I32( + WASM_GET_LOCAL(0)), // <0> to double + WASM_F64_SCONVERT_I64( + WASM_GET_LOCAL(1))), // <1> to double + WASM_F64_CONVERT_F32(WASM_GET_LOCAL(2))), // <2> to double + WASM_GET_LOCAL(3)) // <3> + }, + {WASM_GET_LOCAL(0), // first arg + WASM_I64_IOR(WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(1)), // second arg + WASM_I64_SHL(WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(2)), + WASM_I64V_1(32))), + WASM_GET_LOCAL(3), // third arg + WASM_GET_LOCAL(4), // fourth arg + WASM_CALL_FUNCTION0(f2.function_index())}, + [](int32_t a, int32_t b, int32_t c, float d, double e) { + return 0. + a + (static_cast<int64_t>(b) & 0xffffffff) + + ((static_cast<int64_t>(c) & 0xffffffff) << 32) + d + e; + }); + + auto CheckCall = [&](int32_t a, int64_t b, float c, double d) { + int32_t b0 = static_cast<int32_t>(b); + int32_t b1 = static_cast<int32_t>(b >> 32); + helper.CheckCall(a, b0, b1, c, d); + helper.CheckCall(a, b1, b0, c, d); + }; + + std::vector<int32_t> test_values_i32 = compiler::ValueHelper::int32_vector(); + std::vector<int64_t> test_values_i64 = compiler::ValueHelper::int64_vector(); + std::vector<float> test_values_f32 = compiler::ValueHelper::float32_vector(); + std::vector<double> test_values_f64 = compiler::ValueHelper::float64_vector(); + size_t max_len = + std::max(std::max(test_values_i32.size(), test_values_i64.size()), + std::max(test_values_f32.size(), test_values_f64.size())); + for (size_t i = 0; i < max_len; ++i) { + int32_t i32 = test_values_i32[i % test_values_i32.size()]; + int64_t i64 = test_values_i64[i % test_values_i64.size()]; + float f32 = test_values_f32[i % test_values_f32.size()]; + double f64 = test_values_f64[i % test_values_f64.size()]; + CheckCall(i32, i64, f32, f64); + } +} diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc index 357a4e487e..3dc7839667 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-stack.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/assembler-inl.h" #include "src/wasm/wasm-macro-gen.h" - #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" 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 0418d46bab..91159f2154 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/assembler-inl.h" #include "src/wasm/wasm-macro-gen.h" - #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" @@ -43,6 +43,7 @@ void CheckExceptionInfos(Handle<Object> exc, // Check that it's indeed an Error object. CHECK(exc->IsJSError()); + exc->Print(); // Extract stack frame from the exception. Local<v8::Value> localExc = Utils::ToLocal(exc); v8::Local<v8::StackTrace> stack = v8::Exception::GetStackTrace(localExc); diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index 782e7d9635..316537604b 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -224,14 +224,26 @@ class TestingModule : public ModuleEnv { Handle<JSFunction> WrapCode(uint32_t index) { // Wrap the code so it can be called as a JS function. - Handle<WasmInstanceObject> instance_obj(0, isolate_); Handle<Code> code = instance->function_code[index]; Handle<Code> ret_code = compiler::CompileJSToWasmWrapper(isolate_, &module_, code, index); Handle<JSFunction> ret = WasmExportedFunction::New( - isolate_, instance_obj, MaybeHandle<String>(), static_cast<int>(index), + isolate_, instance_object(), MaybeHandle<String>(), + static_cast<int>(index), static_cast<int>(this->module->functions[index].sig->parameter_count()), ret_code); + + // Add weak reference to exported functions. + Handle<WasmCompiledModule> compiled_module( + instance_object()->compiled_module(), isolate_); + Handle<FixedArray> old_arr = compiled_module->weak_exported_functions(); + Handle<FixedArray> new_arr = + isolate_->factory()->NewFixedArray(old_arr->length() + 1); + old_arr->CopyTo(0, *new_arr, 0, old_arr->length()); + Handle<WeakCell> weak_fn = isolate_->factory()->NewWeakCell(ret); + new_arr->set(old_arr->length(), *weak_fn); + compiled_module->set_weak_exported_functions(new_arr); + return ret; } @@ -319,8 +331,10 @@ class TestingModule : public ModuleEnv { Handle<WasmInstanceObject> InitInstanceObject() { Handle<SeqOneByteString> empty_string = Handle<SeqOneByteString>::cast( isolate_->factory()->NewStringFromOneByte({}).ToHandleChecked()); - Handle<Managed<wasm::WasmModule>> module_wrapper = - Managed<wasm::WasmModule>::New(isolate_, &module_, false); + // The lifetime of the wasm module is tied to this object's, and we cannot + // rely on the mechanics of Managed<T>. + Handle<Foreign> module_wrapper = + isolate_->factory()->NewForeign(reinterpret_cast<Address>(&module)); Handle<Script> script = isolate_->factory()->NewScript(isolate_->factory()->empty_string()); script->set_type(Script::TYPE_WASM); @@ -334,6 +348,10 @@ class TestingModule : public ModuleEnv { // If tests need more (correct) information, add it later. compiled_module->set_min_mem_pages(0); compiled_module->set_max_mem_pages(Smi::kMaxValue); + Handle<FixedArray> code_table = isolate_->factory()->NewFixedArray(0); + compiled_module->set_code_table(code_table); + Handle<FixedArray> weak_exported = isolate_->factory()->NewFixedArray(0); + compiled_module->set_weak_exported_functions(weak_exported); DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); return WasmInstanceObject::New(isolate_, compiled_module); } @@ -541,6 +559,21 @@ class WasmFunctionCompiler : private GraphAndBuilders { &source_position_table_, start, end); Handle<Code> code = Compile(); testing_module_->SetFunctionCode(function_index(), code); + + // Add to code table. + Handle<WasmCompiledModule> compiled_module( + testing_module_->instance_object()->compiled_module(), isolate()); + Handle<FixedArray> code_table = compiled_module->code_table(); + if (static_cast<int>(function_index()) >= code_table->length()) { + Handle<FixedArray> new_arr = isolate()->factory()->NewFixedArray( + static_cast<int>(function_index()) + 1); + code_table->CopyTo(0, *new_arr, 0, code_table->length()); + code_table = new_arr; + compiled_module->set_code_table(code_table); + } + DCHECK(code_table->get(static_cast<int>(function_index())) + ->IsUndefined(isolate())); + code_table->set(static_cast<int>(function_index()), *code); } byte AllocateLocal(ValueType type) { @@ -659,6 +692,7 @@ class WasmRunnerBase : public HandleAndZoneScope { return functions_[0]->AllocateLocal(type); } + uint32_t function_index() { return functions_[0]->function_index(); } WasmFunction* function() { return functions_[0]->function_; } WasmInterpreter* interpreter() { return functions_[0]->interpreter_; } bool possible_nondeterminism() { return possible_nondeterminism_; } @@ -717,9 +751,9 @@ class WasmRunnerBase : public HandleAndZoneScope { bool interpret() { return module_.execution_mode() == kExecuteInterpreted; } public: - // This field has to be static. Otherwise, gcc complains about the using in + // This field has to be static. Otherwise, gcc complains about the use in // the lambda context below. - static jmp_buf jump_buffer; + static bool trap_happened; }; template <typename ReturnType, typename... ParamTypes> @@ -738,15 +772,24 @@ class WasmRunner : public WasmRunnerBase { DCHECK(compiled_); if (interpret()) return CallInterpreter(p...); - // Use setjmp/longjmp to deal with traps in WebAssembly code. ReturnType return_value = static_cast<ReturnType>(0xdeadbeefdeadbeef); - static int setjmp_ret; - setjmp_ret = setjmp(WasmRunnerBase::jump_buffer); - // setjmp returns 0 on the first return, 1 (passed to longjmp) after trap. - if (setjmp_ret == 0) { - DoCall(static_cast<void*>(&p)..., static_cast<void*>(&return_value)); - } - return return_value; + WasmRunnerBase::trap_happened = false; + auto trap_callback = []() -> void { + WasmRunnerBase::trap_happened = true; + set_trap_callback_for_testing(nullptr); + }; + set_trap_callback_for_testing(trap_callback); + + wrapper_.SetInnerCode( + module_.GetFunctionCode(functions_[0]->function_index())); + CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(), + wrapper_.GetWrapperCode(), wrapper_.signature()); + int32_t result = runner.Call(static_cast<void*>(&p)..., + static_cast<void*>(&return_value)); + CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); + return WasmRunnerBase::trap_happened + ? static_cast<ReturnType>(0xdeadbeefdeadbeef) + : return_value; } ReturnType CallInterpreter(ParamTypes... p) { @@ -767,30 +810,10 @@ class WasmRunner : public WasmRunnerBase { return ReturnType{0}; } } - - private: - // Don't inline this function. The setjmp above should be followed immediately - // by a call. - template <typename... Ptrs> - V8_NOINLINE void DoCall(Ptrs... ptrs) { - auto trap_callback = []() -> void { - set_trap_callback_for_testing(nullptr); - longjmp(WasmRunnerBase::jump_buffer, 1); - }; - set_trap_callback_for_testing(trap_callback); - - wrapper_.SetInnerCode( - module_.GetFunctionCode(functions_[0]->function_index())); - CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(), - wrapper_.GetWrapperCode(), wrapper_.signature()); - int32_t result = runner.Call(ptrs...); - // If we arrive here, no trap happened. - CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); - } }; // Declare static variable. -jmp_buf WasmRunnerBase::jump_buffer; +bool WasmRunnerBase::trap_happened; // A macro to define tests that run in different engine configurations. #define WASM_EXEC_TEST(name) \ @@ -803,9 +826,9 @@ jmp_buf WasmRunnerBase::jump_buffer; void RunWasm_##name(WasmExecutionMode execution_mode); \ TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ void RunWasm_##name(WasmExecutionMode execution_mode); \ - TEST(RunWasmCompiledWithTrapIf_##name) { \ + TEST(RunWasmCompiledWithoutTrapIf_##name) { \ bool trap_if = FLAG_wasm_trap_if; \ - FLAG_wasm_trap_if = true; \ + FLAG_wasm_trap_if = false; \ RunWasm_##name(kExecuteCompiled); \ FLAG_wasm_trap_if = trap_if; \ } \ |