diff options
Diffstat (limited to 'deps/v8/test/cctest')
235 files changed, 37235 insertions, 28905 deletions
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn new file mode 100644 index 0000000000..db94e0c7ff --- /dev/null +++ b/deps/v8/test/cctest/BUILD.gn @@ -0,0 +1,173 @@ +# 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. + +# The sources are kept automatically in sync with cctest.gyp. + +import("../../gni/v8.gni") + +gypi_values = exec_script("//build/gypi_to_gn.py", + [ rebase_path("cctest.gyp") ], + "scope", + [ "cctest.gyp" ]) + +v8_executable("cctest") { + testonly = true + + sources = [ "$target_gen_dir/resources.cc" ] + gypi_values.cctest_sources + + if (v8_current_cpu == "arm") { + sources += gypi_values.cctest_sources_arm + } else if (v8_current_cpu == "arm64") { + sources += gypi_values.cctest_sources_arm64 + } else if (v8_current_cpu == "x86") { + sources += gypi_values.cctest_sources_ia32 + } else if (v8_current_cpu == "mips") { + sources += gypi_values.cctest_sources_mips + } else if (v8_current_cpu == "mipsel") { + sources += gypi_values.cctest_sources_mipsel + } else if (v8_current_cpu == "mips64") { + sources += gypi_values.cctest_sources_mips64 + } else if (v8_current_cpu == "mips64el") { + sources += gypi_values.cctest_sources_mips64el + } else if (v8_current_cpu == "x64") { + sources += gypi_values.cctest_sources_x64 + } else if (v8_current_cpu == "x87") { + sources += gypi_values.cctest_sources_x87 + } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") { + sources += gypi_values.cctest_sources_ppc + } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { + sources += gypi_values.cctest_sources_s390 + } + + if (is_linux) { + # TODO(machenbach): Translate 'or OS=="qnx"' from gyp. + sources += [ "test-platform-linux.cc" ] + } else if (is_win) { + sources += [ "test-platform-win32.cc" ] + } + + configs = [ + "../..:external_config", + "../..:internal_config_base", + ] + + # TODO(machenbach): Translate from gyp. + #["OS=="aix"", { + # "ldflags": [ "-Wl,-bbigtoc" ], + #}], + + deps = [ + ":resources", + "../..:v8_libplatform", + "//build/config/sanitizers:deps", + "//build/win:default_exe_manifest", + ] + + if (is_component_build) { + # cctest can't be built against a shared library, so we + # need to depend on the underlying static target in that case. + deps += [ "../..:v8_maybe_snapshot" ] + } else { + deps += [ "../..:v8" ] + } + + cflags = [] + ldflags = [] + + if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" || + v8_current_cpu == "arm" || v8_current_cpu == "arm64" || + v8_current_cpu == "s390" || v8_current_cpu == "s390x") { + # Disable fmadd/fmsub so that expected results match generated code in + # RunFloat64MulAndFloat64Add1 and friends. + cflags += [ "-ffp-contract=off" ] + } + + if (is_win) { + # This warning is benignly triggered by the U16 and U32 macros in + # bytecode-utils.h. + # C4309: 'static_cast': truncation of constant value + cflags += [ "/wd4309" ] + + # MSVS wants this for gay-{precision,shortest}.cc. + cflags += [ "/bigobj" ] + + # Suppress warnings about importing locally defined symbols. + if (is_component_build) { + ldflags += [ + "/ignore:4049", + "/ignore:4217", + ] + } + } +} + +action("resources") { + visibility = [ ":*" ] # Only targets in this file can depend on this. + + script = "../../tools/js2c.py" + + # The script depends on this other script, this rule causes a rebuild if it + # changes. + inputs = [ + "../../tools/jsmin.py", + ] + + # NOSORT + sources = [ + "../../tools/splaytree.js", + "../../tools/codemap.js", + "../../tools/csvparser.js", + "../../tools/consarray.js", + "../../tools/profile.js", + "../../tools/profile_view.js", + "../../tools/logreader.js", + "log-eq-of-logging-and-traversal.js", + ] + + outputs = [ + "$target_gen_dir/resources.cc", + ] + + args = [ + rebase_path("$target_gen_dir/resources.cc", root_build_dir), + "TEST", + ] + args += rebase_path(sources, root_build_dir) +} + +v8_executable("generate-bytecode-expectations") { + sources = [ + "interpreter/bytecode-expectations-printer.cc", + "interpreter/bytecode-expectations-printer.h", + "interpreter/generate-bytecode-expectations.cc", + ] + + configs = [ + "../..:external_config", + "../..:internal_config_base", + ] + + deps = [ + "../..:v8_libplatform", + "//build/config/sanitizers:deps", + "//build/win:default_exe_manifest", + ] + + if (is_component_build) { + # Same as cctest, we need to depend on the underlying static target. + deps += [ "../..:v8_maybe_snapshot" ] + } else { + deps += [ "../..:v8" ] + } + + if (is_win) { + # Suppress warnings about importing locally defined symbols. + if (is_component_build) { + ldflags = [ + "/ignore:4049", + "/ignore:4217", + ] + } + } +} diff --git a/deps/v8/test/cctest/OWNERS b/deps/v8/test/cctest/OWNERS index 4b2b7c51e5..06141ef626 100644 --- a/deps/v8/test/cctest/OWNERS +++ b/deps/v8/test/cctest/OWNERS @@ -16,7 +16,3 @@ per-file *-s390*=mbrandy@us.ibm.com per-file *-s390*=michael_dawson@ca.ibm.com per-file *-x87*=chunyang.dai@intel.com per-file *-x87*=weiliang.lin@intel.com -per-file expression-type-collector*=aseemgarg@chromium.org -per-file expression-type-collector*=bradnelson@chromium.org -per-file test-asm-validator.cc=aseemgarg@chromium.org -per-file test-asm-validator.cc=bradnelson@chromium.org diff --git a/deps/v8/test/cctest/asmjs/OWNERS b/deps/v8/test/cctest/asmjs/OWNERS new file mode 100644 index 0000000000..d8fad3059a --- /dev/null +++ b/deps/v8/test/cctest/asmjs/OWNERS @@ -0,0 +1,10 @@ +# Keep in sync with src/asmjs/OWNERS. + +set noparent + +ahaas@chromium.org +bradnelson@chromium.org +jpp@chromium.org +mtrofin@chromium.org +rossberg@chromium.org +titzer@chromium.org diff --git a/deps/v8/test/cctest/asmjs/test-asm-typer.cc b/deps/v8/test/cctest/asmjs/test-asm-typer.cc new file mode 100644 index 0000000000..dcb778533d --- /dev/null +++ b/deps/v8/test/cctest/asmjs/test-asm-typer.cc @@ -0,0 +1,2003 @@ +// 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 <cstring> +#include <functional> +#include <iostream> +#include <memory> + +#include "src/asmjs/asm-typer.h" +#include "src/asmjs/asm-types.h" +#include "src/ast/ast-value-factory.h" +#include "src/ast/ast.h" +#include "src/ast/scopes.h" +#include "src/base/platform/platform.h" +#include "src/compiler.h" +#include "src/parsing/parse-info.h" +#include "src/parsing/parser.h" +#include "src/v8.h" +#include "test/cctest/cctest.h" + +using namespace v8::internal; +namespace iw = v8::internal::wasm; + +namespace v8 { +namespace internal { +namespace wasm { + +namespace { +enum ValidationType { + ValidateModule, + ValidateGlobals, + ValidateFunctionTables, + ValidateExport, + ValidateFunction, + ValidateStatement, + ValidateExpression, +}; +} // namespace + +class AsmTyperHarnessBuilder { + public: + AsmTyperHarnessBuilder(const char* source, ValidationType type) + : source_(source), + validation_type_(type), + handles_(), + zone_(handles_.main_zone()), + isolate_(CcTest::i_isolate()), + ast_value_factory_(zone_, isolate_->heap()->HashSeed()), + factory_(isolate_->factory()), + source_code_( + factory_->NewStringFromUtf8(CStrVector(source)).ToHandleChecked()), + script_(factory_->NewScript(source_code_)) { + ParseInfo info(zone_, script_); + info.set_global(); + info.set_lazy(false); + info.set_allow_lazy_parsing(false); + info.set_toplevel(true); + info.set_ast_value_factory(&ast_value_factory_); + 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()->declarations()->at(0)->AsFunctionDeclaration()->fun(); + typer_.reset(new AsmTyper(isolate_, zone_, *script_, module_)); + + if (validation_type_ == ValidateStatement || + validation_type_ == ValidateExpression) { + fun_scope_.reset(new AsmTyper::FunctionScope(typer_.get())); + + auto* decls = module_->scope()->declarations(); + for (int ii = 0; ii < decls->length(); ++ii) { + Declaration* decl = decls->at(ii); + if (FunctionDeclaration* fun_decl = decl->AsFunctionDeclaration()) { + fun_decl_ = fun_decl; + break; + } + } + CHECK_NOT_NULL(fun_decl_); + } + } + + struct VariableName { + VariableName(const char* name, VariableMode mode) + : name_(name), mode_(mode) {} + VariableName(const VariableName&) = default; + VariableName& operator=(const VariableName&) = default; + + const char* name_; + const VariableMode mode_; + }; + + AsmTyperHarnessBuilder* WithLocal(VariableName var_name, AsmType* type) { + CHECK(validation_type_ == ValidateStatement || + validation_type_ == ValidateExpression); + auto* var = DeclareVariable(var_name); + auto* var_info = new (zone_) AsmTyper::VariableInfo(type); + var_info->set_mutability(AsmTyper::VariableInfo::kLocal); + CHECK(typer_->AddLocal(var, var_info)); + return this; + } + + AsmTyperHarnessBuilder* WithGlobal(VariableName var_name, AsmType* type) { + auto* var = DeclareVariable(var_name); + auto* var_info = new (zone_) AsmTyper::VariableInfo(type); + var_info->set_mutability(AsmTyper::VariableInfo::kMutableGlobal); + CHECK(typer_->AddGlobal(var, var_info)); + return this; + } + + AsmTyperHarnessBuilder* WithGlobal( + VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { + return WithGlobal(var_name, type_creator(zone_)); + } + + AsmTyperHarnessBuilder* WithUndefinedGlobal( + VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { + auto* type = type_creator(zone_); + CHECK(type->AsFunctionType() != nullptr || + type->AsFunctionTableType() != nullptr); + WithGlobal(var_name, type); + auto* var_info = typer_->Lookup(DeclareVariable(var_name)); + CHECK(var_info); + var_info->FirstForwardUseIs(nullptr); + return this; + } + + AsmTyperHarnessBuilder* WithImport(VariableName var_name, + AsmTyper::StandardMember standard_member) { + auto* var = DeclareVariable(var_name); + AsmTyper::VariableInfo* var_info = nullptr; + auto* stdlib_map = &typer_->stdlib_math_types_; + switch (standard_member) { + case AsmTyper::kHeap: + case AsmTyper::kStdlib: + case AsmTyper::kModule: + case AsmTyper::kNone: + CHECK(false); + case AsmTyper::kFFI: + stdlib_map = nullptr; + var_info = new (zone_) AsmTyper::VariableInfo(AsmType::FFIType(zone_)); + var_info->set_mutability(AsmTyper::VariableInfo::kImmutableGlobal); + break; + case AsmTyper::kInfinity: + case AsmTyper::kNaN: + stdlib_map = &typer_->stdlib_types_; + default: + break; + } + + if (var_info == nullptr) { + for (auto iter : *stdlib_map) { + if (iter.second->standard_member() == standard_member) { + var_info = iter.second; + break; + } + } + + CHECK(var_info != nullptr); + var_info = var_info->Clone(zone_); + } + + CHECK(typer_->AddGlobal(var, var_info)); + return this; + } + + AsmTyperHarnessBuilder* WithReturnType(AsmType* type) { + CHECK(type->IsReturnType()); + CHECK(typer_->return_type_ == AsmType::None()); + typer_->return_type_ = type; + return this; + } + + AsmTyperHarnessBuilder* WithStdlib(VariableName var_name) { + auto* var = DeclareVariable(var_name); + auto* var_info = + AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kStdlib); + CHECK(typer_->AddGlobal(var, var_info)); + return this; + } + + AsmTyperHarnessBuilder* WithHeap(VariableName var_name) { + auto* var = DeclareVariable(var_name); + auto* var_info = + AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kHeap); + CHECK(typer_->AddGlobal(var, var_info)); + return this; + } + + AsmTyperHarnessBuilder* WithFFI(VariableName var_name) { + auto* var = DeclareVariable(var_name); + auto* var_info = + AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kFFI); + CHECK(typer_->AddGlobal(var, var_info)); + return this; + } + + bool Succeeds() { + CHECK(validation_type_ == ValidateModule || + validation_type_ == ValidateGlobals || + validation_type_ == ValidateFunctionTables || + validation_type_ == ValidateExport || + validation_type_ == ValidateFunction || + validation_type_ == ValidateStatement); + + if (validation_type_ == ValidateStatement) { + CHECK(typer_->return_type_ != AsmType::None()); + if (ValidateAllStatements(fun_decl_)) { + return true; + } + } else if (typer_->Validate()) { + return true; + } + + std::cerr << "Asm validation failed: " << typer_->error_message() << "\n"; + return false; + } + + bool SucceedsWithExactType(AsmType* type) { + CHECK(validation_type_ == ValidateExpression); + auto* validated_as = ValidateExpressionStatment(fun_decl_); + if (validated_as == AsmType::None()) { + std::cerr << "Validation failure: " << typer_->error_message() << "\n"; + return false; + } else if (validated_as != type) { + std::cerr << "Validation succeeded with wrong type " + << validated_as->Name() << " (vs. " << type->Name() << ").\n"; + return false; + } + + return true; + } + + bool FailsWithMessage(const char* error_message) { + CHECK(validation_type_ == ValidateModule || + validation_type_ == ValidateGlobals || + validation_type_ == ValidateFunctionTables || + validation_type_ == ValidateExport || + validation_type_ == ValidateFunction || + validation_type_ == ValidateStatement || + validation_type_ == ValidateExpression); + + bool success; + if (validation_type_ == ValidateStatement) { + CHECK(typer_->return_type_ != AsmType::None()); + success = ValidateAllStatements(fun_decl_); + } else if (validation_type_ == ValidateExpression) { + success = ValidateExpressionStatment(fun_decl_) != AsmType::None(); + } else { + success = typer_->Validate(); + } + + if (success) { + std::cerr << "Asm validation succeeded\n"; + return false; + } + + if (std::strstr(typer_->error_message(), error_message) == nullptr) { + std::cerr << "Asm validation failed with the wrong error message:\n" + "Expected to contain '" + << error_message << "'\n" + " Actually is '" + << typer_->error_message() << "'\n"; + return false; + } + + return true; + } + + private: + Variable* DeclareVariable(VariableName var_name) { + auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); + return var_name.mode_ == DYNAMIC_GLOBAL + ? outer_scope_->DeclareDynamicGlobal(name_ast_string, + Variable::NORMAL) + : module_->scope()->DeclareLocal(name_ast_string, VAR, + kCreatedInitialized, + Variable::NORMAL); + } + + bool ValidateAllStatements(FunctionDeclaration* fun_decl) { + AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); + while (auto* curr = iter.Next()) { + if (typer_->ValidateStatement(curr) == AsmType::None()) { + return false; + } + } + return true; + } + + AsmType* ValidateExpressionStatment(FunctionDeclaration* fun_decl) { + AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); + AsmType* ret = AsmType::None(); + bool last_was_expression_statement = false; + while (auto* curr = iter.Next()) { + if (auto* expr_stmt = curr->AsExpressionStatement()) { + last_was_expression_statement = true; + if ((ret = typer_->ValidateExpression(expr_stmt->expression())) == + AsmType::None()) { + break; + } + } else { + ret = AsmType::None(); + last_was_expression_statement = true; + if (typer_->ValidateStatement(curr) == AsmType::None()) { + break; + } + } + } + CHECK(last_was_expression_statement || ret == AsmType::None()); + return ret; + } + + 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_; + + DeclarationScope* outer_scope_; + FunctionLiteral* module_; + FunctionDeclaration* fun_decl_; + std::unique_ptr<AsmTyper> typer_; + std::unique_ptr<AsmTyper::FunctionScope> fun_scope_; +}; + +} // namespace wasm +} // namespace internal +} // namespace v8 + +namespace { + +struct ValidationInput { + ValidationInput(const std::string& source, iw::ValidationType type) + : source_(source), type_(type) {} + + const std::string source_; + const iw::ValidationType type_; +}; + +std::unique_ptr<iw::AsmTyperHarnessBuilder> ValidationOf( + ValidationInput input) { + return std::unique_ptr<iw::AsmTyperHarnessBuilder>( + new iw::AsmTyperHarnessBuilder(input.source_.c_str(), input.type_)); +} + +ValidationInput Module(const char* source) { + return ValidationInput(source, iw::ValidateModule); +} + +std::string WrapInFunction(const char* source, bool needs_use_asm) { + if (needs_use_asm) { + return std::string( + "function foo() {\n" + " 'use asm';\n" + " ") + + source + + "\n" + "}"; + } + + return std::string( + "function bar() {\n" + " ") + + source + + "\n" + "}\n" + "return {b: bar};\n"; +} + +ValidationInput Globals(const char* source) { + static const bool kNeedsUseAsm = true; + return ValidationInput(WrapInFunction(source, kNeedsUseAsm), + iw::ValidateGlobals); +} + +ValidationInput FunctionTables(const char* source) { + static const bool kNeedsUseAsm = true; + return ValidationInput(WrapInFunction(source, kNeedsUseAsm), + iw::ValidateFunctionTables); +} + +ValidationInput Export(const char* source) { + static const bool kNeedsUseAsm = true; + return ValidationInput(WrapInFunction(source, kNeedsUseAsm), + iw::ValidateExport); +} + +ValidationInput Function(const char* source) { + static const bool kNeedsUseAsm = true; + return ValidationInput(WrapInFunction(source, kNeedsUseAsm), + iw::ValidateFunction); +} + +ValidationInput Statement(const char* source) { + static const bool kDoesNotNeedUseAsm = false; + static const bool kNeedsUseAsm = true; + return ValidationInput( + WrapInFunction(WrapInFunction(source, kDoesNotNeedUseAsm).c_str(), + kNeedsUseAsm), + iw::ValidateStatement); +} + +ValidationInput Expression(const char* source) { + static const bool kDoesNotNeedUseAsm = false; + static const bool kNeedsUseAsm = true; + return ValidationInput( + WrapInFunction(WrapInFunction(source, kDoesNotNeedUseAsm).c_str(), + kNeedsUseAsm), + iw::ValidateExpression); +} + +iw::AsmTyperHarnessBuilder::VariableName Var(const char* name) { + return iw::AsmTyperHarnessBuilder::VariableName(name, VAR); +} + +iw::AsmTyperHarnessBuilder::VariableName DynamicGlobal(const char* name) { + return iw::AsmTyperHarnessBuilder::VariableName(name, DYNAMIC_GLOBAL); +} + +TEST(MissingUseAsmDirective) { + v8::V8::Initialize(); + + // We can't test the empty input ("") because the AsmTyperHarnessBuilder will + // CHECK if there's no function in the top-level scope. + const char* kTests[] = {"function module(){}", + "function module(){ use_asm; }", + "function module(){ \"use asm \"; }", + "function module(){ \" use asm \"; }", + "function module(){ \"use Asm\"; }"}; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const char* module = kTests[ii]; + if (!ValidationOf(Module(module)) + ->FailsWithMessage("Missing \"use asm\"")) { + std::cerr << "Test:\n" << module; + CHECK(false); + } + } +} + +TEST(InvalidModuleSignature) { + v8::V8::Initialize(); + + const struct { + const char* module; + const char* error_message; + } kTests[] = { + {"function eval(){ \"use asm\"; }", + "Invalid asm.js identifier in module name"}, + {"function arguments(){ \"use asm\"; }", + "Invalid asm.js identifier in module name"}, + {"function module(eval){ \"use asm\"; }", + "Invalid asm.js identifier in module parameter"}, + {"function module(arguments){ \"use asm\"; }", + "Invalid asm.js identifier in module parameter"}, + {"function module(stdlib, eval){ \"use asm\"; }", + "Invalid asm.js identifier in module parameter"}, + {"function module(stdlib, arguments){ \"use asm\"; }", + "Invalid asm.js identifier in module parameter"}, + {"function module(stdlib, foreign, eval){ \"use asm\"; }", + "Invalid asm.js identifier in module parameter"}, + {"function module(stdlib, foreign, arguments){ \"use asm\"; }", + "Invalid asm.js identifier in module parameter"}, + {"function module(stdlib, foreign, heap, eval){ \"use asm\"; }", + "asm.js modules may not have more than three parameters"}, + {"function module(stdlib, foreign, heap, arguments){ \"use asm\"; }", + "asm.js modules may not have more than three parameters"}, + {"function module(module){ \"use asm\"; }", + "Redeclared identifier in module parameter"}, + {"function module(stdlib, module){ \"use asm\"; }", + "Redeclared identifier in module parameter"}, + {"function module(stdlib, stdlib){ \"use asm\"; }", + "Redeclared identifier in module parameter"}, + {"function module(stdlib, foreign, module){ \"use asm\"; }", + "Redeclared identifier in module parameter"}, + {"function module(stdlib, foreign, stdlib){ \"use asm\"; }", + "Redeclared identifier in module parameter"}, + {"function module(stdlib, foreign, foreign){ \"use asm\"; }", + "Redeclared identifier in module parameter"}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Module(test->module)) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->module; + CHECK(false); + } + } +} + +TEST(ErrorsInGlobalVariableDefinition) { + const struct { + const char* decl; + const char* error_message; + } kTests[] = { + {"var v;", "Global variable missing initializer"}, + {"var v = uninitialized;", "Invalid global variable initializer"}, + {"var v = 'use asm';", "type annotation - forbidden literal"}, + {"var v = 4294967296;", " - forbidden literal"}, + {"var v = not_fround;", "Invalid global variable initializer"}, + {"var v = not_fround(1);", "expected call fround(literal)"}, + {"var v = __fround__(1.0);", "expected call fround(literal)"}, + {"var v = fround(1.0, 1.0);", "expected call fround(literal)"}, + {"var v = fround(not_fround);", "literal argument for call to fround"}, + {"var v = fround(1);", "literal argument to be a floating point"}, + {"var v = stdlib.nan", "Invalid import"}, + {"var v = stdlib.Math.nan", "Invalid import"}, + {"var v = stdlib.Mathh.E", "Invalid import"}, + {"var v = stdlib.Math", "Invalid import"}, + {"var v = Stdlib.Math.E", "Invalid import"}, + {"var v = stdlib.Math.E[0]", "Invalid import"}, + {"var v = stdlibb.NaN", "Invalid import"}, + {"var v = ffi.NaN[0]", "Invalid import"}, + {"var v = heap.NaN[0]", "Invalid import"}, + {"var v = ffi.foo * 2.0;", "unrecognized annotation"}, + {"var v = ffi.foo|1;", "unrecognized annotation"}, + {"var v = ffi()|0;", "must import member"}, + {"var v = +ffi();", "must import member"}, + {"var v = ffi().a|0;", "object lookup failed"}, + {"var v = +ffi().a;", "object lookup failed"}, + {"var v = sstdlib.a|0;", "object lookup failed"}, + {"var v = +sstdlib.a;", "object lookup failed"}, + {"var v = stdlib.NaN|0;", "object is not the ffi"}, + {"var v = +stdlib.NaN;", "object is not the ffi"}, + {"var v = new f()", "Invalid type after new"}, + {"var v = new stdli.Uint8Array(heap)", "Unknown stdlib member in heap"}, + {"var v = new stdlib.dd(heap)", "Unknown stdlib member in heap"}, + {"var v = new stdlib.Math.fround(heap)", "Type is not a heap view type"}, + {"var v = new stdlib.Uint8Array(a, b)", "Invalid number of arguments"}, + {"var v = new stdlib.Uint8Array(heap())", "should be the module's heap"}, + {"var v = new stdlib.Uint8Array(heap_)", "instead of heap parameter"}, + {"var v = new stdlib.Uint8Array(ffi)", "should be the module's heap"}, + {"var eval = 0;", "in global variable"}, + {"var eval = 0.0;", "in global variable"}, + {"var eval = fround(0.0);", "in global variable"}, + {"var eval = +ffi.a;", "in global variable"}, + {"var eval = ffi.a|0;", "in global variable"}, + {"var eval = ffi.a;", "in global variable"}, + {"var eval = new stdlib.Uint8Array(heap);", "in global variable"}, + {"var arguments = 0;", "in global variable"}, + {"var arguments = 0.0;", "in global variable"}, + {"var arguments = fround(0.0);", "in global variable"}, + {"var arguments = +ffi.a;", "in global variable"}, + {"var arguments = ffi.a|0;", "in global variable"}, + {"var arguments = ffi.a;", "in global variable"}, + {"var arguments = new stdlib.Uint8Array(heap);", "in global variable"}, + {"var a = 0, a = 0.0;", "Redefined global variable"}, + {"var a = 0; var a = 0;", "Redefined global variable"}, + {"var a = 0, b = 0; var a = 0;", "Redefined global variable"}, + {"var a = 0, b = 0; var b = 0, a = 0.0;", "Redefined global variable"}, + {"var a = stdlib.Int8Array", "Heap view types can not be aliased"}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Globals(test->decl)) + ->WithStdlib(DynamicGlobal("stdlib")) + ->WithFFI(DynamicGlobal("ffi")) + ->WithHeap(DynamicGlobal("heap")) + ->WithGlobal(DynamicGlobal("not_fround"), iw::AsmType::Int()) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->decl; + CHECK(false); + } + } +} + +TEST(ErrorsInFunctionTableDefinition) { + const struct { + const char* tables; + const char* error_message; + } kTests[] = { + {"var a = [a, a, a];", "Invalid length for function pointer table"}, + {"var a = [d2s0()];", "must be a function name"}, + {"var a = [d2s44];", "Undefined identifier in function pointer"}, + {"var a = [fround];", "not be a member of the standard library"}, + {"var a = [imul];", "not be a member of the standard library"}, + {"var a = [ffi_import];", "must be an asm.js function"}, + {"var a = [dI];", "must be an asm.js function"}, + {"var a = [d2s0, d2s1, d2s0, f2s0];", "mismatch in function pointer"}, + {"var eval = [d2s0, d2s1];", "asm.js identifier in function table name"}, + {"var arguments = [d2s0, d2s1];", "asm.js identifier in function table"}, + {"var foo = [d2s0, d2s1];", + "Identifier redefined as function pointer table"}, + {"var I = [d2s0, d2s1];", + "Identifier redefined as function pointer table"}, + {"var d2s = [d2f0, d2f1];", "redefined as function pointer table"}, + {"var d2s_t = [d2s0];", "Function table size mismatch"}, + {"var d2s_t = [d2f0, d2f1];", "initializer does not match previous"}, + }; + + auto d2s = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Signed()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Double()); + return ret; + }; + + auto d2s_tbl = [](Zone* zone) -> iw::AsmType* { + auto* d2s = iw::AsmType::Function(zone, iw::AsmType::Signed()); + d2s->AsFunctionType()->AddArgument(iw::AsmType::Double()); + + auto* ret = iw::AsmType::FunctionTableType(zone, 2, d2s); + return ret; + }; + + auto f2s = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Signed()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Float()); + return ret; + }; + + auto d2f = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Float()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Double()); + return ret; + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(FunctionTables(test->tables)) + ->WithImport(DynamicGlobal("ffi_import"), iw::AsmTyper::kFFI) + ->WithImport(DynamicGlobal("imul"), iw::AsmTyper::kMathImul) + ->WithImport(DynamicGlobal("E"), iw::AsmTyper::kMathE) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithImport(DynamicGlobal("floor"), iw::AsmTyper::kMathFround) + ->WithGlobal(DynamicGlobal("d2s0"), d2s) + ->WithGlobal(DynamicGlobal("d2s1"), d2s) + ->WithGlobal(DynamicGlobal("f2s0"), f2s) + ->WithGlobal(DynamicGlobal("f2s1"), f2s) + ->WithGlobal(DynamicGlobal("d2f0"), d2f) + ->WithGlobal(DynamicGlobal("d2f1"), d2f) + ->WithGlobal(DynamicGlobal("dI"), iw::AsmType::Int()) + ->WithGlobal(Var("I"), iw::AsmType::Int()) + ->WithUndefinedGlobal(Var("d2s"), d2s) + ->WithUndefinedGlobal(Var("d2s_t"), d2s_tbl) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->tables; + CHECK(false); + } + } +} + +TEST(ErrorsInModuleExport) { + const struct { + const char* module_export; + const char* error_message; + } kTests[] = { + {"", "Missing asm.js module export"}, + {"return;", "Unrecognized expression in asm.js module export expression"}, + {"return f;", "Undefined identifier in asm.js module export"}, + {"return f();", "Unrecognized expression in asm.js module export"}, + {"return d2s_tbl;", "cannot export function tables"}, + {"return min;", "cannot export standard library functions"}, + {"return ffi;", "cannot export foreign functions"}, + {"return I;", "is not an asm.js function"}, + {"return {'a': d2s_tbl}", "cannot export function tables"}, + {"return {'a': min}", "cannot export standard library functions"}, + {"return {'a': ffi}", "cannot export foreign functions"}, + {"return {'a': f()}", "must be an asm.js function name"}, + {"return {'a': f}", "Undefined identifier in asm.js module export"}, + {"function v() { a(); } return {b: d2s}", "Missing definition for forw"}, + {"return {b: d2s, 'a': d2s_tbl}", "cannot export function tables"}, + {"return {b: d2s, 'a': min}", "cannot export standard library"}, + {"return {b: d2s, 'a': ffi}", "cannot export foreign functions"}, + {"return {b: d2s, 'a': f()}", "must be an asm.js function name"}, + {"return {b: d2s, 'a': f}", "Undefined identifier in asm.js module"}, + }; + + auto d2s_tbl = [](Zone* zone) -> iw::AsmType* { + auto* d2s = iw::AsmType::Function(zone, iw::AsmType::Signed()); + d2s->AsFunctionType()->AddArgument(iw::AsmType::Double()); + + auto* ret = iw::AsmType::FunctionTableType(zone, 2, d2s); + return ret; + }; + + auto d2s = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Signed()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Double()); + return ret; + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Export(test->module_export)) + ->WithGlobal(DynamicGlobal("d2s_tbl"), d2s_tbl) + ->WithGlobal(DynamicGlobal("d2s"), d2s) + ->WithImport(DynamicGlobal("min"), iw::AsmTyper::kMathMin) + ->WithImport(DynamicGlobal("ffi"), iw::AsmTyper::kFFI) + ->WithGlobal(DynamicGlobal("I"), iw::AsmType::Int()) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->module_export; + CHECK(false); + } + } +} + +TEST(ErrorsInFunction) { + auto d2s = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Signed()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Double()); + return ret; + }; + + const struct { + const char* function; + const char* error_message; + } kTests[] = { + {"function f(eval) {" + " eval = eval|0;" + "}\n", + "Invalid asm.js identifier in parameter name"}, + {"function f(arguments) {" + " arguments = arguments|0;" + "}\n", + "Invalid asm.js identifier in parameter name"}, + // The following error should actually be a "redeclared local," but the + // AST "hides" the first parameter from us, so the parameter type checking + // will fail because the validator will think that the a = a|0 is + // annotating the second parameter. + {"function f(a, a) {\n" + " a = a|0;\n" + " a = +a;\n" + "}\n", + "Incorrect parameter type annotations"}, + {"function f(b, a) {\n" + " if (0) return;\n" + " b = +b;\n" + " a = a|0;\n" + "}\n", + "Incorrect parameter type annotations"}, + {"function f(b, a) {\n" + " f();\n" + " b = +b;\n" + " a = a|0;\n" + "}\n", + "Incorrect parameter type annotations"}, + {"function f(b, a) {\n" + " f.a = 0;\n" + " b = +b;\n" + " a = a|0;\n" + "}\n", + "Incorrect parameter type annotations"}, + {"function f(b, a) {\n" + " a = a|0;\n" + " b = +b;\n" + "}\n", + "Incorrect parameter type annotations"}, + {"function f(b, a) {\n" + " b = +b;\n" + " a = a|0;\n" + " var eval = 0;\n" + "}\n", + "Invalid asm.js identifier in local variable"}, + {"function f(b, a) {\n" + " b = +b;\n" + " a = a|0;\n" + " var b = 0;\n" + "}\n", + "Redeclared local"}, + {"function f(b, a) {\n" + " b = +b;\n" + " a = a|0;\n" + " var c = 0, c = 1.0;\n" + "}\n", + "Redeclared local"}, + {"function f(b, a) {\n" + " b = +b;\n" + " a = a|0;\n" + " var c = 0; var c = 1.0;\n" + "}\n", + "Redeclared local"}, + {"function f(b, a) {\n" + " b = +b;\n" + " a = a|0;\n" + " f();\n" + " var c = 0;\n" + "}\n", + "Local variable missing initializer in asm.js module"}, + {"function f() {\n" + " function ff() {}\n" + "}\n", + "Functions may only define inner variables"}, + {"function f() {\n" + " return a+1;\n" + "}\n", + "Invalid return type annotation"}, + {"function f() {\n" + " return ~~x;\n" + "}\n", + "Invalid return type annotation"}, + {"function f() {\n" + " return d();\n" + "}\n", + "Invalid function call in return statement"}, + {"function f() {\n" + " return 'use asm';\n" + "}\n", + "Invalid literal in return statement"}, + {"function f() {\n" + " return 2147483648;\n" + "}\n", + "Invalid literal in return statement"}, + {"function f() {\n" + " return stdlib.Math.E;" + "}\n", + "Invalid return type expression"}, + {"function f() {\n" + " return E[0];" + "}\n", + "Invalid return type expression"}, + {"function I() {}\n", "Identifier redefined as function"}, + {"function foo() {}\n", "Identifier redefined as function"}, + {"function d2s() {}\n", "Identifier redefined (function name)"}, + {"function d2s(x) {\n" + " x = x|0;\n" + " return -1;\n" + "}\n", + "Identifier redefined (function name)"}, + {"function d2s(x) {\n" + " x = +x;\n" + " return -1.0;\n" + "}\n", + "Identifier redefined (function name)"}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Function(test->function)) + ->WithGlobal(Var("I"), iw::AsmType::Int()) + ->WithGlobal(Var("d2s"), d2s) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->function; + CHECK(false); + } + } +} + +TEST(ErrorsInStatement) { + const struct { + const char* statement; + const char* error_message; + } kTests[] = { + {"if (fround(1));", "If condition must be type int"}, + {"return;", "Type mismatch in return statement"}, + {"return +1.0;", "Type mismatch in return statement"}, + {"return +d()", "Type mismatch in return statement"}, + {"while (fround(1));", "While condition must be type int"}, + {"do {} while (fround(1));", "Do {} While condition must be type int"}, + {"for (;fround(1););", "For condition must be type int"}, + {"switch(flocal){ case 0: return 0; }", "Switch tag must be signed"}, + {"switch(slocal){ default: case 0: return 0; }", + "Switch default must appear last"}, + {"switch(slocal){ case 1: case 1: return 0; }", "Duplicated case label"}, + {"switch(slocal){ case 1: case 0: break; case 1: return 0; }", + "Duplicated case label"}, + {"switch(slocal){ case 1.0: return 0; }", + "Case label must be a 32-bit signed integer"}, + {"switch(slocal){ case 1.0: return 0; }", + "Case label must be a 32-bit signed integer"}, + {"switch(slocal){ case -100000: case 2147483647: return 0; }", + "Out-of-bounds case"}, + {"switch(slocal){ case 2147483648: return 0; }", + "Case label must be a 32-bit signed"}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Statement(test->statement)) + ->WithReturnType(iw::AsmType::Signed()) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithLocal(DynamicGlobal("flocal"), iw::AsmType::Float()) + ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->statement; + CHECK(false); + } + } +} + +TEST(ErrorsInExpression) { + auto d2d = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Double()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Double()); + return ret; + }; + + auto d2s_tbl = [](Zone* zone) -> iw::AsmType* { + auto* d2s = iw::AsmType::Function(zone, iw::AsmType::Signed()); + d2s->AsFunctionType()->AddArgument(iw::AsmType::Double()); + + auto* ret = iw::AsmType::FunctionTableType(zone, 2, d2s); + return ret; + }; + + const struct { + const char* expression; + const char* error_message; + } kTests[] = { + {"noy_a_function();", "Unanotated call to a function must be a call to"}, + {"a = 0;", "Undeclared identifier"}, + // we can't verify the module's name being referenced here because + // expression validation does not invoke ValidateModule, which sets up the + // module information in the AsmTyper. + {"stdlib", "accessed by ordinary expressions"}, + {"ffi", "accessed by ordinary expressions"}, + {"heap", "accessed by ordinary expressions"}, + {"d2d", "accessed by ordinary expression"}, + {"fround", "accessed by ordinary expression"}, + {"d2s_tbl", "accessed by ordinary expression"}, + {"ilocal = +1.0", "Type mismatch in assignment"}, + {"!dlocal", "Invalid type for !"}, + {"2 * dlocal", "Invalid types for intish *"}, + {"dlocal * 2", "Invalid types for intish *"}, + {"1048577 * ilocal", "Invalid operands for *"}, + {"1048577 / ilocal", "Invalid operands for /"}, + {"1048577 % dlocal", "Invalid operands for %"}, + {"1048577 * dlocal", "Invalid operands for *"}, + {"1048577 / dlocal", "Invalid operands for /"}, + {"1048577 % ilocal", "Invalid operands for %"}, + {"ilocal * dlocal", "Invalid operands for *"}, + {"ilocal / dlocal", "Invalid operands for /"}, + {"ilocal % dlocal", "Invalid operands for %"}, + {"1048577 + dlocal", "Invalid operands for additive expression"}, + {"1048577 - dlocal", "Invalid operands for additive expression"}, + {"ilocal + dlocal", "Invalid operands for additive expression"}, + {"ilocal - dlocal", "Invalid operands for additive expression"}, + {"1048577 << dlocal", "Invalid operands for <<"}, + {"1048577 >> dlocal", "Invalid operands for >>"}, + {"1048577 >>> dlocal", "Invalid operands for >>"}, + {"ilocal << dlocal", "Invalid operands for <<"}, + {"ilocal >> dlocal", "Invalid operands for >>"}, + {"ilocal >>> dlocal", "Invalid operands for >>>"}, + {"1048577 < dlocal", "Invalid operands for <"}, + {"ilocal < dlocal", "Invalid operands for <"}, + {"1048577 > dlocal", "Invalid operands for >"}, + {"ilocal > dlocal", "Invalid operands for >"}, + {"1048577 <= dlocal", "Invalid operands for <="}, + {"ilocal <= dlocal", "Invalid operands for <="}, + {"1048577 >= dlocal", "Invalid operands for >="}, + {"ilocal >= dlocal", "Invalid operands for >="}, + {"1048577 == dlocal", "Invalid operands for =="}, + {"ilocal == dlocal", "Invalid operands for =="}, + /* NOTE: the parser converts a == b to !(a == b). */ + {"1048577 != dlocal", "Invalid operands for =="}, + {"ilocal != dlocal", "Invalid operands for =="}, + {"dlocal & dlocal", "Invalid operands for &"}, + {"1048577 & dlocal", "Invalid operands for &"}, + {"ilocal & dlocal", "Invalid operands for &"}, + {"dlocal | dlocal2", "Invalid operands for |"}, + {"1048577 | dlocal", "Invalid operands for |"}, + {"ilocal | dlocal", "Invalid operands for |"}, + {"dlocal ^ dlocal2", "Invalid operands for ^"}, + {"1048577 ^ dlocal", "Invalid operands for ^"}, + {"ilocal ^ dlocal", "Invalid operands for ^"}, + {"dlocal ? 0 : 1", "Ternary operation condition should be int"}, + {"ilocal ? dlocal : 1", "Type mismatch for ternary operation result"}, + {"ilocal ? 1 : dlocal", "Type mismatch for ternary operation result"}, + {"eval(10)|0", "Invalid asm.js identifier in (forward) function"}, + {"arguments(10)|0", "Invalid asm.js identifier in (forward) function"}, + {"not_a_function(10)|0", "Calling something that's not a function"}, + {"fround(FFI())", "Foreign functions can't return float"}, + {"FFI(fround(0))|0", "Function invocation does not match function type"}, + {"FFI(2147483648)|0", "Function invocation does not match function type"}, + {"d2d(2.0)|0", "Function invocation does not match function type"}, + {"+d2d(2)", "Function invocation does not match function type"}, + {"eval[ilocal & 3]()|0", "Invalid asm.js identifier in (forward)"}, + {"arguments[ilocal & 3]()|0", "Invalid asm.js identifier in (forward)"}, + {"not_a_function[ilocal & 3]()|0", "Identifier does not name a function"}, + {"d2s_tbl[ilocal & 3](0.0)|0", "Function table size does not match"}, + {"+d2s_tbl[ilocal & 1](0.0)", "does not match previous signature"}, + {"d2s_tbl[ilocal & 1](0)|0", "does not match previous signature"}, + {"a.b()|0", "Indirect call index must be in the expr & mask form"}, + {"HEAP32[0][0] = 0", "Invalid heap access"}, + {"heap32[0] = 0", "Undeclared identifier in heap access"}, + {"not_a_function[0] = 0", "Identifier does not represent a heap view"}, + {"HEAP32[0.0] = 0", "Heap access index must be int"}, + {"HEAP32[-1] = 0", "Heap access index must be a 32-bit unsigned integer"}, + {"HEAP32[ilocal >> 1] = 0", "Invalid heap access index"}, + // *VIOLATION* the following is invalid, but because of desugaring it is + // accepted. + // {"HEAP32[0 >> 1] = 0", "Invalid heap access index"}, + {"HEAP8[fround(0.0)] = 0", "Invalid heap access index for byte array"}, + {"HEAP8[iish] = 0", "Invalid heap access index for byte array"}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithStdlib(DynamicGlobal("stdlib")) + ->WithFFI(DynamicGlobal("ffi")) + ->WithHeap(DynamicGlobal("heap")) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) + ->WithLocal(DynamicGlobal("dlocal"), iw::AsmType::Double()) + ->WithLocal(DynamicGlobal("dlocal2"), iw::AsmType::Double()) + ->WithLocal(DynamicGlobal("not_a_function"), iw::AsmType::Int()) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithImport(DynamicGlobal("FFI"), iw::AsmTyper::kFFI) + ->WithGlobal(DynamicGlobal("d2d"), d2d) + ->WithGlobal(DynamicGlobal("d2s_tbl"), d2s_tbl) + ->WithGlobal(DynamicGlobal("HEAP32"), iw::AsmType::Int32Array()) + ->WithGlobal(DynamicGlobal("HEAP8"), iw::AsmType::Int8Array()) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateNumericLiteral) { + const struct { + const char* expression; + iw::AsmType* expected_type; + } kTests[] = { + {"0", iw::AsmType::FixNum()}, + {"-1", iw::AsmType::Signed()}, + {"2147483648", iw::AsmType::Unsigned()}, + {"0.0", iw::AsmType::Double()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->SucceedsWithExactType(test->expected_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateIdentifier) { + const struct { + const char* expression; + iw::AsmType* expected_type; + } kTests[] = {{"afixnum", iw::AsmType::FixNum()}, + {"adouble", iw::AsmType::Double()}, + {"afloat", iw::AsmType::Float()}, + {"anextern", iw::AsmType::Extern()}, + {"avoid", iw::AsmType::Void()}}; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal(test->expression), test->expected_type) + ->WithGlobal(DynamicGlobal(test->expression), + iw::AsmType::Floatish()) + ->SucceedsWithExactType(test->expected_type)) { + std::cerr << "Test (local identifiers):\n" << test->expression; + CHECK(false); + } + } + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithGlobal(DynamicGlobal(test->expression), test->expected_type) + ->SucceedsWithExactType(test->expected_type)) { + std::cerr << "Test (global identifiers):\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateCallExpression) { + auto v2f = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Float()); + return ret; + }; + + const struct { + const char* expression; + } kTests[] = { + {"a_float_function()"}, + {"fround(0)"}, + {"slocal"}, + {"ulocal"}, + {"dqlocal"}, + {"fishlocal"}, + }; + + char full_test[200]; + static const size_t kFullTestSize = arraysize(full_test); + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", + test->expression) < kFullTestSize); + if (!ValidationOf(Expression(full_test)) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithGlobal(DynamicGlobal("a_float_function"), v2f) + ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("ulocal"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("dqlocal"), iw::AsmType::DoubleQ()) + ->WithLocal(DynamicGlobal("fishlocal"), iw::AsmType::Floatish()) + ->SucceedsWithExactType(iw::AsmType::Float())) { + std::cerr << "Test:\n" << full_test; + CHECK(false); + } + } + + const struct { + const char* expression; + const char* error_message; + } kFailureTests[] = { + {"vlocal", "Invalid argument type to fround"}, + {"ilocal", "Invalid argument type to fround"}, + {"a_double_function()", "Function invocation does not match"}, + }; + + auto v2d = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Double()); + return ret; + }; + + for (size_t ii = 0; ii < arraysize(kFailureTests); ++ii) { + const auto* test = kFailureTests + ii; + CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", + test->expression) < kFullTestSize); + if (!ValidationOf(Expression(full_test)) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) + ->WithLocal(DynamicGlobal("vlocal"), iw::AsmType::Void()) + ->WithGlobal(DynamicGlobal("a_double_function"), v2d) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << full_test; + CHECK(false); + } + } +} + +TEST(ValidateMemberExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"I8[i]", iw::AsmType::Intish()}, // Legacy: no shift for 8-bit view. + {"I8[iish >> 0]", iw::AsmType::Intish()}, + {"I8[0]", iw::AsmType::Intish()}, + {"I8[2147483648]", iw::AsmType::Intish()}, + {"U8[iish >> 0]", iw::AsmType::Intish()}, + {"U8[i]", iw::AsmType::Intish()}, // Legacy: no shift for 8-bit view. + {"U8[0]", iw::AsmType::Intish()}, + {"U8[2147483648]", iw::AsmType::Intish()}, + {"I16[iish >> 1]", iw::AsmType::Intish()}, + {"I16[0]", iw::AsmType::Intish()}, + {"I16[1073741824]", iw::AsmType::Intish()}, + {"U16[iish >> 1]", iw::AsmType::Intish()}, + {"U16[0]", iw::AsmType::Intish()}, + {"U16[1073741824]", iw::AsmType::Intish()}, + {"I32[iish >> 2]", iw::AsmType::Intish()}, + {"I32[0]", iw::AsmType::Intish()}, + {"I32[536870912]", iw::AsmType::Intish()}, + {"U32[iish >> 2]", iw::AsmType::Intish()}, + {"U32[0]", iw::AsmType::Intish()}, + {"U32[536870912]", iw::AsmType::Intish()}, + {"F32[iish >> 2]", iw::AsmType::FloatQ()}, + {"F32[0]", iw::AsmType::FloatQ()}, + {"F32[536870912]", iw::AsmType::FloatQ()}, + {"F64[iish >> 3]", iw::AsmType::DoubleQ()}, + {"F64[0]", iw::AsmType::DoubleQ()}, + {"F64[268435456]", iw::AsmType::DoubleQ()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithGlobal(DynamicGlobal("I8"), iw::AsmType::Int8Array()) + ->WithGlobal(DynamicGlobal("U8"), iw::AsmType::Uint8Array()) + ->WithGlobal(DynamicGlobal("I16"), iw::AsmType::Int16Array()) + ->WithGlobal(DynamicGlobal("U16"), iw::AsmType::Uint16Array()) + ->WithGlobal(DynamicGlobal("I32"), iw::AsmType::Int32Array()) + ->WithGlobal(DynamicGlobal("U32"), iw::AsmType::Uint32Array()) + ->WithGlobal(DynamicGlobal("F32"), iw::AsmType::Float32Array()) + ->WithGlobal(DynamicGlobal("F64"), iw::AsmType::Float64Array()) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->WithLocal(DynamicGlobal("i"), iw::AsmType::Int()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateAssignmentExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + // ----------------------------------------------------------------------- + // Array assignments. + // Storing signed to int heap view. + {"I8[1024] = -1024", iw::AsmType::Signed()}, + {"I8[1024 >> 0] = -1024", iw::AsmType::Signed()}, + {"I8[0] = -1024", iw::AsmType::Signed()}, + {"I8[2147483648] = -1024", iw::AsmType::Signed()}, + {"U8[1024 >> 0] = -1024", iw::AsmType::Signed()}, + {"U8[0] = -1024", iw::AsmType::Signed()}, + {"U8[2147483648] = -1024", iw::AsmType::Signed()}, + {"I16[1024 >> 1] = -1024", iw::AsmType::Signed()}, + {"I16[0] = -1024", iw::AsmType::Signed()}, + {"I16[1073741824] = -1024", iw::AsmType::Signed()}, // not pre-shifted. + {"U16[1024 >> 1] = -1024", iw::AsmType::Signed()}, + {"U16[0] = -1024", iw::AsmType::Signed()}, + {"U16[1073741824] = -1024", iw::AsmType::Signed()}, // not pre-shifted. + {"I32[1024 >> 2] = -1024", iw::AsmType::Signed()}, + {"I32[0] = -1024", iw::AsmType::Signed()}, + {"I32[536870912] = -1024", iw::AsmType::Signed()}, // not pre-shifted. + {"U32[1024 >> 2] = -1024", iw::AsmType::Signed()}, + {"U32[0] = -1024", iw::AsmType::Signed()}, + {"U32[536870912] = -1024", iw::AsmType::Signed()}, // not pre-shifted. + // Sroting fixnum to int heap view. + {"I8[1024] = 1024", iw::AsmType::FixNum()}, + {"I8[1024 >> 0] = 1024", iw::AsmType::FixNum()}, + {"I8[0] = 1024", iw::AsmType::FixNum()}, + {"I8[2147483648] = 1024", iw::AsmType::FixNum()}, + {"U8[1024 >> 0] = 1024", iw::AsmType::FixNum()}, + {"U8[0] = 1024", iw::AsmType::FixNum()}, + {"U8[2147483648] = 1024", iw::AsmType::FixNum()}, + {"I16[1024 >> 1] = 1024", iw::AsmType::FixNum()}, + {"I16[0] = 1024", iw::AsmType::FixNum()}, + {"I16[1073741824] = 1024", iw::AsmType::FixNum()}, // not pre-shifted. + {"U16[1024 >> 1] = 1024", iw::AsmType::FixNum()}, + {"U16[0] = 1024", iw::AsmType::FixNum()}, + {"U16[1073741824] = 1024", iw::AsmType::FixNum()}, // not pre-shifted. + {"I32[1024 >> 2] = 1024", iw::AsmType::FixNum()}, + {"I32[0] = 1024", iw::AsmType::FixNum()}, + {"I32[536870912] = 1024", iw::AsmType::FixNum()}, // not pre-shifted. + {"U32[1024 >> 2] = 1024", iw::AsmType::FixNum()}, + {"U32[0] = 1024", iw::AsmType::FixNum()}, + {"U32[536870912] = 1024", iw::AsmType::FixNum()}, // not pre-shifted. + // Storing int to int heap view. + {"I8[ilocal] = ilocal", iw::AsmType::Int()}, + {"I8[ilocal >> 0] = ilocal", iw::AsmType::Int()}, + {"I8[0] = ilocal", iw::AsmType::Int()}, + {"I8[2147483648] = ilocal", iw::AsmType::Int()}, + {"U8[ilocal >> 0] = ilocal", iw::AsmType::Int()}, + {"U8[0] = ilocal", iw::AsmType::Int()}, + {"U8[2147483648] = ilocal", iw::AsmType::Int()}, + {"I16[ilocal >> 1] = ilocal", iw::AsmType::Int()}, + {"I16[0] = ilocal", iw::AsmType::Int()}, + {"I16[1073741824] = ilocal", iw::AsmType::Int()}, // not pre-shifted. + {"U16[ilocal >> 1] = ilocal", iw::AsmType::Int()}, + {"U16[0] = ilocal", iw::AsmType::Int()}, + {"U16[1073741824] = ilocal", iw::AsmType::Int()}, // not pre-shifted. + {"I32[ilocal >> 2] = ilocal", iw::AsmType::Int()}, + {"I32[0] = ilocal", iw::AsmType::Int()}, + {"I32[536870912] = ilocal", iw::AsmType::Int()}, // not pre-shifted. + {"U32[ilocal >> 2] = ilocal", iw::AsmType::Int()}, + {"U32[0] = ilocal", iw::AsmType::Int()}, + {"U32[536870912] = ilocal", iw::AsmType::Int()}, // not pre-shifted. + // Storing intish to int heap view. + {"I8[ilocal] = iish", iw::AsmType::Intish()}, + {"I8[iish >> 0] = iish", iw::AsmType::Intish()}, + {"I8[0] = iish", iw::AsmType::Intish()}, + {"I8[2147483648] = iish", iw::AsmType::Intish()}, + {"U8[iish >> 0] = iish", iw::AsmType::Intish()}, + {"U8[0] = iish", iw::AsmType::Intish()}, + {"U8[2147483648] = iish", iw::AsmType::Intish()}, + {"I16[iish >> 1] = iish", iw::AsmType::Intish()}, + {"I16[0] = iish", iw::AsmType::Intish()}, + {"I16[1073741824] = iish", iw::AsmType::Intish()}, // not pre-shifted. + {"U16[iish >> 1] = iish", iw::AsmType::Intish()}, + {"U16[0] = iish", iw::AsmType::Intish()}, + {"U16[1073741824] = iish", iw::AsmType::Intish()}, // not pre-shifted. + {"I32[iish >> 2] = iish", iw::AsmType::Intish()}, + {"I32[0] = iish", iw::AsmType::Intish()}, + {"I32[536870912] = iish", iw::AsmType::Intish()}, // not pre-shifted. + {"U32[iish >> 2] = iish", iw::AsmType::Intish()}, + {"U32[0] = iish", iw::AsmType::Intish()}, + {"U32[536870912] = iish", iw::AsmType::Intish()}, // not pre-shifted. + // Storing floatish to f32 heap view. + {"F32[iish >> 2] = fish", iw::AsmType::Floatish()}, + {"F32[0] = fish", iw::AsmType::Floatish()}, + {"F32[536870912] = fish ", iw::AsmType::Floatish()}, // not pre-shifted. + // Storing double? to f32 heap view. + {"F32[iish >> 2] = dq", iw::AsmType::DoubleQ()}, + {"F32[0] = dq", iw::AsmType::DoubleQ()}, + {"F32[536870912] = dq", iw::AsmType::DoubleQ()}, // not pre-shifted. + // Storing float? to f64 heap view. + {"F64[iish >> 3] = fq", iw::AsmType::FloatQ()}, + {"F64[0] = fq", iw::AsmType::FloatQ()}, + {"F64[268435456] = fq", iw::AsmType::FloatQ()}, // not pre-shifted. + // Storing double? to f64 heap view. + {"F64[iish >> 3] = dq", iw::AsmType::DoubleQ()}, + {"F64[0] = dq", iw::AsmType::DoubleQ()}, + {"F64[268435456] = dq", iw::AsmType::DoubleQ()}, // not pre-shifted. + // ----------------------------------------------------------------------- + // Scalar assignments. + {"ilocal = 1024", iw::AsmType::FixNum()}, + {"ilocal = -1024", iw::AsmType::Signed()}, + {"ilocal = 2147483648", iw::AsmType::Unsigned()}, + {"ilocal = iglobal", iw::AsmType::Int()}, + {"iglobal = 1024", iw::AsmType::FixNum()}, + {"iglobal = -1024", iw::AsmType::Signed()}, + {"iglobal = 2147483648", iw::AsmType::Unsigned()}, + {"iglobal = ilocal", iw::AsmType::Int()}, + {"dlocal = 0.0", iw::AsmType::Double()}, + {"dlocal = +make_double()", iw::AsmType::Double()}, + {"dglobal = 0.0", iw::AsmType::Double()}, + {"dglobal = +make_double()", iw::AsmType::Double()}, + {"flocal = fround(0)", iw::AsmType::Float()}, + {"flocal = fround(make_float())", iw::AsmType::Float()}, + {"fglobal = fround(0)", iw::AsmType::Float()}, + {"fglobal = fround(make_float())", iw::AsmType::Float()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithLocal(DynamicGlobal("fq"), iw::AsmType::FloatQ()) + ->WithLocal(DynamicGlobal("dq"), iw::AsmType::DoubleQ()) + ->WithLocal(DynamicGlobal("fish"), iw::AsmType::Floatish()) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->WithGlobal(DynamicGlobal("iglobal"), iw::AsmType::Int()) + ->WithGlobal(DynamicGlobal("dglobal"), iw::AsmType::Double()) + ->WithGlobal(DynamicGlobal("fglobal"), iw::AsmType::Float()) + ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) + ->WithLocal(DynamicGlobal("dlocal"), iw::AsmType::Double()) + ->WithLocal(DynamicGlobal("flocal"), iw::AsmType::Float()) + ->WithGlobal(DynamicGlobal("I8"), iw::AsmType::Int8Array()) + ->WithGlobal(DynamicGlobal("U8"), iw::AsmType::Uint8Array()) + ->WithGlobal(DynamicGlobal("I16"), iw::AsmType::Int16Array()) + ->WithGlobal(DynamicGlobal("U16"), iw::AsmType::Uint16Array()) + ->WithGlobal(DynamicGlobal("I32"), iw::AsmType::Int32Array()) + ->WithGlobal(DynamicGlobal("U32"), iw::AsmType::Uint32Array()) + ->WithGlobal(DynamicGlobal("F32"), iw::AsmType::Float32Array()) + ->WithGlobal(DynamicGlobal("F64"), iw::AsmType::Float64Array()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateUnaryExpression) { + auto v2d = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Double()); + return ret; + }; + + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"-2147483648", iw::AsmType::Signed()}, + {"-1024", iw::AsmType::Signed()}, + {"-1", iw::AsmType::Signed()}, + {"-2147483648.0", iw::AsmType::Double()}, + {"+make_double()", iw::AsmType::Double()}, + {"+dbl()", iw::AsmType::Double()}, + {"make_double() * 1.0", iw::AsmType::Double()}, // Violation. + {"~~fq", iw::AsmType::Signed()}, + {"~~dglobal", iw::AsmType::Signed()}, + {"+slocal", iw::AsmType::Double()}, + {"slocal * 1.0", iw::AsmType::Double()}, // Violation. + {"+ulocal", iw::AsmType::Double()}, + {"ulocal * 1.0", iw::AsmType::Double()}, // Violation. + {"+dq", iw::AsmType::Double()}, + {"dq * 1.0", iw::AsmType::Double()}, // Violation. + {"+fq", iw::AsmType::Double()}, + {"fq * 1.0", iw::AsmType::Double()}, // Violation. + {"-ilocal", iw::AsmType::Intish()}, + {"ilocal * -1", iw::AsmType::Intish()}, // Violation. + {"-dq", iw::AsmType::Double()}, + {"dq * -1", iw::AsmType::Double()}, // Violation. + {"-fq", iw::AsmType::Floatish()}, + {"fq * -1", iw::AsmType::Floatish()}, // Violation. + {"~iish", iw::AsmType::Signed()}, + {"iish ^ -1", iw::AsmType::Signed()}, // Violation, but OK. + {"!ilocal", iw::AsmType::Int()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal("fq"), iw::AsmType::FloatQ()) + ->WithLocal(DynamicGlobal("dq"), iw::AsmType::DoubleQ()) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("ulocal"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) + ->WithGlobal(DynamicGlobal("dglobal"), iw::AsmType::Double()) + ->WithGlobal(DynamicGlobal("dbl"), v2d) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateMultiplicativeExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"dq * dq", iw::AsmType::Double()}, + {"fq * fq", iw::AsmType::Floatish()}, + {"slocal / slocal", iw::AsmType::Intish()}, + {"ulocal / ulocal", iw::AsmType::Intish()}, + {"dq / dq", iw::AsmType::Double()}, + {"fq / fq", iw::AsmType::Floatish()}, + {"slocal % slocal", iw::AsmType::Intish()}, + {"ulocal % ulocal", iw::AsmType::Intish()}, + {"dq % dq", iw::AsmType::Double()}, + {"-1048575 * ilocal", iw::AsmType::Intish()}, + {"ilocal * -1048575", iw::AsmType::Intish()}, + {"1048575 * ilocal", iw::AsmType::Intish()}, + {"ilocal * 1048575", iw::AsmType::Intish()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal("fq"), iw::AsmType::FloatQ()) + ->WithLocal(DynamicGlobal("dq"), iw::AsmType::DoubleQ()) + ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("ulocal"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) + ->WithGlobal(DynamicGlobal("dglobal"), iw::AsmType::Double()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateAdditiveExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"dlocal + dlocal", iw::AsmType::Double()}, + {"fq + fq", iw::AsmType::Floatish()}, + {"dq - dq", iw::AsmType::Double()}, + {"fq - fq", iw::AsmType::Floatish()}, + {"ilocal + 1", iw::AsmType::Intish()}, + {"ilocal - 1", iw::AsmType::Intish()}, + {"slocal + ilocal + 1", iw::AsmType::Intish()}, + {"slocal - ilocal + 1", iw::AsmType::Intish()}, + {"ulocal + ilocal + 1", iw::AsmType::Intish()}, + {"ulocal - ilocal + 1", iw::AsmType::Intish()}, + {"ulocal + slocal + ilocal + 1", iw::AsmType::Intish()}, + {"ulocal + slocal - ilocal + 1", iw::AsmType::Intish()}, + {"ulocal - slocal + ilocal + 1", iw::AsmType::Intish()}, + {"ulocal - slocal - ilocal + 1", iw::AsmType::Intish()}, + {"1 + 1", iw::AsmType::FixNum()}, // Violation: intish. + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal("fq"), iw::AsmType::FloatQ()) + ->WithLocal(DynamicGlobal("dq"), iw::AsmType::DoubleQ()) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->WithLocal(DynamicGlobal("dlocal"), iw::AsmType::Double()) + ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("ulocal"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateShiftExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"iish << iish", iw::AsmType::Signed()}, + {"iish >> iish", iw::AsmType::Signed()}, + {"iish >>> iish", iw::AsmType::Unsigned()}, + {"1 << 0", iw::AsmType::FixNum()}, // Violation: signed. + {"1 >> 0", iw::AsmType::FixNum()}, // Violation: signed. + {"4294967295 >>> 0", iw::AsmType::Unsigned()}, + {"-1 >>> 0", iw::AsmType::Unsigned()}, + {"2147483647 >>> 0", iw::AsmType::FixNum()}, // Violation: unsigned. + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateComparisonExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + // ----------------------------------------------------------------------- + // Non const <op> Non const + {"s0 == s1", iw::AsmType::Int()}, + {"u0 == u1", iw::AsmType::Int()}, + {"f0 == f1", iw::AsmType::Int()}, + {"d0 == d1", iw::AsmType::Int()}, + {"s0 != s1", iw::AsmType::Int()}, + {"u0 != u1", iw::AsmType::Int()}, + {"f0 != f1", iw::AsmType::Int()}, + {"d0 != d1", iw::AsmType::Int()}, + {"s0 < s1", iw::AsmType::Int()}, + {"u0 < u1", iw::AsmType::Int()}, + {"f0 < f1", iw::AsmType::Int()}, + {"d0 < d1", iw::AsmType::Int()}, + {"s0 <= s1", iw::AsmType::Int()}, + {"u0 <= u1", iw::AsmType::Int()}, + {"f0 <= f1", iw::AsmType::Int()}, + {"d0 <= d1", iw::AsmType::Int()}, + {"s0 > s1", iw::AsmType::Int()}, + {"u0 > u1", iw::AsmType::Int()}, + {"f0 > f1", iw::AsmType::Int()}, + {"d0 > d1", iw::AsmType::Int()}, + {"s0 >= s1", iw::AsmType::Int()}, + {"u0 >= u1", iw::AsmType::Int()}, + {"f0 >= f1", iw::AsmType::Int()}, + {"d0 >= d1", iw::AsmType::Int()}, + // ----------------------------------------------------------------------- + // Non const <op> Const + {"s0 == -1025", iw::AsmType::Int()}, + {"u0 == 123456789", iw::AsmType::Int()}, + {"f0 == fround(123456.78)", iw::AsmType::Int()}, + {"d0 == 9876543.201", iw::AsmType::Int()}, + {"s0 != -1025", iw::AsmType::Int()}, + {"u0 != 123456789", iw::AsmType::Int()}, + {"f0 != fround(123456.78)", iw::AsmType::Int()}, + {"d0 != 9876543.201", iw::AsmType::Int()}, + {"s0 < -1025", iw::AsmType::Int()}, + {"u0 < 123456789", iw::AsmType::Int()}, + {"f0 < fround(123456.78)", iw::AsmType::Int()}, + {"d0 < 9876543.201", iw::AsmType::Int()}, + {"s0 <= -1025", iw::AsmType::Int()}, + {"u0 <= 123456789", iw::AsmType::Int()}, + {"f0 <= fround(123456.78)", iw::AsmType::Int()}, + {"d0 <= 9876543.201", iw::AsmType::Int()}, + {"s0 > -1025", iw::AsmType::Int()}, + {"u0 > 123456789", iw::AsmType::Int()}, + {"f0 > fround(123456.78)", iw::AsmType::Int()}, + {"d0 > 9876543.201", iw::AsmType::Int()}, + {"s0 >= -1025", iw::AsmType::Int()}, + {"u0 >= 123456789", iw::AsmType::Int()}, + {"f0 >= fround(123456.78)", iw::AsmType::Int()}, + {"d0 >= 9876543.201", iw::AsmType::Int()}, + // ----------------------------------------------------------------------- + // Const <op> Non const + {"-1025 == s0", iw::AsmType::Int()}, + {"123456789 == u0", iw::AsmType::Int()}, + {"fround(123456.78) == f0", iw::AsmType::Int()}, + {"9876543.201 == d0", iw::AsmType::Int()}, + {"-1025 != s0", iw::AsmType::Int()}, + {"123456789 != u0", iw::AsmType::Int()}, + {"fround(123456.78) != f0", iw::AsmType::Int()}, + {"9876543.201 != d0", iw::AsmType::Int()}, + {"-1025 < s0", iw::AsmType::Int()}, + {"123456789 < u0", iw::AsmType::Int()}, + {"fround(123456.78) < f0", iw::AsmType::Int()}, + {"9876543.201 < d0", iw::AsmType::Int()}, + {"-1025 <= s0", iw::AsmType::Int()}, + {"123456789 <= u0", iw::AsmType::Int()}, + {"fround(123456.78) <= f0", iw::AsmType::Int()}, + {"9876543.201 <= d0", iw::AsmType::Int()}, + {"-1025 > s0", iw::AsmType::Int()}, + {"123456789 > u0", iw::AsmType::Int()}, + {"fround(123456.78) > f0", iw::AsmType::Int()}, + {"9876543.201 > d0", iw::AsmType::Int()}, + {"-1025 >= s0", iw::AsmType::Int()}, + {"123456789 >= u0", iw::AsmType::Int()}, + {"fround(123456.78) >= f0", iw::AsmType::Int()}, + {"9876543.201 >= d0", iw::AsmType::Int()}, + // TODO(jpp): maybe add Const <op> Const. + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithLocal(DynamicGlobal("u0"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("u1"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("s0"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("s1"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("f0"), iw::AsmType::Float()) + ->WithLocal(DynamicGlobal("f1"), iw::AsmType::Float()) + ->WithLocal(DynamicGlobal("d0"), iw::AsmType::Double()) + ->WithLocal(DynamicGlobal("d1"), iw::AsmType::Double()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateBitwiseExpression) { + auto v2s = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Signed()); + return ret; + }; + + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"iish0 & iish1", iw::AsmType::Signed()}, + {"iish0 | iish1", iw::AsmType::Signed()}, + {"iish0 ^ iish1", iw::AsmType::Signed()}, + {"iish0 & -1", iw::AsmType::Signed()}, + {"iish0 | -1", iw::AsmType::Signed()}, + {"iish0 ^ -1", iw::AsmType::Signed()}, + {"2147483648 & iish1", iw::AsmType::Signed()}, + {"2147483648 | iish1", iw::AsmType::Signed()}, + {"2147483648 ^ iish1", iw::AsmType::Signed()}, + {"2147483648 & 0", iw::AsmType::FixNum()}, // Violation: signed. + {"2147483648 | 0", iw::AsmType::Signed()}, + {"2147483648 ^ 0", iw::AsmType::Signed()}, + {"2134651 & 123", iw::AsmType::FixNum()}, // Violation: signed. + {"2134651 | 123", iw::AsmType::FixNum()}, // Violation: signed. + {"2134651 ^ 123", iw::AsmType::FixNum()}, // Violation: signed. + {"make_signed()|0", iw::AsmType::Signed()}, + {"signed()|0", iw::AsmType::Signed()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal("iish1"), iw::AsmType::Intish()) + ->WithLocal(DynamicGlobal("iish0"), iw::AsmType::Intish()) + ->WithGlobal(DynamicGlobal("signed"), v2s) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateConditionalExpression) { + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + {"i0 ? i0 : i1", iw::AsmType::Int()}, + {"i0 ? f0 : f1", iw::AsmType::Float()}, + {"i0 ? d0 : d1", iw::AsmType::Double()}, + {"0 ? -1 : 2147483648", iw::AsmType::Int()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithLocal(DynamicGlobal("i0"), iw::AsmType::Int()) + ->WithLocal(DynamicGlobal("i1"), iw::AsmType::Int()) + ->WithLocal(DynamicGlobal("f0"), iw::AsmType::Float()) + ->WithLocal(DynamicGlobal("f1"), iw::AsmType::Float()) + ->WithLocal(DynamicGlobal("d0"), iw::AsmType::Double()) + ->WithLocal(DynamicGlobal("d1"), iw::AsmType::Double()) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(ValidateCall) { + auto v2f = [](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, iw::AsmType::Float()); + return ret; + }; + + // ifd2_ is a helper function that returns a lambda for creating a function + // type that accepts an int, a float, and a double. ret_type_factory is a + // pointer to an AsmType*() function, and (*ret_type_factory)() returns the + // desired return type. For example, + // + // ifd2_(&iw::AsmType::Float) + // + // returns an AsmType representing an asm.j function with the following + // signature: + // + // float(int, float, double) + auto ifd2_ = [](iw::AsmType* ( + *ret_type_factory)()) -> std::function<iw::AsmType*(Zone*)> { + return [ret_type_factory](Zone* zone) -> iw::AsmType* { + auto* ret = iw::AsmType::Function(zone, (*ret_type_factory)()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Int()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Float()); + ret->AsFunctionType()->AddArgument(iw::AsmType::Double()); + return ret; + }; + }; + auto ifd2f = ifd2_(&iw::AsmType::Float); + auto ifd2d = ifd2_(&iw::AsmType::Double); + auto ifd2i = ifd2_(&iw::AsmType::Signed); + + // Just like ifd2_, but this one returns a type representing a function table. + auto tbl_ifd2_ = [](size_t tbl_size, iw::AsmType* (*ret_type_factory)()) + -> std::function<iw::AsmType*(Zone*)> { + return [tbl_size, ret_type_factory](Zone* zone) -> iw::AsmType* { + auto* signature = iw::AsmType::Function(zone, (*ret_type_factory)()); + signature->AsFunctionType()->AddArgument(iw::AsmType::Int()); + signature->AsFunctionType()->AddArgument(iw::AsmType::Float()); + signature->AsFunctionType()->AddArgument(iw::AsmType::Double()); + + auto* ret = iw::AsmType::FunctionTableType(zone, tbl_size, signature); + return ret; + }; + }; + auto ifd2f_tbl = tbl_ifd2_(32, &iw::AsmType::Float); + auto ifd2d_tbl = tbl_ifd2_(64, &iw::AsmType::Double); + auto ifd2i_tbl = tbl_ifd2_(4096, &iw::AsmType::Signed); + + const struct { + const char* expression; + iw::AsmType* load_type; + } kTests[] = { + // ----------------------------------------------------------------------- + // Functions. + {"fround(v2f())", iw::AsmType::Float()}, + {"fround(fish)", iw::AsmType::Float()}, + {"fround(dq)", iw::AsmType::Float()}, + {"fround(s)", iw::AsmType::Float()}, + {"fround(u)", iw::AsmType::Float()}, + {"ffi()|0", iw::AsmType::Signed()}, + {"ffi(1.0)|0", iw::AsmType::Signed()}, + {"ffi(1.0, 2.0)|0", iw::AsmType::Signed()}, + {"ffi(1.0, 2.0, 3)|0", iw::AsmType::Signed()}, + {"ffi(1.0, 2.0, 3, 4)|0", iw::AsmType::Signed()}, + {"+ffi()", iw::AsmType::Double()}, + {"+ffi(1.0)", iw::AsmType::Double()}, + {"+ffi(1.0, 2.0)", iw::AsmType::Double()}, + {"+ffi(1.0, 2.0, 3)", iw::AsmType::Double()}, + {"+ffi(1.0, 2.0, 3, 4)", iw::AsmType::Double()}, + {"fround(ifd2f(1, fround(1), 1.0))", iw::AsmType::Float()}, + {"+ifd2d(1, fround(1), 1.0)", iw::AsmType::Double()}, + {"ifd2i(1, fround(1), 1.0)|0", iw::AsmType::Signed()}, + // ----------------------------------------------------------------------- + // Function tables. + {"fround(ifd2f_tbl[iish & 31](1, fround(1), 1.0))", iw::AsmType::Float()}, + {"+ifd2d_tbl[iish & 63](1, fround(1), 1.0)", iw::AsmType::Double()}, + {"ifd2i_tbl[iish & 4095](1, fround(1), 1.0)|0", iw::AsmType::Signed()}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Expression(test->expression)) + ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) + ->WithImport(DynamicGlobal("ffi"), iw::AsmTyper::kFFI) + ->WithLocal(DynamicGlobal("fish"), iw::AsmType::Floatish()) + ->WithLocal(DynamicGlobal("dq"), iw::AsmType::DoubleQ()) + ->WithLocal(DynamicGlobal("s"), iw::AsmType::Signed()) + ->WithLocal(DynamicGlobal("u"), iw::AsmType::Unsigned()) + ->WithLocal(DynamicGlobal("iish"), iw::AsmType::Intish()) + ->WithGlobal(DynamicGlobal("v2f"), v2f) + ->WithGlobal(DynamicGlobal("ifd2f_tbl"), ifd2f_tbl) + ->WithGlobal(DynamicGlobal("ifd2d_tbl"), ifd2d_tbl) + ->WithGlobal(DynamicGlobal("ifd2i_tbl"), ifd2i_tbl) + ->SucceedsWithExactType(test->load_type)) { + std::cerr << "Test:\n" << test->expression; + CHECK(false); + } + } +} + +TEST(CannotReferenceModuleName) { + v8::V8::Initialize(); + + const struct { + const char* module; + const char* error_message; + } kTests[] = { + {"function asm() {\n" + " 'use asm';\n" + " function f() { asm; }\n" + "}", + "accessed by ordinary expressions"}, + {"function asm() { 'use asm'; return asm; }", "Module cannot export"}, + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + const auto* test = kTests + ii; + if (!ValidationOf(Module(test->module)) + ->FailsWithMessage(test->error_message)) { + std::cerr << "Test:\n" << test->module; + CHECK(false); + } + } +} + +TEST(InvalidSourceLayout) { + const char* kTests[] = { + "function asm() {\n" + " 'use asm';\n" + " function f() {}\n" + " var v = 0;\n" + " var v_v = [f];\n" + " return f;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " function f() {}\n" + " var v_v = [f];\n" + " var v = 0;\n" + " return f;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " function f() {}\n" + " var v_v = [f];\n" + " return f;\n" + " var v = 0;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " var v = 0;\n" + " var v_v = [f];\n" + " function f() {}\n" + " return f;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " var v = 0;\n" + " var v_v = [f];\n" + " return f;\n" + " function f() {}\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " var v = 0;\n" + " function f() {}\n" + " return f;\n" + " var v_v = [f];\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " var v = 0;\n" + " function f() {}\n" + " var v1 = 0;\n" + " var v_v = [f];\n" + " return f;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " var v = 0;\n" + " function f() {}\n" + " var v_v = [f];\n" + " var v1 = 0;\n" + " return f;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " var v = 0;\n" + " function f() {}\n" + " var v_v = [f];\n" + " return f;\n" + " var v1 = 0;\n" + "}", + "function asm() {\n" + " function f() {}\n" + " 'use asm';\n" + " var v_v = [f];\n" + " return f;\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " return f;\n" + " var v = 0;\n" + " function f() {}\n" + " var v_v = [f];\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " return f;\n" + " function f() {}\n" + "}", + "function __f_59() {\n" + " 'use asm';\n" + " function __f_110() {\n" + " return 71;\n" + " }\n" + " function __f_21() {\n" + " var __v_38 = 0;\n" + " return __v_23[__v_38&0]() | 0;\n" + " }\n" + " return {__f_21:__f_21};\n" + " var __v_23 = [__f_110];\n" + "}", + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + if (!ValidationOf(Module(kTests[ii])) + ->FailsWithMessage("Invalid asm.js source code layout")) { + std::cerr << "Test:\n" << kTests[ii]; + CHECK(false); + } + } +} + +// This issue was triggered because of the "lenient" 8-bit heap access code +// path. The canonical heap access index validation fails because __34 is not an +// intish. Then, during the "lenient" code path for accessing elements in 8-bit +// heap views, the __34 node in the indexing expression would be re-tagged, thus +// causing the assertion failure. +TEST(B63099) { + const char* kTests[] = { + "function __f_109(stdlib, __v_36, buffer) {\n" + " 'use asm';\n" + " var __v_34 = new stdlib.Uint8Array(buffer);\n" + " function __f_22() {__v_34[__v_34>>0]|0 + 1 | 0;\n" + " }\n" + "}", + "function __f_109(stdlib, __v_36, buffer) {\n" + " 'use asm';\n" + " var __v_34 = new stdlib.Int8Array(buffer);\n" + " function __f_22() {__v_34[__v_34>>0]|0 + 1 | 0;\n" + " }\n" + "}", + }; + + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + if (!ValidationOf(Module(kTests[ii])) + ->FailsWithMessage("Invalid heap access index")) { + std::cerr << "Test:\n" << kTests[ii]; + CHECK(false); + } + } +} + +// This issue was triggered because assignments to immutable symbols (e.g., the +// module's name, or any of the asm.js' module parameters) was not being +// handled. +TEST(B640194) { + const char* kTests[] = { + "function asm() {\n" + " 'use asm';\n" + " function f() {\n" + " asm = 0;\n" + " }\n" + " return f;\n" + "}", + "function asm(stdlib) {\n" + " 'use asm';\n" + " function f() {\n" + " stdlib = 0;\n" + " }\n" + " return f;\n" + "}", + "function asm(stdlib, foreign) {\n" + " 'use asm';\n" + " function f() {\n" + " foreign = 0;\n" + " }\n" + " return f;\n" + "}", + "function asm(stdlib, foreign, heap) {\n" + " 'use asm';\n" + " function f() {\n" + " heap = 0;\n" + " }\n" + " return f;\n" + "}", + "function asm(stdlib, foreign, heap) {\n" + " 'use asm';\n" + " var f = stdlib.Math.fround;\n" + " function f() {\n" + " f = 0;\n" + " }\n" + " return f;\n" + "}", + "function asm(stdlib, foreign, heap) {\n" + " 'use asm';\n" + " var E = stdlib.Math.E;\n" + " function f() {\n" + " E = 0;\n" + " }\n" + " return f;\n" + "}", + }; + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + if (!ValidationOf(Module(kTests[ii])) + ->FailsWithMessage("Can't assign to immutable symbol")) { + std::cerr << "Test:\n" << kTests[ii]; + CHECK(false); + } + } +} + +} // namespace diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 5681f704e1..312001a35b 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -186,7 +186,7 @@ int main(int argc, char* argv[]) { } } - v8::V8::InitializeICU(); + v8::V8::InitializeICUDefaultLocation(argv[0]); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(platform); v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); diff --git a/deps/v8/test/cctest/cctest.gyp b/deps/v8/test/cctest/cctest.gyp index 2e00e88b5b..217d74b6dc 100644 --- a/deps/v8/test/cctest/cctest.gyp +++ b/deps/v8/test/cctest/cctest.gyp @@ -25,277 +25,344 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# The sources are kept automatically in sync with BUILD.gn. + { 'variables': { 'v8_code': 1, 'generated_file': '<(SHARED_INTERMEDIATE_DIR)/resources.cc', + 'cctest_sources': [ ### gcmole(all) ### + 'asmjs/test-asm-typer.cc', + 'compiler/c-signature.h', + 'compiler/codegen-tester.cc', + 'compiler/codegen-tester.h', + 'compiler/code-assembler-tester.h', + 'compiler/function-tester.h', + 'compiler/graph-builder-tester.h', + 'compiler/test-basic-block-profiler.cc', + 'compiler/test-branch-combine.cc', + 'compiler/test-run-unwinding-info.cc', + 'compiler/test-gap-resolver.cc', + 'compiler/test-graph-visualizer.cc', + 'compiler/test-code-assembler.cc', + 'compiler/test-instruction.cc', + 'compiler/test-js-context-specialization.cc', + 'compiler/test-js-constant-cache.cc', + 'compiler/test-js-typed-lowering.cc', + 'compiler/test-jump-threading.cc', + 'compiler/test-linkage.cc', + 'compiler/test-loop-assignment-analysis.cc', + 'compiler/test-loop-analysis.cc', + 'compiler/test-machine-operator-reducer.cc', + 'compiler/test-multiple-return.cc', + 'compiler/test-node.cc', + 'compiler/test-operator.cc', + 'compiler/test-osr.cc', + 'compiler/test-representation-change.cc', + 'compiler/test-run-bytecode-graph-builder.cc', + 'compiler/test-run-calls-to-external-references.cc', + 'compiler/test-run-deopt.cc', + 'compiler/test-run-inlining.cc', + 'compiler/test-run-intrinsics.cc', + 'compiler/test-run-jsbranches.cc', + 'compiler/test-run-jscalls.cc', + 'compiler/test-run-jsexceptions.cc', + 'compiler/test-run-jsobjects.cc', + 'compiler/test-run-jsops.cc', + 'compiler/test-run-load-store.cc', + 'compiler/test-run-machops.cc', + 'compiler/test-run-native-calls.cc', + 'compiler/test-run-stackcheck.cc', + 'compiler/test-run-stubs.cc', + 'compiler/test-run-variables.cc', + 'compiler/test-run-wasm-machops.cc', + 'compiler/test-simplified-lowering.cc', + 'cctest.cc', + 'interpreter/interpreter-tester.cc', + 'interpreter/source-position-matcher.cc', + 'interpreter/source-position-matcher.h', + 'interpreter/test-bytecode-generator.cc', + 'interpreter/test-interpreter.cc', + 'interpreter/test-interpreter-intrinsics.cc', + 'interpreter/test-source-positions.cc', + 'interpreter/bytecode-expectations-printer.cc', + 'interpreter/bytecode-expectations-printer.h', + 'gay-fixed.cc', + 'gay-precision.cc', + 'gay-shortest.cc', + 'heap/heap-tester.h', + 'heap/heap-utils.cc', + 'heap/heap-utils.h', + 'heap/test-alloc.cc', + 'heap/test-array-buffer-tracker.cc', + 'heap/test-compaction.cc', + 'heap/test-heap.cc', + 'heap/test-incremental-marking.cc', + 'heap/test-lab.cc', + 'heap/test-mark-compact.cc', + 'heap/test-page-promotion.cc', + 'heap/test-spaces.cc', + 'libplatform/test-tracing.cc', + 'libsampler/test-sampler.cc', + 'print-extension.cc', + 'profiler-extension.cc', + 'test-access-checks.cc', + 'test-accessors.cc', + 'test-api.cc', + 'test-api.h', + 'test-api-accessors.cc', + 'test-api-interceptors.cc', + 'test-api-fast-accessor-builder.cc', + 'test-array-list.cc', + 'test-ast.cc', + 'test-atomicops.cc', + 'test-bignum.cc', + 'test-bignum-dtoa.cc', + 'test-bit-vector.cc', + 'test-circular-queue.cc', + 'test-code-cache.cc', + 'test-code-layout.cc', + 'test-code-stub-assembler.cc', + 'test-compiler.cc', + 'test-constantpool.cc', + 'test-conversions.cc', + 'test-cpu-profiler.cc', + 'test-date.cc', + 'test-debug.cc', + 'test-decls.cc', + 'test-deoptimization.cc', + 'test-dictionary.cc', + 'test-diy-fp.cc', + 'test-double.cc', + 'test-dtoa.cc', + 'test-elements-kind.cc', + 'test-fast-dtoa.cc', + 'test-feedback-vector.cc', + 'test-field-type-tracking.cc', + 'test-fixed-dtoa.cc', + 'test-flags.cc', + 'test-func-name-inference.cc', + 'test-global-handles.cc', + 'test-global-object.cc', + 'test-hashing.cc', + 'test-hashmap.cc', + 'test-heap-profiler.cc', + 'test-hydrogen-types.cc', + 'test-identity-map.cc', + 'test-inobject-slack-tracking.cc', + 'test-list.cc', + 'test-liveedit.cc', + 'test-lockers.cc', + 'test-log.cc', + 'test-mementos.cc', + 'test-object.cc', + 'test-parsing.cc', + 'test-platform.cc', + 'test-profile-generator.cc', + 'test-random-number-generator.cc', + 'test-receiver-check-hidden-prototype.cc', + 'test-regexp.cc', + 'test-representation.cc', + 'test-sampler-api.cc', + 'test-serialize.cc', + 'test-simd.cc', + 'test-strings.cc', + 'test-symbols.cc', + 'test-strtod.cc', + 'test-thread-termination.cc', + 'test-threads.cc', + 'test-trace-event.cc', + 'test-transitions.cc', + 'test-typedarrays.cc', + 'test-types.cc', + 'test-unbound-queue.cc', + 'test-unboxed-doubles.cc', + 'test-unique.cc', + 'test-unscopables-hidden-prototype.cc', + 'test-usecounters.cc', + 'test-utils.cc', + 'test-version.cc', + 'test-weakmaps.cc', + 'test-weaksets.cc', + 'trace-extension.cc', + 'wasm/test-run-wasm.cc', + 'wasm/test-run-wasm-64.cc', + 'wasm/test-run-wasm-asmjs.cc', + 'wasm/test-run-wasm-interpreter.cc', + 'wasm/test-run-wasm-js.cc', + 'wasm/test-run-wasm-module.cc', + 'wasm/test-run-wasm-relocation.cc', + 'wasm/test-signatures.h', + 'wasm/test-wasm-function-name-table.cc', + 'wasm/test-wasm-stack.cc', + 'wasm/test-wasm-trap-position.cc', + 'wasm/wasm-run-utils.h', + ], + 'cctest_sources_ia32': [ ### gcmole(arch:ia32) ### + 'test-assembler-ia32.cc', + 'test-code-stubs.cc', + 'test-code-stubs-ia32.cc', + 'test-disasm-ia32.cc', + 'test-macro-assembler-ia32.cc', + 'test-log-stack-tracer.cc', + 'test-run-wasm-relocation-ia32.cc' + ], + 'cctest_sources_x64': [ ### gcmole(arch:x64) ### + 'test-assembler-x64.cc', + 'test-code-stubs.cc', + 'test-code-stubs-x64.cc', + 'test-disasm-x64.cc', + 'test-macro-assembler-x64.cc', + 'test-log-stack-tracer.cc', + 'test-run-wasm-relocation-x64.cc' + ], + 'cctest_sources_arm': [ ### gcmole(arch:arm) ### + 'test-assembler-arm.cc', + 'test-code-stubs.cc', + 'test-code-stubs-arm.cc', + 'test-disasm-arm.cc', + 'test-macro-assembler-arm.cc', + 'test-run-wasm-relocation-arm.cc' + ], + 'cctest_sources_arm64': [ ### gcmole(arch:arm64) ### + 'test-utils-arm64.cc', + 'test-assembler-arm64.cc', + 'test-code-stubs.cc', + 'test-code-stubs-arm64.cc', + 'test-disasm-arm64.cc', + 'test-fuzz-arm64.cc', + 'test-javascript-arm64.cc', + 'test-js-arm64-variables.cc', + 'test-run-wasm-relocation-arm64.cc' + ], + 'cctest_sources_s390': [ ### gcmole(arch:s390) ### + 'test-assembler-s390.cc', + 'test-code-stubs.cc', + 'test-disasm-s390.cc' + ], + 'cctest_sources_ppc': [ ### gcmole(arch:ppc) ### + 'test-assembler-ppc.cc', + 'test-code-stubs.cc', + 'test-disasm-ppc.cc' + ], + 'cctest_sources_mips': [ ### gcmole(arch:mips) ### + 'test-assembler-mips.cc', + 'test-code-stubs.cc', + 'test-code-stubs-mips.cc', + 'test-disasm-mips.cc', + 'test-macro-assembler-mips.cc' + ], + 'cctest_sources_mipsel': [ ### gcmole(arch:mipsel) ### + 'test-assembler-mips.cc', + 'test-code-stubs.cc', + 'test-code-stubs-mips.cc', + 'test-disasm-mips.cc', + 'test-macro-assembler-mips.cc' + ], + 'cctest_sources_mips64': [ ### gcmole(arch:mips64) ### + 'test-assembler-mips64.cc', + 'test-code-stubs.cc', + 'test-code-stubs-mips64.cc', + 'test-disasm-mips64.cc', + 'test-macro-assembler-mips64.cc' + ], + 'cctest_sources_mips64el': [ ### gcmole(arch:mips64el) ### + 'test-assembler-mips64.cc', + 'test-code-stubs.cc', + 'test-code-stubs-mips64.cc', + 'test-disasm-mips64.cc', + 'test-macro-assembler-mips64.cc' + ], + 'cctest_sources_x87': [ ### gcmole(arch:x87) ### + 'test-assembler-x87.cc', + 'test-code-stubs.cc', + 'test-code-stubs-x87.cc', + 'test-disasm-x87.cc', + 'test-macro-assembler-x87.cc', + 'test-log-stack-tracer.cc', + 'test-run-wasm-relocation-x87.cc' + ], }, - 'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'], + 'includes': ['../../gypfiles/toolchain.gypi', '../../gypfiles/features.gypi'], 'targets': [ { 'target_name': 'cctest', 'type': 'executable', 'dependencies': [ 'resources', - '../../tools/gyp/v8.gyp:v8_libplatform', + '../../src/v8.gyp:v8_libplatform', ], 'include_dirs': [ '../..', ], - 'sources': [ ### gcmole(all) ### + 'sources': [ + '<@(cctest_sources)', '<(generated_file)', - 'compiler/c-signature.h', - 'compiler/codegen-tester.cc', - 'compiler/codegen-tester.h', - 'compiler/function-tester.h', - 'compiler/graph-builder-tester.h', - 'compiler/test-basic-block-profiler.cc', - 'compiler/test-branch-combine.cc', - 'compiler/test-changes-lowering.cc', - 'compiler/test-code-stub-assembler.cc', - 'compiler/test-gap-resolver.cc', - 'compiler/test-graph-visualizer.cc', - 'compiler/test-instruction.cc', - 'compiler/test-js-context-specialization.cc', - 'compiler/test-js-constant-cache.cc', - 'compiler/test-js-typed-lowering.cc', - 'compiler/test-jump-threading.cc', - 'compiler/test-linkage.cc', - 'compiler/test-loop-assignment-analysis.cc', - 'compiler/test-loop-analysis.cc', - 'compiler/test-machine-operator-reducer.cc', - 'compiler/test-multiple-return.cc', - 'compiler/test-node.cc', - 'compiler/test-operator.cc', - 'compiler/test-osr.cc', - 'compiler/test-pipeline.cc', - 'compiler/test-representation-change.cc', - 'compiler/test-run-bytecode-graph-builder.cc', - 'compiler/test-run-calls-to-external-references.cc', - 'compiler/test-run-deopt.cc', - 'compiler/test-run-inlining.cc', - 'compiler/test-run-intrinsics.cc', - 'compiler/test-run-jsbranches.cc', - 'compiler/test-run-jscalls.cc', - 'compiler/test-run-jsexceptions.cc', - 'compiler/test-run-jsobjects.cc', - 'compiler/test-run-jsops.cc', - 'compiler/test-run-machops.cc', - 'compiler/test-run-native-calls.cc', - 'compiler/test-run-stackcheck.cc', - 'compiler/test-run-stubs.cc', - 'compiler/test-run-variables.cc', - 'compiler/test-simplified-lowering.cc', - 'cctest.cc', - 'expression-type-collector.cc', - 'expression-type-collector.h', - 'interpreter/interpreter-tester.cc', - 'interpreter/test-bytecode-generator.cc', - 'interpreter/test-interpreter.cc', - 'interpreter/test-interpreter-intrinsics.cc', - 'interpreter/bytecode-expectations-printer.cc', - 'interpreter/bytecode-expectations-printer.h', - 'gay-fixed.cc', - 'gay-precision.cc', - 'gay-shortest.cc', - 'heap/heap-tester.h', - 'heap/test-alloc.cc', - 'heap/test-compaction.cc', - 'heap/test-heap.cc', - 'heap/test-incremental-marking.cc', - 'heap/test-lab.cc', - 'heap/test-mark-compact.cc', - 'heap/test-spaces.cc', - 'heap/utils-inl.h', - 'print-extension.cc', - 'profiler-extension.cc', - 'test-accessors.cc', - 'test-api.cc', - 'test-api.h', - 'test-api-accessors.cc', - 'test-api-interceptors.cc', - 'test-api-fast-accessor-builder.cc', - 'test-array-list.cc', - 'test-ast.cc', - 'test-ast-expression-visitor.cc', - 'test-asm-validator.cc', - 'test-atomicops.cc', - 'test-bignum.cc', - 'test-bignum-dtoa.cc', - 'test-bit-vector.cc', - 'test-circular-queue.cc', - 'test-compiler.cc', - 'test-constantpool.cc', - 'test-conversions.cc', - 'test-cpu-profiler.cc', - 'test-date.cc', - 'test-debug.cc', - 'test-decls.cc', - 'test-deoptimization.cc', - 'test-dictionary.cc', - 'test-diy-fp.cc', - 'test-double.cc', - 'test-dtoa.cc', - 'test-elements-kind.cc', - 'test-fast-dtoa.cc', - 'test-feedback-vector.cc', - 'test-field-type-tracking.cc', - 'test-fixed-dtoa.cc', - 'test-flags.cc', - 'test-func-name-inference.cc', - 'test-global-handles.cc', - 'test-global-object.cc', - 'test-hashing.cc', - 'test-hashmap.cc', - 'test-heap-profiler.cc', - 'test-hydrogen-types.cc', - 'test-identity-map.cc', - 'test-inobject-slack-tracking.cc', - 'test-list.cc', - 'test-liveedit.cc', - 'test-lockers.cc', - 'test-log.cc', - 'test-microtask-delivery.cc', - 'test-mementos.cc', - 'test-object-observe.cc', - 'test-parsing.cc', - 'test-platform.cc', - 'test-profile-generator.cc', - 'test-random-number-generator.cc', - 'test-receiver-check-hidden-prototype.cc', - 'test-regexp.cc', - 'test-reloc-info.cc', - 'test-representation.cc', - 'test-sampler-api.cc', - 'test-serialize.cc', - 'test-simd.cc', - 'test-strings.cc', - 'test-symbols.cc', - 'test-strtod.cc', - 'test-thread-termination.cc', - 'test-threads.cc', - 'test-trace-event.cc', - 'test-transitions.cc', - 'test-typedarrays.cc', - 'test-types.cc', - 'test-typing-reset.cc', - 'test-unbound-queue.cc', - 'test-unboxed-doubles.cc', - 'test-unique.cc', - 'test-unscopables-hidden-prototype.cc', - 'test-utils.cc', - 'test-version.cc', - 'test-weakmaps.cc', - 'test-weaksets.cc', - 'trace-extension.cc', - 'wasm/test-run-wasm.cc', - 'wasm/test-run-wasm-64.cc', - 'wasm/test-run-wasm-js.cc', - 'wasm/test-run-wasm-module.cc', - 'wasm/test-signatures.h', - 'wasm/wasm-run-utils.h', ], 'conditions': [ ['v8_target_arch=="ia32"', { - 'sources': [ ### gcmole(arch:ia32) ### - 'test-assembler-ia32.cc', - 'test-code-stubs.cc', - 'test-code-stubs-ia32.cc', - 'test-disasm-ia32.cc', - 'test-macro-assembler-ia32.cc', - 'test-log-stack-tracer.cc', - 'test-run-wasm-relocation-ia32.cc' + 'sources': [ + '<@(cctest_sources_ia32)', ], }], ['v8_target_arch=="x64"', { - 'sources': [ ### gcmole(arch:x64) ### - 'test-assembler-x64.cc', - 'test-code-stubs.cc', - 'test-code-stubs-x64.cc', - 'test-disasm-x64.cc', - 'test-macro-assembler-x64.cc', - 'test-log-stack-tracer.cc', - 'test-run-wasm-relocation-x64.cc' + 'sources': [ + '<@(cctest_sources_x64)', ], }], ['v8_target_arch=="arm"', { - 'sources': [ ### gcmole(arch:arm) ### - 'test-assembler-arm.cc', - 'test-code-stubs.cc', - 'test-code-stubs-arm.cc', - 'test-disasm-arm.cc', - 'test-macro-assembler-arm.cc', - 'test-run-wasm-relocation-arm.cc' + 'sources': [ + '<@(cctest_sources_arm)', ], }], ['v8_target_arch=="arm64"', { - 'sources': [ ### gcmole(arch:arm64) ### - 'test-utils-arm64.cc', - 'test-assembler-arm64.cc', - 'test-code-stubs.cc', - 'test-code-stubs-arm64.cc', - 'test-disasm-arm64.cc', - 'test-fuzz-arm64.cc', - 'test-javascript-arm64.cc', - 'test-js-arm64-variables.cc', - 'test-run-wasm-relocation-arm64.cc' + 'sources': [ + '<@(cctest_sources_arm64)', ], }], ['v8_target_arch=="s390"', { - 'sources': [ ### gcmole(arch:s390) ### - 'test-assembler-s390.cc', - 'test-code-stubs.cc', - 'test-disasm-s390.cc' + 'sources': [ + '<@(cctest_sources_s390)', ], }], ['v8_target_arch=="s390x"', { - 'sources': [ ### gcmole(arch:s390x) ### - 'test-assembler-s390.cc', - 'test-code-stubs.cc', - 'test-disasm-s390.cc' + 'sources': [ + '<@(cctest_sources_s390)', ], }], ['v8_target_arch=="ppc"', { - 'sources': [ ### gcmole(arch:ppc) ### - 'test-assembler-ppc.cc', - 'test-code-stubs.cc', - 'test-disasm-ppc.cc' + 'sources': [ + '<@(cctest_sources_ppc)', ], }], ['v8_target_arch=="ppc64"', { - 'sources': [ ### gcmole(arch:ppc64) ### - 'test-assembler-ppc.cc', - 'test-code-stubs.cc', - 'test-disasm-ppc.cc' + 'sources': [ + '<@(cctest_sources_ppc)', + ], + }], + ['v8_target_arch=="mips"', { + 'sources': [ + '<@(cctest_sources_mips)', ], }], ['v8_target_arch=="mipsel"', { - 'sources': [ ### gcmole(arch:mipsel) ### - 'test-assembler-mips.cc', - 'test-code-stubs.cc', - 'test-code-stubs-mips.cc', - 'test-disasm-mips.cc', - 'test-macro-assembler-mips.cc' + 'sources': [ + '<@(cctest_sources_mipsel)', + ], + }], + ['v8_target_arch=="mips64"', { + 'sources': [ + '<@(cctest_sources_mips64)', ], }], ['v8_target_arch=="mips64el"', { 'sources': [ - 'test-assembler-mips64.cc', - 'test-code-stubs.cc', - 'test-code-stubs-mips64.cc', - 'test-disasm-mips64.cc', - 'test-macro-assembler-mips64.cc' + '<@(cctest_sources_mips64el)', ], }], ['v8_target_arch=="x87"', { - 'sources': [ ### gcmole(arch:x87) ### - 'test-assembler-x87.cc', - 'test-code-stubs.cc', - 'test-code-stubs-x87.cc', - 'test-disasm-x87.cc', - 'test-macro-assembler-x87.cc', - 'test-log-stack-tracer.cc', - 'test-run-wasm-relocation-x87.cc' + 'sources': [ + '<@(cctest_sources_x87)', ], }], [ 'OS=="linux" or OS=="qnx"', { @@ -327,9 +394,9 @@ ['component=="shared_library"', { # cctest can't be built against a shared library, so we need to # depend on the underlying static target in that case. - 'dependencies': ['../../tools/gyp/v8.gyp:v8_maybe_snapshot'], + 'dependencies': ['../../src/v8.gyp:v8_maybe_snapshot'], }, { - 'dependencies': ['../../tools/gyp/v8.gyp:v8'], + 'dependencies': ['../../src/v8.gyp:v8'], }], ], }, @@ -372,14 +439,14 @@ 'target_name': 'generate-bytecode-expectations', 'type': 'executable', 'dependencies': [ - '../../tools/gyp/v8.gyp:v8_libplatform', + '../../src/v8.gyp:v8_libplatform', ], 'conditions': [ ['component=="shared_library"', { # Same as cctest, we need to depend on the underlying static target. - 'dependencies': ['../../tools/gyp/v8.gyp:v8_maybe_snapshot'], + 'dependencies': ['../../src/v8.gyp:v8_maybe_snapshot'], }, { - 'dependencies': ['../../tools/gyp/v8.gyp:v8'], + 'dependencies': ['../../src/v8.gyp:v8'], }], ], 'include_dirs+': [ @@ -402,7 +469,7 @@ 'cctest', ], 'includes': [ - '../../build/isolate.gypi', + '../../gypfiles/isolate.gypi', ], 'sources': [ 'cctest_exe.isolate', @@ -415,7 +482,7 @@ 'cctest_exe_run', ], 'includes': [ - '../../build/isolate.gypi', + '../../gypfiles/isolate.gypi', ], 'sources': [ 'cctest.isolate', diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index c992ab6160..5a88f0f701 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -86,43 +86,9 @@ 'test-func-name-inference/UpperCaseClass': [FAIL], 'test-func-name-inference/LowerCaseClass': [FAIL], - ############################################################################## - # TurboFan compiler failures. - - # Some tests are just too slow to run for now. - 'test-heap/IncrementalMarkingStepMakesBigProgressWithLargeObjects': [PASS, NO_VARIANTS], - 'test-heap-profiler/ManyLocalsInSharedContext': [PASS, NO_VARIANTS], - 'test-serialize/CodeSerializerLargeCodeObject': [PASS, NO_VARIANTS], - 'test-debug/ThreadedDebugging': [PASS, NO_VARIANTS], # BUG(3742). 'test-mark-compact/MarkCompactCollector': [PASS, ['arch==arm', NO_VARIANTS]], - # TODO(mstarzinger): The rewriter is not being called when top-level code is - # optimized and hence scripts don't "return" the correct value. Fix this. - 'test-compiler/CompileFunctionInContext*': [PASS, NO_VARIANTS], - - # TODO(bmeurer): TurboFan embeds strong references to all kinds of objects - # via deoptimization data (Crankshaft also does this, but lack proper test - # coverage). - 'test-heap/ObjectsInOptimizedCodeAreWeak': [PASS, NO_VARIANTS], - - # TurboFan doesn't support allocation sites currently. - 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringAllocationFolding': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringDoubleArrayProperties': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringMixedInObjectProperties': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringNestedObjectLiterals': [PASS, NO_VARIANTS], - 'test-heap/OptimizedPretenuringObjectArrayLiterals': [PASS, NO_VARIANTS], - - # TurboFan cpu profiler result is different. - 'test-cpu-profiler/CollectDeoptEvents': [PASS, NO_VARIANTS], - 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [PASS, NO_VARIANTS], - 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [PASS, NO_VARIANTS], - 'test-cpu-profiler/DeoptUntrackedFunction': [PASS, NO_VARIANTS], - ############################################################################ # Slow tests. 'test-api/Threading1': [PASS, ['mode == debug', SLOW]], @@ -159,18 +125,6 @@ # BUG(v8:3434). ' test-api/LoadICFastApi_DirectCall_GCMoveStubWithProfiler': [SKIP], - - # BUG(v8:4795). - 'test-run-wasm-js/Run_JSSelectAlign_0': [SKIP], - 'test-run-wasm-js/Run_JSSelectAlign_2': [SKIP], - 'test-run-wasm-js/Run_JSSelectAlign_4': [SKIP], - 'test-run-wasm-js/Run_JSSelect_0': [SKIP], - 'test-run-wasm-js/Run_JSSelect_1': [SKIP], - 'test-run-wasm-js/Run_JSSelect_2': [SKIP], - 'test-run-wasm-js/Run_JSSelect_3': [SKIP], - 'test-run-wasm-js/Run_JSSelect_4': [SKIP], - 'test-run-wasm-js/Run_JSSelect_5': [SKIP], - 'test-run-wasm-js/Run_JSSelect_6': [SKIP], }], # 'arch == arm64' ['arch == arm64 and simulator_run == True', { @@ -245,27 +199,10 @@ 'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [SKIP], 'test-cpu-profiler/JsNativeJsSample': [SKIP], 'test-cpu-profiler/JsNative1JsNative2JsSample': [SKIP], -}], # 'system == windows' -############################################################################## -['byteorder == big', { - # TODO(mips-team): Fix Wasm for big-endian. - 'test-run-wasm-module/Run_WasmModule_CallAdd': [SKIP], - 'test-run-wasm-module/Run_WasmModule_CallMain_recursive': [SKIP], - 'test-run-wasm-module/Run_WasmModule_ReadLoadedDataSegment': [SKIP], - 'test-run-wasm-module/Run_WasmModule_Return114': [SKIP], - 'test-run-wasm-module/Run_WasmModule_CheckMemoryIsZero': [SKIP], - 'test-run-wasm-module/Run_WasmModule_Global': [SKIP], - 'test-run-wasm/Run_Wasm_Int32LoadInt16_signext': [SKIP], - 'test-run-wasm/Run_Wasm_Int32LoadInt16_zeroext': [SKIP], - 'test-run-wasm/Run_WasmMixedGlobals': [SKIP], - 'test-run-wasm-64/Run_WasmI64*': [SKIP], - 'test-run-wasm-64/Run_Wasm_I64*': [SKIP], - 'test-run-wasm-64/Run_Wasm_LoadStoreI64_sx': [SKIP], - 'test-run-wasm-64/Run_TestI64WasmRunner': [SKIP], - 'test-run-wasm-64/Run_WasmCall_Int64Sub': [SKIP], - 'test-run-wasm-64/Run_Wasm_MemI64_Sum': [SKIP], -}], # 'byteorder == big' + # BUG(5193): Flaky timeout. + 'test-sampler/LibSamplerCollectSample': [PASS, ['arch == x64', SKIP]], +}], # 'system == windows' ############################################################################## ['arch == arm', { @@ -341,7 +278,12 @@ 'test-run-machops/RunFloat64MulAndFloat64Add2': [SKIP], 'test-run-machops/RunFloat64MulAndFloat64Sub1': [SKIP], 'test-run-machops/RunFloat64MulAndFloat64Sub2': [SKIP], + 'test-run-machops/RunFloat64Sin': [SKIP], + 'test-run-machops/RunFloat64Cos': [SKIP], + 'test-run-machops/RunFloat64Expm1': [SKIP], + 'test-run-machops/RunFloat64Tan': [SKIP], 'test-cpu-profiler/Inlining': [SKIP], + 'test-gap-resolver/FuzzResolver': [SKIP], }], # 'arch == x87' ############################################################################## @@ -354,111 +296,6 @@ }], # 'arch == android_arm or arch == android_ia32' ############################################################################## -['arch == nacl_ia32 or arch == nacl_x64', { - - # NaCl builds have problems with threaded tests since Pepper_28. - # V8 Issue 2786 - 'test-api/Threading1': [SKIP], - 'test-lockers/ExtensionsRegistration': [SKIP], - - # These tests fail as there is no /tmp directory in Native Client. - 'test-log/LogAccessorCallbacks': [SKIP], - 'test-log/LogCallbacks': [SKIP], - 'test-log/ProfLazyMode': [SKIP], - - # Native Client doesn't support sockets. - 'test-debug/DebuggerAgent': [SKIP], - 'test-debug/DebuggerAgentProtocolOverflowHeader': [SKIP], - 'test-socket/Socket': [SKIP], - - # Profiling doesn't work on Native Client. - 'test-cpu-profiler/*': [SKIP], - - # Fails since 16322 (new test). - 'test-code-stubs-arm/ConvertDToI': [SKIP], - - # BUG(2998). - 'test-macro-assembler-arm/LoadAndStoreWithRepresentation': [SKIP], - - # BUG(3150). - 'test-api/PreCompileInvalidPreparseDataError': [SKIP], - - 'test-types/Convert' : [SKIP], - 'test-symbols/Create' : [SKIP], - 'test-parsing/ParserSync' : [SKIP], - 'test-parsing/ErrorsEvalAndArguments' : [SKIP], - 'test-parsing/ErrorsFutureStrictReservedWords' : [SKIP], - 'test-parsing/ErrorsReservedWords' : [SKIP], - 'test-parsing/ErrorsYieldStrict' : [SKIP], - 'test-parsing/ErrorsNotAnIdentifierName' : [SKIP], - 'test-parsing/FunctionDeclaresItselfStrict' : [SKIP], - 'test-parsing/ErrorsObjectLiteralChecking' : [SKIP], - 'test-parsing/InvalidLeftHandSide' : [SKIP], - 'test-heap/GarbageCollection' : [SKIP], - 'test-heap/GlobalHandles' : [SKIP], - 'test-heap/WeakGlobalHandlesScavenge' : [SKIP], - 'test-heap/DeleteWeakGlobalHandle' : [SKIP], - 'test-heap/GrowAndShrinkNewSpace' : [SKIP], - 'test-heap/OptimizedAllocationAlwaysInNewSpace' : [SKIP], - 'test-heap/OptimizedPretenuringAllocationFolding' : [SKIP], - 'test-heap/OptimizedPretenuringObjectArrayLiterals' : [SKIP], - 'test-heap/OptimizedPretenuringAllocationFoldingBlocks' : [SKIP], - 'test-heap/OptimizedPretenuringMixedInObjectProperties' : [SKIP], - 'test-heap/OptimizedPretenuringDoubleArrayProperties' : [SKIP], - 'test-heap/OptimizedPretenuringdoubleArrayLiterals' : [SKIP], - 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals' : [SKIP], - 'test-heap/OptimizedPretenuringNestedObjectLiterals' : [SKIP], - 'test-heap/OptimizedPretenuringNestedDoubleLiterals' : [SKIP], - 'test-heap/Regress169928' : [SKIP], - 'test-decls/Unknown' : [SKIP], - 'test-decls/Present' : [SKIP], - 'test-decls/Absent' : [SKIP], - 'test-decls/Appearing' : [SKIP], - 'test-decls/Reappearing' : [SKIP], - 'test-decls/ExistsInPrototype' : [SKIP], - 'test-decls/AbsentInPrototype' : [SKIP], - 'test-decls/ExistsInHiddenPrototype' : [SKIP], - 'test-debug/ConditionalScriptBreakPoint' : [SKIP], - 'test-debug/DebugEvaluate' : [SKIP], - 'test-debug/ConditionalBreakpointWithCodeGenerationDisallowed' : [SKIP], - 'test-debug/DebugEvaluateWithCodeGenerationDisallowed' : [SKIP], - 'test-debug/DebugBreak' : [SKIP], - 'test-debug/ThreadedDebugging' : [SKIP], - 'test-debug/RecursiveBreakpoints' : [SKIP], - 'test-dictionary/HashMap' : [SKIP], - 'test-debug/Backtrace' : [SKIP], - 'test-debug/DebugBreakLoop' : [SKIP], - 'test-constantpool/ConstantPool' : [SKIP], - 'test-compiler/GetScriptLineNumber' : [SKIP], - 'test-api/ScriptMakingExternalString' : [SKIP], - 'test-api/ScriptMakingExternalOneByteString' : [SKIP], - 'test-api/MakingExternalStringConditions' : [SKIP], - 'test-api/MakingExternalOneByteStringConditions' : [SKIP], - 'test-api/MakingExternalUnalignedOneByteString' : [SKIP], - 'test-api/IndexedInterceptorUnboxedDoubleWithIndexedAccessor' : [SKIP], - 'test-api/IndependentWeakHandle' : [SKIP], - 'test-api/GCFromWeakCallbacks' : [SKIP], - 'test-api/IndependentHandleRevival' : [SKIP], - 'test-api/StringWrite' : [SKIP], - 'test-api/Threading3' : [SKIP], - 'test-api/Threading4' : [SKIP], - 'test-api/Threading2' : [SKIP], - 'test-api/FixedFloat32Array' : [SKIP], - 'test-api/FixedFloat64Array' : [SKIP], - 'test-api/ExternalFloat32Array' : [SKIP], - 'test-api/ExternalFloat64Array' : [SKIP], - 'test-api/ExternalArrays' : [SKIP], - 'test-api/Float32Array' : [SKIP], - 'test-api/Float64Array' : [SKIP], - 'test-api/Regress2333' : [SKIP], - 'test-alloc/StressHandles' : [SKIP], - 'test-alloc/StressJS' : [SKIP], - 'test-accessors/HandleScopePop' : [SKIP], - 'test-accessors/Gc' : [SKIP], - -}], # 'arch == nacl_ia32 or arch == nacl_x64' - -############################################################################## ['system == aix and arch == ppc64', { # BUG 2857 @@ -488,35 +325,42 @@ }], # 'arch == ppc64 and simulator_run == True' ############################################################################## -['ignition == True', { +['variant == turbofan', { + + # TODO(bmeurer): TurboFan embeds strong references to all kinds of objects + # via deoptimization data (Crankshaft also does this, but lack proper test + # coverage). + 'test-heap/ObjectsInOptimizedCodeAreWeak': [FAIL], + + # TurboFan cpu profiler result is different. + 'test-cpu-profiler/CollectDeoptEvents': [FAIL], + 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], + 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], - # TODO(rmcilroy,4680): The function_data field should be a BytecodeArray on interpreter entry - 'test-api/SetFunctionEntryHook': [FAIL], +}], # variant == turbofan - # TODO(rmcilroy,4680): Check failed: !function->shared()->is_compiled() || function->IsOptimized(). +############################################################################## +['variant == turbofan_opt', { + # BUG(5193): Flaky. + 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], +}], # variant == turbofan_opt + +############################################################################## +['variant == ignition', { + # TODO(rmcilroy,4680): Related to lack of code flushing. Check failed: !function->shared()->is_compiled() || function->IsOptimized(). 'test-heap/TestCodeFlushingPreAged': [FAIL], 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], 'test-heap/TestCodeFlushing': [FAIL], 'test-heap/TestCodeFlushingIncremental': [FAIL], 'test-heap/TestCodeFlushingIncrementalAbort': [PASS, ['mode == debug or dcheck_always_on == True', FAIL]], - # TODO(rmcilroy,4766): Requires BytecodeGraphBuilder to track source position - # on nodes (behind --turbo_source_positions flag). - 'test-cpu-profiler/TickLinesOptimized': [FAIL], - - # TODO(rmcilroy,4680): Fails to find the correct function name for the - # anonymous function. Fails without ignition but with --no-lazy also, so seems - # to be an issue when eagerly parsing. - 'test-func-name-inference/ReturnAnonymousFunction': [FAIL], + # TODO(mythria,4780): Related to type feedback support for Array function. + 'test-feedback-vector/VectorCallFeedbackForArray': [FAIL], - # TODO(mythria,4780): Related to type feedback support for calls. - 'test-feedback-vector/VectorCallICStates': [FAIL], - 'test-compiler/FeedbackVectorPreservedAcrossRecompiles': [FAIL], + # TODO(mythria,4780): Related to type feedback support for constructor. + 'test-feedback-vector/VectorConstructCounts': [FAIL], 'test-heap/WeakFunctionInConstructor': [FAIL], - 'test-heap/IncrementalMarkingClearsMonomorphicConstructor': [FAIL], 'test-heap/IncrementalMarkingPreservesMonomorphicConstructor': [FAIL], - 'test-heap/IncrementalMarkingPreservesMonomorphicCallIC': [FAIL], - 'test-heap/CellsInOptimizedCodeAreWeak': [FAIL], # TODO(mythria,4680): Lack of code-ageing in interpreter. 'test-heap/Regress169209': [FAIL], @@ -525,13 +369,95 @@ # in interpreter. 'test-heap/CompilationCacheCachingBehavior': [FAIL], - # TODO(mstarzinger,4680): Fails due to the turbo-asm pipeline only being taken - # in compiler.cc GetLazyCode for uncompiled code, and no similar path for eager - # code. - 'test-api/TurboAsmDisablesNeuter': [FAIL], + # BUG(rmcilroy,4680): Function is optimized without type feedback and so immediately deopts again, causing check failure in the test. + 'test-heap/ResetSharedFunctionInfoCountersDuringIncrementalMarking': [FAIL], + 'test-heap/ResetSharedFunctionInfoCountersDuringMarkSweep': [FAIL], + + # BUG(4680): Missing type feedback makes optimistic optimizations fail. + 'test-cpu-profiler/CollectDeoptEvents': [FAIL], + 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], + + # BUG(4680): Ignition doesn't support allocation sites currently. + 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL], + 'test-heap/OptimizedPretenuringAllocationFolding': [FAIL], + 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedObjectLiterals': [FAIL], + 'test-heap/OptimizedPretenuringObjectArrayLiterals': [FAIL], + + # BUG(4751). Flaky with ignition. + 'test-cpu-profiler/JsNativeJsSample': [PASS, FAIL], + + # TODO(ignition): Fails due to missing type info when optimizing from bytecode + # with crankshaft. + 'test-cpu-profiler/TickLinesOptimized': [SKIP], + + # TurboFan cpu profiler result is different. + 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], + 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], + + # BUG(5193): Flaky. + 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], +}], # variant == ignition - # TODO(rmcilroy,4837): We don't set a LoadContextSlot for a function as - # immutable in the BytecodeGraphBuilder, therefore no inlining happens. +############################################################################## +['variant == ignition_staging', { + 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], + 'test-cpu-profiler/TickLinesOptimized': [SKIP], + 'test-cpu-profiler/CollectDeoptEvents': [FAIL], + 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], + 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], + 'test-feedback-vector/VectorCallFeedbackForArray': [FAIL], + 'test-feedback-vector/VectorConstructCounts': [FAIL], + 'test-heap/CompilationCacheCachingBehavior': [FAIL], + 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL], + 'test-heap/IncrementalMarkingPreservesMonomorphicConstructor': [FAIL], + 'test-heap/OptimizedPretenuringAllocationFolding': [FAIL], + 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedObjectLiterals': [FAIL], + 'test-heap/OptimizedPretenuringObjectArrayLiterals': [FAIL], + 'test-heap/Regress169209': [FAIL], + 'test-heap/ResetSharedFunctionInfoCountersDuringIncrementalMarking': [FAIL], + 'test-heap/ResetSharedFunctionInfoCountersDuringMarkSweep': [FAIL], + 'test-heap/TestCodeFlushing': [FAIL], + 'test-heap/TestCodeFlushingIncremental': [FAIL], + 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], + 'test-heap/TestCodeFlushingPreAged': [FAIL], + 'test-heap/WeakFunctionInConstructor': [FAIL], + 'test-run-inlining/InlineBuiltin': [FAIL], + 'test-run-inlining/InlineLoopGuardedEmpty': [FAIL], + 'test-run-inlining/InlineLoopGuardedOnce': [FAIL], + 'test-run-inlining/InlineLoopGuardedTwice': [FAIL], + 'test-run-inlining/InlineLoopUnguardedEmpty': [FAIL], + 'test-run-inlining/InlineLoopUnguardedOnce': [FAIL], + 'test-run-inlining/InlineLoopUnguardedTwice': [FAIL], + 'test-run-inlining/InlineMutuallyRecursive': [FAIL], + 'test-run-inlining/InlineNestedBuiltin': [FAIL], + 'test-run-inlining/InlineOmitArgumentsDeopt': [FAIL], + 'test-run-inlining/InlineOmitArguments': [FAIL], + 'test-run-inlining/InlineOmitArgumentsObject': [FAIL], + 'test-run-inlining/InlineSurplusArgumentsDeopt': [FAIL], + 'test-run-inlining/InlineSurplusArguments': [FAIL], + 'test-run-inlining/InlineSurplusArgumentsObject': [FAIL], + 'test-run-inlining/InlineTwiceDependentDiamondDifferent': [FAIL], + 'test-run-inlining/InlineTwiceDependentDiamond': [FAIL], + 'test-run-inlining/InlineTwiceDependent': [FAIL], + 'test-run-inlining/InlineTwice': [FAIL], + 'test-run-inlining/InlineWithArguments': [FAIL], + 'test-run-inlining/SimpleInliningContextDeopt': [FAIL], + 'test-run-inlining/SimpleInliningContext': [FAIL], + 'test-run-inlining/SimpleInlining': [FAIL], + + # BUG(5193): Flaky. + 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], +}], # variant == ignition_staging + +############################################################################## +['variant == ignition_turbofan', { + # TODO(5251): Inlining is currently disabled for the BytecodeGraphBuilder. 'test-run-inlining/InlineLoopGuardedTwice': [FAIL], 'test-run-inlining/InlineSurplusArgumentsDeopt': [FAIL], 'test-run-inlining/InlineTwice': [FAIL], @@ -555,6 +481,60 @@ 'test-run-inlining/InlineBuiltin': [FAIL], 'test-run-inlining/InlineTwiceDependent': [FAIL], 'test-run-inlining/SimpleInliningContextDeopt': [FAIL], -}], # ignition == True + + # TODO(rmcilroy,4766): Requires BytecodeGraphBuilder to track source position + # on nodes (behind --turbo_source_positions flag). + 'test-cpu-profiler/TickLinesOptimized': [FAIL], + + # TODO(rmcilroy,4680): Related to lack of code flushing. Check failed: !function->shared()->is_compiled() || function->IsOptimized(). + 'test-heap/TestCodeFlushingPreAged': [FAIL], + 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], + 'test-heap/TestCodeFlushing': [FAIL], + 'test-heap/TestCodeFlushingIncremental': [FAIL], + 'test-heap/TestCodeFlushingIncrementalAbort': [PASS, ['mode == debug or dcheck_always_on == True', FAIL]], + + # TODO(mythria,4780): Related to type feedback support for Array function. + 'test-feedback-vector/VectorCallFeedbackForArray': [FAIL], + + # TODO(mythria,4780): Related to type feedback support for constructor. + 'test-feedback-vector/VectorConstructCounts': [FAIL], + 'test-heap/WeakFunctionInConstructor': [FAIL], + 'test-heap/IncrementalMarkingPreservesMonomorphicConstructor': [FAIL], + + # TODO(mythria,4680): Lack of code-ageing in interpreter. + 'test-heap/Regress169209': [FAIL], + + # TODO(mythria,4680): Lack of code-ageing and/or lack of compilation cache + # in interpreter. + 'test-heap/CompilationCacheCachingBehavior': [FAIL], + + # BUG(4680): Missing type feedback makes optimistic optimizations fail. + 'test-cpu-profiler/CollectDeoptEvents': [FAIL], + 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], + + # BUG(4680): Ignition doesn't support allocation sites currently. + 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL], + 'test-heap/OptimizedPretenuringAllocationFolding': [FAIL], + 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [FAIL], + 'test-heap/OptimizedPretenuringNestedObjectLiterals': [FAIL], + 'test-heap/OptimizedPretenuringObjectArrayLiterals': [FAIL], + + # BUG(4751). Flaky with Ignition. + 'test-cpu-profiler/JsNativeJsSample': [SKIP], + + # TODO(bmeurer): TurboFan embeds strong references to all kinds of objects + # via deoptimization data (Crankshaft also does this, but lack proper test + # coverage). + 'test-heap/ObjectsInOptimizedCodeAreWeak': [FAIL], + + # TurboFan cpu profiler result is different. + 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], + 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], + + # BUG(5193): Flaky. + 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], +}], # variant == ignition_turbofan ] diff --git a/deps/v8/test/cctest/compiler/call-tester.h b/deps/v8/test/cctest/compiler/call-tester.h index c75bde1e91..77d2ce1e95 100644 --- a/deps/v8/test/cctest/compiler/call-tester.h +++ b/deps/v8/test/cctest/compiler/call-tester.h @@ -106,12 +106,14 @@ struct ParameterTraits<int32_t> { static int64_t Cast(int32_t r) { return static_cast<int64_t>(r); } }; +#if !V8_TARGET_ARCH_PPC64 template <> struct ParameterTraits<uint32_t> { static int64_t Cast(uint32_t r) { return static_cast<int64_t>(static_cast<int32_t>(r)); } }; +#endif #endif // !V8_TARGET_ARCH_64_BIT diff --git a/deps/v8/test/cctest/compiler/code-assembler-tester.h b/deps/v8/test/cctest/compiler/code-assembler-tester.h new file mode 100644 index 0000000000..eb2d77a171 --- /dev/null +++ b/deps/v8/test/cctest/compiler/code-assembler-tester.h @@ -0,0 +1,61 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/handles.h" +#include "src/interface-descriptors.h" +#include "src/isolate.h" +#include "test/cctest/compiler/function-tester.h" + +namespace v8 { +namespace internal { +namespace compiler { + +class ZoneHolder { + public: + explicit ZoneHolder(Isolate* isolate) : zone_(isolate->allocator()) {} + Zone* zone() { return &zone_; } + + private: + Zone zone_; +}; + +// Inherit from ZoneHolder in order to create a zone that can be passed to +// CodeAssembler base class constructor. +template <typename CodeAssemblerT> +class CodeAssemblerTesterImpl : private ZoneHolder, public CodeAssemblerT { + public: + // Test generating code for a stub. + CodeAssemblerTesterImpl(Isolate* isolate, + const CallInterfaceDescriptor& descriptor) + : ZoneHolder(isolate), + CodeAssemblerT(isolate, ZoneHolder::zone(), descriptor, + Code::ComputeFlags(Code::STUB), "test"), + scope_(isolate) {} + + // Test generating code for a JS function (e.g. builtins). + CodeAssemblerTesterImpl(Isolate* isolate, int parameter_count) + : ZoneHolder(isolate), + CodeAssemblerT(isolate, ZoneHolder::zone(), parameter_count, + Code::ComputeFlags(Code::FUNCTION), "test"), + scope_(isolate) {} + + // This constructor is intended to be used for creating code objects with + // specific flags. + CodeAssemblerTesterImpl(Isolate* isolate, Code::Flags flags) + : ZoneHolder(isolate), + CodeAssemblerT(isolate, ZoneHolder::zone(), 0, flags, "test"), + scope_(isolate) {} + + Handle<Code> GenerateCodeCloseAndEscape() { + return scope_.CloseAndEscape(CodeAssemblerT::GenerateCode()); + } + + private: + HandleScope scope_; + LocalContext context_; +}; + +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h index 5d670bfee8..3d115454b9 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.h +++ b/deps/v8/test/cctest/compiler/codegen-tester.h @@ -5,6 +5,7 @@ #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ +#include "src/compiler.h" #include "src/compiler/instruction-selector.h" #include "src/compiler/pipeline.h" #include "src/compiler/raw-machine-assembler.h" @@ -38,7 +39,8 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, p1, p2, p3, p4), true), MachineType::PointerRepresentation(), - InstructionSelector::SupportedMachineOperatorFlags()) {} + InstructionSelector::SupportedMachineOperatorFlags(), + InstructionSelector::AlignmentRequirements()) {} virtual ~RawMachineAssemblerTester() {} @@ -65,7 +67,7 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, Schedule* schedule = this->Export(); CallDescriptor* call_descriptor = this->call_descriptor(); Graph* graph = this->graph(); - CompilationInfo info("testing", main_isolate(), main_zone()); + CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone()); code_ = Pipeline::GenerateCodeForTesting(&info, call_descriptor, graph, schedule); } @@ -256,7 +258,7 @@ class BufferedRawMachineAssemblerTester<void> // parameters from memory. Thereby it is possible to pass 64 bit parameters // to the IR graph. Node* Parameter(size_t index) { - CHECK(index >= 0 && index < 4); + CHECK(index < 4); return parameter_nodes_[index]; } diff --git a/deps/v8/test/cctest/compiler/function-tester.h b/deps/v8/test/cctest/compiler/function-tester.h index 631bdde5ce..c1473ac960 100644 --- a/deps/v8/test/cctest/compiler/function-tester.h +++ b/deps/v8/test/cctest/compiler/function-tester.h @@ -6,7 +6,6 @@ #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ #include "src/ast/ast-numbering.h" -#include "src/ast/scopes.h" #include "src/compiler.h" #include "src/compiler/linkage.h" #include "src/compiler/pipeline.h" @@ -14,6 +13,7 @@ #include "src/full-codegen/full-codegen.h" #include "src/handles.h" #include "src/objects-inl.h" +#include "src/parsing/parse-info.h" #include "src/parsing/parser.h" #include "src/parsing/rewriter.h" #include "test/cctest/cctest.h" @@ -30,8 +30,8 @@ class FunctionTester : public InitializedHandleScope { flags_(flags) { Compile(function); const uint32_t supported_flags = - CompilationInfo::kFunctionContextSpecializing | - CompilationInfo::kInliningEnabled | CompilationInfo::kTypingEnabled; + CompilationInfo::kNativeContextSpecializing | + CompilationInfo::kInliningEnabled; CHECK_EQ(0u, flags_ & ~supported_flags); } @@ -42,16 +42,18 @@ class FunctionTester : public InitializedHandleScope { CompileGraph(graph); } - FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code) + FunctionTester(Handle<Code> code, int param_count) : isolate(main_isolate()), - function( - (FLAG_allow_natives_syntax = true, - NewFunction(BuildFunctionFromDescriptor(descriptor).c_str()))), + function((FLAG_allow_natives_syntax = true, + NewFunction(BuildFunction(param_count).c_str()))), flags_(0) { Compile(function); function->ReplaceCode(*code); } + FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code) + : FunctionTester(code, descriptor.GetParameterCount()) {} + Isolate* isolate; Handle<JSFunction> function; @@ -59,11 +61,22 @@ class FunctionTester : public InitializedHandleScope { return Execution::Call(isolate, function, undefined(), 0, nullptr); } + MaybeHandle<Object> Call(Handle<Object> a) { + Handle<Object> args[] = {a}; + return Execution::Call(isolate, function, undefined(), 1, args); + } + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b) { Handle<Object> args[] = {a, b}; return Execution::Call(isolate, function, undefined(), 2, args); } + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, + Handle<Object> c) { + Handle<Object> args[] = {a, b, c}; + return Execution::Call(isolate, function, undefined(), 3, args); + } + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, Handle<Object> d) { Handle<Object> args[] = {a, b, c, d}; @@ -91,41 +104,56 @@ class FunctionTester : public InitializedHandleScope { return try_catch.Message(); } - void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) { - Handle<Object> result = Call(a, b).ToHandleChecked(); + void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b, + Handle<Object> c, Handle<Object> d) { + Handle<Object> result = Call(a, b, c, d).ToHandleChecked(); CHECK(expected->SameValue(*result)); } + void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b, + Handle<Object> c) { + return CheckCall(expected, a, b, c, undefined()); + } + + void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) { + return CheckCall(expected, a, b, undefined()); + } + void CheckCall(Handle<Object> expected, Handle<Object> a) { CheckCall(expected, a, undefined()); } - void CheckCall(Handle<Object> expected) { - CheckCall(expected, undefined(), undefined()); - } + void CheckCall(Handle<Object> expected) { CheckCall(expected, undefined()); } void CheckCall(double expected, double a, double b) { CheckCall(Val(expected), Val(a), Val(b)); } + void CheckTrue(Handle<Object> a) { CheckCall(true_value(), a); } + void CheckTrue(Handle<Object> a, Handle<Object> b) { CheckCall(true_value(), a, b); } - void CheckTrue(Handle<Object> a) { CheckCall(true_value(), a, undefined()); } + void CheckTrue(Handle<Object> a, Handle<Object> b, Handle<Object> c) { + CheckCall(true_value(), a, b, c); + } + + void CheckTrue(Handle<Object> a, Handle<Object> b, Handle<Object> c, + Handle<Object> d) { + CheckCall(true_value(), a, b, c, d); + } void CheckTrue(double a, double b) { CheckCall(true_value(), Val(a), Val(b)); } + void CheckFalse(Handle<Object> a) { CheckCall(false_value(), a); } + void CheckFalse(Handle<Object> a, Handle<Object> b) { CheckCall(false_value(), a, b); } - void CheckFalse(Handle<Object> a) { - CheckCall(false_value(), a, undefined()); - } - void CheckFalse(double a, double b) { CheckCall(false_value(), Val(a), Val(b)); } @@ -177,25 +205,29 @@ class FunctionTester : public InitializedHandleScope { Handle<JSFunction> Compile(Handle<JSFunction> function) { Zone zone(function->GetIsolate()->allocator()); ParseInfo parse_info(&zone, function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); info.MarkAsDeoptimizationEnabled(); - CHECK(Parser::ParseStatic(info.parse_info())); + if (!FLAG_turbo_from_bytecode) { + CHECK(Parser::ParseStatic(info.parse_info())); + } info.SetOptimizing(); - if (flags_ & CompilationInfo::kFunctionContextSpecializing) { - info.MarkAsFunctionContextSpecializing(); + if (flags_ & CompilationInfo::kNativeContextSpecializing) { + info.MarkAsNativeContextSpecializing(); } if (flags_ & CompilationInfo::kInliningEnabled) { info.MarkAsInliningEnabled(); } - if (flags_ & CompilationInfo::kTypingEnabled) { - info.MarkAsTypingEnabled(); + if (FLAG_turbo_from_bytecode) { + CHECK(Compiler::EnsureBytecode(&info)); + info.MarkAsOptimizeFromBytecode(); + } else { + CHECK(Compiler::Analyze(info.parse_info())); + CHECK(Compiler::EnsureDeoptimizationSupport(&info)); } - CHECK(Compiler::Analyze(info.parse_info())); - CHECK(Compiler::EnsureDeoptimizationSupport(&info)); + JSFunction::EnsureLiterals(function); - Pipeline pipeline(&info); - Handle<Code> code = pipeline.GenerateCode(); + Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); CHECK(!code.is_null()); info.dependencies()->Commit(code); info.context()->native_context()->AddOptimizedCode(*code); @@ -216,22 +248,15 @@ class FunctionTester : public InitializedHandleScope { return function_string; } - std::string BuildFunctionFromDescriptor( - const CallInterfaceDescriptor& descriptor) { - return BuildFunction(descriptor.GetParameterCount()); - } - // Compile the given machine graph instead of the source of the function // and replace the JSFunction's code with the result. Handle<JSFunction> CompileGraph(Graph* graph) { Zone zone(function->GetIsolate()->allocator()); ParseInfo parse_info(&zone, function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); CHECK(Parser::ParseStatic(info.parse_info())); info.SetOptimizing(); - CHECK(Compiler::Analyze(info.parse_info())); - CHECK(Compiler::EnsureDeoptimizationSupport(&info)); Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); CHECK(!code.is_null()); diff --git a/deps/v8/test/cctest/compiler/graph-builder-tester.h b/deps/v8/test/cctest/compiler/graph-builder-tester.h index de2713a5ac..c870a3e84e 100644 --- a/deps/v8/test/cctest/compiler/graph-builder-tester.h +++ b/deps/v8/test/cctest/compiler/graph-builder-tester.h @@ -5,6 +5,7 @@ #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ +#include "src/compiler.h" #include "src/compiler/common-operator.h" #include "src/compiler/instruction-selector.h" #include "src/compiler/linkage.h" @@ -25,7 +26,8 @@ class GraphAndBuilders { : main_graph_(new (zone) Graph(zone)), main_common_(zone), main_machine_(zone, MachineType::PointerRepresentation(), - InstructionSelector::SupportedMachineOperatorFlags()), + InstructionSelector::SupportedMachineOperatorFlags(), + InstructionSelector::AlignmentRequirements()), main_simplified_(zone) {} Graph* graph() const { return main_graph_; } @@ -168,11 +170,11 @@ class GraphBuilderTester : public HandleAndZoneScope, Node* ChangeFloat64ToTagged(Node* a) { return NewNode(simplified()->ChangeFloat64ToTagged(), a); } - Node* ChangeBoolToBit(Node* a) { - return NewNode(simplified()->ChangeBoolToBit(), a); + Node* ChangeTaggedToBit(Node* a) { + return NewNode(simplified()->ChangeTaggedToBit(), a); } - Node* ChangeBitToBool(Node* a) { - return NewNode(simplified()->ChangeBitToBool(), a); + Node* ChangeBitToTagged(Node* a) { + return NewNode(simplified()->ChangeBitToTagged(), a); } Node* LoadField(const FieldAccess& access, Node* object) { @@ -238,7 +240,7 @@ class GraphBuilderTester : public HandleAndZoneScope, CHECK_EQ(op->ValueInputCount(), value_input_count); CHECK(!OperatorProperties::HasContextInput(op)); - CHECK_EQ(0, OperatorProperties::GetFrameStateInputCount(op)); + CHECK(!OperatorProperties::HasFrameStateInput(op)); bool has_control = op->ControlInputCount() == 1; bool has_effect = op->EffectInputCount() == 1; @@ -277,7 +279,7 @@ class GraphBuilderTester : public HandleAndZoneScope, Zone* zone = graph()->zone(); CallDescriptor* desc = Linkage::GetSimplifiedCDescriptor(zone, this->csig_); - CompilationInfo info("testing", main_isolate(), main_zone()); + CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone()); code_ = Pipeline::GenerateCodeForTesting(&info, desc, graph()); #ifdef ENABLE_DISASSEMBLER if (!code_.is_null() && FLAG_print_opt_code) { diff --git a/deps/v8/test/cctest/compiler/test-branch-combine.cc b/deps/v8/test/cctest/compiler/test-branch-combine.cc index c5c41667a0..edaf7b6ac1 100644 --- a/deps/v8/test/cctest/compiler/test-branch-combine.cc +++ b/deps/v8/test/cctest/compiler/test-branch-combine.cc @@ -478,6 +478,454 @@ TEST(BranchCombineEffectLevel) { CHECK_EQ(42, m.Call()); } +TEST(BranchCombineInt32AddLessThanZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Int32LessThan(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = (a + b < 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineInt32AddGreaterThanOrEqualZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Int32GreaterThanOrEqual(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = (a + b >= 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineInt32ZeroGreaterThanAdd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Int32GreaterThan(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = (0 > a + b) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineInt32ZeroLessThanOrEqualAdd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Int32LessThanOrEqual(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = (0 <= a + b) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32AddLessThanOrEqualZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Uint32LessThanOrEqual(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = (a + b <= 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32AddGreaterThanZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Uint32GreaterThan(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = (a + b > 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32ZeroGreaterThanOrEqualAdd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Uint32GreaterThanOrEqual(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = (0 >= a + b) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32ZeroLessThanAdd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Int32Add(a, b); + Node* compare = m.Uint32LessThan(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = (0 < a + b) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineWord32AndLessThanZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Int32LessThan(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = ((a & b) < 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineWord32AndGreaterThanOrEqualZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Int32GreaterThanOrEqual(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = ((a & b) >= 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineInt32ZeroGreaterThanAnd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Int32GreaterThan(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = (0 > (a & b)) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineInt32ZeroLessThanOrEqualAnd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Int32LessThanOrEqual(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t a = *i; + int32_t b = *j; + int32_t expect = (0 <= (a & b)) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32AndLessThanOrEqualZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Uint32LessThanOrEqual(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = ((a & b) <= 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32AndGreaterThanZero) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Uint32GreaterThan(add, m.Int32Constant(0)); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = ((a & b) > 0) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32ZeroGreaterThanOrEqualAnd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Uint32GreaterThanOrEqual(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = (0 >= (a & b)) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + +TEST(BranchCombineUint32ZeroLessThanAnd) { + int32_t t_constant = -1033; + int32_t f_constant = 825118; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + Node* a = m.Parameter(0); + Node* b = m.Parameter(1); + Node* add = m.Word32And(a, b); + Node* compare = m.Uint32LessThan(m.Int32Constant(0), add); + + RawMachineLabel blocka, blockb; + m.Branch(compare, &blocka, &blockb); + m.Bind(&blocka); + m.Return(m.Int32Constant(t_constant)); + m.Bind(&blockb); + m.Return(m.Int32Constant(f_constant)); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + uint32_t a = *i; + uint32_t b = *j; + int32_t expect = (0 < (a & b)) ? t_constant : f_constant; + CHECK_EQ(expect, m.Call(a, b)); + } + } +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-changes-lowering.cc b/deps/v8/test/cctest/compiler/test-changes-lowering.cc deleted file mode 100644 index ddeabe479b..0000000000 --- a/deps/v8/test/cctest/compiler/test-changes-lowering.cc +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <limits> - -#include "src/ast/scopes.h" -#include "src/compiler/change-lowering.h" -#include "src/compiler/control-builders.h" -#include "src/compiler/js-graph.h" -#include "src/compiler/node-properties.h" -#include "src/compiler/pipeline.h" -#include "src/compiler/select-lowering.h" -#include "src/compiler/simplified-lowering.h" -#include "src/compiler/typer.h" -#include "src/compiler/verifier.h" -#include "src/execution.h" -#include "src/globals.h" -#include "src/parsing/parser.h" -#include "src/parsing/rewriter.h" -#include "test/cctest/cctest.h" -#include "test/cctest/compiler/codegen-tester.h" -#include "test/cctest/compiler/function-tester.h" -#include "test/cctest/compiler/graph-builder-tester.h" -#include "test/cctest/compiler/value-helper.h" - -namespace v8 { -namespace internal { -namespace compiler { - -template <typename ReturnType> -class ChangesLoweringTester : public GraphBuilderTester<ReturnType> { - public: - explicit ChangesLoweringTester(MachineType p0 = MachineType::None()) - : GraphBuilderTester<ReturnType>(p0), - javascript(this->zone()), - jsgraph(this->isolate(), this->graph(), this->common(), &javascript, - nullptr, this->machine()), - function(Handle<JSFunction>::null()) {} - - JSOperatorBuilder javascript; - JSGraph jsgraph; - Handle<JSFunction> function; - - Node* start() { return this->graph()->start(); } - - template <typename T> - T* CallWithPotentialGC() { - // TODO(titzer): we wrap the code in a JSFunction here to reuse the - // JSEntryStub; that could be done with a special prologue or other stub. - if (function.is_null()) { - function = FunctionTester::ForMachineGraph(this->graph()); - } - Handle<Object>* args = NULL; - MaybeHandle<Object> result = - Execution::Call(this->isolate(), function, factory()->undefined_value(), - 0, args, false); - return T::cast(*result.ToHandleChecked()); - } - - void StoreFloat64(Node* node, double* ptr) { - Node* ptr_node = this->PointerConstant(ptr); - this->Store(MachineType::Float64(), ptr_node, node); - } - - Node* LoadInt32(int32_t* ptr) { - Node* ptr_node = this->PointerConstant(ptr); - return this->Load(MachineType::Int32(), ptr_node); - } - - Node* LoadUint32(uint32_t* ptr) { - Node* ptr_node = this->PointerConstant(ptr); - return this->Load(MachineType::Uint32(), ptr_node); - } - - Node* LoadFloat64(double* ptr) { - Node* ptr_node = this->PointerConstant(ptr); - return this->Load(MachineType::Float64(), ptr_node); - } - - void CheckNumber(double expected, Object* number) { - CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number)); - } - - void BuildAndLower(const Operator* op) { - // We build a graph by hand here, because the raw machine assembler - // does not add the correct control and effect nodes. - Node* p0 = this->Parameter(0); - Node* change = this->graph()->NewNode(op, p0); - Node* ret = this->graph()->NewNode(this->common()->Return(), change, - this->start(), this->start()); - Node* end = this->graph()->NewNode(this->common()->End(1), ret); - this->graph()->SetEnd(end); - LowerChange(change); - } - - void BuildStoreAndLower(const Operator* op, const Operator* store_op, - void* location) { - // We build a graph by hand here, because the raw machine assembler - // does not add the correct control and effect nodes. - Node* p0 = this->Parameter(0); - Node* change = this->graph()->NewNode(op, p0); - Node* store = this->graph()->NewNode( - store_op, this->PointerConstant(location), this->Int32Constant(0), - change, this->start(), this->start()); - Node* ret = this->graph()->NewNode( - this->common()->Return(), this->Int32Constant(0), store, this->start()); - Node* end = this->graph()->NewNode(this->common()->End(1), ret); - this->graph()->SetEnd(end); - LowerChange(change); - } - - void BuildLoadAndLower(const Operator* op, const Operator* load_op, - void* location) { - // We build a graph by hand here, because the raw machine assembler - // does not add the correct control and effect nodes. - Node* load = this->graph()->NewNode( - load_op, this->PointerConstant(location), this->Int32Constant(0), - this->start(), this->start()); - Node* change = this->graph()->NewNode(op, load); - Node* ret = this->graph()->NewNode(this->common()->Return(), change, - this->start(), this->start()); - Node* end = this->graph()->NewNode(this->common()->End(1), ret); - this->graph()->SetEnd(end); - LowerChange(change); - } - - void LowerChange(Node* change) { - // Run the graph reducer with changes lowering on a single node. - Typer typer(this->isolate(), this->graph()); - typer.Run(); - ChangeLowering change_lowering(&jsgraph); - SelectLowering select_lowering(this->graph(), this->common()); - GraphReducer reducer(this->zone(), this->graph()); - reducer.AddReducer(&change_lowering); - reducer.AddReducer(&select_lowering); - reducer.ReduceNode(change); - Verifier::Run(this->graph(), Verifier::UNTYPED); - } - - Factory* factory() { return this->isolate()->factory(); } - Heap* heap() { return this->isolate()->heap(); } -}; - - -TEST(RunChangeTaggedToInt32) { - // Build and lower a graph by hand. - ChangesLoweringTester<int32_t> t(MachineType::AnyTagged()); - t.BuildAndLower(t.simplified()->ChangeTaggedToInt32()); - - FOR_INT32_INPUTS(i) { - int32_t input = *i; - - if (Smi::IsValid(input)) { - int32_t result = t.Call(Smi::FromInt(input)); - CHECK_EQ(input, result); - } - - { - Handle<Object> number = t.factory()->NewNumber(input); - int32_t result = t.Call(*number); - CHECK_EQ(input, result); - } - - { - Handle<HeapNumber> number = t.factory()->NewHeapNumber(input); - int32_t result = t.Call(*number); - CHECK_EQ(input, result); - } - } -} - - -TEST(RunChangeTaggedToUint32) { - // Build and lower a graph by hand. - ChangesLoweringTester<uint32_t> t(MachineType::AnyTagged()); - t.BuildAndLower(t.simplified()->ChangeTaggedToUint32()); - - FOR_UINT32_INPUTS(i) { - uint32_t input = *i; - - if (Smi::IsValid(input)) { - uint32_t result = t.Call(Smi::FromInt(input)); - CHECK_EQ(static_cast<int32_t>(input), static_cast<int32_t>(result)); - } - - { - Handle<Object> number = t.factory()->NewNumber(input); - uint32_t result = t.Call(*number); - CHECK_EQ(static_cast<int32_t>(input), static_cast<int32_t>(result)); - } - - { - Handle<HeapNumber> number = t.factory()->NewHeapNumber(input); - uint32_t result = t.Call(*number); - CHECK_EQ(static_cast<int32_t>(input), static_cast<int32_t>(result)); - } - } -} - - -TEST(RunChangeTaggedToFloat64) { - ChangesLoweringTester<int32_t> t(MachineType::AnyTagged()); - double result; - - t.BuildStoreAndLower(t.simplified()->ChangeTaggedToFloat64(), - t.machine()->Store(StoreRepresentation( - MachineRepresentation::kFloat64, kNoWriteBarrier)), - &result); - - { - FOR_INT32_INPUTS(i) { - int32_t input = *i; - - if (Smi::IsValid(input)) { - t.Call(Smi::FromInt(input)); - CHECK_EQ(input, static_cast<int32_t>(result)); - } - - { - Handle<Object> number = t.factory()->NewNumber(input); - t.Call(*number); - CHECK_EQ(input, static_cast<int32_t>(result)); - } - - { - Handle<HeapNumber> number = t.factory()->NewHeapNumber(input); - t.Call(*number); - CHECK_EQ(input, static_cast<int32_t>(result)); - } - } - } - - { - FOR_FLOAT64_INPUTS(i) { - double input = *i; - { - Handle<Object> number = t.factory()->NewNumber(input); - t.Call(*number); - CHECK_DOUBLE_EQ(input, result); - } - - { - Handle<HeapNumber> number = t.factory()->NewHeapNumber(input); - t.Call(*number); - CHECK_DOUBLE_EQ(input, result); - } - } - } -} - - -TEST(RunChangeBoolToBit) { - ChangesLoweringTester<int32_t> t(MachineType::AnyTagged()); - t.BuildAndLower(t.simplified()->ChangeBoolToBit()); - - { - Object* true_obj = t.heap()->true_value(); - int32_t result = t.Call(true_obj); - CHECK_EQ(1, result); - } - - { - Object* false_obj = t.heap()->false_value(); - int32_t result = t.Call(false_obj); - CHECK_EQ(0, result); - } -} - - -TEST(RunChangeBitToBool) { - ChangesLoweringTester<Object*> t(MachineType::Int32()); - t.BuildAndLower(t.simplified()->ChangeBitToBool()); - - { - Object* result = t.Call(1); - Object* true_obj = t.heap()->true_value(); - CHECK_EQ(true_obj, result); - } - - { - Object* result = t.Call(0); - Object* false_obj = t.heap()->false_value(); - CHECK_EQ(false_obj, result); - } -} - -} // namespace compiler -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-code-stub-assembler.cc b/deps/v8/test/cctest/compiler/test-code-assembler.cc index ff02cc9b44..d9bb9346f5 100644 --- a/deps/v8/test/cctest/compiler/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/compiler/test-code-assembler.cc @@ -2,52 +2,54 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/interface-descriptors.h" +#include "src/compiler/code-assembler.h" #include "src/isolate.h" +#include "test/cctest/compiler/code-assembler-tester.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { namespace internal { namespace compiler { +typedef CodeAssemblerTesterImpl<CodeAssembler> CodeAssemblerTester; -class CodeStubAssemblerTester : public CodeStubAssembler { - public: - // Test generating code for a stub. - CodeStubAssemblerTester(Isolate* isolate, - const CallInterfaceDescriptor& descriptor) - : CodeStubAssembler(isolate, isolate->runtime_zone(), descriptor, - Code::ComputeFlags(Code::STUB), "test"), - scope_(isolate) {} +namespace { + +Node* SmiTag(CodeAssemblerTester& m, Node* value) { + int32_t constant_value; + if (m.ToInt32Constant(value, constant_value) && + Smi::IsValid(constant_value)) { + return m.SmiConstant(Smi::FromInt(constant_value)); + } + return m.WordShl(value, m.IntPtrConstant(kSmiShiftSize + kSmiTagSize)); +} - // Test generating code for a JS function (e.g. builtins). - CodeStubAssemblerTester(Isolate* isolate, int parameter_count) - : CodeStubAssembler(isolate, isolate->runtime_zone(), parameter_count, - Code::ComputeFlags(Code::FUNCTION), "test"), - scope_(isolate) {} +Node* UndefinedConstant(CodeAssemblerTester& m) { + return m.LoadRoot(Heap::kUndefinedValueRootIndex); +} - private: - HandleScope scope_; - LocalContext context_; -}; +Node* LoadObjectField(CodeAssemblerTester& m, Node* object, int offset, + MachineType rep = MachineType::AnyTagged()) { + return m.Load(rep, object, m.IntPtrConstant(offset - kHeapObjectTag)); +} +} // namespace TEST(SimpleSmiReturn) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); - m.Return(m.SmiTag(m.Int32Constant(37))); + CodeAssemblerTester m(isolate, descriptor); + m.Return(SmiTag(m, m.Int32Constant(37))); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); MaybeHandle<Object> result = ft.Call(); CHECK_EQ(37, Handle<Smi>::cast(result.ToHandleChecked())->value()); } - TEST(SimpleIntPtrReturn) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); int test; m.Return(m.IntPtrConstant(reinterpret_cast<intptr_t>(&test))); Handle<Code> code = m.GenerateCode(); @@ -57,11 +59,10 @@ TEST(SimpleIntPtrReturn) { reinterpret_cast<intptr_t>(*result.ToHandleChecked())); } - TEST(SimpleDoubleReturn) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); m.Return(m.NumberConstant(0.5)); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); @@ -69,13 +70,12 @@ TEST(SimpleDoubleReturn) { CHECK_EQ(0.5, Handle<HeapNumber>::cast(result.ToHandleChecked())->value()); } - TEST(SimpleCallRuntime1Arg) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* b = m.SmiTag(m.Int32Constant(0)); + Node* b = SmiTag(m, m.Int32Constant(0)); m.Return(m.CallRuntime(Runtime::kNumberToSmi, context, b)); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); @@ -83,13 +83,12 @@ TEST(SimpleCallRuntime1Arg) { CHECK_EQ(0, Handle<Smi>::cast(result.ToHandleChecked())->value()); } - TEST(SimpleTailCallRuntime1Arg) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* b = m.SmiTag(m.Int32Constant(0)); + Node* b = SmiTag(m, m.Int32Constant(0)); m.TailCallRuntime(Runtime::kNumberToSmi, context, b); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); @@ -97,40 +96,123 @@ TEST(SimpleTailCallRuntime1Arg) { CHECK_EQ(0, Handle<Smi>::cast(result.ToHandleChecked())->value()); } - TEST(SimpleCallRuntime2Arg) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* a = m.SmiTag(m.Int32Constant(2)); - Node* b = m.SmiTag(m.Int32Constant(4)); - m.Return(m.CallRuntime(Runtime::kMathPow, context, a, b)); + Node* a = SmiTag(m, m.Int32Constant(2)); + Node* b = SmiTag(m, m.Int32Constant(4)); + m.Return(m.CallRuntime(Runtime::kAdd, context, a, b)); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); MaybeHandle<Object> result = ft.Call(); - CHECK_EQ(16, Handle<Smi>::cast(result.ToHandleChecked())->value()); + CHECK_EQ(6, Handle<Smi>::cast(result.ToHandleChecked())->value()); } - TEST(SimpleTailCallRuntime2Arg) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* a = m.SmiTag(m.Int32Constant(2)); - Node* b = m.SmiTag(m.Int32Constant(4)); - m.TailCallRuntime(Runtime::kMathPow, context, a, b); + Node* a = SmiTag(m, m.Int32Constant(2)); + Node* b = SmiTag(m, m.Int32Constant(4)); + m.TailCallRuntime(Runtime::kAdd, context, a, b); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); MaybeHandle<Object> result = ft.Call(); - CHECK_EQ(16, Handle<Smi>::cast(result.ToHandleChecked())->value()); + CHECK_EQ(6, Handle<Smi>::cast(result.ToHandleChecked())->value()); +} + +namespace { + +Handle<JSFunction> CreateSumAllArgumentsFunction(FunctionTester& ft) { + const char* source = + "(function() {\n" + " var sum = 0 + this;\n" + " for (var i = 0; i < arguments.length; i++) {\n" + " sum += arguments[i];\n" + " }\n" + " return sum;\n" + "})"; + return ft.NewFunction(source); +} + +} // namespace + +TEST(SimpleCallJSFunction0Arg) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 1; + CodeAssemblerTester m(isolate, kNumParams); + { + Node* function = m.Parameter(0); + Node* context = m.Parameter(kNumParams + 2); + + Node* receiver = SmiTag(m, m.Int32Constant(42)); + + Callable callable = CodeFactory::Call(isolate); + Node* result = m.CallJS(callable, context, function, receiver); + m.Return(result); + } + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<JSFunction> sum = CreateSumAllArgumentsFunction(ft); + MaybeHandle<Object> result = ft.Call(sum); + CHECK_EQ(Smi::FromInt(42), *result.ToHandleChecked()); +} + +TEST(SimpleCallJSFunction1Arg) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 2; + CodeAssemblerTester m(isolate, kNumParams); + { + Node* function = m.Parameter(0); + Node* context = m.Parameter(1); + + Node* receiver = SmiTag(m, m.Int32Constant(42)); + Node* a = SmiTag(m, m.Int32Constant(13)); + + Callable callable = CodeFactory::Call(isolate); + Node* result = m.CallJS(callable, context, function, receiver, a); + m.Return(result); + } + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<JSFunction> sum = CreateSumAllArgumentsFunction(ft); + MaybeHandle<Object> result = ft.Call(sum); + CHECK_EQ(Smi::FromInt(55), *result.ToHandleChecked()); +} + +TEST(SimpleCallJSFunction2Arg) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 2; + CodeAssemblerTester m(isolate, kNumParams); + { + Node* function = m.Parameter(0); + Node* context = m.Parameter(1); + + Node* receiver = SmiTag(m, m.Int32Constant(42)); + Node* a = SmiTag(m, m.Int32Constant(13)); + Node* b = SmiTag(m, m.Int32Constant(153)); + + Callable callable = CodeFactory::Call(isolate); + Node* result = m.CallJS(callable, context, function, receiver, a, b); + m.Return(result); + } + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<JSFunction> sum = CreateSumAllArgumentsFunction(ft); + MaybeHandle<Object> result = ft.Call(sum); + CHECK_EQ(Smi::FromInt(208), *result.ToHandleChecked()); } TEST(VariableMerge1) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Variable var1(&m, MachineRepresentation::kTagged); CodeStubAssembler::Label l1(&m), l2(&m), merge(&m); Node* temp = m.Int32Constant(0); @@ -149,7 +231,7 @@ TEST(VariableMerge1) { TEST(VariableMerge2) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Variable var1(&m, MachineRepresentation::kTagged); CodeStubAssembler::Label l1(&m), l2(&m), merge(&m); Node* temp = m.Int32Constant(0); @@ -170,7 +252,7 @@ TEST(VariableMerge2) { TEST(VariableMerge3) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Variable var1(&m, MachineRepresentation::kTagged); CodeStubAssembler::Variable var2(&m, MachineRepresentation::kTagged); CodeStubAssembler::Label l1(&m), l2(&m), merge(&m); @@ -195,7 +277,7 @@ TEST(VariableMerge3) { TEST(VariableMergeBindFirst) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Variable var1(&m, MachineRepresentation::kTagged); CodeStubAssembler::Label l1(&m), l2(&m), merge(&m, &var1), end(&m); Node* temp = m.Int32Constant(0); @@ -221,7 +303,7 @@ TEST(VariableMergeBindFirst) { TEST(VariableMergeSwitch) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Variable var1(&m, MachineRepresentation::kTagged); CodeStubAssembler::Label l1(&m), l2(&m), default_label(&m); CodeStubAssembler::Label* labels[] = {&l1, &l2}; @@ -240,101 +322,10 @@ TEST(VariableMergeSwitch) { m.Return(temp); } -TEST(FixedArrayAccessSmiIndex) { - Isolate* isolate(CcTest::InitIsolateOnce()); - VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); - Handle<FixedArray> array = isolate->factory()->NewFixedArray(5); - array->set(4, Smi::FromInt(733)); - m.Return(m.LoadFixedArrayElementSmiIndex(m.HeapConstant(array), - m.SmiTag(m.Int32Constant(4)))); - Handle<Code> code = m.GenerateCode(); - FunctionTester ft(descriptor, code); - MaybeHandle<Object> result = ft.Call(); - CHECK_EQ(733, Handle<Smi>::cast(result.ToHandleChecked())->value()); -} - -TEST(LoadHeapNumberValue) { - Isolate* isolate(CcTest::InitIsolateOnce()); - VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); - Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(1234); - m.Return(m.SmiTag( - m.ChangeFloat64ToUint32(m.LoadHeapNumberValue(m.HeapConstant(number))))); - Handle<Code> code = m.GenerateCode(); - FunctionTester ft(descriptor, code); - MaybeHandle<Object> result = ft.Call(); - CHECK_EQ(1234, Handle<Smi>::cast(result.ToHandleChecked())->value()); -} - -TEST(LoadInstanceType) { - Isolate* isolate(CcTest::InitIsolateOnce()); - VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); - Handle<HeapObject> undefined = isolate->factory()->undefined_value(); - m.Return(m.SmiTag(m.LoadInstanceType(m.HeapConstant(undefined)))); - Handle<Code> code = m.GenerateCode(); - FunctionTester ft(descriptor, code); - MaybeHandle<Object> result = ft.Call(); - CHECK_EQ(InstanceType::ODDBALL_TYPE, - Handle<Smi>::cast(result.ToHandleChecked())->value()); -} - -namespace { - -class TestBitField : public BitField<unsigned, 3, 3> {}; - -} // namespace - -TEST(BitFieldDecode) { - Isolate* isolate(CcTest::InitIsolateOnce()); - VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); - m.Return(m.SmiTag(m.BitFieldDecode<TestBitField>(m.Int32Constant(0x2f)))); - Handle<Code> code = m.GenerateCode(); - FunctionTester ft(descriptor, code); - MaybeHandle<Object> result = ft.Call(); - // value = 00101111 - // mask = 00111000 - // result = 101 - CHECK_EQ(5, Handle<Smi>::cast(result.ToHandleChecked())->value()); -} - -namespace { - -Handle<JSFunction> CreateFunctionFromCode(int parameter_count_with_receiver, - Handle<Code> code) { - Isolate* isolate = code->GetIsolate(); - Handle<String> name = isolate->factory()->InternalizeUtf8String("test"); - Handle<JSFunction> function = - isolate->factory()->NewFunctionWithoutPrototype(name, code); - function->shared()->set_internal_formal_parameter_count( - parameter_count_with_receiver - 1); // Implicit undefined receiver. - return function; -} - -} // namespace - -TEST(JSFunction) { - const int kNumParams = 3; // Receiver, left, right. - Isolate* isolate(CcTest::InitIsolateOnce()); - CodeStubAssemblerTester m(isolate, kNumParams); - m.Return(m.SmiTag(m.Int32Add(m.SmiToWord32(m.Parameter(1)), - m.SmiToWord32(m.Parameter(2))))); - Handle<Code> code = m.GenerateCode(); - Handle<JSFunction> function = CreateFunctionFromCode(kNumParams, code); - Handle<Object> args[] = {Handle<Smi>(Smi::FromInt(23), isolate), - Handle<Smi>(Smi::FromInt(34), isolate)}; - MaybeHandle<Object> result = - Execution::Call(isolate, function, isolate->factory()->undefined_value(), - arraysize(args), args); - CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value()); -} - TEST(SplitEdgeBranchMerge) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Label l1(&m), merge(&m); m.Branch(m.Int32Constant(1), &l1, &merge); m.Bind(&l1); @@ -346,7 +337,7 @@ TEST(SplitEdgeBranchMerge) { TEST(SplitEdgeSwitchMerge) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); - CodeStubAssemblerTester m(isolate, descriptor); + CodeAssemblerTester m(isolate, descriptor); CodeStubAssembler::Label l1(&m), l2(&m), l3(&m), default_label(&m); CodeStubAssembler::Label* labels[] = {&l1, &l2}; int32_t values[] = {1, 2}; @@ -361,6 +352,87 @@ TEST(SplitEdgeSwitchMerge) { USE(m.GenerateCode()); } +TEST(TestToConstant) { + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeAssemblerTester m(isolate, descriptor); + int32_t value32; + int64_t value64; + Node* a = m.Int32Constant(5); + CHECK(m.ToInt32Constant(a, value32)); + CHECK(m.ToInt64Constant(a, value64)); + + a = m.Int64Constant(static_cast<int64_t>(1) << 32); + CHECK(!m.ToInt32Constant(a, value32)); + CHECK(m.ToInt64Constant(a, value64)); + + a = m.Int64Constant(13); + CHECK(m.ToInt32Constant(a, value32)); + CHECK(m.ToInt64Constant(a, value64)); + + a = UndefinedConstant(m); + CHECK(!m.ToInt32Constant(a, value32)); + CHECK(!m.ToInt64Constant(a, value64)); + + a = UndefinedConstant(m); + CHECK(!m.ToInt32Constant(a, value32)); + CHECK(!m.ToInt64Constant(a, value64)); +} + +TEST(DeferredCodePhiHints) { + typedef compiler::Node Node; + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeAssemblerTester m(isolate, descriptor); + Label block1(&m, Label::kDeferred); + m.Goto(&block1); + m.Bind(&block1); + { + Variable var_object(&m, MachineRepresentation::kTagged); + Label loop(&m, &var_object); + var_object.Bind(m.IntPtrConstant(0)); + m.Goto(&loop); + m.Bind(&loop); + { + Node* map = LoadObjectField(m, var_object.value(), JSObject::kMapOffset); + var_object.Bind(map); + m.Goto(&loop); + } + } + CHECK(!m.GenerateCode().is_null()); +} + +TEST(TestOutOfScopeVariable) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeAssemblerTester m(isolate, descriptor); + Label block1(&m); + Label block2(&m); + Label block3(&m); + Label block4(&m); + m.Branch(m.WordEqual(m.Parameter(0), m.IntPtrConstant(0)), &block1, &block4); + m.Bind(&block4); + { + Variable var_object(&m, MachineRepresentation::kTagged); + m.Branch(m.WordEqual(m.Parameter(0), m.IntPtrConstant(0)), &block2, + &block3); + + m.Bind(&block2); + var_object.Bind(m.IntPtrConstant(55)); + m.Goto(&block1); + + m.Bind(&block3); + var_object.Bind(m.IntPtrConstant(66)); + m.Goto(&block1); + } + m.Bind(&block1); + CHECK(!m.GenerateCode().is_null()); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-gap-resolver.cc b/deps/v8/test/cctest/compiler/test-gap-resolver.cc index 7f85088809..b8b1251724 100644 --- a/deps/v8/test/cctest/compiler/test-gap-resolver.cc +++ b/deps/v8/test/cctest/compiler/test-gap-resolver.cc @@ -33,7 +33,7 @@ class InterpreterState { private: struct Key { bool is_constant; - bool is_float; + MachineRepresentation rep; LocationOperand::LocationKind kind; int index; @@ -41,8 +41,8 @@ class InterpreterState { if (this->is_constant != other.is_constant) { return this->is_constant; } - if (this->is_float != other.is_float) { - return this->is_float; + if (this->rep != other.rep) { + return static_cast<int>(this->rep) < static_cast<int>(other.rep); } if (this->kind != other.kind) { return this->kind < other.kind; @@ -51,7 +51,7 @@ class InterpreterState { } bool operator==(const Key& other) const { - return this->is_constant == other.is_constant && + return this->is_constant == other.is_constant && this->rep == other.rep && this->kind == other.kind && this->index == other.index; } }; @@ -75,24 +75,26 @@ class InterpreterState { static Key KeyFor(const InstructionOperand& op) { bool is_constant = op.IsConstant(); - bool is_float = false; + MachineRepresentation rep = + v8::internal::compiler::InstructionSequence::DefaultRepresentation(); LocationOperand::LocationKind kind; int index; if (!is_constant) { - if (op.IsRegister()) { - index = LocationOperand::cast(op).GetRegister().code(); - } else if (op.IsDoubleRegister()) { - index = LocationOperand::cast(op).GetDoubleRegister().code(); + const LocationOperand& loc_op = LocationOperand::cast(op); + if (loc_op.IsAnyRegister()) { + if (loc_op.IsFPRegister()) { + rep = MachineRepresentation::kFloat64; + } + index = loc_op.register_code(); } else { - index = LocationOperand::cast(op).index(); + index = loc_op.index(); } - is_float = IsFloatingPoint(LocationOperand::cast(op).representation()); - kind = LocationOperand::cast(op).location_kind(); + kind = loc_op.location_kind(); } else { index = ConstantOperand::cast(op).virtual_register(); kind = LocationOperand::REGISTER; } - Key key = {is_constant, is_float, kind, index}; + Key key = {is_constant, rep, kind, index}; return key; } @@ -102,10 +104,7 @@ class InterpreterState { if (key.is_constant) { return ConstantOperand(key.index); } - return AllocatedOperand( - key.kind, - v8::internal::compiler::InstructionSequence::DefaultRepresentation(), - key.index); + return AllocatedOperand(key.kind, key.rep, key.index); } friend std::ostream& operator<<(std::ostream& os, @@ -113,12 +112,10 @@ class InterpreterState { for (OperandMap::const_iterator it = is.values_.begin(); it != is.values_.end(); ++it) { if (it != is.values_.begin()) os << " "; - InstructionOperand source = FromKey(it->first); - InstructionOperand destination = FromKey(it->second); + InstructionOperand source = FromKey(it->second); + InstructionOperand destination = FromKey(it->first); MoveOperands mo(source, destination); - PrintableMoveOperands pmo = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), - &mo}; + PrintableMoveOperands pmo = {RegisterConfiguration::Turbofan(), &mo}; os << pmo; } return os; @@ -168,7 +165,9 @@ class ParallelMoveCreator : public HandleAndZoneScope { ParallelMove* parallel_move = new (main_zone()) ParallelMove(main_zone()); std::set<InstructionOperand, CompareOperandModuloType> seen; for (int i = 0; i < size; ++i) { - MoveOperands mo(CreateRandomOperand(true), CreateRandomOperand(false)); + MachineRepresentation rep = RandomRepresentation(); + MoveOperands mo(CreateRandomOperand(true, rep), + CreateRandomOperand(false, rep)); if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) { parallel_move->AddMove(mo.source(), mo.destination()); seen.insert(mo.destination()); @@ -179,52 +178,59 @@ class ParallelMoveCreator : public HandleAndZoneScope { private: MachineRepresentation RandomRepresentation() { - int index = rng_->NextInt(3); + int index = rng_->NextInt(5); switch (index) { case 0: return MachineRepresentation::kWord32; case 1: return MachineRepresentation::kWord64; case 2: + return MachineRepresentation::kFloat32; + case 3: + return MachineRepresentation::kFloat64; + case 4: return MachineRepresentation::kTagged; } UNREACHABLE(); return MachineRepresentation::kNone; } - MachineRepresentation RandomDoubleRepresentation() { - int index = rng_->NextInt(2); - if (index == 0) return MachineRepresentation::kFloat64; - return MachineRepresentation::kFloat32; - } - - InstructionOperand CreateRandomOperand(bool is_source) { + InstructionOperand CreateRandomOperand(bool is_source, + MachineRepresentation rep) { + auto conf = RegisterConfiguration::Turbofan(); + auto GetRegisterCode = [&conf](MachineRepresentation rep, int index) { + switch (rep) { + case MachineRepresentation::kFloat32: +#if V8_TARGET_ARCH_ARM + // Only even number float registers are used on Arm. + // TODO(bbudge) Eliminate this when FP register aliasing works. + return conf->RegisterConfiguration::GetAllocatableDoubleCode(index) * + 2; +#endif + // Fall through on non-Arm targets. + case MachineRepresentation::kFloat64: + return conf->RegisterConfiguration::GetAllocatableDoubleCode(index); + + default: + return conf->RegisterConfiguration::GetAllocatableGeneralCode(index); + } + UNREACHABLE(); + return static_cast<int>(Register::kCode_no_reg); + }; int index = rng_->NextInt(7); // destination can't be Constant. - switch (rng_->NextInt(is_source ? 7 : 6)) { + switch (rng_->NextInt(is_source ? 5 : 4)) { case 0: - return AllocatedOperand(LocationOperand::STACK_SLOT, - RandomRepresentation(), index); + return AllocatedOperand(LocationOperand::STACK_SLOT, rep, index); case 1: - return AllocatedOperand(LocationOperand::STACK_SLOT, - RandomDoubleRepresentation(), index); + return AllocatedOperand(LocationOperand::REGISTER, rep, index); case 2: - return AllocatedOperand(LocationOperand::REGISTER, - RandomRepresentation(), index); + return ExplicitOperand(LocationOperand::REGISTER, rep, + GetRegisterCode(rep, 1)); case 3: - return AllocatedOperand(LocationOperand::REGISTER, - RandomDoubleRepresentation(), index); + return ExplicitOperand(LocationOperand::STACK_SLOT, rep, + GetRegisterCode(rep, index)); case 4: - return ExplicitOperand( - LocationOperand::REGISTER, RandomRepresentation(), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(1)); - case 5: - return ExplicitOperand( - LocationOperand::STACK_SLOT, RandomRepresentation(), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(index)); - case 6: return ConstantOperand(index); } UNREACHABLE(); @@ -250,7 +256,7 @@ TEST(FuzzResolver) { GapResolver resolver(&mi2); resolver.Resolve(pm); - CHECK(mi1.state() == mi2.state()); + CHECK_EQ(mi1.state(), mi2.state()); } } } 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 c7cd47a55c..e9bf064750 100644 --- a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc +++ b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc @@ -186,81 +186,6 @@ TEST(ReduceJSStoreContext) { } -// TODO(titzer): factor out common code with effects checking in typed lowering. -static void CheckEffectInput(Node* effect, Node* use) { - CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); -} - - -TEST(SpecializeToContext) { - ContextSpecializationTester t; - - Node* start = t.graph()->NewNode(t.common()->Start(0)); - t.graph()->SetStart(start); - - // Make a context and initialize it a bit for this test. - Handle<Context> native = t.factory()->NewNativeContext(); - Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!"); - const int slot = Context::NATIVE_CONTEXT_INDEX; - native->set(slot, *expected); - - Node* const_context = t.jsgraph()->Constant(native); - Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start); - - { - // Check that specialization replaces values and forwards effects - // correctly, and folds values from constant and non-constant contexts - Node* effect_in = start; - Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true), - const_context, const_context, effect_in); - - - Node* value_use = - t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), load); - Node* other_load = - t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true), - param_context, param_context, load); - Node* effect_use = other_load; - Node* other_use = - t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), other_load); - - Node* add = t.graph()->NewNode( - t.javascript()->Add(BinaryOperationHints::Any()), value_use, other_use, - param_context, t.jsgraph()->EmptyFrameState(), - t.jsgraph()->EmptyFrameState(), other_load, start); - - Node* ret = - t.graph()->NewNode(t.common()->Return(), add, effect_use, start); - Node* end = t.graph()->NewNode(t.common()->End(1), ret); - USE(end); - t.graph()->SetEnd(end); - - // Double check the above graph is what we expect, or the test is broken. - CheckEffectInput(effect_in, load); - CheckEffectInput(load, effect_use); - - // Perform the reduction on the entire graph. - GraphReducer graph_reducer(t.main_zone(), t.graph()); - JSContextSpecialization spec(&graph_reducer, t.jsgraph(), - MaybeHandle<Context>()); - graph_reducer.AddReducer(&spec); - graph_reducer.ReduceGraph(); - - // Effects should have been forwarded (not replaced with a value). - CheckEffectInput(effect_in, effect_use); - - // Use of {other_load} should not have been replaced. - CHECK_EQ(other_load, other_use->InputAt(0)); - - Node* replacement = value_use->InputAt(0); - HeapObjectMatcher match(replacement); - CHECK(match.HasValue()); - CHECK_EQ(*expected, *match.Value()); - } - // TODO(titzer): clean up above test and test more complicated effects. -} - - TEST(SpecializeJSFunction_ToConstant1) { FunctionTester T( "(function() { var x = 1; function inc(a)" @@ -300,10 +225,14 @@ TEST(SpecializeJSFunction_ToConstant_uninit) { FunctionTester T( "(function() { if (false) { var x = 1; } function inc(a)" " { return x; } return inc; })()"); // x is undefined! - - CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined()); - CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined()); - CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsUndefined()); + i::Isolate* isolate = CcTest::i_isolate(); + CHECK( + T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate)); + CHECK( + T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate)); + CHECK(T.Call(T.Val(-2.1), T.Val(0.0)) + .ToHandleChecked() + ->IsUndefined(isolate)); } { 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 0075de5329..88cd6c663c 100644 --- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc @@ -19,7 +19,9 @@ namespace compiler { class JSTypedLoweringTester : public HandleAndZoneScope { public: - explicit JSTypedLoweringTester(int num_parameters = 0) + JSTypedLoweringTester( + int num_parameters = 0, + JSTypedLowering::Flags flags = JSTypedLowering::kDeoptimizationEnabled) : isolate(main_isolate()), binop(NULL), unop(NULL), @@ -30,7 +32,8 @@ class JSTypedLoweringTester : public HandleAndZoneScope { deps(main_isolate(), main_zone()), graph(main_zone()), typer(main_isolate(), &graph), - context_node(NULL) { + context_node(NULL), + flags(flags) { graph.SetStart(graph.NewNode(common.Start(num_parameters))); graph.SetEnd(graph.NewNode(common.End(1), graph.start())); typer.Run(); @@ -47,7 +50,9 @@ class JSTypedLoweringTester : public HandleAndZoneScope { Graph graph; Typer typer; Node* context_node; - BinaryOperationHints const hints = BinaryOperationHints::Any(); + JSTypedLowering::Flags flags; + BinaryOperationHint const binop_hints = BinaryOperationHint::kAny; + CompareOperationHint const compare_hints = CompareOperationHint::kAny; Node* Parameter(Type* t, int32_t index = 0) { Node* n = graph.NewNode(common.Parameter(index), graph.start()); @@ -82,8 +87,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { &machine); // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(main_zone(), &graph); - JSTypedLowering reducer(&graph_reducer, &deps, - JSTypedLowering::kDeoptimizationEnabled, &jsgraph, + JSTypedLowering reducer(&graph_reducer, &deps, flags, &jsgraph, main_zone()); Reduction reduction = reducer.Reduce(node); if (reduction.Changed()) return reduction.replacement(); @@ -243,7 +247,7 @@ TEST(AddNumber1) { for (size_t i = 0; i < arraysize(kNumberTypes); ++i) { Node* p0 = R.Parameter(kNumberTypes[i], 0); Node* p1 = R.Parameter(kNumberTypes[i], 1); - Node* add = R.Binop(R.javascript.Add(BinaryOperationHints::Any()), p0, p1); + Node* add = R.Binop(R.javascript.Add(BinaryOperationHint::kAny), p0, p1); Node* r = R.reduce(add); R.CheckBinop(IrOpcode::kNumberAdd, r); @@ -255,11 +259,11 @@ TEST(AddNumber1) { TEST(NumberBinops) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Add(R.hints), R.simplified.NumberAdd(), - R.javascript.Subtract(R.hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.hints), R.simplified.NumberMultiply(), - R.javascript.Divide(R.hints), R.simplified.NumberDivide(), - R.javascript.Modulus(R.hints), R.simplified.NumberModulus(), + 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(), }; for (size_t i = 0; i < arraysize(kNumberTypes); ++i) { @@ -301,11 +305,11 @@ class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { public: JSBitwiseShiftTypedLoweringTester() : JSTypedLoweringTester() { int i = 0; - set(i++, javascript.ShiftLeft(hints), true); + set(i++, javascript.ShiftLeft(binop_hints), true); set(i++, simplified.NumberShiftLeft(), false); - set(i++, javascript.ShiftRight(hints), true); + set(i++, javascript.ShiftRight(binop_hints), true); set(i++, simplified.NumberShiftRight(), false); - set(i++, javascript.ShiftRightLogical(hints), false); + set(i++, javascript.ShiftRightLogical(binop_hints), false); set(i++, simplified.NumberShiftRightLogical(), false); } static const int kNumberOps = 6; @@ -357,11 +361,11 @@ class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester { public: JSBitwiseTypedLoweringTester() : JSTypedLoweringTester() { int i = 0; - set(i++, javascript.BitwiseOr(hints), true); + set(i++, javascript.BitwiseOr(binop_hints), true); set(i++, simplified.NumberBitwiseOr(), true); - set(i++, javascript.BitwiseXor(hints), true); + set(i++, javascript.BitwiseXor(binop_hints), true); set(i++, simplified.NumberBitwiseXor(), true); - set(i++, javascript.BitwiseAnd(hints), true); + set(i++, javascript.BitwiseAnd(binop_hints), true); set(i++, simplified.NumberBitwiseAnd(), true); } static const int kNumberOps = 6; @@ -438,7 +442,7 @@ TEST(JSToNumber_replacement) { R.graph.NewNode(R.javascript.ToNumber(), n, R.context(), R.EmptyFrameState(R.context()), R.start(), R.start()); Node* effect_use = R.UseForEffect(c); - Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(Type::Any()), n, c); + Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(), n, c); R.CheckEffectInput(c, effect_use); Node* r = R.reduce(c); @@ -492,7 +496,7 @@ TEST(JSToNumberOfNumberOrOtherPrimitive) { for (size_t i = 0; i < arraysize(others); i++) { Type* t = Type::Union(Type::Number(), others[i], R.main_zone()); Node* r = R.ReduceUnop(R.javascript.ToNumber(), t); - CHECK_EQ(IrOpcode::kJSToNumber, r->opcode()); + CHECK_EQ(IrOpcode::kPlainPrimitiveToNumber, r->opcode()); } } @@ -550,7 +554,7 @@ TEST(JSToString_replacement) { R.graph.NewNode(R.javascript.ToString(), n, R.context(), R.EmptyFrameState(R.context()), R.start(), R.start()); Node* effect_use = R.UseForEffect(c); - Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(Type::Any()), n, c); + Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(), n, c); R.CheckEffectInput(c, effect_use); Node* r = R.reduce(c); @@ -571,10 +575,14 @@ TEST(StringComparison) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.LessThan(), R.simplified.StringLessThan(), - R.javascript.LessThanOrEqual(), R.simplified.StringLessThanOrEqual(), - R.javascript.GreaterThan(), R.simplified.StringLessThan(), - R.javascript.GreaterThanOrEqual(), R.simplified.StringLessThanOrEqual()}; + R.javascript.LessThan(CompareOperationHint::kAny), + R.simplified.StringLessThan(), + R.javascript.LessThanOrEqual(CompareOperationHint::kAny), + R.simplified.StringLessThanOrEqual(), + R.javascript.GreaterThan(CompareOperationHint::kAny), + R.simplified.StringLessThan(), + R.javascript.GreaterThanOrEqual(CompareOperationHint::kAny), + R.simplified.StringLessThanOrEqual()}; for (size_t i = 0; i < arraysize(kStringTypes); i++) { Node* p0 = R.Parameter(kStringTypes[i], 0); @@ -604,9 +612,6 @@ TEST(StringComparison) { static void CheckIsConvertedToNumber(Node* val, Node* converted) { if (NodeProperties::GetType(val)->Is(Type::Number())) { CHECK_EQ(val, converted); - } else if (NodeProperties::GetType(val)->Is(Type::Boolean())) { - CHECK_EQ(IrOpcode::kBooleanToNumber, converted->opcode()); - CHECK_EQ(val, converted->InputAt(0)); } else { if (converted->opcode() == IrOpcode::kNumberConstant) return; CHECK_EQ(IrOpcode::kJSToNumber, converted->opcode()); @@ -618,10 +623,14 @@ TEST(NumberComparison) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.LessThan(), R.simplified.NumberLessThan(), - R.javascript.LessThanOrEqual(), R.simplified.NumberLessThanOrEqual(), - R.javascript.GreaterThan(), R.simplified.NumberLessThan(), - R.javascript.GreaterThanOrEqual(), R.simplified.NumberLessThanOrEqual()}; + R.javascript.LessThan(CompareOperationHint::kAny), + R.simplified.NumberLessThan(), + R.javascript.LessThanOrEqual(CompareOperationHint::kAny), + R.simplified.NumberLessThanOrEqual(), + R.javascript.GreaterThan(CompareOperationHint::kAny), + R.simplified.NumberLessThan(), + R.javascript.GreaterThanOrEqual(CompareOperationHint::kAny), + R.simplified.NumberLessThanOrEqual()}; Node* const p0 = R.Parameter(Type::Number(), 0); Node* const p1 = R.Parameter(Type::Number(), 1); @@ -655,7 +664,8 @@ TEST(MixedComparison1) { for (size_t j = 0; j < arraysize(types); j++) { Node* p1 = R.Parameter(types[j], 1); { - const Operator* less_than = R.javascript.LessThan(); + const Operator* less_than = + R.javascript.LessThan(CompareOperationHint::kAny); Node* cmp = R.Binop(less_than, p0, p1); Node* r = R.reduce(cmp); if (types[i]->Is(Type::String()) && types[j]->Is(Type::String())) { @@ -700,14 +710,12 @@ TEST(RemoveToNumberEffects) { case 2: effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); case 3: - effect_use = - R.graph.NewNode(R.javascript.Add(R.hints), ton, ton, R.context(), - frame_state, frame_state, ton, R.start()); + effect_use = R.graph.NewNode(R.javascript.Add(R.binop_hints), ton, ton, + R.context(), frame_state, ton, R.start()); break; case 4: - effect_use = - R.graph.NewNode(R.javascript.Add(R.hints), p0, p0, R.context(), - frame_state, frame_state, ton, R.start()); + effect_use = R.graph.NewNode(R.javascript.Add(R.binop_hints), p0, p0, + R.context(), frame_state, ton, R.start()); break; case 5: effect_use = R.graph.NewNode(R.common.Return(), p0, ton, R.start()); @@ -739,8 +747,10 @@ TEST(RemoveToNumberEffects) { // Helper class for testing the reduction of a single binop. class BinopEffectsTester { public: - explicit BinopEffectsTester(const Operator* op, Type* t0, Type* t1) - : R(), + BinopEffectsTester( + const Operator* op, Type* t0, Type* t1, + JSTypedLowering::Flags flags = JSTypedLowering::kDeoptimizationEnabled) + : R(0, flags), p0(R.Parameter(t0, 0)), p1(R.Parameter(t1, 1)), binop(R.Binop(op, p0, p1)), @@ -801,7 +811,8 @@ void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l, { const Operator* op = - strict ? R->javascript.StrictEqual() : R->javascript.Equal(); + strict ? R->javascript.StrictEqual(CompareOperationHint::kAny) + : R->javascript.Equal(CompareOperationHint::kAny); Node* eq = R->Binop(op, p0, p1); Node* r = R->reduce(eq); R->CheckBinop(expected, r); @@ -809,7 +820,8 @@ void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l, { const Operator* op = - strict ? R->javascript.StrictNotEqual() : R->javascript.NotEqual(); + strict ? R->javascript.StrictNotEqual(CompareOperationHint::kAny) + : R->javascript.NotEqual(CompareOperationHint::kAny); Node* ne = R->Binop(op, p0, p1); Node* n = R->reduce(ne); CHECK_EQ(IrOpcode::kBooleanNot, n->opcode()); @@ -876,14 +888,22 @@ TEST(RemovePureNumberBinopEffects) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Equal(), R.simplified.NumberEqual(), - R.javascript.Add(R.hints), R.simplified.NumberAdd(), - R.javascript.Subtract(R.hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.hints), R.simplified.NumberMultiply(), - R.javascript.Divide(R.hints), R.simplified.NumberDivide(), - R.javascript.Modulus(R.hints), R.simplified.NumberModulus(), - R.javascript.LessThan(), R.simplified.NumberLessThan(), - R.javascript.LessThanOrEqual(), R.simplified.NumberLessThanOrEqual(), + R.javascript.Equal(R.compare_hints), + R.simplified.NumberEqual(), + 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.LessThan(R.compare_hints), + R.simplified.NumberLessThan(), + R.javascript.LessThanOrEqual(R.compare_hints), + R.simplified.NumberLessThanOrEqual(), }; for (size_t j = 0; j < arraysize(ops); j += 2) { @@ -904,13 +924,13 @@ TEST(OrderNumberBinopEffects1) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Subtract(R.hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.hints), R.simplified.NumberMultiply(), - R.javascript.Divide(R.hints), R.simplified.NumberDivide(), + R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), + R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), }; for (size_t j = 0; j < arraysize(ops); j += 2) { - BinopEffectsTester B(ops[j], Type::Symbol(), Type::Symbol()); + BinopEffectsTester B(ops[j], Type::Symbol(), Type::Symbol(), + JSTypedLowering::kNoFlags); CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); @@ -929,14 +949,14 @@ TEST(OrderNumberBinopEffects2) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.Add(R.hints), R.simplified.NumberAdd(), - R.javascript.Subtract(R.hints), R.simplified.NumberSubtract(), - R.javascript.Multiply(R.hints), R.simplified.NumberMultiply(), - R.javascript.Divide(R.hints), R.simplified.NumberDivide(), + 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(), }; for (size_t j = 0; j < arraysize(ops); j += 2) { - BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol()); + BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol(), + JSTypedLowering::kNoFlags); Node* i0 = B.CheckNoOp(0); Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); @@ -949,7 +969,8 @@ TEST(OrderNumberBinopEffects2) { } for (size_t j = 0; j < arraysize(ops); j += 2) { - BinopEffectsTester B(ops[j], Type::Symbol(), Type::Number()); + BinopEffectsTester B(ops[j], Type::Symbol(), Type::Number(), + JSTypedLowering::kNoFlags); Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); Node* i1 = B.CheckNoOp(1); @@ -967,15 +988,18 @@ TEST(OrderCompareEffects) { JSTypedLoweringTester R; const Operator* ops[] = { - R.javascript.GreaterThan(), R.simplified.NumberLessThan(), - R.javascript.GreaterThanOrEqual(), R.simplified.NumberLessThanOrEqual(), + R.javascript.GreaterThan(R.compare_hints), R.simplified.NumberLessThan(), + R.javascript.GreaterThanOrEqual(R.compare_hints), + R.simplified.NumberLessThanOrEqual(), }; for (size_t j = 0; j < arraysize(ops); j += 2) { - BinopEffectsTester B(ops[j], Type::Symbol(), Type::String()); + BinopEffectsTester B(ops[j], Type::Symbol(), Type::String(), + JSTypedLowering::kNoFlags); CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); - Node* i0 = B.CheckConvertedInput(IrOpcode::kStringToNumber, 0, false); + Node* i0 = + B.CheckConvertedInput(IrOpcode::kPlainPrimitiveToNumber, 0, false); Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); // Inputs should be commuted. @@ -987,7 +1011,8 @@ TEST(OrderCompareEffects) { } for (size_t j = 0; j < arraysize(ops); j += 2) { - BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol()); + BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol(), + JSTypedLowering::kNoFlags); Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); Node* i1 = B.result->InputAt(1); @@ -1000,7 +1025,8 @@ TEST(OrderCompareEffects) { } for (size_t j = 0; j < arraysize(ops); j += 2) { - BinopEffectsTester B(ops[j], Type::Symbol(), Type::Number()); + BinopEffectsTester B(ops[j], Type::Symbol(), Type::Number(), + JSTypedLowering::kNoFlags); Node* i0 = B.result->InputAt(0); Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); @@ -1018,7 +1044,8 @@ TEST(Int32BinopEffects) { JSBitwiseTypedLoweringTester R; for (int j = 0; j < R.kNumberOps; j += 2) { bool signed_left = R.signedness[j], signed_right = R.signedness[j + 1]; - BinopEffectsTester B(R.ops[j], I32Type(signed_left), I32Type(signed_right)); + BinopEffectsTester B(R.ops[j], I32Type(signed_left), I32Type(signed_right), + JSTypedLowering::kNoFlags); CHECK_EQ(R.ops[j + 1]->opcode(), B.result->op()->opcode()); B.R.CheckBinop(B.result->opcode(), B.result); @@ -1031,7 +1058,8 @@ TEST(Int32BinopEffects) { for (int j = 0; j < R.kNumberOps; j += 2) { bool signed_left = R.signedness[j], signed_right = R.signedness[j + 1]; - BinopEffectsTester B(R.ops[j], Type::Number(), Type::Number()); + BinopEffectsTester B(R.ops[j], Type::Number(), Type::Number(), + JSTypedLowering::kNoFlags); CHECK_EQ(R.ops[j + 1]->opcode(), B.result->op()->opcode()); B.R.CheckBinop(B.result->opcode(), B.result); @@ -1044,7 +1072,8 @@ TEST(Int32BinopEffects) { for (int j = 0; j < R.kNumberOps; j += 2) { bool signed_left = R.signedness[j], signed_right = R.signedness[j + 1]; - BinopEffectsTester B(R.ops[j], Type::Number(), Type::Primitive()); + BinopEffectsTester B(R.ops[j], Type::Number(), Type::Primitive(), + JSTypedLowering::kNoFlags); B.R.CheckBinop(B.result->opcode(), B.result); @@ -1061,7 +1090,8 @@ TEST(Int32BinopEffects) { for (int j = 0; j < R.kNumberOps; j += 2) { bool signed_left = R.signedness[j], signed_right = R.signedness[j + 1]; - BinopEffectsTester B(R.ops[j], Type::Primitive(), Type::Number()); + BinopEffectsTester B(R.ops[j], Type::Primitive(), Type::Number(), + JSTypedLowering::kNoFlags); B.R.CheckBinop(B.result->opcode(), B.result); @@ -1078,7 +1108,8 @@ TEST(Int32BinopEffects) { for (int j = 0; j < R.kNumberOps; j += 2) { bool signed_left = R.signedness[j], signed_right = R.signedness[j + 1]; - BinopEffectsTester B(R.ops[j], Type::Primitive(), Type::Primitive()); + BinopEffectsTester B(R.ops[j], Type::Primitive(), Type::Primitive(), + JSTypedLowering::kNoFlags); B.R.CheckBinop(B.result->opcode(), B.result); @@ -1171,23 +1202,18 @@ TEST(Int32Comparisons) { struct Entry { const Operator* js_op; - const Operator* uint_op; - const Operator* int_op; const Operator* num_op; bool commute; }; - Entry ops[] = { - {R.javascript.LessThan(), R.machine.Uint32LessThan(), - R.machine.Int32LessThan(), R.simplified.NumberLessThan(), false}, - {R.javascript.LessThanOrEqual(), R.machine.Uint32LessThanOrEqual(), - R.machine.Int32LessThanOrEqual(), R.simplified.NumberLessThanOrEqual(), - false}, - {R.javascript.GreaterThan(), R.machine.Uint32LessThan(), - R.machine.Int32LessThan(), R.simplified.NumberLessThan(), true}, - {R.javascript.GreaterThanOrEqual(), R.machine.Uint32LessThanOrEqual(), - R.machine.Int32LessThanOrEqual(), R.simplified.NumberLessThanOrEqual(), - true}}; + Entry ops[] = {{R.javascript.LessThan(R.compare_hints), + R.simplified.NumberLessThan(), false}, + {R.javascript.LessThanOrEqual(R.compare_hints), + R.simplified.NumberLessThanOrEqual(), false}, + {R.javascript.GreaterThan(R.compare_hints), + R.simplified.NumberLessThan(), true}, + {R.javascript.GreaterThanOrEqual(R.compare_hints), + R.simplified.NumberLessThanOrEqual(), true}}; for (size_t o = 0; o < arraysize(ops); o++) { for (size_t i = 0; i < arraysize(kNumberTypes); i++) { @@ -1201,15 +1227,7 @@ TEST(Int32Comparisons) { Node* cmp = R.Binop(ops[o].js_op, p0, p1); Node* r = R.reduce(cmp); - const Operator* expected; - if (t0->Is(Type::Unsigned32()) && t1->Is(Type::Unsigned32())) { - expected = ops[o].uint_op; - } else if (t0->Is(Type::Signed32()) && t1->Is(Type::Signed32())) { - expected = ops[o].int_op; - } else { - expected = ops[o].num_op; - } - R.CheckBinop(expected, r); + R.CheckBinop(ops[o].num_op, r); if (ops[o].commute) { CHECK_EQ(p1, r->InputAt(0)); CHECK_EQ(p0, r->InputAt(1)); diff --git a/deps/v8/test/cctest/compiler/test-linkage.cc b/deps/v8/test/cctest/compiler/test-linkage.cc index 0cbdb4c6b2..6661e916db 100644 --- a/deps/v8/test/cctest/compiler/test-linkage.cc +++ b/deps/v8/test/cctest/compiler/test-linkage.cc @@ -4,9 +4,10 @@ #include "src/code-stubs.h" #include "src/compiler.h" -#include "src/parsing/parser.h" +#include "src/parsing/parse-info.h" #include "src/zone.h" +#include "src/code-factory.h" #include "src/compiler/common-operator.h" #include "src/compiler/graph.h" #include "src/compiler/linkage.h" @@ -43,7 +44,7 @@ TEST(TestLinkageCreate) { HandleAndZoneScope handles; Handle<JSFunction> function = Compile("a + b"); ParseInfo parse_info(handles.main_zone(), function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CHECK(descriptor); } @@ -59,7 +60,7 @@ TEST(TestLinkageJSFunctionIncoming) { Handle<JSFunction>::cast(v8::Utils::OpenHandle( *v8::Local<v8::Function>::Cast(CompileRun(sources[i])))); ParseInfo parse_info(handles.main_zone(), function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CHECK(descriptor); @@ -75,7 +76,7 @@ TEST(TestLinkageJSCall) { HandleAndZoneScope handles; Handle<JSFunction> function = Compile("a + c"); ParseInfo parse_info(handles.main_zone(), function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); for (int i = 0; i < 32; i++) { CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( @@ -97,13 +98,12 @@ TEST(TestLinkageRuntimeCall) { TEST(TestLinkageStubCall) { Isolate* isolate = CcTest::InitIsolateOnce(); Zone zone(isolate->allocator()); - ToNumberStub stub(isolate); - CompilationInfo info("test", isolate, &zone, Code::ComputeFlags(Code::STUB)); - CallInterfaceDescriptor interface_descriptor = - stub.GetCallInterfaceDescriptor(); + Callable callable = CodeFactory::ToNumber(isolate); + CompilationInfo info(ArrayVector("test"), isolate, &zone, + Code::ComputeFlags(Code::STUB)); CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( - isolate, &zone, interface_descriptor, stub.GetStackParameterCount(), - CallDescriptor::kNoFlags, Operator::kNoProperties); + isolate, &zone, callable.descriptor(), 0, CallDescriptor::kNoFlags, + Operator::kNoProperties); CHECK(descriptor); CHECK_EQ(0, static_cast<int>(descriptor->StackParameterCount())); CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); 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 69f5e157ad..8ee79ddb60 100644 --- a/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc @@ -3,7 +3,9 @@ // found in the LICENSE file. #include "src/ast/scopes.h" +#include "src/compiler.h" #include "src/compiler/ast-loop-assignment-analyzer.h" +#include "src/parsing/parse-info.h" #include "src/parsing/parser.h" #include "src/parsing/rewriter.h" #include "test/cctest/cctest.h" @@ -31,13 +33,13 @@ struct TestHelper : public HandleAndZoneScope { void CheckLoopAssignedCount(int expected, const char* var_name) { // TODO(titzer): don't scope analyze every single time. ParseInfo parse_info(main_zone(), function); - CompilationInfo info(&parse_info); + CompilationInfo info(&parse_info, function); CHECK(Parser::ParseStatic(&parse_info)); CHECK(Rewriter::Rewrite(&parse_info)); - CHECK(Scope::Analyze(&parse_info)); + Scope::Analyze(&parse_info); - Scope* scope = info.literal()->scope(); + DeclarationScope* scope = info.literal()->scope(); AstValueFactory* factory = parse_info.ast_value_factory(); CHECK(scope); 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 86888e96f5..d4ea47368a 100644 --- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc +++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc @@ -26,11 +26,22 @@ const Operator* NewConstantOperator<int32_t>(CommonOperatorBuilder* common, } template <> +const Operator* NewConstantOperator<int64_t>(CommonOperatorBuilder* common, + volatile int64_t value) { + return common->Int64Constant(value); +} + +template <> const Operator* NewConstantOperator<double>(CommonOperatorBuilder* common, volatile double value) { return common->Float64Constant(value); } +template <> +const Operator* NewConstantOperator<float>(CommonOperatorBuilder* common, + volatile float value) { + return common->Float32Constant(value); +} template <typename T> T ValueOfOperator(const Operator* op); @@ -42,6 +53,18 @@ int32_t ValueOfOperator<int32_t>(const Operator* op) { } template <> +int64_t ValueOfOperator<int64_t>(const Operator* op) { + CHECK_EQ(IrOpcode::kInt64Constant, op->opcode()); + return OpParameter<int64_t>(op); +} + +template <> +float ValueOfOperator<float>(const Operator* op) { + CHECK_EQ(IrOpcode::kFloat32Constant, op->opcode()); + return OpParameter<float>(op); +} + +template <> double ValueOfOperator<double>(const Operator* op) { CHECK_EQ(IrOpcode::kFloat64Constant, op->opcode()); return OpParameter<double>(op); @@ -50,9 +73,9 @@ double ValueOfOperator<double>(const Operator* op) { class ReducerTester : public HandleAndZoneScope { public: - explicit ReducerTester( - int num_parameters = 0, - MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags) + explicit ReducerTester(int num_parameters = 0, + MachineOperatorBuilder::Flags flags = + MachineOperatorBuilder::kAllOptionalOps) : isolate(main_isolate()), binop(NULL), unop(NULL), @@ -105,7 +128,15 @@ class ReducerTester : public HandleAndZoneScope { Reduction reduction = reducer.Reduce(n); CHECK(reduction.Changed()); CHECK_NE(n, reduction.replacement()); - CHECK_EQ(expect, ValueOf<T>(reduction.replacement()->op())); + // Deal with NaNs. + if (expect == expect) { + // We do not expect a NaN, check for equality. + CHECK_EQ(expect, ValueOf<T>(reduction.replacement()->op())); + } else { + // Check for NaN. + T result = ValueOf<T>(reduction.replacement()->op()); + CHECK_NE(result, result); + } } // Check that the reduction of this binop applied to {a} and {b} yields @@ -315,6 +346,24 @@ TEST(ReduceWord32Shl) { R.CheckBinop(x, x, zero); // x << 0 => x } +TEST(ReduceWord64Shl) { + ReducerTester R; + R.binop = R.machine.Word64Shl(); + + FOR_INT64_INPUTS(i) { + for (int64_t y = 0; y < 64; y++) { + int64_t x = *i; + R.CheckFoldBinop<int64_t>(x << y, x, y); + } + } + + R.CheckDontPutConstantOnRight(44); + + Node* x = R.Parameter(); + Node* zero = R.Constant<int64_t>(0); + + R.CheckBinop(x, x, zero); // x << 0 => x +} TEST(ReduceWord32Shr) { ReducerTester R; @@ -336,6 +385,24 @@ TEST(ReduceWord32Shr) { R.CheckBinop(x, x, zero); // x >>> 0 => x } +TEST(ReduceWord64Shr) { + ReducerTester R; + R.binop = R.machine.Word64Shr(); + + FOR_UINT64_INPUTS(i) { + for (uint64_t y = 0; y < 64; y++) { + uint64_t x = *i; + R.CheckFoldBinop<int64_t>(x >> y, x, y); + } + } + + R.CheckDontPutConstantOnRight(44); + + Node* x = R.Parameter(); + Node* zero = R.Constant<int64_t>(0); + + R.CheckBinop(x, x, zero); // x >>> 0 => x +} TEST(ReduceWord32Sar) { ReducerTester R; @@ -357,6 +424,24 @@ TEST(ReduceWord32Sar) { R.CheckBinop(x, x, zero); // x >> 0 => x } +TEST(ReduceWord64Sar) { + ReducerTester R; + R.binop = R.machine.Word64Sar(); + + FOR_INT64_INPUTS(i) { + for (int64_t y = 0; y < 64; y++) { + int64_t x = *i; + R.CheckFoldBinop<int64_t>(x >> y, x, y); + } + } + + R.CheckDontPutConstantOnRight(44); + + Node* x = R.Parameter(); + Node* zero = R.Constant<int64_t>(0); + + R.CheckBinop(x, x, zero); // x >> 0 => x +} static void CheckJsShift(ReducerTester* R) { CHECK(R->machine.Word32ShiftIsSafe()); @@ -433,6 +518,24 @@ TEST(ReduceInt32Add) { R.CheckBinop(x, zero, x); // 0 + x => x } +TEST(ReduceInt64Add) { + ReducerTester R; + R.binop = R.machine.Int64Add(); + + FOR_INT64_INPUTS(pl) { + FOR_INT64_INPUTS(pr) { + int64_t x = *pl, y = *pr; + R.CheckFoldBinop<int64_t>(x + y, x, y); + } + } + + R.CheckPutConstantOnRight(41); + + Node* x = R.Parameter(); + Node* zero = R.Constant<int64_t>(0); + R.CheckBinop(x, x, zero); // x + 0 => x + R.CheckBinop(x, zero, x); // 0 + x => x +} TEST(ReduceInt32Sub) { ReducerTester R; @@ -453,6 +556,30 @@ TEST(ReduceInt32Sub) { R.CheckBinop(x, x, zero); // x - 0 => x } +TEST(ReduceInt64Sub) { + ReducerTester R; + R.binop = R.machine.Int64Sub(); + + FOR_INT64_INPUTS(pl) { + FOR_INT64_INPUTS(pr) { + int64_t x = *pl, y = *pr; + R.CheckFoldBinop<int64_t>(x - y, x, y); + } + } + + R.CheckDontPutConstantOnRight(42); + + Node* x = R.Parameter(); + Node* zero = R.Constant<int64_t>(0); + + R.CheckBinop(x, x, zero); // x - 0 => x + R.CheckFoldBinop<int64_t>(0, x, x); // x - x => 0 + + Node* k = R.Constant<int64_t>(6); + + R.CheckFoldBinop<int64_t>(x, R.machine.Int64Add(), -6, x, + k); // x - K => x + -K +} TEST(ReduceInt32Mul) { ReducerTester R; @@ -616,13 +743,8 @@ TEST(ReduceInt32LessThan) { R.CheckDontPutConstantOnRight(-440197); Node* x = R.Parameter(0); - Node* y = R.Parameter(1); - Node* zero = R.Constant<int32_t>(0); - Node* sub = R.graph.NewNode(R.machine.Int32Sub(), x, y); R.CheckFoldBinop<int32_t>(0, x, x); // x < x => 0 - R.CheckFoldBinop(x, y, sub, zero); // x - y < 0 => x < y - R.CheckFoldBinop(y, x, zero, sub); // 0 < x - y => y < x } @@ -640,13 +762,8 @@ TEST(ReduceInt32LessThanOrEqual) { FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(*i); } Node* x = R.Parameter(0); - Node* y = R.Parameter(1); - Node* zero = R.Constant<int32_t>(0); - Node* sub = R.graph.NewNode(R.machine.Int32Sub(), x, y); R.CheckFoldBinop<int32_t>(1, x, x); // x <= x => 1 - R.CheckFoldBinop(x, y, sub, zero); // x - y <= 0 => x <= y - R.CheckFoldBinop(y, x, zero, sub); // 0 <= x - y => y <= x } @@ -723,17 +840,51 @@ TEST(ReduceLoadStore) { } } +TEST(ReduceFloat32Sub) { + ReducerTester R; + R.binop = R.machine.Float32Sub(); + + FOR_FLOAT32_INPUTS(pl) { + FOR_FLOAT32_INPUTS(pr) { + float x = *pl, y = *pr; + R.CheckFoldBinop<float>(x - y, x, y); + } + } + + Node* x = R.Parameter(); + Node* zero = R.Constant<float>(0.0); + Node* nan = R.Constant<float>(std::numeric_limits<float>::quiet_NaN()); + + R.CheckBinop(x, x, zero); // x - 0 => x + R.CheckBinop(nan, nan, x); // nan - x => nan + R.CheckBinop(nan, x, nan); // x - nan => nan +} + +TEST(ReduceFloat64Sub) { + ReducerTester R; + R.binop = R.machine.Float64Sub(); + + FOR_FLOAT64_INPUTS(pl) { + FOR_FLOAT64_INPUTS(pr) { + double x = *pl, y = *pr; + R.CheckFoldBinop<double>(x - y, x, y); + } + } + + Node* x = R.Parameter(); + Node* zero = R.Constant<double>(0.0); + Node* nan = R.Constant<double>(std::numeric_limits<double>::quiet_NaN()); + + R.CheckBinop(x, x, zero); // x - 0 => x + R.CheckBinop(nan, nan, x); // nan - x => nan + R.CheckBinop(nan, x, nan); // x - nan => nan +} // TODO(titzer): test MachineOperatorReducer for Word64And // TODO(titzer): test MachineOperatorReducer for Word64Or // TODO(titzer): test MachineOperatorReducer for Word64Xor -// TODO(titzer): test MachineOperatorReducer for Word64Shl -// TODO(titzer): test MachineOperatorReducer for Word64Shr -// TODO(titzer): test MachineOperatorReducer for Word64Sar // TODO(titzer): test MachineOperatorReducer for Word64Equal // TODO(titzer): test MachineOperatorReducer for Word64Not -// TODO(titzer): test MachineOperatorReducer for Int64Add -// TODO(titzer): test MachineOperatorReducer for Int64Sub // TODO(titzer): test MachineOperatorReducer for Int64Mul // TODO(titzer): test MachineOperatorReducer for Int64UMul // TODO(titzer): test MachineOperatorReducer for Int64Div diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index 2108ab1302..2221ffbc86 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -25,25 +25,21 @@ namespace { CallDescriptor* GetCallDescriptor(Zone* zone, int return_count, int param_count) { - MachineSignature::Builder msig(zone, return_count, param_count); LocationSignature::Builder locations(zone, return_count, param_count); - const RegisterConfiguration* config = - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); + const RegisterConfiguration* config = RegisterConfiguration::Turbofan(); // Add return location(s). CHECK(return_count <= config->num_allocatable_general_registers()); for (int i = 0; i < return_count; i++) { - msig.AddReturn(MachineType::Int32()); - locations.AddReturn( - LinkageLocation::ForRegister(config->allocatable_general_codes()[i])); + locations.AddReturn(LinkageLocation::ForRegister( + config->allocatable_general_codes()[i], MachineType::AnyTagged())); } // Add register and/or stack parameter(s). CHECK(param_count <= config->num_allocatable_general_registers()); for (int i = 0; i < param_count; i++) { - msig.AddParam(MachineType::Int32()); - locations.AddParam( - LinkageLocation::ForRegister(config->allocatable_general_codes()[i])); + locations.AddParam(LinkageLocation::ForRegister( + config->allocatable_general_codes()[i], MachineType::AnyTagged())); } const RegList kCalleeSaveRegisters = 0; @@ -56,7 +52,6 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count, CallDescriptor::kCallCodeObject, // kind target_type, // target MachineType target_loc, // target location - msig.Build(), // machine_sig locations.Build(), // location_sig 0, // js_parameter_count compiler::Operator::kNoProperties, // properties @@ -85,7 +80,8 @@ TEST(ReturnThreeValues) { Node* mul = m.Int32Mul(p0, p1); m.Return(add, sub, mul); - CompilationInfo info("testing", handles.main_isolate(), handles.main_zone()); + CompilationInfo info(ArrayVector("testing"), handles.main_isolate(), + handles.main_zone()); Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, desc, m.graph(), m.Export()); #ifdef ENABLE_DISASSEMBLER diff --git a/deps/v8/test/cctest/compiler/test-node.cc b/deps/v8/test/cctest/compiler/test-node.cc index d317c3877c..e2aacf3100 100644 --- a/deps/v8/test/cctest/compiler/test-node.cc +++ b/deps/v8/test/cctest/compiler/test-node.cc @@ -320,6 +320,80 @@ TEST(Inputs) { CHECK_USES(n4, n3, n3, n5); } +TEST(InsertInputs) { + base::AccountingAllocator allocator; + Zone zone(&allocator); + Graph graph(&zone); + + Node* n0 = graph.NewNode(&dummy_operator0); + Node* n1 = graph.NewNode(&dummy_operator1, n0); + Node* n2 = graph.NewNode(&dummy_operator1, n0); + + { + Node* node = graph.NewNode(&dummy_operator1, n0); + node->InsertInputs(graph.zone(), 0, 1); + node->ReplaceInput(0, n1); + CHECK_INPUTS(node, n1, n0); + } + { + Node* node = graph.NewNode(&dummy_operator1, n0); + node->InsertInputs(graph.zone(), 0, 2); + node->ReplaceInput(0, node); + node->ReplaceInput(1, n2); + CHECK_INPUTS(node, node, n2, n0); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 0, 1); + node->ReplaceInput(0, node); + CHECK_INPUTS(node, node, n0, n1, n2); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 1, 1); + node->ReplaceInput(1, node); + CHECK_INPUTS(node, n0, node, n1, n2); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 2, 1); + node->ReplaceInput(2, node); + CHECK_INPUTS(node, n0, n1, node, n2); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 2, 1); + node->ReplaceInput(2, node); + CHECK_INPUTS(node, n0, n1, node, n2); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 0, 4); + node->ReplaceInput(0, node); + node->ReplaceInput(1, node); + node->ReplaceInput(2, node); + node->ReplaceInput(3, node); + CHECK_INPUTS(node, node, node, node, node, n0, n1, n2); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 1, 4); + node->ReplaceInput(1, node); + node->ReplaceInput(2, node); + node->ReplaceInput(3, node); + node->ReplaceInput(4, node); + CHECK_INPUTS(node, n0, node, node, node, node, n1, n2); + } + { + Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2); + node->InsertInputs(graph.zone(), 2, 4); + node->ReplaceInput(2, node); + node->ReplaceInput(3, node); + node->ReplaceInput(4, node); + node->ReplaceInput(5, node); + CHECK_INPUTS(node, n0, n1, node, node, node, node, n2); + } +} TEST(RemoveInput) { base::AccountingAllocator allocator; diff --git a/deps/v8/test/cctest/compiler/test-operator.cc b/deps/v8/test/cctest/compiler/test-operator.cc index eecf46a054..90814ba99d 100644 --- a/deps/v8/test/cctest/compiler/test-operator.cc +++ b/deps/v8/test/cctest/compiler/test-operator.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 <memory> #include <sstream> #include "src/compiler/operator.h" @@ -67,11 +68,10 @@ TEST(TestOperator_Equals) { CHECK(!op2b.Equals(&op1b)); } - -static v8::base::SmartArrayPointer<const char> OperatorToString(Operator* op) { +static std::unique_ptr<char[]> OperatorToString(Operator* op) { std::ostringstream os; os << *op; - return v8::base::SmartArrayPointer<const char>(StrDup(os.str().c_str())); + return std::unique_ptr<char[]>(StrDup(os.str().c_str())); } diff --git a/deps/v8/test/cctest/compiler/test-osr.cc b/deps/v8/test/cctest/compiler/test-osr.cc index f0640c2e0a..9e3445ac0b 100644 --- a/deps/v8/test/cctest/compiler/test-osr.cc +++ b/deps/v8/test/cctest/compiler/test-osr.cc @@ -120,10 +120,10 @@ class OsrDeconstructorTester : public HandleAndZoneScope { CHECK(!nodes.IsLive(osr_normal_entry)); CHECK(!nodes.IsLive(osr_loop_entry)); // No dangling nodes should be left over. - for (Node* const node : nodes.live) { + for (Node* const node : nodes.reachable) { for (Node* const use : node->uses()) { - CHECK(std::find(nodes.live.begin(), nodes.live.end(), use) != - nodes.live.end()); + CHECK(std::find(nodes.reachable.begin(), nodes.reachable.end(), use) != + nodes.reachable.end()); } } } diff --git a/deps/v8/test/cctest/compiler/test-pipeline.cc b/deps/v8/test/cctest/compiler/test-pipeline.cc deleted file mode 100644 index 35e342765b..0000000000 --- a/deps/v8/test/cctest/compiler/test-pipeline.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/compiler.h" -#include "src/compiler/pipeline.h" -#include "src/handles.h" -#include "src/parsing/parser.h" -#include "test/cctest/cctest.h" - -namespace v8 { -namespace internal { -namespace compiler { - -static void RunPipeline(Zone* zone, const char* source) { - Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle( - *v8::Local<v8::Function>::Cast(CompileRun(source)))); - ParseInfo parse_info(zone, function); - CHECK(Compiler::ParseAndAnalyze(&parse_info)); - CompilationInfo info(&parse_info); - info.SetOptimizing(); - - Pipeline pipeline(&info); - Handle<Code> code = pipeline.GenerateCode(); - CHECK(!code.is_null()); -} - - -TEST(PipelineTyped) { - HandleAndZoneScope handles; - FLAG_turbo_types = true; - RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); -} - - -TEST(PipelineGeneric) { - HandleAndZoneScope handles; - FLAG_turbo_types = false; - RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); -} - -} // namespace compiler -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc index 7e75bf8eb0..b475e9a5b9 100644 --- a/deps/v8/test/cctest/compiler/test-representation-change.cc +++ b/deps/v8/test/cctest/compiler/test-representation-change.cc @@ -83,12 +83,20 @@ class RepresentationChangerTester : public HandleAndZoneScope, return n; } + Node* Return(Node* input) { + Node* n = graph()->NewNode(common()->Return(), input, graph()->start(), + graph()->start()); + return n; + } + void CheckTypeError(MachineRepresentation from, Type* from_type, MachineRepresentation to) { changer()->testing_type_errors_ = true; changer()->type_error_ = false; Node* n = Parameter(0); - Node* c = changer()->GetRepresentationFor(n, from, from_type, to); + Node* use = Return(n); + Node* c = changer()->GetRepresentationFor(n, from, from_type, use, + UseInfo(to, Truncation::None())); CHECK(changer()->type_error_); CHECK_EQ(n, c); } @@ -96,7 +104,9 @@ class RepresentationChangerTester : public HandleAndZoneScope, void CheckNop(MachineRepresentation from, Type* from_type, MachineRepresentation to) { Node* n = Parameter(0); - Node* c = changer()->GetRepresentationFor(n, from, from_type, to); + Node* use = Return(n); + Node* c = changer()->GetRepresentationFor(n, from, from_type, use, + UseInfo(to, Truncation::None())); CHECK_EQ(n, c); } }; @@ -113,15 +123,17 @@ TEST(BoolToBit_constant) { RepresentationChangerTester r; Node* true_node = r.jsgraph()->TrueConstant(); + Node* true_use = r.Return(true_node); Node* true_bit = r.changer()->GetRepresentationFor( - true_node, MachineRepresentation::kTagged, Type::None(), - MachineRepresentation::kBit); + true_node, MachineRepresentation::kTagged, Type::None(), true_use, + UseInfo(MachineRepresentation::kBit, Truncation::None())); r.CheckInt32Constant(true_bit, 1); Node* false_node = r.jsgraph()->FalseConstant(); + Node* false_use = r.Return(false_node); Node* false_bit = r.changer()->GetRepresentationFor( - false_node, MachineRepresentation::kTagged, Type::None(), - MachineRepresentation::kBit); + false_node, MachineRepresentation::kTagged, Type::None(), false_use, + UseInfo(MachineRepresentation::kBit, Truncation::None())); r.CheckInt32Constant(false_bit, 0); } @@ -131,9 +143,10 @@ TEST(BitToBool_constant) { for (int i = -5; i < 5; i++) { Node* node = r.jsgraph()->Int32Constant(i); + Node* use = r.Return(node); Node* val = r.changer()->GetRepresentationFor( - node, MachineRepresentation::kBit, Type::Boolean(), - MachineRepresentation::kTagged); + node, MachineRepresentation::kBit, Type::Boolean(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); r.CheckHeapConstant(val, i == 0 ? r.isolate()->heap()->false_value() : r.isolate()->heap()->true_value()); } @@ -146,49 +159,54 @@ TEST(ToTagged_constant) { { FOR_FLOAT64_INPUTS(i) { Node* n = r.jsgraph()->Float64Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), - MachineRepresentation::kTagged); - r.CheckNumberConstant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::None(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, *i); } } { FOR_FLOAT64_INPUTS(i) { Node* n = r.jsgraph()->Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), - MachineRepresentation::kTagged); - r.CheckNumberConstant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::None(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, *i); } } { FOR_FLOAT32_INPUTS(i) { Node* n = r.jsgraph()->Float32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::None(), - MachineRepresentation::kTagged); - r.CheckNumberConstant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat32, Type::None(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, *i); } } { FOR_INT32_INPUTS(i) { Node* n = r.jsgraph()->Int32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), - MachineRepresentation::kTagged); - r.CheckNumberConstant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, *i); } } { FOR_UINT32_INPUTS(i) { Node* n = r.jsgraph()->Int32Constant(*i); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), - MachineRepresentation::kTagged); + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); r.CheckNumberConstant(c, *i); } } @@ -201,49 +219,54 @@ TEST(ToFloat64_constant) { { FOR_FLOAT64_INPUTS(i) { Node* n = r.jsgraph()->Float64Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), - MachineRepresentation::kFloat64); - CHECK_EQ(n, c); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::None(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + CHECK_EQ(n, c); } } { FOR_FLOAT64_INPUTS(i) { Node* n = r.jsgraph()->Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::None(), - MachineRepresentation::kFloat64); - r.CheckFloat64Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kTagged, Type::None(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + r.CheckFloat64Constant(c, *i); } } { FOR_FLOAT32_INPUTS(i) { Node* n = r.jsgraph()->Float32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::None(), - MachineRepresentation::kFloat64); - r.CheckFloat64Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat32, Type::None(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + r.CheckFloat64Constant(c, *i); } } { FOR_INT32_INPUTS(i) { Node* n = r.jsgraph()->Int32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), - MachineRepresentation::kFloat64); - r.CheckFloat64Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + r.CheckFloat64Constant(c, *i); } } { FOR_UINT32_INPUTS(i) { Node* n = r.jsgraph()->Int32Constant(*i); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), - MachineRepresentation::kFloat64); + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); r.CheckFloat64Constant(c, *i); } } @@ -264,30 +287,33 @@ TEST(ToFloat32_constant) { { FOR_FLOAT32_INPUTS(i) { Node* n = r.jsgraph()->Float32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::None(), - MachineRepresentation::kFloat32); - CHECK_EQ(n, c); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat32, Type::None(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); + CHECK_EQ(n, c); } } { FOR_FLOAT32_INPUTS(i) { Node* n = r.jsgraph()->Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::None(), - MachineRepresentation::kFloat32); - r.CheckFloat32Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kTagged, Type::None(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); + r.CheckFloat32Constant(c, *i); } } { FOR_FLOAT32_INPUTS(i) { Node* n = r.jsgraph()->Float64Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), - MachineRepresentation::kFloat32); - r.CheckFloat32Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::None(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); + r.CheckFloat32Constant(c, *i); } } @@ -295,9 +321,10 @@ TEST(ToFloat32_constant) { FOR_INT32_INPUTS(i) { if (!IsFloat32Int32(*i)) continue; Node* n = r.jsgraph()->Int32Constant(*i); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), - MachineRepresentation::kFloat32); + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); r.CheckFloat32Constant(c, static_cast<float>(*i)); } } @@ -306,9 +333,10 @@ TEST(ToFloat32_constant) { FOR_UINT32_INPUTS(i) { if (!IsFloat32Uint32(*i)) continue; Node* n = r.jsgraph()->Int32Constant(*i); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), - MachineRepresentation::kFloat32); + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); r.CheckFloat32Constant(c, static_cast<float>(*i)); } } @@ -321,10 +349,11 @@ TEST(ToInt32_constant) { { FOR_INT32_INPUTS(i) { Node* n = r.jsgraph()->Int32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), - MachineRepresentation::kWord32); - r.CheckInt32Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); + r.CheckInt32Constant(c, *i); } } @@ -332,9 +361,10 @@ TEST(ToInt32_constant) { FOR_INT32_INPUTS(i) { if (!IsFloat32Int32(*i)) continue; Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i)); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::Signed32(), - MachineRepresentation::kWord32); + n, MachineRepresentation::kFloat32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); r.CheckInt32Constant(c, *i); } } @@ -342,19 +372,21 @@ TEST(ToInt32_constant) { { FOR_INT32_INPUTS(i) { Node* n = r.jsgraph()->Float64Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::Signed32(), - MachineRepresentation::kWord32); - r.CheckInt32Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::Signed32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); + r.CheckInt32Constant(c, *i); } } { FOR_INT32_INPUTS(i) { Node* n = r.jsgraph()->Constant(*i); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::Signed32(), - MachineRepresentation::kWord32); + n, MachineRepresentation::kTagged, Type::Signed32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); r.CheckInt32Constant(c, *i); } } @@ -367,10 +399,11 @@ TEST(ToUint32_constant) { { FOR_UINT32_INPUTS(i) { Node* n = r.jsgraph()->Int32Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), - MachineRepresentation::kWord32); - r.CheckUint32Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); + r.CheckUint32Constant(c, *i); } } @@ -378,9 +411,10 @@ TEST(ToUint32_constant) { FOR_UINT32_INPUTS(i) { if (!IsFloat32Uint32(*i)) continue; Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i)); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::Unsigned32(), - MachineRepresentation::kWord32); + n, MachineRepresentation::kFloat32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); r.CheckUint32Constant(c, *i); } } @@ -388,31 +422,34 @@ TEST(ToUint32_constant) { { FOR_UINT32_INPUTS(i) { Node* n = r.jsgraph()->Float64Constant(*i); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::Unsigned32(), - MachineRepresentation::kWord32); - r.CheckUint32Constant(c, *i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); + r.CheckUint32Constant(c, *i); } } { FOR_UINT32_INPUTS(i) { Node* n = r.jsgraph()->Constant(static_cast<double>(*i)); + Node* use = r.Return(n); Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::Unsigned32(), - MachineRepresentation::kWord32); + n, MachineRepresentation::kTagged, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); r.CheckUint32Constant(c, *i); } } } - static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, Type* from_type, MachineRepresentation to) { RepresentationChangerTester r; Node* n = r.Parameter(); - Node* c = r.changer()->GetRepresentationFor(n, from, from_type, to); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor(n, from, from_type, use, + UseInfo(to, Truncation::None())); CHECK_NE(c, n); CHECK_EQ(expected, c->opcode()); @@ -427,7 +464,9 @@ static void CheckTwoChanges(IrOpcode::Value expected2, RepresentationChangerTester r; Node* n = r.Parameter(); - Node* c1 = r.changer()->GetRepresentationFor(n, from, from_type, to); + Node* use = r.Return(n); + Node* c1 = r.changer()->GetRepresentationFor(n, from, from_type, use, + UseInfo(to, Truncation::None())); CHECK_NE(c1, n); CHECK_EQ(expected1, c1->opcode()); @@ -437,26 +476,64 @@ static void CheckTwoChanges(IrOpcode::Value expected2, CHECK_EQ(n, c2->InputAt(0)); } +static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, + Type* from_type, MachineRepresentation to, + UseInfo use_info) { + RepresentationChangerTester r; + + Node* n = r.Parameter(); + Node* use = r.Return(n); + Node* c = + r.changer()->GetRepresentationFor(n, from, from_type, use, use_info); + + CHECK_NE(c, n); + CHECK_EQ(expected, c->opcode()); + CHECK_EQ(n, c->InputAt(0)); +} TEST(SingleChanges) { - CheckChange(IrOpcode::kChangeBoolToBit, MachineRepresentation::kTagged, + CheckChange(IrOpcode::kChangeTaggedToBit, MachineRepresentation::kTagged, Type::None(), MachineRepresentation::kBit); - CheckChange(IrOpcode::kChangeBitToBool, MachineRepresentation::kBit, + CheckChange(IrOpcode::kChangeBitToTagged, MachineRepresentation::kBit, Type::None(), MachineRepresentation::kTagged); + CheckChange(IrOpcode::kChangeInt31ToTaggedSigned, + MachineRepresentation::kWord32, Type::Signed31(), + MachineRepresentation::kTagged); CheckChange(IrOpcode::kChangeInt32ToTagged, MachineRepresentation::kWord32, Type::Signed32(), MachineRepresentation::kTagged); CheckChange(IrOpcode::kChangeUint32ToTagged, MachineRepresentation::kWord32, Type::Unsigned32(), MachineRepresentation::kTagged); CheckChange(IrOpcode::kChangeFloat64ToTagged, MachineRepresentation::kFloat64, - Type::None(), MachineRepresentation::kTagged); + Type::Number(), MachineRepresentation::kTagged); + CheckTwoChanges(IrOpcode::kChangeFloat64ToInt32, + IrOpcode::kChangeInt31ToTaggedSigned, + MachineRepresentation::kFloat64, Type::Signed31(), + MachineRepresentation::kTagged); + CheckTwoChanges(IrOpcode::kChangeFloat64ToInt32, + IrOpcode::kChangeInt32ToTagged, + MachineRepresentation::kFloat64, Type::Signed32(), + MachineRepresentation::kTagged); + CheckTwoChanges(IrOpcode::kChangeFloat64ToUint32, + IrOpcode::kChangeUint32ToTagged, + MachineRepresentation::kFloat64, Type::Unsigned32(), + MachineRepresentation::kTagged); CheckChange(IrOpcode::kChangeTaggedToInt32, MachineRepresentation::kTagged, Type::Signed32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kChangeTaggedToUint32, MachineRepresentation::kTagged, Type::Unsigned32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, - Type::None(), MachineRepresentation::kFloat64); + Type::Number(), MachineRepresentation::kFloat64); + CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, + Type::Number(), MachineRepresentation::kFloat64); + CheckChange(IrOpcode::kTruncateTaggedToFloat64, + MachineRepresentation::kTagged, Type::NumberOrUndefined(), + MachineRepresentation::kFloat64); + CheckTwoChanges(IrOpcode::kChangeTaggedSignedToInt32, + IrOpcode::kChangeInt32ToFloat64, + MachineRepresentation::kTagged, Type::TaggedSigned(), + MachineRepresentation::kFloat64); // Int32,Uint32 <-> Float64 are actually machine conversions. CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, @@ -513,16 +590,20 @@ TEST(SignednessInWord32) { Type::None(), MachineRepresentation::kFloat64); CheckChange(IrOpcode::kChangeFloat64ToInt32, MachineRepresentation::kFloat64, Type::Signed32(), MachineRepresentation::kWord32); - CheckChange(IrOpcode::kTruncateFloat64ToInt32, + CheckChange(IrOpcode::kTruncateFloat64ToWord32, MachineRepresentation::kFloat64, Type::Number(), MachineRepresentation::kWord32); + CheckChange(IrOpcode::kCheckedTruncateTaggedToWord32, + MachineRepresentation::kTagged, Type::NumberOrOddball(), + MachineRepresentation::kWord32, + UseInfo::CheckedNumberOrOddballAsWord32()); CheckTwoChanges(IrOpcode::kChangeInt32ToFloat64, IrOpcode::kTruncateFloat64ToFloat32, MachineRepresentation::kWord32, Type::None(), MachineRepresentation::kFloat32); CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, - IrOpcode::kTruncateFloat64ToInt32, + IrOpcode::kTruncateFloat64ToWord32, MachineRepresentation::kFloat32, Type::Number(), MachineRepresentation::kWord32); } @@ -593,10 +674,6 @@ TEST(TypeErrors) { // Floats cannot be implicitly converted to/from comparison conditions. r.CheckTypeError(MachineRepresentation::kFloat64, Type::None(), MachineRepresentation::kBit); - r.CheckTypeError(MachineRepresentation::kBit, Type::None(), - MachineRepresentation::kFloat64); - r.CheckTypeError(MachineRepresentation::kBit, Type::Boolean(), - MachineRepresentation::kFloat64); // Floats cannot be implicitly converted to/from comparison conditions. r.CheckTypeError(MachineRepresentation::kFloat32, Type::None(), 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 c32f92387e..446b5e7d5f 100644 --- a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc +++ b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc @@ -4,12 +4,13 @@ #include <utility> +#include "src/compiler.h" #include "src/compiler/pipeline.h" #include "src/execution.h" #include "src/handles.h" #include "src/interpreter/bytecode-array-builder.h" #include "src/interpreter/interpreter.h" -#include "src/parsing/parser.h" +#include "src/parsing/parse-info.h" #include "test/cctest/cctest.h" namespace v8 { @@ -125,11 +126,11 @@ class BytecodeGraphTester { // having to instantiate a ParseInfo first. Fix this! ParseInfo parse_info(zone_, function); - CompilationInfo compilation_info(&parse_info); + CompilationInfo compilation_info(&parse_info, function); compilation_info.SetOptimizing(); compilation_info.MarkAsDeoptimizationEnabled(); - compiler::Pipeline pipeline(&compilation_info); - Handle<Code> code = pipeline.GenerateCode(); + compilation_info.MarkAsOptimizeFromBytecode(); + Handle<Code> code = Pipeline::GenerateCodeForTesting(&compilation_info); function->ReplaceCode(*code); return function; @@ -2332,7 +2333,19 @@ TEST(BytecodeGraphBuilderDo) { " if (x == 4) break;\n" "} while (x < 7);\n" "return y;", - {factory->NewNumberFromInt(16)}}}; + {factory->NewNumberFromInt(16)}}, + {"var x = 0, sum = 0;\n" + "do {\n" + " do {\n" + " ++sum;\n" + " ++x;\n" + " } while (sum < 1 || x < 2)\n" + " do {\n" + " ++x;\n" + " } while (x < 1)\n" + "} while (sum < 3)\n" + "return sum;", + {factory->NewNumber(3)}}}; for (size_t i = 0; i < arraysize(snippets); i++) { ScopedVector<char> script(1024); @@ -2413,6 +2426,19 @@ TEST(BytecodeGraphBuilderFor) { "}\n" "return sum;", {factory->NewNumberFromInt(385)}}, + {"var sum = 0;\n" + "for (var x = 0; x < 5; x++) {\n" + " for (var y = 0; y < 5; y++) {\n" + " ++sum;\n" + " }\n" + "}\n" + "for (var x = 0; x < 5; x++) {\n" + " for (var y = 0; y < 5; y++) {\n" + " ++sum;\n" + " }\n" + "}\n" + "return sum;", + {factory->NewNumberFromInt(50)}}, }; for (size_t i = 0; i < arraysize(snippets); i++) { 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 3b79cd8a44..0bc6ff3998 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/wasm/wasm-external-refs.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/value-helper.h" @@ -10,521 +11,240 @@ namespace v8 { namespace internal { namespace compiler { -template <typename T> -void TestExternalReferenceRoundingFunction( - BufferedRawMachineAssemblerTester<int32_t>* m, ExternalReference ref, - T (*comparison)(T)) { - T parameter; +template <typename P> +void TestExternalReference(BufferedRawMachineAssemblerTester<int32_t>* m, + ExternalReference ref, void (*comparison)(P*), + P param) { + P comparison_param = param; Node* function = m->ExternalConstant(ref); m->CallCFunction1(MachineType::Pointer(), MachineType::Pointer(), function, - m->PointerConstant(¶meter)); + m->PointerConstant(¶m)); m->Return(m->Int32Constant(4356)); - FOR_FLOAT64_INPUTS(i) { - parameter = *i; - m->Call(); - CHECK_DOUBLE_EQ(comparison(*i), parameter); - } + + m->Call(); + comparison(&comparison_param); + + CHECK_EQ(comparison_param, param); +} + +template <typename P1, typename P2> +void TestExternalReference(BufferedRawMachineAssemblerTester<int32_t>* m, + ExternalReference ref, void (*comparison)(P1*, P2*), + P1 param1, P2 param2) { + P1 comparison_param1 = param1; + P2 comparison_param2 = param2; + + Node* function = m->ExternalConstant(ref); + m->CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), + MachineType::Pointer(), function, + m->PointerConstant(¶m1), m->PointerConstant(¶m2)); + m->Return(m->Int32Constant(4356)); + + m->Call(); + comparison(&comparison_param1, &comparison_param2); + + CHECK_EQ(comparison_param1, param1); + CHECK_EQ(comparison_param2, param2); +} + +template <typename R, typename P> +void TestExternalReference(BufferedRawMachineAssemblerTester<R>* m, + ExternalReference ref, R (*comparison)(P*), + P param) { + P comparison_param = param; + + Node* function = m->ExternalConstant(ref); + m->Return(m->CallCFunction1(MachineType::Pointer(), MachineType::Pointer(), + function, m->PointerConstant(¶m))); + + CHECK_EQ(comparison(&comparison_param), m->Call()); + + CHECK_EQ(comparison_param, param); +} + +template <typename R, typename P1, typename P2> +void TestExternalReference(BufferedRawMachineAssemblerTester<R>* m, + ExternalReference ref, R (*comparison)(P1*, P2*), + P1 param1, P2 param2) { + P1 comparison_param1 = param1; + P2 comparison_param2 = param2; + + Node* function = m->ExternalConstant(ref); + m->Return(m->CallCFunction2( + MachineType::Pointer(), MachineType::Pointer(), MachineType::Pointer(), + function, m->PointerConstant(¶m1), m->PointerConstant(¶m2))); + + CHECK_EQ(comparison(&comparison_param1, &comparison_param2), m->Call()); + + CHECK_EQ(comparison_param1, param1); + CHECK_EQ(comparison_param2, param2); } TEST(RunCallF32Trunc) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f32_trunc(m.isolate()); - TestExternalReferenceRoundingFunction<float>(&m, ref, truncf); + TestExternalReference(&m, ref, wasm::f32_trunc_wrapper, 1.25f); } TEST(RunCallF32Floor) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f32_floor(m.isolate()); - TestExternalReferenceRoundingFunction<float>(&m, ref, floorf); + TestExternalReference(&m, ref, wasm::f32_floor_wrapper, 1.25f); } TEST(RunCallF32Ceil) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f32_ceil(m.isolate()); - TestExternalReferenceRoundingFunction<float>(&m, ref, ceilf); + TestExternalReference(&m, ref, wasm::f32_ceil_wrapper, 1.25f); } TEST(RunCallF32RoundTiesEven) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f32_nearest_int(m.isolate()); - TestExternalReferenceRoundingFunction<float>(&m, ref, nearbyintf); + TestExternalReference(&m, ref, wasm::f32_nearest_int_wrapper, 1.25f); } TEST(RunCallF64Trunc) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f64_trunc(m.isolate()); - TestExternalReferenceRoundingFunction<double>(&m, ref, trunc); + TestExternalReference(&m, ref, wasm::f64_trunc_wrapper, 1.25); } TEST(RunCallF64Floor) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f64_floor(m.isolate()); - TestExternalReferenceRoundingFunction<double>(&m, ref, floor); + TestExternalReference(&m, ref, wasm::f64_floor_wrapper, 1.25); } TEST(RunCallF64Ceil) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f64_ceil(m.isolate()); - TestExternalReferenceRoundingFunction<double>(&m, ref, ceil); + TestExternalReference(&m, ref, wasm::f64_ceil_wrapper, 1.25); } TEST(RunCallF64RoundTiesEven) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_f64_nearest_int(m.isolate()); - TestExternalReferenceRoundingFunction<double>(&m, ref, nearbyint); + TestExternalReference(&m, ref, wasm::f64_nearest_int_wrapper, 1.25); } TEST(RunCallInt64ToFloat32) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_int64_to_float32(m.isolate()); - - int64_t input; - float output; - - Node* function = m.ExternalConstant(ref); - m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), - MachineType::Pointer(), function, m.PointerConstant(&input), - m.PointerConstant(&output)); - m.Return(m.Int32Constant(4356)); - FOR_INT64_INPUTS(i) { - input = *i; - m.Call(); - CHECK_FLOAT_EQ(static_cast<float>(*i), output); - } + TestExternalReference(&m, ref, wasm::int64_to_float32_wrapper, int64_t(-2124), + 1.25f); } TEST(RunCallUint64ToFloat32) { - struct { - uint64_t input; - uint32_t expected; - } values[] = {{0x0, 0x0}, - {0x1, 0x3f800000}, - {0xffffffff, 0x4f800000}, - {0x1b09788b, 0x4dd84bc4}, - {0x4c5fce8, 0x4c98bf9d}, - {0xcc0de5bf, 0x4f4c0de6}, - {0x2, 0x40000000}, - {0x3, 0x40400000}, - {0x4, 0x40800000}, - {0x5, 0x40a00000}, - {0x8, 0x41000000}, - {0x9, 0x41100000}, - {0xffffffffffffffff, 0x5f800000}, - {0xfffffffffffffffe, 0x5f800000}, - {0xfffffffffffffffd, 0x5f800000}, - {0x0, 0x0}, - {0x100000000, 0x4f800000}, - {0xffffffff00000000, 0x5f800000}, - {0x1b09788b00000000, 0x5dd84bc4}, - {0x4c5fce800000000, 0x5c98bf9d}, - {0xcc0de5bf00000000, 0x5f4c0de6}, - {0x200000000, 0x50000000}, - {0x300000000, 0x50400000}, - {0x400000000, 0x50800000}, - {0x500000000, 0x50a00000}, - {0x800000000, 0x51000000}, - {0x900000000, 0x51100000}, - {0x273a798e187937a3, 0x5e1ce9e6}, - {0xece3af835495a16b, 0x5f6ce3b0}, - {0xb668ecc11223344, 0x5d3668ed}, - {0x9e, 0x431e0000}, - {0x43, 0x42860000}, - {0xaf73, 0x472f7300}, - {0x116b, 0x458b5800}, - {0x658ecc, 0x4acb1d98}, - {0x2b3b4c, 0x4a2ced30}, - {0x88776655, 0x4f087766}, - {0x70000000, 0x4ee00000}, - {0x7200000, 0x4ce40000}, - {0x7fffffff, 0x4f000000}, - {0x56123761, 0x4eac246f}, - {0x7fffff00, 0x4efffffe}, - {0x761c4761eeeeeeee, 0x5eec388f}, - {0x80000000eeeeeeee, 0x5f000000}, - {0x88888888dddddddd, 0x5f088889}, - {0xa0000000dddddddd, 0x5f200000}, - {0xddddddddaaaaaaaa, 0x5f5dddde}, - {0xe0000000aaaaaaaa, 0x5f600000}, - {0xeeeeeeeeeeeeeeee, 0x5f6eeeef}, - {0xfffffffdeeeeeeee, 0x5f800000}, - {0xf0000000dddddddd, 0x5f700000}, - {0x7fffffdddddddd, 0x5b000000}, - {0x3fffffaaaaaaaa, 0x5a7fffff}, - {0x1fffffaaaaaaaa, 0x59fffffd}, - {0xfffff, 0x497ffff0}, - {0x7ffff, 0x48ffffe0}, - {0x3ffff, 0x487fffc0}, - {0x1ffff, 0x47ffff80}, - {0xffff, 0x477fff00}, - {0x7fff, 0x46fffe00}, - {0x3fff, 0x467ffc00}, - {0x1fff, 0x45fff800}, - {0xfff, 0x457ff000}, - {0x7ff, 0x44ffe000}, - {0x3ff, 0x447fc000}, - {0x1ff, 0x43ff8000}, - {0x3fffffffffff, 0x56800000}, - {0x1fffffffffff, 0x56000000}, - {0xfffffffffff, 0x55800000}, - {0x7ffffffffff, 0x55000000}, - {0x3ffffffffff, 0x54800000}, - {0x1ffffffffff, 0x54000000}, - {0x8000008000000000, 0x5f000000}, - {0x8000008000000001, 0x5f000001}, - {0x8000008000000002, 0x5f000001}, - {0x8000008000000004, 0x5f000001}, - {0x8000008000000008, 0x5f000001}, - {0x8000008000000010, 0x5f000001}, - {0x8000008000000020, 0x5f000001}, - {0x8000009000000000, 0x5f000001}, - {0x800000a000000000, 0x5f000001}, - {0x8000008000100000, 0x5f000001}, - {0x8000000000000400, 0x5f000000}, - {0x8000000000000401, 0x5f000000}}; - BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_uint64_to_float32(m.isolate()); - - uint64_t input; - float output; - - Node* function = m.ExternalConstant(ref); - m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), - MachineType::Pointer(), function, m.PointerConstant(&input), - m.PointerConstant(&output)); - m.Return(m.Int32Constant(4356)); - - for (size_t i = 0; i < arraysize(values); i++) { - input = values[i].input; - m.Call(); - CHECK_EQ(values[i].expected, bit_cast<uint32_t>(output)); - } + TestExternalReference(&m, ref, wasm::uint64_to_float32_wrapper, + uint64_t(2124), 1.25f); } TEST(RunCallInt64ToFloat64) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_int64_to_float64(m.isolate()); - - int64_t input; - double output; - - Node* function = m.ExternalConstant(ref); - m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), - MachineType::Pointer(), function, m.PointerConstant(&input), - m.PointerConstant(&output)); - m.Return(m.Int32Constant(4356)); - FOR_INT64_INPUTS(i) { - input = *i; - m.Call(); - CHECK_DOUBLE_EQ(static_cast<double>(*i), output); - } + TestExternalReference(&m, ref, wasm::int64_to_float64_wrapper, int64_t(2124), + 1.25); } TEST(RunCallUint64ToFloat64) { - struct { - uint64_t input; - uint64_t expected; - } values[] = {{0x0, 0x0}, - {0x1, 0x3ff0000000000000}, - {0xffffffff, 0x41efffffffe00000}, - {0x1b09788b, 0x41bb09788b000000}, - {0x4c5fce8, 0x419317f3a0000000}, - {0xcc0de5bf, 0x41e981bcb7e00000}, - {0x2, 0x4000000000000000}, - {0x3, 0x4008000000000000}, - {0x4, 0x4010000000000000}, - {0x5, 0x4014000000000000}, - {0x8, 0x4020000000000000}, - {0x9, 0x4022000000000000}, - {0xffffffffffffffff, 0x43f0000000000000}, - {0xfffffffffffffffe, 0x43f0000000000000}, - {0xfffffffffffffffd, 0x43f0000000000000}, - {0x100000000, 0x41f0000000000000}, - {0xffffffff00000000, 0x43efffffffe00000}, - {0x1b09788b00000000, 0x43bb09788b000000}, - {0x4c5fce800000000, 0x439317f3a0000000}, - {0xcc0de5bf00000000, 0x43e981bcb7e00000}, - {0x200000000, 0x4200000000000000}, - {0x300000000, 0x4208000000000000}, - {0x400000000, 0x4210000000000000}, - {0x500000000, 0x4214000000000000}, - {0x800000000, 0x4220000000000000}, - {0x900000000, 0x4222000000000000}, - {0x273a798e187937a3, 0x43c39d3cc70c3c9c}, - {0xece3af835495a16b, 0x43ed9c75f06a92b4}, - {0xb668ecc11223344, 0x43a6cd1d98224467}, - {0x9e, 0x4063c00000000000}, - {0x43, 0x4050c00000000000}, - {0xaf73, 0x40e5ee6000000000}, - {0x116b, 0x40b16b0000000000}, - {0x658ecc, 0x415963b300000000}, - {0x2b3b4c, 0x41459da600000000}, - {0x88776655, 0x41e10eeccaa00000}, - {0x70000000, 0x41dc000000000000}, - {0x7200000, 0x419c800000000000}, - {0x7fffffff, 0x41dfffffffc00000}, - {0x56123761, 0x41d5848dd8400000}, - {0x7fffff00, 0x41dfffffc0000000}, - {0x761c4761eeeeeeee, 0x43dd8711d87bbbbc}, - {0x80000000eeeeeeee, 0x43e00000001dddde}, - {0x88888888dddddddd, 0x43e11111111bbbbc}, - {0xa0000000dddddddd, 0x43e40000001bbbbc}, - {0xddddddddaaaaaaaa, 0x43ebbbbbbbb55555}, - {0xe0000000aaaaaaaa, 0x43ec000000155555}, - {0xeeeeeeeeeeeeeeee, 0x43edddddddddddde}, - {0xfffffffdeeeeeeee, 0x43efffffffbdddde}, - {0xf0000000dddddddd, 0x43ee0000001bbbbc}, - {0x7fffffdddddddd, 0x435ffffff7777777}, - {0x3fffffaaaaaaaa, 0x434fffffd5555555}, - {0x1fffffaaaaaaaa, 0x433fffffaaaaaaaa}, - {0xfffff, 0x412ffffe00000000}, - {0x7ffff, 0x411ffffc00000000}, - {0x3ffff, 0x410ffff800000000}, - {0x1ffff, 0x40fffff000000000}, - {0xffff, 0x40efffe000000000}, - {0x7fff, 0x40dfffc000000000}, - {0x3fff, 0x40cfff8000000000}, - {0x1fff, 0x40bfff0000000000}, - {0xfff, 0x40affe0000000000}, - {0x7ff, 0x409ffc0000000000}, - {0x3ff, 0x408ff80000000000}, - {0x1ff, 0x407ff00000000000}, - {0x3fffffffffff, 0x42cfffffffffff80}, - {0x1fffffffffff, 0x42bfffffffffff00}, - {0xfffffffffff, 0x42affffffffffe00}, - {0x7ffffffffff, 0x429ffffffffffc00}, - {0x3ffffffffff, 0x428ffffffffff800}, - {0x1ffffffffff, 0x427ffffffffff000}, - {0x8000008000000000, 0x43e0000010000000}, - {0x8000008000000001, 0x43e0000010000000}, - {0x8000000000000400, 0x43e0000000000000}, - {0x8000000000000401, 0x43e0000000000001}, - {0x8000000000000402, 0x43e0000000000001}, - {0x8000000000000404, 0x43e0000000000001}, - {0x8000000000000408, 0x43e0000000000001}, - {0x8000000000000410, 0x43e0000000000001}, - {0x8000000000000420, 0x43e0000000000001}, - {0x8000000000000440, 0x43e0000000000001}, - {0x8000000000000480, 0x43e0000000000001}, - {0x8000000000000500, 0x43e0000000000001}, - {0x8000000000000600, 0x43e0000000000001}}; - BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_uint64_to_float64(m.isolate()); - - uint64_t input; - double output; - - Node* function = m.ExternalConstant(ref); - m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), - MachineType::Pointer(), function, m.PointerConstant(&input), - m.PointerConstant(&output)); - m.Return(m.Int32Constant(4356)); - - for (size_t i = 0; i < arraysize(values); i++) { - input = values[i].input; - m.Call(); - CHECK_EQ(values[i].expected, bit_cast<uint64_t>(output)); - } + TestExternalReference(&m, ref, wasm::uint64_to_float64_wrapper, + uint64_t(2124), 1.25); } TEST(RunCallFloat32ToInt64) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_float32_to_int64(m.isolate()); - - float input; - int64_t output; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2( - MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(), - function, m.PointerConstant(&input), m.PointerConstant(&output))); - FOR_FLOAT32_INPUTS(i) { - input = *i; - if (*i >= static_cast<float>(std::numeric_limits<int64_t>::min()) && - *i < static_cast<float>(std::numeric_limits<int64_t>::max())) { - CHECK_EQ(1, m.Call()); - CHECK_EQ(static_cast<int64_t>(*i), output); - } else { - CHECK_EQ(0, m.Call()); - } - } + TestExternalReference(&m, ref, wasm::float32_to_int64_wrapper, 1.25f, + int64_t(2124)); } TEST(RunCallFloat32ToUint64) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_float32_to_uint64(m.isolate()); - - float input; - uint64_t output; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2( - MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(), - function, m.PointerConstant(&input), m.PointerConstant(&output))); - FOR_FLOAT32_INPUTS(i) { - input = *i; - if (*i > -1.0 && - *i < static_cast<float>(std::numeric_limits<uint64_t>::max())) { - CHECK_EQ(1, m.Call()); - CHECK_EQ(static_cast<uint64_t>(*i), output); - } else { - CHECK_EQ(0, m.Call()); - } - } + TestExternalReference(&m, ref, wasm::float32_to_uint64_wrapper, 1.25f, + uint64_t(2124)); } TEST(RunCallFloat64ToInt64) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_float64_to_int64(m.isolate()); - - double input; - int64_t output; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2( - MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(), - function, m.PointerConstant(&input), m.PointerConstant(&output))); - FOR_FLOAT64_INPUTS(i) { - input = *i; - if (*i >= static_cast<double>(std::numeric_limits<int64_t>::min()) && - *i < static_cast<double>(std::numeric_limits<int64_t>::max())) { - CHECK_EQ(1, m.Call()); - CHECK_EQ(static_cast<int64_t>(*i), output); - } else { - CHECK_EQ(0, m.Call()); - } - } + TestExternalReference(&m, ref, wasm::float64_to_int64_wrapper, 1.25, + int64_t(2124)); } TEST(RunCallFloat64ToUint64) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_float64_to_uint64(m.isolate()); - - double input; - uint64_t output; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2( - MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(), - function, m.PointerConstant(&input), m.PointerConstant(&output))); - FOR_FLOAT64_INPUTS(i) { - input = *i; - if (*i > -1.0 && - *i < static_cast<double>(std::numeric_limits<uint64_t>::max())) { - CHECK_EQ(1, m.Call()); - CHECK_EQ(static_cast<uint64_t>(*i), output); - } else { - CHECK_EQ(0, m.Call()); - } - } + TestExternalReference(&m, ref, wasm::float64_to_uint64_wrapper, 1.25, + uint64_t(2124)); } TEST(RunCallInt64Div) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_int64_div(m.isolate()); - - int64_t dst; - int64_t src; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2(MachineType::Int32(), MachineType::Pointer(), - MachineType::Pointer(), function, - m.PointerConstant(&dst), m.PointerConstant(&src))); - FOR_INT64_INPUTS(i) { - FOR_INT64_INPUTS(j) { - dst = *i; - src = *j; - if (src == 0) { - CHECK_EQ(0, m.Call()); - } else if (src == -1 && dst == std::numeric_limits<int64_t>::min()) { - CHECK_EQ(-1, m.Call()); - } else { - CHECK_EQ(1, m.Call()); - CHECK_EQ(*i / *j, dst); - } - } - } + TestExternalReference(&m, ref, wasm::int64_div_wrapper, int64_t(1774), + int64_t(21)); } TEST(RunCallInt64Mod) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_int64_mod(m.isolate()); - - int64_t dst; - int64_t src; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2(MachineType::Int32(), MachineType::Pointer(), - MachineType::Pointer(), function, - m.PointerConstant(&dst), m.PointerConstant(&src))); - FOR_INT64_INPUTS(i) { - FOR_INT64_INPUTS(j) { - dst = *i; - src = *j; - if (src == 0) { - CHECK_EQ(0, m.Call()); - } else { - CHECK_EQ(1, m.Call()); - CHECK_EQ(*i % *j, dst); - } - } - } + TestExternalReference(&m, ref, wasm::int64_mod_wrapper, int64_t(1774), + int64_t(21)); } TEST(RunCallUint64Div) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_uint64_div(m.isolate()); - - uint64_t dst; - uint64_t src; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2(MachineType::Int32(), MachineType::Pointer(), - MachineType::Pointer(), function, - m.PointerConstant(&dst), m.PointerConstant(&src))); - FOR_UINT64_INPUTS(i) { - FOR_UINT64_INPUTS(j) { - dst = *i; - src = *j; - if (src == 0) { - CHECK_EQ(0, m.Call()); - } else { - CHECK_EQ(1, m.Call()); - CHECK_EQ(*i / *j, dst); - } - } - } + TestExternalReference(&m, ref, wasm::uint64_div_wrapper, uint64_t(1774), + uint64_t(21)); } TEST(RunCallUint64Mod) { BufferedRawMachineAssemblerTester<int32_t> m; ExternalReference ref = ExternalReference::wasm_uint64_mod(m.isolate()); + TestExternalReference(&m, ref, wasm::uint64_mod_wrapper, uint64_t(1774), + uint64_t(21)); +} + +TEST(RunCallWord32Ctz) { + BufferedRawMachineAssemblerTester<uint32_t> m; + ExternalReference ref = ExternalReference::wasm_word32_ctz(m.isolate()); + TestExternalReference(&m, ref, wasm::word32_ctz_wrapper, uint32_t(1774)); +} + +TEST(RunCallWord64Ctz) { + BufferedRawMachineAssemblerTester<uint32_t> m; + ExternalReference ref = ExternalReference::wasm_word64_ctz(m.isolate()); + TestExternalReference(&m, ref, wasm::word64_ctz_wrapper, uint64_t(1774)); +} + +TEST(RunCallWord32Popcnt) { + BufferedRawMachineAssemblerTester<uint32_t> m; + ExternalReference ref = ExternalReference::wasm_word32_popcnt(m.isolate()); + TestExternalReference(&m, ref, wasm::word32_popcnt_wrapper, uint32_t(1774)); +} - uint64_t dst; - uint64_t src; - - Node* function = m.ExternalConstant(ref); - m.Return(m.CallCFunction2(MachineType::Int32(), MachineType::Pointer(), - MachineType::Pointer(), function, - m.PointerConstant(&dst), m.PointerConstant(&src))); - FOR_UINT64_INPUTS(i) { - FOR_UINT64_INPUTS(j) { - dst = *i; - src = *j; - if (src == 0) { - CHECK_EQ(0, m.Call()); - } else { - CHECK_EQ(1, m.Call()); - CHECK_EQ(*i % *j, dst); - } - } - } +TEST(RunCallWord64Popcnt) { + BufferedRawMachineAssemblerTester<uint32_t> m; + ExternalReference ref = ExternalReference::wasm_word64_popcnt(m.isolate()); + TestExternalReference(&m, ref, wasm::word64_popcnt_wrapper, uint64_t(1774)); +} + +TEST(RunCallFloat64Pow) { + BufferedRawMachineAssemblerTester<int32_t> m; + ExternalReference ref = ExternalReference::wasm_float64_pow(m.isolate()); + TestExternalReference(&m, ref, wasm::float64_pow_wrapper, 1.5, 1.5); } } // namespace compiler } // namespace internal diff --git a/deps/v8/test/cctest/compiler/test-run-inlining.cc b/deps/v8/test/cctest/compiler/test-run-inlining.cc index 234060c7f7..b715214c0d 100644 --- a/deps/v8/test/cctest/compiler/test-run-inlining.cc +++ b/deps/v8/test/cctest/compiler/test-run-inlining.cc @@ -14,7 +14,7 @@ namespace { // Helper to determine inline count via JavaScriptFrame::GetFunctions. // Note that a count of 1 indicates that no inlining has occured. void AssertInlineCount(const v8::FunctionCallbackInfo<v8::Value>& args) { - StackTraceFrameIterator it(CcTest::i_isolate()); + JavaScriptFrameIterator it(CcTest::i_isolate()); int frames_seen = 0; JavaScriptFrame* topmost = it.frame(); while (!it.done()) { @@ -47,25 +47,20 @@ void InstallAssertInlineCountHelper(v8::Isolate* isolate) { .FromJust()); } - const uint32_t kRestrictedInliningFlags = - CompilationInfo::kFunctionContextSpecializing | - CompilationInfo::kTypingEnabled; + CompilationInfo::kNativeContextSpecializing; const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | - CompilationInfo::kFunctionContextSpecializing | - CompilationInfo::kTypingEnabled; + CompilationInfo::kNativeContextSpecializing; } // namespace TEST(SimpleInlining) { FunctionTester T( - "(function(){" - " function foo(s) { AssertInlineCount(2); return s; };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); return s; };" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -75,11 +70,9 @@ TEST(SimpleInlining) { TEST(SimpleInliningDeopt) { FunctionTester T( - "(function(){" - " function foo(s) { %DeoptimizeFunction(bar); return s; };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { %DeoptimizeFunction(bar); return s; };" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -89,11 +82,9 @@ TEST(SimpleInliningDeopt) { TEST(SimpleInliningDeoptSelf) { FunctionTester T( - "(function(){" - " function foo(s) { %_DeoptimizeNow(); return s; };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { %_DeoptimizeNow(); return s; };" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -103,11 +94,9 @@ TEST(SimpleInliningDeoptSelf) { TEST(SimpleInliningContext) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); var x = 12; return s + x; };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); var x = 12; return s + x; };" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -117,14 +106,12 @@ TEST(SimpleInliningContext) { TEST(SimpleInliningContextDeopt) { FunctionTester T( - "(function () {" - " function foo(s) {" - " AssertInlineCount(2); %DeoptimizeFunction(bar); var x = 12;" - " return s + x;" - " };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) {" + " AssertInlineCount(2); %DeoptimizeFunction(bar); var x = 12;" + " return s + x;" + "};" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -152,10 +139,8 @@ TEST(CaptureContext) { TEST(DontInlineEval) { FunctionTester T( "var x = 42;" - "(function () {" - " function bar(s, t) { return eval(\"AssertInlineCount(1); x\") };" - " return bar;" - "})();", + "function bar(s, t) { return eval(\"AssertInlineCount(1); x\") };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -165,12 +150,10 @@ TEST(DontInlineEval) { TEST(InlineOmitArguments) { FunctionTester T( - "(function () {" - " var x = 42;" - " function bar(s, t, u, v) { AssertInlineCount(2); return x + s; };" - " function foo(s, t) { return bar(s); };" - " return foo;" - "})();", + "var x = 42;" + "function bar(s, t, u, v) { AssertInlineCount(2); return x + s; };" + "function foo(s, t) { return bar(s); };" + "foo;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -180,13 +163,11 @@ TEST(InlineOmitArguments) { TEST(InlineOmitArgumentsObject) { FunctionTester T( - "(function () {" - " function bar(s, t, u, v) { AssertInlineCount(2); return arguments; };" - " function foo(s, t) { var args = bar(s);" - " return args.length == 1 &&" - " args[0] == 11; };" - " return foo;" - "})();", + "function bar(s, t, u, v) { AssertInlineCount(2); return arguments; };" + "function foo(s, t) { var args = bar(s);" + " return args.length == 1 &&" + " args[0] == 11; };" + "foo;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -196,14 +177,12 @@ TEST(InlineOmitArgumentsObject) { TEST(InlineOmitArgumentsDeopt) { FunctionTester T( - "(function () {" - " function foo(s,t,u,v) { AssertInlineCount(2);" - " %DeoptimizeFunction(bar); return baz(); };" - " function bar() { return foo(11); };" - " function baz() { return foo.arguments.length == 1 &&" - " foo.arguments[0] == 11; }" - " return bar;" - "})();", + "function foo(s,t,u,v) { AssertInlineCount(2);" + " %DeoptimizeFunction(bar); return baz(); };" + "function bar() { return foo(11); };" + "function baz() { return foo.arguments.length == 1 &&" + " foo.arguments[0] == 11; }" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -213,12 +192,10 @@ TEST(InlineOmitArgumentsDeopt) { TEST(InlineSurplusArguments) { FunctionTester T( - "(function () {" - " var x = 42;" - " function foo(s) { AssertInlineCount(2); return x + s; };" - " function bar(s, t) { return foo(s, t, 13); };" - " return bar;" - "})();", + "var x = 42;" + "function foo(s) { AssertInlineCount(2); return x + s; };" + "function bar(s, t) { return foo(s, t, 13); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -228,15 +205,13 @@ TEST(InlineSurplusArguments) { TEST(InlineSurplusArgumentsObject) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); return arguments; };" - " function bar(s, t) { var args = foo(s, t, 13);" - " return args.length == 3 &&" - " args[0] == 11 &&" - " args[1] == 12 &&" - " args[2] == 13; };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); return arguments; };" + "function bar(s, t) { var args = foo(s, t, 13);" + " return args.length == 3 &&" + " args[0] == 11 &&" + " args[1] == 12 &&" + " args[2] == 13; };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -246,16 +221,14 @@ TEST(InlineSurplusArgumentsObject) { TEST(InlineSurplusArgumentsDeopt) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); %DeoptimizeFunction(bar);" - " return baz(); };" - " function bar() { return foo(13, 14, 15); };" - " function baz() { return foo.arguments.length == 3 &&" - " foo.arguments[0] == 13 &&" - " foo.arguments[1] == 14 &&" - " foo.arguments[2] == 15; }" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); %DeoptimizeFunction(bar);" + " return baz(); };" + "function bar() { return foo(13, 14, 15); };" + "function baz() { return foo.arguments.length == 3 &&" + " foo.arguments[0] == 13 &&" + " foo.arguments[1] == 14 &&" + " foo.arguments[2] == 15; }" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -265,12 +238,10 @@ TEST(InlineSurplusArgumentsDeopt) { TEST(InlineTwice) { FunctionTester T( - "(function () {" - " var x = 42;" - " function bar(s) { AssertInlineCount(2); return x + s; };" - " function foo(s, t) { return bar(s) + bar(t); };" - " return foo;" - "})();", + "var x = 42;" + "function bar(s) { AssertInlineCount(2); return x + s; };" + "function foo(s, t) { return bar(s) + bar(t); };" + "foo;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -280,12 +251,10 @@ TEST(InlineTwice) { TEST(InlineTwiceDependent) { FunctionTester T( - "(function () {" - " var x = 42;" - " function foo(s) { AssertInlineCount(2); return x + s; };" - " function bar(s,t) { return foo(foo(s)); };" - " return bar;" - "})();", + "var x = 42;" + "function foo(s) { AssertInlineCount(2); return x + s; };" + "function bar(s,t) { return foo(foo(s)); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -295,13 +264,11 @@ TEST(InlineTwiceDependent) { TEST(InlineTwiceDependentDiamond) { FunctionTester T( - "(function () {" - " var x = 41;" - " function foo(s) { AssertInlineCount(2); if (s % 2 == 0) {" - " return x - s } else { return x + s; } };" - " function bar(s,t) { return foo(foo(s)); };" - " return bar;" - "})();", + "var x = 41;" + "function foo(s) { AssertInlineCount(2); if (s % 2 == 0) {" + " return x - s } else { return x + s; } };" + "function bar(s,t) { return foo(foo(s)); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -311,13 +278,11 @@ TEST(InlineTwiceDependentDiamond) { TEST(InlineTwiceDependentDiamondDifferent) { FunctionTester T( - "(function () {" - " var x = 41;" - " function foo(s,t) { AssertInlineCount(2); if (s % 2 == 0) {" - " return x - s * t } else { return x + s * t; } };" - " function bar(s,t) { return foo(foo(s, 3), 5); };" - " return bar;" - "})();", + "var x = 41;" + "function foo(s,t) { AssertInlineCount(2); if (s % 2 == 0) {" + " return x - s * t } else { return x + s * t; } };" + "function bar(s,t) { return foo(foo(s, 3), 5); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -327,11 +292,9 @@ TEST(InlineTwiceDependentDiamondDifferent) { TEST(InlineLoopGuardedEmpty) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); if (s) while (s); return s; };" - " function bar(s,t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); if (s) while (s); return s; };" + "function bar(s,t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -341,12 +304,10 @@ TEST(InlineLoopGuardedEmpty) { TEST(InlineLoopGuardedOnce) { FunctionTester T( - "(function () {" - " function foo(s,t) { AssertInlineCount(2); if (t > 0) while (s > 0) {" - " s = s - 1; }; return s; };" - " function bar(s,t) { return foo(s,t); };" - " return bar;" - "})();", + "function foo(s,t) { AssertInlineCount(2); if (t > 0) while (s > 0) {" + " s = s - 1; }; return s; };" + "function bar(s,t) { return foo(s,t); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -356,12 +317,10 @@ TEST(InlineLoopGuardedOnce) { TEST(InlineLoopGuardedTwice) { FunctionTester T( - "(function () {" - " function foo(s,t) { AssertInlineCount(2); if (t > 0) while (s > 0) {" - " s = s - 1; }; return s; };" - " function bar(s,t) { return foo(foo(s,t),t); };" - " return bar;" - "})();", + "function foo(s,t) { AssertInlineCount(2); if (t > 0) while (s > 0) {" + " s = s - 1; }; return s; };" + "function bar(s,t) { return foo(foo(s,t),t); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -371,11 +330,9 @@ TEST(InlineLoopGuardedTwice) { TEST(InlineLoopUnguardedEmpty) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); while (s); return s; };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); while (s); return s; };" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -385,12 +342,10 @@ TEST(InlineLoopUnguardedEmpty) { TEST(InlineLoopUnguardedOnce) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); while (s) {" - " s = s - 1; }; return s; };" - " function bar(s, t) { return foo(s); };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); while (s) {" + " s = s - 1; }; return s; };" + "function bar(s, t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -400,12 +355,10 @@ TEST(InlineLoopUnguardedOnce) { TEST(InlineLoopUnguardedTwice) { FunctionTester T( - "(function () {" - " function foo(s) { AssertInlineCount(2); while (s > 0) {" - " s = s - 1; }; return s; };" - " function bar(s,t) { return foo(foo(s,t),t); };" - " return bar;" - "})();", + "function foo(s) { AssertInlineCount(2); while (s > 0) {" + " s = s - 1; }; return s; };" + "function bar(s,t) { return foo(foo(s,t),t); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -415,13 +368,11 @@ TEST(InlineLoopUnguardedTwice) { TEST(InlineStrictIntoNonStrict) { FunctionTester T( - "(function () {" - " var x = Object.create({}, { y: { value:42, writable:false } });" - " function foo(s) { 'use strict';" - " x.y = 9; };" - " function bar(s,t) { return foo(s); };" - " return bar;" - "})();", + "var x = Object.create({}, { y: { value:42, writable:false } });" + "function foo(s) { 'use strict';" + " x.y = 9; };" + "function bar(s,t) { return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -431,12 +382,10 @@ TEST(InlineStrictIntoNonStrict) { TEST(InlineNonStrictIntoStrict) { FunctionTester T( - "(function () {" - " var x = Object.create({}, { y: { value:42, writable:false } });" - " function foo(s) { x.y = 9; return x.y; };" - " function bar(s,t) { \'use strict\'; return foo(s); };" - " return bar;" - "})();", + "var x = Object.create({}, { y: { value:42, writable:false } });" + "function foo(s) { x.y = 9; return x.y; };" + "function bar(s,t) { \'use strict\'; return foo(s); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -444,66 +393,16 @@ TEST(InlineNonStrictIntoStrict) { } -TEST(InlineIntrinsicIsSmi) { - FunctionTester T( - "(function () {" - " var x = 42;" - " function bar(s,t) { return %_IsSmi(x); };" - " return bar;" - "})();", - kInlineFlags); - - InstallAssertInlineCountHelper(CcTest::isolate()); - T.CheckCall(T.true_value(), T.Val(12), T.Val(4)); -} - - -TEST(InlineIntrinsicIsArray) { - FunctionTester T( - "(function () {" - " var x = [1,2,3];" - " function bar(s,t) { return %_IsArray(x); };" - " return bar;" - "})();", - kInlineFlags); - - InstallAssertInlineCountHelper(CcTest::isolate()); - T.CheckCall(T.true_value(), T.Val(12), T.Val(4)); - - FunctionTester T2( - "(function () {" - " var x = 32;" - " function bar(s,t) { return %_IsArray(x); };" - " return bar;" - "})();", - kInlineFlags); - - T2.CheckCall(T.false_value(), T.Val(12), T.Val(4)); - - FunctionTester T3( - "(function () {" - " var x = bar;" - " function bar(s,t) { return %_IsArray(x); };" - " return bar;" - "})();", - kInlineFlags); - - T3.CheckCall(T.false_value(), T.Val(12), T.Val(4)); -} - - TEST(InlineWithArguments) { FunctionTester T( - "(function () {" - " function foo(s,t,u) { AssertInlineCount(2);" - " return foo.arguments.length == 3 &&" - " foo.arguments[0] == 13 &&" - " foo.arguments[1] == 14 &&" - " foo.arguments[2] == 15;" - " }" - " function bar() { return foo(13, 14, 15); };" - " return bar;" - "})();", + "function foo(s,t,u) { AssertInlineCount(2);" + " return foo.arguments.length == 3 &&" + " foo.arguments[0] == 13 &&" + " foo.arguments[1] == 14 &&" + " foo.arguments[2] == 15;" + "}" + "function bar() { return foo(13, 14, 15); };" + "bar;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -513,12 +412,10 @@ TEST(InlineWithArguments) { TEST(InlineBuiltin) { FunctionTester T( - "(function () {" - " function foo(s,t,u) { AssertInlineCount(2); return true; }" - " function bar() { return foo(); };" - " %SetForceInlineFlag(foo);" - " return bar;" - "})();", + "function foo(s,t,u) { AssertInlineCount(2); return true; }" + "function bar() { return foo(); };" + "%SetForceInlineFlag(foo);" + "bar;", kRestrictedInliningFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -528,14 +425,12 @@ TEST(InlineBuiltin) { TEST(InlineNestedBuiltin) { FunctionTester T( - "(function () {" - " function foo(s,t,u) { AssertInlineCount(3); return true; }" - " function baz(s,t,u) { return foo(s,t,u); }" - " function bar() { return baz(); };" - " %SetForceInlineFlag(foo);" - " %SetForceInlineFlag(baz);" - " return bar;" - "})();", + "function foo(s,t,u) { AssertInlineCount(3); return true; }" + "function baz(s,t,u) { return foo(s,t,u); }" + "function bar() { return baz(); };" + "%SetForceInlineFlag(foo);" + "%SetForceInlineFlag(baz);" + "bar;", kRestrictedInliningFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -545,14 +440,12 @@ TEST(InlineNestedBuiltin) { TEST(InlineSelfRecursive) { FunctionTester T( - "(function () {" - " function foo(x) { " - " AssertInlineCount(1);" - " if (x == 1) return foo(12);" - " return x;" - " }" - " return foo;" - "})();", + "function foo(x) { " + " AssertInlineCount(1);" + " if (x == 1) return foo(12);" + " return x;" + "}" + "foo;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); @@ -562,14 +455,12 @@ TEST(InlineSelfRecursive) { TEST(InlineMutuallyRecursive) { FunctionTester T( - "(function () {" - " function bar(x) { AssertInlineCount(2); return foo(x); }" - " function foo(x) { " - " if (x == 1) return bar(42);" - " return x;" - " }" - " return foo;" - "})();", + "function bar(x) { AssertInlineCount(2); return foo(x); }" + "function foo(x) { " + " if (x == 1) return bar(42);" + " return x;" + "}" + "foo;", kInlineFlags); InstallAssertInlineCountHelper(CcTest::isolate()); diff --git a/deps/v8/test/cctest/compiler/test-run-intrinsics.cc b/deps/v8/test/cctest/compiler/test-run-intrinsics.cc index 6aa5f391ad..681891c91f 100644 --- a/deps/v8/test/cctest/compiler/test-run-intrinsics.cc +++ b/deps/v8/test/cctest/compiler/test-run-intrinsics.cc @@ -111,37 +111,6 @@ TEST(IsSmi) { } -TEST(OneByteSeqStringGetChar) { - FunctionTester T("(function(a,b) { return %_OneByteSeqStringGetChar(a,b); })", - flags); - - Handle<SeqOneByteString> string = - T.main_isolate()->factory()->NewRawOneByteString(3).ToHandleChecked(); - string->SeqOneByteStringSet(0, 'b'); - string->SeqOneByteStringSet(1, 'a'); - string->SeqOneByteStringSet(2, 'r'); - T.CheckCall(T.Val('b'), string, T.Val(0.0)); - T.CheckCall(T.Val('a'), string, T.Val(1)); - T.CheckCall(T.Val('r'), string, T.Val(2)); -} - - -TEST(OneByteSeqStringSetChar) { - FunctionTester T("(function(a,b) { %_OneByteSeqStringSetChar(a,88,b); })", - flags); - - Handle<SeqOneByteString> string = - T.main_isolate()->factory()->NewRawOneByteString(3).ToHandleChecked(); - string->SeqOneByteStringSet(0, 'b'); - string->SeqOneByteStringSet(1, 'a'); - string->SeqOneByteStringSet(2, 'r'); - T.Call(T.Val(1), string); - CHECK_EQ('b', string->SeqOneByteStringGet(0)); - CHECK_EQ('X', string->SeqOneByteStringGet(1)); - CHECK_EQ('r', string->SeqOneByteStringGet(2)); -} - - TEST(StringAdd) { FunctionTester T("(function(a,b) { return %_StringAdd(a,b); })", flags); @@ -151,15 +120,6 @@ TEST(StringAdd) { } -TEST(StringCharAt) { - FunctionTester T("(function(a,b) { return %_StringCharAt(a,b); })", flags); - - T.CheckCall(T.Val("e"), T.Val("huge fan!"), T.Val(3)); - T.CheckCall(T.Val("f"), T.Val("\xE2\x9D\x8A fan!"), T.Val(2)); - T.CheckCall(T.Val(""), T.Val("not a fan!"), T.Val(23)); -} - - TEST(StringCharCodeAt) { FunctionTester T("(function(a,b) { return %_StringCharCodeAt(a,b); })", flags); @@ -196,47 +156,6 @@ TEST(SubString) { T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); } - -TEST(TwoByteSeqStringGetChar) { - FunctionTester T("(function(a,b) { return %_TwoByteSeqStringGetChar(a,b); })", - flags); - - Handle<SeqTwoByteString> string = - T.main_isolate()->factory()->NewRawTwoByteString(3).ToHandleChecked(); - string->SeqTwoByteStringSet(0, 'b'); - string->SeqTwoByteStringSet(1, 'a'); - string->SeqTwoByteStringSet(2, 'r'); - T.CheckCall(T.Val('b'), string, T.Val(0.0)); - T.CheckCall(T.Val('a'), string, T.Val(1)); - T.CheckCall(T.Val('r'), string, T.Val(2)); -} - - -TEST(TwoByteSeqStringSetChar) { - FunctionTester T("(function(a,b) { %_TwoByteSeqStringSetChar(a,88,b); })", - flags); - - Handle<SeqTwoByteString> string = - T.main_isolate()->factory()->NewRawTwoByteString(3).ToHandleChecked(); - string->SeqTwoByteStringSet(0, 'b'); - string->SeqTwoByteStringSet(1, 'a'); - string->SeqTwoByteStringSet(2, 'r'); - T.Call(T.Val(1), string); - CHECK_EQ('b', string->SeqTwoByteStringGet(0)); - CHECK_EQ('X', string->SeqTwoByteStringGet(1)); - CHECK_EQ('r', string->SeqTwoByteStringGet(2)); -} - - -TEST(ValueOf) { - FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); - - T.CheckCall(T.Val("a"), T.Val("a")); - T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); - T.CheckCall(T.Val(123), T.Val(123)); - T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-jscalls.cc b/deps/v8/test/cctest/compiler/test-run-jscalls.cc index 12566c242a..f69e508f90 100644 --- a/deps/v8/test/cctest/compiler/test-run-jscalls.cc +++ b/deps/v8/test/cctest/compiler/test-run-jscalls.cc @@ -32,7 +32,7 @@ TEST(SimpleCall2) { TEST(ConstCall) { FunctionTester T("(function(foo,a) { return foo(a,3); })"); - FunctionTester U("(function(a,b) { return a + b; })"); + FunctionTester U("(function (a,b) { return a + b; })"); T.CheckCall(T.Val(6), U.function, T.Val(3)); T.CheckCall(T.Val(6.1), U.function, T.Val(3.1)); @@ -44,7 +44,7 @@ TEST(ConstCall) { TEST(ConstCall2) { FunctionTester T("(function(foo,a) { return foo(a,\"3\"); })"); - FunctionTester U("(function(a,b) { return a + b; })"); + FunctionTester U("(function (a,b) { return a + b; })"); T.CheckCall(T.Val("33"), U.function, T.Val(3)); T.CheckCall(T.Val("3.13"), U.function, T.Val(3.1)); @@ -218,6 +218,7 @@ TEST(ContextLoadedFromActivation) { i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); jsfun->set_code(T.function->code()); jsfun->set_shared(T.function->shared()); + jsfun->set_literals(T.function->literals()); CHECK(context->Global() ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) .FromJust()); @@ -242,6 +243,7 @@ TEST(BuiltinLoadedFromActivation) { i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); jsfun->set_code(T.function->code()); jsfun->set_shared(T.function->shared()); + jsfun->set_literals(T.function->literals()); CHECK(context->Global() ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) .FromJust()); diff --git a/deps/v8/test/cctest/compiler/test-run-jsops.cc b/deps/v8/test/cctest/compiler/test-run-jsops.cc index b68fc1cdde..78e12576f1 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsops.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsops.cc @@ -512,7 +512,6 @@ TEST(RegExpLiteral) { TEST(ClassLiteral) { - FLAG_harmony_sloppy = true; const char* src = "(function(a,b) {" " class C {" diff --git a/deps/v8/test/cctest/compiler/test-run-load-store.cc b/deps/v8/test/cctest/compiler/test-run-load-store.cc new file mode 100644 index 0000000000..2461129384 --- /dev/null +++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc @@ -0,0 +1,1190 @@ +// 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 <cmath> +#include <functional> +#include <limits> + +#include "src/base/bits.h" +#include "src/base/utils/random-number-generator.h" +#include "src/codegen.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" + +using namespace v8::base; + +namespace { +template <typename Type> +void CheckOobValue(Type val) { + UNREACHABLE(); +} + +template <> +void CheckOobValue(int32_t val) { + CHECK_EQ(0, val); +} + +template <> +void CheckOobValue(int64_t val) { + CHECK_EQ(0, val); +} + +template <> +void CheckOobValue(float val) { + CHECK(std::isnan(val)); +} + +template <> +void CheckOobValue(double val) { + CHECK(std::isnan(val)); +} +} // namespace + +namespace v8 { +namespace internal { +namespace compiler { + +enum TestAlignment { + kAligned, + kUnaligned, +}; + +// This is a America! +#define A_BILLION 1000000000ULL +#define A_GIG (1024ULL * 1024ULL * 1024ULL) + +namespace { +void RunLoadInt32(const TestAlignment t) { + RawMachineAssemblerTester<int32_t> m; + + int32_t p1 = 0; // loads directly from this location. + + if (t == TestAlignment::kAligned) { + m.Return(m.LoadFromPointer(&p1, MachineType::Int32())); + } else if (t == TestAlignment::kUnaligned) { + m.Return(m.UnalignedLoadFromPointer(&p1, MachineType::Int32())); + } else { + UNREACHABLE(); + } + + FOR_INT32_INPUTS(i) { + p1 = *i; + CHECK_EQ(p1, m.Call()); + } +} + +void RunLoadInt32Offset(TestAlignment t) { + int32_t p1 = 0; // loads directly from this location. + + int32_t offsets[] = {-2000000, -100, -101, 1, 3, + 7, 120, 2000, 2000000000, 0xff}; + + for (size_t i = 0; i < arraysize(offsets); i++) { + RawMachineAssemblerTester<int32_t> m; + int32_t offset = offsets[i]; + byte* pointer = reinterpret_cast<byte*>(&p1) - offset; + + // generate load [#base + #index] + if (t == TestAlignment::kAligned) { + m.Return(m.LoadFromPointer(pointer, MachineType::Int32(), offset)); + } else if (t == TestAlignment::kUnaligned) { + m.Return( + m.UnalignedLoadFromPointer(pointer, MachineType::Int32(), offset)); + } else { + UNREACHABLE(); + } + + FOR_INT32_INPUTS(j) { + p1 = *j; + CHECK_EQ(p1, m.Call()); + } + } +} + +void RunLoadStoreFloat32Offset(TestAlignment t) { + float p1 = 0.0f; // loads directly from this location. + float p2 = 0.0f; // and stores directly into this location. + + FOR_INT32_INPUTS(i) { + int32_t magic = 0x2342aabb + *i * 3; + RawMachineAssemblerTester<int32_t> m; + int32_t offset = *i; + byte* from = reinterpret_cast<byte*>(&p1) - offset; + byte* to = reinterpret_cast<byte*>(&p2) - offset; + // generate load [#base + #index] + if (t == TestAlignment::kAligned) { + Node* load = m.Load(MachineType::Float32(), m.PointerConstant(from), + m.IntPtrConstant(offset)); + m.Store(MachineRepresentation::kFloat32, m.PointerConstant(to), + m.IntPtrConstant(offset), load, kNoWriteBarrier); + } else if (t == TestAlignment::kUnaligned) { + Node* load = + m.UnalignedLoad(MachineType::Float32(), m.PointerConstant(from), + m.IntPtrConstant(offset)); + m.UnalignedStore(MachineRepresentation::kFloat32, m.PointerConstant(to), + m.IntPtrConstant(offset), load); + + } else { + UNREACHABLE(); + } + m.Return(m.Int32Constant(magic)); + + FOR_FLOAT32_INPUTS(j) { + p1 = *j; + p2 = *j - 5; + CHECK_EQ(magic, m.Call()); + CheckDoubleEq(p1, p2); + } + } +} + +void RunLoadStoreFloat64Offset(TestAlignment t) { + double p1 = 0; // loads directly from this location. + double p2 = 0; // and stores directly into this location. + + FOR_INT32_INPUTS(i) { + int32_t magic = 0x2342aabb + *i * 3; + RawMachineAssemblerTester<int32_t> m; + int32_t offset = *i; + byte* from = reinterpret_cast<byte*>(&p1) - offset; + byte* to = reinterpret_cast<byte*>(&p2) - offset; + // generate load [#base + #index] + if (t == TestAlignment::kAligned) { + Node* load = m.Load(MachineType::Float64(), m.PointerConstant(from), + m.IntPtrConstant(offset)); + m.Store(MachineRepresentation::kFloat64, m.PointerConstant(to), + m.IntPtrConstant(offset), load, kNoWriteBarrier); + } else if (t == TestAlignment::kUnaligned) { + Node* load = + m.UnalignedLoad(MachineType::Float64(), m.PointerConstant(from), + m.IntPtrConstant(offset)); + m.UnalignedStore(MachineRepresentation::kFloat64, m.PointerConstant(to), + m.IntPtrConstant(offset), load); + } else { + UNREACHABLE(); + } + m.Return(m.Int32Constant(magic)); + + FOR_FLOAT64_INPUTS(j) { + p1 = *j; + p2 = *j - 5; + CHECK_EQ(magic, m.Call()); + CheckDoubleEq(p1, p2); + } + } +} +} // namespace + +TEST(RunLoadInt32) { RunLoadInt32(TestAlignment::kAligned); } + +TEST(RunUnalignedLoadInt32) { RunLoadInt32(TestAlignment::kUnaligned); } + +TEST(RunLoadInt32Offset) { RunLoadInt32Offset(TestAlignment::kAligned); } + +TEST(RunUnalignedLoadInt32Offset) { + RunLoadInt32Offset(TestAlignment::kUnaligned); +} + +TEST(RunLoadStoreFloat32Offset) { + RunLoadStoreFloat32Offset(TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreFloat32Offset) { + RunLoadStoreFloat32Offset(TestAlignment::kUnaligned); +} + +TEST(RunLoadStoreFloat64Offset) { + RunLoadStoreFloat64Offset(TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreFloat64Offset) { + RunLoadStoreFloat64Offset(TestAlignment::kUnaligned); +} + +namespace { +template <typename Type> +void RunLoadImmIndex(MachineType rep, TestAlignment t) { + const int kNumElems = 3; + Type buffer[kNumElems]; + + // initialize the buffer with some raw data. + byte* raw = reinterpret_cast<byte*>(buffer); + for (size_t i = 0; i < sizeof(buffer); i++) { + raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); + } + + // Test with various large and small offsets. + for (int offset = -1; offset <= 200000; offset *= -5) { + for (int i = 0; i < kNumElems; i++) { + BufferedRawMachineAssemblerTester<Type> m; + Node* base = m.PointerConstant(buffer - offset); + Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); + if (t == TestAlignment::kAligned) { + m.Return(m.Load(rep, base, index)); + } else if (t == TestAlignment::kUnaligned) { + m.Return(m.UnalignedLoad(rep, base, index)); + } else { + UNREACHABLE(); + } + + volatile Type expected = buffer[i]; + volatile Type actual = m.Call(); + CHECK_EQ(expected, actual); + } + } +} + +template <typename CType> +void RunLoadStore(MachineType rep, TestAlignment t) { + const int kNumElems = 4; + CType buffer[kNumElems]; + + for (int32_t x = 0; x < kNumElems; x++) { + int32_t y = kNumElems - x - 1; + // initialize the buffer with raw data. + byte* raw = reinterpret_cast<byte*>(buffer); + for (size_t i = 0; i < sizeof(buffer); i++) { + raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); + } + + RawMachineAssemblerTester<int32_t> m; + int32_t OK = 0x29000 + x; + Node* base = m.PointerConstant(buffer); + Node* index0 = m.IntPtrConstant(x * sizeof(buffer[0])); + Node* index1 = m.IntPtrConstant(y * sizeof(buffer[0])); + if (t == TestAlignment::kAligned) { + Node* load = m.Load(rep, base, index0); + m.Store(rep.representation(), base, index1, load, kNoWriteBarrier); + } else if (t == TestAlignment::kUnaligned) { + Node* load = m.UnalignedLoad(rep, base, index0); + m.UnalignedStore(rep.representation(), base, index1, load); + } + + m.Return(m.Int32Constant(OK)); + + CHECK(buffer[x] != buffer[y]); + CHECK_EQ(OK, m.Call()); + CHECK(buffer[x] == buffer[y]); + } +} + +template <typename CType> +void RunUnalignedLoadStoreUnalignedAccess(MachineType rep) { + CType in, out; + CType in_buffer[2]; + CType out_buffer[2]; + byte* raw; + + for (int x = 0; x < sizeof(CType); x++) { + int y = sizeof(CType) - x; + + raw = reinterpret_cast<byte*>(&in); + for (size_t i = 0; i < sizeof(CType); i++) { + raw[i] = static_cast<byte>((i + sizeof(CType)) ^ 0xAA); + } + + raw = reinterpret_cast<byte*>(in_buffer); + MemCopy(raw + x, &in, sizeof(CType)); + + RawMachineAssemblerTester<int32_t> m; + int32_t OK = 0x29000 + x; + + Node* base0 = m.PointerConstant(in_buffer); + Node* base1 = m.PointerConstant(out_buffer); + Node* index0 = m.IntPtrConstant(x); + Node* index1 = m.IntPtrConstant(y); + Node* load = m.UnalignedLoad(rep, base0, index0); + m.UnalignedStore(rep.representation(), base1, index1, load); + + m.Return(m.Int32Constant(OK)); + + CHECK_EQ(OK, m.Call()); + + raw = reinterpret_cast<byte*>(&out_buffer); + MemCopy(&out, raw + y, sizeof(CType)); + CHECK(in == out); + } +} +} // namespace + +TEST(RunLoadImmIndex) { + RunLoadImmIndex<int8_t>(MachineType::Int8(), TestAlignment::kAligned); + RunLoadImmIndex<uint8_t>(MachineType::Uint8(), TestAlignment::kAligned); + RunLoadImmIndex<int16_t>(MachineType::Int16(), TestAlignment::kAligned); + RunLoadImmIndex<uint16_t>(MachineType::Uint16(), TestAlignment::kAligned); + RunLoadImmIndex<int32_t>(MachineType::Int32(), TestAlignment::kAligned); + RunLoadImmIndex<uint32_t>(MachineType::Uint32(), TestAlignment::kAligned); + RunLoadImmIndex<int32_t*>(MachineType::AnyTagged(), TestAlignment::kAligned); + RunLoadImmIndex<float>(MachineType::Float32(), TestAlignment::kAligned); + RunLoadImmIndex<double>(MachineType::Float64(), TestAlignment::kAligned); +#if V8_TARGET_ARCH_64_BIT + RunLoadImmIndex<int64_t>(MachineType::Int64(), TestAlignment::kAligned); +#endif + // TODO(titzer): test various indexing modes. +} + +TEST(RunUnalignedLoadImmIndex) { + RunLoadImmIndex<int16_t>(MachineType::Int16(), TestAlignment::kUnaligned); + RunLoadImmIndex<uint16_t>(MachineType::Uint16(), TestAlignment::kUnaligned); + RunLoadImmIndex<int32_t>(MachineType::Int32(), TestAlignment::kUnaligned); + RunLoadImmIndex<uint32_t>(MachineType::Uint32(), TestAlignment::kUnaligned); + RunLoadImmIndex<int32_t*>(MachineType::AnyTagged(), + TestAlignment::kUnaligned); + RunLoadImmIndex<float>(MachineType::Float32(), TestAlignment::kUnaligned); + RunLoadImmIndex<double>(MachineType::Float64(), TestAlignment::kUnaligned); +#if V8_TARGET_ARCH_64_BIT + RunLoadImmIndex<int64_t>(MachineType::Int64(), TestAlignment::kUnaligned); +#endif + // TODO(titzer): test various indexing modes. +} + +TEST(RunLoadStore) { + RunLoadStore<int8_t>(MachineType::Int8(), TestAlignment::kAligned); + RunLoadStore<uint8_t>(MachineType::Uint8(), TestAlignment::kAligned); + RunLoadStore<int16_t>(MachineType::Int16(), TestAlignment::kAligned); + RunLoadStore<uint16_t>(MachineType::Uint16(), TestAlignment::kAligned); + RunLoadStore<int32_t>(MachineType::Int32(), TestAlignment::kAligned); + RunLoadStore<uint32_t>(MachineType::Uint32(), TestAlignment::kAligned); + RunLoadStore<void*>(MachineType::AnyTagged(), TestAlignment::kAligned); + RunLoadStore<float>(MachineType::Float32(), TestAlignment::kAligned); + RunLoadStore<double>(MachineType::Float64(), TestAlignment::kAligned); +#if V8_TARGET_ARCH_64_BIT + RunLoadStore<int64_t>(MachineType::Int64(), TestAlignment::kAligned); +#endif +} + +TEST(RunUnalignedLoadStore) { + RunLoadStore<int16_t>(MachineType::Int16(), TestAlignment::kUnaligned); + RunLoadStore<uint16_t>(MachineType::Uint16(), TestAlignment::kUnaligned); + RunLoadStore<int32_t>(MachineType::Int32(), TestAlignment::kUnaligned); + RunLoadStore<uint32_t>(MachineType::Uint32(), TestAlignment::kUnaligned); + RunLoadStore<void*>(MachineType::AnyTagged(), TestAlignment::kUnaligned); + RunLoadStore<float>(MachineType::Float32(), TestAlignment::kUnaligned); + RunLoadStore<double>(MachineType::Float64(), TestAlignment::kUnaligned); +#if V8_TARGET_ARCH_64_BIT + RunLoadStore<int64_t>(MachineType::Int64(), TestAlignment::kUnaligned); +#endif +} + +TEST(RunUnalignedLoadStoreUnalignedAccess) { + RunUnalignedLoadStoreUnalignedAccess<int16_t>(MachineType::Int16()); + RunUnalignedLoadStoreUnalignedAccess<uint16_t>(MachineType::Uint16()); + RunUnalignedLoadStoreUnalignedAccess<int32_t>(MachineType::Int32()); + RunUnalignedLoadStoreUnalignedAccess<uint32_t>(MachineType::Uint32()); + RunUnalignedLoadStoreUnalignedAccess<void*>(MachineType::AnyTagged()); + RunUnalignedLoadStoreUnalignedAccess<float>(MachineType::Float32()); + RunUnalignedLoadStoreUnalignedAccess<double>(MachineType::Float64()); +#if V8_TARGET_ARCH_64_BIT + RunUnalignedLoadStoreUnalignedAccess<int64_t>(MachineType::Int64()); +#endif +} + +#if V8_TARGET_LITTLE_ENDIAN +#define LSB(addr, bytes) addr +#elif V8_TARGET_BIG_ENDIAN +#define LSB(addr, bytes) reinterpret_cast<byte*>(addr + 1) - bytes +#else +#error "Unknown Architecture" +#endif + +namespace { +void RunLoadStoreSignExtend32(TestAlignment t) { + int32_t buffer[4]; + RawMachineAssemblerTester<int32_t> m; + Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Int8()); + if (t == TestAlignment::kAligned) { + Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Int16()); + Node* load32 = m.LoadFromPointer(&buffer[0], MachineType::Int32()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord32, load8); + m.StoreToPointer(&buffer[2], MachineRepresentation::kWord32, load16); + m.StoreToPointer(&buffer[3], MachineRepresentation::kWord32, load32); + } else if (t == TestAlignment::kUnaligned) { + Node* load16 = + m.UnalignedLoadFromPointer(LSB(&buffer[0], 2), MachineType::Int16()); + Node* load32 = m.UnalignedLoadFromPointer(&buffer[0], MachineType::Int32()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord32, load8); + m.UnalignedStoreToPointer(&buffer[2], MachineRepresentation::kWord32, + load16); + m.UnalignedStoreToPointer(&buffer[3], MachineRepresentation::kWord32, + load32); + } else { + UNREACHABLE(); + } + m.Return(load8); + + FOR_INT32_INPUTS(i) { + buffer[0] = *i; + + CHECK_EQ(static_cast<int8_t>(*i & 0xff), m.Call()); + CHECK_EQ(static_cast<int8_t>(*i & 0xff), buffer[1]); + CHECK_EQ(static_cast<int16_t>(*i & 0xffff), buffer[2]); + CHECK_EQ(*i, buffer[3]); + } +} + +void RunLoadStoreZeroExtend32(TestAlignment t) { + uint32_t buffer[4]; + RawMachineAssemblerTester<uint32_t> m; + Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8()); + if (t == TestAlignment::kAligned) { + Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16()); + Node* load32 = m.LoadFromPointer(&buffer[0], MachineType::Uint32()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord32, load8); + m.StoreToPointer(&buffer[2], MachineRepresentation::kWord32, load16); + m.StoreToPointer(&buffer[3], MachineRepresentation::kWord32, load32); + } else if (t == TestAlignment::kUnaligned) { + Node* load16 = + m.UnalignedLoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16()); + Node* load32 = + m.UnalignedLoadFromPointer(&buffer[0], MachineType::Uint32()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord32, load8); + m.UnalignedStoreToPointer(&buffer[2], MachineRepresentation::kWord32, + load16); + m.UnalignedStoreToPointer(&buffer[3], MachineRepresentation::kWord32, + load32); + } + m.Return(load8); + + FOR_UINT32_INPUTS(i) { + buffer[0] = *i; + + CHECK_EQ((*i & 0xff), m.Call()); + CHECK_EQ((*i & 0xff), buffer[1]); + CHECK_EQ((*i & 0xffff), buffer[2]); + CHECK_EQ(*i, buffer[3]); + } +} +} // namespace + +TEST(RunLoadStoreSignExtend32) { + RunLoadStoreSignExtend32(TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreSignExtend32) { + RunLoadStoreSignExtend32(TestAlignment::kUnaligned); +} + +TEST(RunLoadStoreZeroExtend32) { + RunLoadStoreZeroExtend32(TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreZeroExtend32) { + RunLoadStoreZeroExtend32(TestAlignment::kUnaligned); +} + +#if V8_TARGET_ARCH_64_BIT + +namespace { +void RunLoadStoreSignExtend64(TestAlignment t) { + if (true) return; // TODO(titzer): sign extension of loads to 64-bit. + int64_t buffer[5]; + RawMachineAssemblerTester<int64_t> m; + Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Int8()); + if (t == TestAlignment::kAligned) { + Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Int16()); + Node* load32 = m.LoadFromPointer(LSB(&buffer[0], 4), MachineType::Int32()); + Node* load64 = m.LoadFromPointer(&buffer[0], MachineType::Int64()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord64, load8); + m.StoreToPointer(&buffer[2], MachineRepresentation::kWord64, load16); + m.StoreToPointer(&buffer[3], MachineRepresentation::kWord64, load32); + m.StoreToPointer(&buffer[4], MachineRepresentation::kWord64, load64); + } else if (t == TestAlignment::kUnaligned) { + Node* load16 = + m.UnalignedLoadFromPointer(LSB(&buffer[0], 2), MachineType::Int16()); + Node* load32 = + m.UnalignedLoadFromPointer(LSB(&buffer[0], 4), MachineType::Int32()); + Node* load64 = m.UnalignedLoadFromPointer(&buffer[0], MachineType::Int64()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord64, load8); + m.UnalignedStoreToPointer(&buffer[2], MachineRepresentation::kWord64, + load16); + m.UnalignedStoreToPointer(&buffer[3], MachineRepresentation::kWord64, + load32); + m.UnalignedStoreToPointer(&buffer[4], MachineRepresentation::kWord64, + load64); + } else { + UNREACHABLE(); + } + m.Return(load8); + + FOR_INT64_INPUTS(i) { + buffer[0] = *i; + + CHECK_EQ(static_cast<int8_t>(*i & 0xff), m.Call()); + CHECK_EQ(static_cast<int8_t>(*i & 0xff), buffer[1]); + CHECK_EQ(static_cast<int16_t>(*i & 0xffff), buffer[2]); + CHECK_EQ(static_cast<int32_t>(*i & 0xffffffff), buffer[3]); + CHECK_EQ(*i, buffer[4]); + } +} + +void RunLoadStoreZeroExtend64(TestAlignment t) { + if (kPointerSize < 8) return; + uint64_t buffer[5]; + RawMachineAssemblerTester<int64_t> m; + Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8()); + if (t == TestAlignment::kAligned) { + Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16()); + Node* load32 = m.LoadFromPointer(LSB(&buffer[0], 4), MachineType::Uint32()); + Node* load64 = m.LoadFromPointer(&buffer[0], MachineType::Uint64()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord64, load8); + m.StoreToPointer(&buffer[2], MachineRepresentation::kWord64, load16); + m.StoreToPointer(&buffer[3], MachineRepresentation::kWord64, load32); + m.StoreToPointer(&buffer[4], MachineRepresentation::kWord64, load64); + } else if (t == TestAlignment::kUnaligned) { + Node* load16 = + m.UnalignedLoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16()); + Node* load32 = + m.UnalignedLoadFromPointer(LSB(&buffer[0], 4), MachineType::Uint32()); + Node* load64 = + m.UnalignedLoadFromPointer(&buffer[0], MachineType::Uint64()); + m.StoreToPointer(&buffer[1], MachineRepresentation::kWord64, load8); + m.UnalignedStoreToPointer(&buffer[2], MachineRepresentation::kWord64, + load16); + m.UnalignedStoreToPointer(&buffer[3], MachineRepresentation::kWord64, + load32); + m.UnalignedStoreToPointer(&buffer[4], MachineRepresentation::kWord64, + load64); + } else { + UNREACHABLE(); + } + m.Return(load8); + + FOR_UINT64_INPUTS(i) { + buffer[0] = *i; + + CHECK_EQ((*i & 0xff), m.Call()); + CHECK_EQ((*i & 0xff), buffer[1]); + CHECK_EQ((*i & 0xffff), buffer[2]); + CHECK_EQ((*i & 0xffffffff), buffer[3]); + CHECK_EQ(*i, buffer[4]); + } +} + +} // namespace + +TEST(RunCheckedLoadInt64) { + int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; + RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); + Node* base = m.PointerConstant(buffer); + Node* index = m.Parameter(0); + Node* length = m.Int32Constant(16); + Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base, + index, length); + m.Return(load); + + CHECK_EQ(buffer[0], m.Call(0)); + CHECK_EQ(buffer[1], m.Call(8)); + CheckOobValue(m.Call(16)); +} + +TEST(RunLoadStoreSignExtend64) { + RunLoadStoreSignExtend64(TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreSignExtend64) { + RunLoadStoreSignExtend64(TestAlignment::kUnaligned); +} + +TEST(RunLoadStoreZeroExtend64) { + RunLoadStoreZeroExtend64(TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreZeroExtend64) { + RunLoadStoreZeroExtend64(TestAlignment::kUnaligned); +} + +TEST(RunCheckedStoreInt64) { + const int64_t write = 0x5566778899aabbLL; + const int64_t before = 0x33bbccddeeff0011LL; + int64_t buffer[] = {before, before}; + RawMachineAssemblerTester<int32_t> m(MachineType::Int32()); + Node* base = m.PointerConstant(buffer); + Node* index = m.Parameter(0); + Node* length = m.Int32Constant(16); + Node* value = m.Int64Constant(write); + Node* store = + m.AddNode(m.machine()->CheckedStore(MachineRepresentation::kWord64), base, + index, length, value); + USE(store); + m.Return(m.Int32Constant(11)); + + CHECK_EQ(11, m.Call(16)); + CHECK_EQ(before, buffer[0]); + CHECK_EQ(before, buffer[1]); + + CHECK_EQ(11, m.Call(0)); + CHECK_EQ(write, buffer[0]); + CHECK_EQ(before, buffer[1]); + + CHECK_EQ(11, m.Call(8)); + CHECK_EQ(write, buffer[0]); + CHECK_EQ(write, buffer[1]); +} +#endif + +namespace { +template <typename IntType> +void LoadStoreTruncation(MachineType kRepresentation, TestAlignment t) { + IntType input; + + RawMachineAssemblerTester<int32_t> m; + Node* ap1; + if (t == TestAlignment::kAligned) { + Node* a = m.LoadFromPointer(&input, kRepresentation); + ap1 = m.Int32Add(a, m.Int32Constant(1)); + m.StoreToPointer(&input, kRepresentation.representation(), ap1); + } else if (t == TestAlignment::kUnaligned) { + Node* a = m.UnalignedLoadFromPointer(&input, kRepresentation); + ap1 = m.Int32Add(a, m.Int32Constant(1)); + m.UnalignedStoreToPointer(&input, kRepresentation.representation(), ap1); + } else { + UNREACHABLE(); + } + m.Return(ap1); + + const IntType max = std::numeric_limits<IntType>::max(); + const IntType min = std::numeric_limits<IntType>::min(); + + // Test upper bound. + input = max; + CHECK_EQ(max + 1, m.Call()); + CHECK_EQ(min, input); + + // Test lower bound. + input = min; + CHECK_EQ(static_cast<IntType>(max + 2), m.Call()); + CHECK_EQ(min + 1, input); + + // Test all one byte values that are not one byte bounds. + for (int i = -127; i < 127; i++) { + input = i; + int expected = i >= 0 ? i + 1 : max + (i - min) + 2; + CHECK_EQ(static_cast<IntType>(expected), m.Call()); + CHECK_EQ(static_cast<IntType>(i + 1), input); + } +} +} // namespace + +TEST(RunLoadStoreTruncation) { + LoadStoreTruncation<int8_t>(MachineType::Int8(), TestAlignment::kAligned); + LoadStoreTruncation<int16_t>(MachineType::Int16(), TestAlignment::kAligned); +} + +TEST(RunUnalignedLoadStoreTruncation) { + LoadStoreTruncation<int16_t>(MachineType::Int16(), TestAlignment::kUnaligned); +} + +void TestRunOobCheckedLoad(bool length_is_immediate) { + USE(CheckOobValue<int32_t>); + USE(CheckOobValue<int64_t>); + USE(CheckOobValue<float>); + USE(CheckOobValue<double>); + + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + MachineOperatorBuilder machine(m.zone()); + const int32_t kNumElems = 27; + const int32_t kLength = kNumElems * 4; + + int32_t buffer[kNumElems]; + Node* base = m.PointerConstant(buffer); + Node* offset = m.Parameter(0); + Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); + Node* node = + m.AddNode(machine.CheckedLoad(MachineType::Int32()), base, offset, len); + m.Return(node); + + { + // randomize memory. + v8::base::RandomNumberGenerator rng; + rng.SetSeed(100); + rng.NextBytes(&buffer[0], sizeof(buffer)); + } + + // in-bounds accesses. + for (int32_t i = 0; i < kNumElems; i++) { + int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); + int32_t expected = buffer[i]; + CHECK_EQ(expected, m.Call(offset, kLength)); + } + + // slightly out-of-bounds accesses. + for (int32_t i = kLength; i < kNumElems + 30; i++) { + int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); + CheckOobValue(m.Call(offset, kLength)); + } + + // way out-of-bounds accesses. + for (int32_t offset = -2000000000; offset <= 2000000000; + offset += 100000000) { + if (offset == 0) continue; + CheckOobValue(m.Call(offset, kLength)); + } +} + +TEST(RunOobCheckedLoad) { TestRunOobCheckedLoad(false); } + +TEST(RunOobCheckedLoadImm) { TestRunOobCheckedLoad(true); } + +void TestRunOobCheckedStore(bool length_is_immediate) { + RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), + MachineType::Int32()); + MachineOperatorBuilder machine(m.zone()); + const int32_t kNumElems = 29; + const int32_t kValue = -78227234; + const int32_t kLength = kNumElems * 4; + + int32_t buffer[kNumElems + kNumElems]; + Node* base = m.PointerConstant(buffer); + Node* offset = m.Parameter(0); + Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); + Node* val = m.Int32Constant(kValue); + m.AddNode(machine.CheckedStore(MachineRepresentation::kWord32), base, offset, + len, val); + m.Return(val); + + // in-bounds accesses. + for (int32_t i = 0; i < kNumElems; i++) { + memset(buffer, 0, sizeof(buffer)); + int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); + CHECK_EQ(kValue, m.Call(offset, kLength)); + for (int32_t j = 0; j < kNumElems + kNumElems; j++) { + if (i == j) { + CHECK_EQ(kValue, buffer[j]); + } else { + CHECK_EQ(0, buffer[j]); + } + } + } + + memset(buffer, 0, sizeof(buffer)); + + // slightly out-of-bounds accesses. + for (int32_t i = kLength; i < kNumElems + 30; i++) { + int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); + CHECK_EQ(kValue, m.Call(offset, kLength)); + for (int32_t j = 0; j < kNumElems + kNumElems; j++) { + CHECK_EQ(0, buffer[j]); + } + } + + // way out-of-bounds accesses. + for (int32_t offset = -2000000000; offset <= 2000000000; + offset += 100000000) { + if (offset == 0) continue; + CHECK_EQ(kValue, m.Call(offset, kLength)); + for (int32_t j = 0; j < kNumElems + kNumElems; j++) { + CHECK_EQ(0, buffer[j]); + } + } +} + +TEST(RunOobCheckedStore) { TestRunOobCheckedStore(false); } + +TEST(RunOobCheckedStoreImm) { TestRunOobCheckedStore(true); } + +// TODO(titzer): CheckedLoad/CheckedStore don't support 64-bit offsets. +#define ALLOW_64_BIT_OFFSETS 0 + +#if V8_TARGET_ARCH_64_BIT && ALLOW_64_BIT_OFFSETS + +void TestRunOobCheckedLoad64(uint32_t pseudo_base, bool length_is_immediate) { + RawMachineAssemblerTester<int32_t> m(MachineType::Uint64(), + MachineType::Uint64()); + MachineOperatorBuilder machine(m.zone()); + const uint32_t kNumElems = 25; + const uint32_t kLength = kNumElems * 4; + int32_t real_buffer[kNumElems]; + + // Simulate the end of a large buffer. + int32_t* buffer = real_buffer - (pseudo_base / 4); + uint64_t length = kLength + pseudo_base; + + Node* base = m.PointerConstant(buffer); + Node* offset = m.Parameter(0); + Node* len = length_is_immediate ? m.Int64Constant(length) : m.Parameter(1); + Node* node = + m.AddNode(machine.CheckedLoad(MachineType::Int32()), base, offset, len); + m.Return(node); + + { + // randomize memory. + v8::base::RandomNumberGenerator rng; + rng.SetSeed(100); + rng.NextBytes(&real_buffer[0], sizeof(real_buffer)); + } + + // in-bounds accesses. + for (uint32_t i = 0; i < kNumElems; i++) { + uint64_t offset = pseudo_base + i * 4; + int32_t expected = real_buffer[i]; + CHECK_EQ(expected, m.Call(offset, length)); + } + + // in-bounds accesses w.r.t lower 32-bits, but upper bits set. + for (uint64_t i = 0x100000000ULL; i != 0; i <<= 1) { + uint64_t offset = pseudo_base + i; + CheckOobValue(m.Call(offset, length)); + } + + // slightly out-of-bounds accesses. + for (uint32_t i = kLength; i < kNumElems + 30; i++) { + uint64_t offset = pseudo_base + i * 4; + CheckOobValue(0, m.Call(offset, length)); + } + + // way out-of-bounds accesses. + for (uint64_t offset = length; offset < 100 * A_BILLION; offset += A_GIG) { + if (offset < length) continue; + CheckOobValue(0, m.Call(offset, length)); + } +} + +TEST(RunOobCheckedLoad64_0) { + TestRunOobCheckedLoad64(0, false); + TestRunOobCheckedLoad64(0, true); +} + +TEST(RunOobCheckedLoad64_1) { + TestRunOobCheckedLoad64(1 * A_BILLION, false); + TestRunOobCheckedLoad64(1 * A_BILLION, true); +} + +TEST(RunOobCheckedLoad64_2) { + TestRunOobCheckedLoad64(2 * A_BILLION, false); + TestRunOobCheckedLoad64(2 * A_BILLION, true); +} + +TEST(RunOobCheckedLoad64_3) { + TestRunOobCheckedLoad64(3 * A_BILLION, false); + TestRunOobCheckedLoad64(3 * A_BILLION, true); +} + +TEST(RunOobCheckedLoad64_4) { + TestRunOobCheckedLoad64(4 * A_BILLION, false); + TestRunOobCheckedLoad64(4 * A_BILLION, true); +} + +void TestRunOobCheckedStore64(uint32_t pseudo_base, bool length_is_immediate) { + RawMachineAssemblerTester<int32_t> m(MachineType::Uint64(), + MachineType::Uint64()); + MachineOperatorBuilder machine(m.zone()); + const uint32_t kNumElems = 21; + const uint32_t kLength = kNumElems * 4; + const uint32_t kValue = 897234987; + int32_t real_buffer[kNumElems + kNumElems]; + + // Simulate the end of a large buffer. + int32_t* buffer = real_buffer - (pseudo_base / 4); + uint64_t length = kLength + pseudo_base; + + Node* base = m.PointerConstant(buffer); + Node* offset = m.Parameter(0); + Node* len = length_is_immediate ? m.Int64Constant(length) : m.Parameter(1); + Node* val = m.Int32Constant(kValue); + m.AddNode(machine.CheckedStore(MachineRepresentation::kWord32), base, offset, + len, val); + m.Return(val); + + // in-bounds accesses. + for (uint32_t i = 0; i < kNumElems; i++) { + memset(real_buffer, 0, sizeof(real_buffer)); + uint64_t offset = pseudo_base + i * 4; + CHECK_EQ(kValue, m.Call(offset, length)); + for (uint32_t j = 0; j < kNumElems + kNumElems; j++) { + if (i == j) { + CHECK_EQ(kValue, real_buffer[j]); + } else { + CHECK_EQ(0, real_buffer[j]); + } + } + } + + memset(real_buffer, 0, sizeof(real_buffer)); + + // in-bounds accesses w.r.t lower 32-bits, but upper bits set. + for (uint64_t i = 0x100000000ULL; i != 0; i <<= 1) { + uint64_t offset = pseudo_base + i; + CHECK_EQ(kValue, m.Call(offset, length)); + for (int32_t j = 0; j < kNumElems + kNumElems; j++) { + CHECK_EQ(0, real_buffer[j]); + } + } + + // slightly out-of-bounds accesses. + for (uint32_t i = kLength; i < kNumElems + 30; i++) { + uint64_t offset = pseudo_base + i * 4; + CHECK_EQ(kValue, m.Call(offset, length)); + for (int32_t j = 0; j < kNumElems + kNumElems; j++) { + CHECK_EQ(0, real_buffer[j]); + } + } + + // way out-of-bounds accesses. + for (uint64_t offset = length; offset < 100 * A_BILLION; offset += A_GIG) { + if (offset < length) continue; + CHECK_EQ(kValue, m.Call(offset, length)); + for (int32_t j = 0; j < kNumElems + kNumElems; j++) { + CHECK_EQ(0, real_buffer[j]); + } + } +} + +TEST(RunOobCheckedStore64_0) { + TestRunOobCheckedStore64(0, false); + TestRunOobCheckedStore64(0, true); +} + +TEST(RunOobCheckedStore64_1) { + TestRunOobCheckedStore64(1 * A_BILLION, false); + TestRunOobCheckedStore64(1 * A_BILLION, true); +} + +TEST(RunOobCheckedStore64_2) { + TestRunOobCheckedStore64(2 * A_BILLION, false); + TestRunOobCheckedStore64(2 * A_BILLION, true); +} + +TEST(RunOobCheckedStore64_3) { + TestRunOobCheckedStore64(3 * A_BILLION, false); + TestRunOobCheckedStore64(3 * A_BILLION, true); +} + +TEST(RunOobCheckedStore64_4) { + TestRunOobCheckedStore64(4 * A_BILLION, false); + TestRunOobCheckedStore64(4 * A_BILLION, true); +} + +#endif + +void TestRunOobCheckedLoad_pseudo(uint64_t x, bool length_is_immediate) { + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + + uint32_t pseudo_base = static_cast<uint32_t>(x); + MachineOperatorBuilder machine(m.zone()); + const uint32_t kNumElems = 29; + const uint32_t kLength = pseudo_base + kNumElems * 4; + + int32_t buffer[kNumElems]; + Node* base = m.PointerConstant(reinterpret_cast<byte*>(buffer) - pseudo_base); + Node* offset = m.Parameter(0); + Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); + Node* node = + m.AddNode(machine.CheckedLoad(MachineType::Int32()), base, offset, len); + m.Return(node); + + { + // randomize memory. + v8::base::RandomNumberGenerator rng; + rng.SetSeed(100); + rng.NextBytes(&buffer[0], sizeof(buffer)); + } + + // in-bounds accesses. + for (uint32_t i = 0; i < kNumElems; i++) { + uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t)); + uint32_t expected = buffer[i]; + CHECK_EQ(expected, m.Call(offset + pseudo_base, kLength)); + } + + // slightly out-of-bounds accesses. + for (int32_t i = kNumElems; i < kNumElems + 30; i++) { + uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t)); + CheckOobValue(m.Call(offset + pseudo_base, kLength)); + } + + // way out-of-bounds accesses. + for (uint64_t i = pseudo_base + sizeof(buffer); i < 0xFFFFFFFF; + i += A_BILLION) { + uint32_t offset = static_cast<uint32_t>(i); + CheckOobValue(m.Call(offset, kLength)); + } +} + +TEST(RunOobCheckedLoad_pseudo0) { + TestRunOobCheckedLoad_pseudo(0, false); + TestRunOobCheckedLoad_pseudo(0, true); +} + +TEST(RunOobCheckedLoad_pseudo1) { + TestRunOobCheckedLoad_pseudo(100000, false); + TestRunOobCheckedLoad_pseudo(100000, true); +} + +TEST(RunOobCheckedLoad_pseudo2) { + TestRunOobCheckedLoad_pseudo(A_BILLION, false); + TestRunOobCheckedLoad_pseudo(A_BILLION, true); +} + +TEST(RunOobCheckedLoad_pseudo3) { + TestRunOobCheckedLoad_pseudo(A_GIG, false); + TestRunOobCheckedLoad_pseudo(A_GIG, true); +} + +TEST(RunOobCheckedLoad_pseudo4) { + TestRunOobCheckedLoad_pseudo(2 * A_BILLION, false); + TestRunOobCheckedLoad_pseudo(2 * A_BILLION, true); +} + +TEST(RunOobCheckedLoad_pseudo5) { + TestRunOobCheckedLoad_pseudo(2 * A_GIG, false); + TestRunOobCheckedLoad_pseudo(2 * A_GIG, true); +} + +TEST(RunOobCheckedLoad_pseudo6) { + TestRunOobCheckedLoad_pseudo(3 * A_BILLION, false); + TestRunOobCheckedLoad_pseudo(3 * A_BILLION, true); +} + +TEST(RunOobCheckedLoad_pseudo7) { + TestRunOobCheckedLoad_pseudo(3 * A_GIG, false); + TestRunOobCheckedLoad_pseudo(3 * A_GIG, true); +} + +TEST(RunOobCheckedLoad_pseudo8) { + TestRunOobCheckedLoad_pseudo(4 * A_BILLION, false); + TestRunOobCheckedLoad_pseudo(4 * A_BILLION, true); +} + +template <typename MemType> +void TestRunOobCheckedLoadT_pseudo(uint64_t x, bool length_is_immediate) { + const int32_t kReturn = 11999; + const uint32_t kNumElems = 29; + MemType buffer[kNumElems]; + uint32_t pseudo_base = static_cast<uint32_t>(x); + const uint32_t kLength = static_cast<uint32_t>(pseudo_base + sizeof(buffer)); + + MemType result; + + RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), + MachineType::Uint32()); + MachineOperatorBuilder machine(m.zone()); + Node* base = m.PointerConstant(reinterpret_cast<byte*>(buffer) - pseudo_base); + Node* offset = m.Parameter(0); + Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); + Node* node = m.AddNode(machine.CheckedLoad(MachineTypeForC<MemType>()), base, + offset, len); + Node* store = m.StoreToPointer( + &result, MachineTypeForC<MemType>().representation(), node); + USE(store); + m.Return(m.Int32Constant(kReturn)); + + { + // randomize memory. + v8::base::RandomNumberGenerator rng; + rng.SetSeed(103); + rng.NextBytes(&buffer[0], sizeof(buffer)); + } + + // in-bounds accesses. + for (uint32_t i = 0; i < kNumElems; i++) { + uint32_t offset = static_cast<uint32_t>(i * sizeof(MemType)); + MemType expected = buffer[i]; + CHECK_EQ(kReturn, m.Call(offset + pseudo_base, kLength)); + CHECK_EQ(expected, result); + } + + // slightly out-of-bounds accesses. + for (int32_t i = kNumElems; i < kNumElems + 30; i++) { + uint32_t offset = static_cast<uint32_t>(i * sizeof(MemType)); + CHECK_EQ(kReturn, m.Call(offset + pseudo_base, kLength)); + CheckOobValue(result); + } + + // way out-of-bounds accesses. + for (uint64_t i = pseudo_base + sizeof(buffer); i < 0xFFFFFFFF; + i += A_BILLION) { + uint32_t offset = static_cast<uint32_t>(i); + CHECK_EQ(kReturn, m.Call(offset, kLength)); + CheckOobValue(result); + } +} + +TEST(RunOobCheckedLoadT_pseudo0) { + TestRunOobCheckedLoadT_pseudo<int32_t>(0, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(0, true); + TestRunOobCheckedLoadT_pseudo<float>(0, false); + TestRunOobCheckedLoadT_pseudo<float>(0, true); + TestRunOobCheckedLoadT_pseudo<double>(0, false); + TestRunOobCheckedLoadT_pseudo<double>(0, true); +} + +TEST(RunOobCheckedLoadT_pseudo1) { + TestRunOobCheckedLoadT_pseudo<int32_t>(100000, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(100000, true); + TestRunOobCheckedLoadT_pseudo<float>(100000, false); + TestRunOobCheckedLoadT_pseudo<float>(100000, true); + TestRunOobCheckedLoadT_pseudo<double>(100000, false); + TestRunOobCheckedLoadT_pseudo<double>(100000, true); +} + +TEST(RunOobCheckedLoadT_pseudo2) { + TestRunOobCheckedLoadT_pseudo<int32_t>(A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<float>(A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<float>(A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<double>(A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<double>(A_BILLION, true); +} + +TEST(RunOobCheckedLoadT_pseudo3) { + TestRunOobCheckedLoadT_pseudo<int32_t>(A_GIG, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(A_GIG, true); + TestRunOobCheckedLoadT_pseudo<float>(A_GIG, false); + TestRunOobCheckedLoadT_pseudo<float>(A_GIG, true); + TestRunOobCheckedLoadT_pseudo<double>(A_GIG, false); + TestRunOobCheckedLoadT_pseudo<double>(A_GIG, true); +} + +TEST(RunOobCheckedLoadT_pseudo4) { + TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<float>(2 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<float>(2 * A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<double>(2 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<double>(2 * A_BILLION, true); +} + +TEST(RunOobCheckedLoadT_pseudo5) { + TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_GIG, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_GIG, true); + TestRunOobCheckedLoadT_pseudo<float>(2 * A_GIG, false); + TestRunOobCheckedLoadT_pseudo<float>(2 * A_GIG, true); + TestRunOobCheckedLoadT_pseudo<double>(2 * A_GIG, false); + TestRunOobCheckedLoadT_pseudo<double>(2 * A_GIG, true); +} + +TEST(RunOobCheckedLoadT_pseudo6) { + TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<float>(3 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<float>(3 * A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<double>(3 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<double>(3 * A_BILLION, true); +} + +TEST(RunOobCheckedLoadT_pseudo7) { + TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_GIG, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_GIG, true); + TestRunOobCheckedLoadT_pseudo<float>(3 * A_GIG, false); + TestRunOobCheckedLoadT_pseudo<float>(3 * A_GIG, true); + TestRunOobCheckedLoadT_pseudo<double>(3 * A_GIG, false); + TestRunOobCheckedLoadT_pseudo<double>(3 * A_GIG, true); +} + +TEST(RunOobCheckedLoadT_pseudo8) { + TestRunOobCheckedLoadT_pseudo<int32_t>(4 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<int32_t>(4 * A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<float>(4 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<float>(4 * A_BILLION, true); + TestRunOobCheckedLoadT_pseudo<double>(4 * A_BILLION, false); + TestRunOobCheckedLoadT_pseudo<double>(4 * A_BILLION, true); +} + +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc index 2bfe1244be..50b46d7d0e 100644 --- a/deps/v8/test/cctest/compiler/test-run-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-machops.cc @@ -7,8 +7,10 @@ #include <limits> #include "src/base/bits.h" +#include "src/base/ieee754.h" #include "src/base/utils/random-number-generator.h" #include "src/codegen.h" +#include "src/utils.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/graph-builder-tester.h" @@ -28,6 +30,39 @@ TEST(RunInt32Add) { CHECK_EQ(1, m.Call()); } +static int RunInt32AddShift(bool is_left, int32_t add_left, int32_t add_right, + int32_t shift_left, int32_t shit_right) { + RawMachineAssemblerTester<int32_t> m; + Node* shift = + m.Word32Shl(m.Int32Constant(shift_left), m.Int32Constant(shit_right)); + Node* add = m.Int32Add(m.Int32Constant(add_left), m.Int32Constant(add_right)); + Node* lsa = is_left ? m.Int32Add(shift, add) : m.Int32Add(add, shift); + m.Return(lsa); + return m.Call(); +} + +TEST(RunInt32AddShift) { + struct Test_case { + int32_t add_left, add_right, shift_left, shit_right, expected; + }; + + Test_case tc[] = { + {20, 22, 4, 2, 58}, + {20, 22, 4, 1, 50}, + {20, 22, 1, 6, 106}, + {INT_MAX - 2, 1, 1, 1, INT_MIN}, // INT_MAX - 2 + 1 + (1 << 1), overflow. + }; + const size_t tc_size = sizeof(tc) / sizeof(Test_case); + + for (size_t i = 0; i < tc_size; ++i) { + CHECK_EQ(tc[i].expected, + RunInt32AddShift(false, tc[i].add_left, tc[i].add_right, + tc[i].shift_left, tc[i].shit_right)); + CHECK_EQ(tc[i].expected, + RunInt32AddShift(true, tc[i].add_left, tc[i].add_right, + tc[i].shift_left, tc[i].shit_right)); + } +} TEST(RunWord32ReverseBits) { BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Uint32()); @@ -47,6 +82,23 @@ TEST(RunWord32ReverseBits) { CHECK_EQ(uint32_t(0xffffffff), m.Call(uint32_t(0xffffffff))); } +TEST(RunWord32ReverseBytes) { + BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Uint32()); + if (!m.machine()->Word32ReverseBytes().IsSupported()) { + // We can only test the operator if it exists on the testing platform. + return; + } + m.Return(m.AddNode(m.machine()->Word32ReverseBytes().op(), m.Parameter(0))); + + CHECK_EQ(uint32_t(0x00000000), m.Call(uint32_t(0x00000000))); + CHECK_EQ(uint32_t(0x12345678), m.Call(uint32_t(0x78563412))); + CHECK_EQ(uint32_t(0xfedcba09), m.Call(uint32_t(0x09badcfe))); + CHECK_EQ(uint32_t(0x01010101), m.Call(uint32_t(0x01010101))); + CHECK_EQ(uint32_t(0x01020408), m.Call(uint32_t(0x08040201))); + CHECK_EQ(uint32_t(0xf0703010), m.Call(uint32_t(0x103070f0))); + CHECK_EQ(uint32_t(0x1f8d0a3a), m.Call(uint32_t(0x3a0a8d1f))); + CHECK_EQ(uint32_t(0xffffffff), m.Call(uint32_t(0xffffffff))); +} TEST(RunWord32Ctz) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32()); @@ -169,6 +221,23 @@ TEST(RunWord64ReverseBits) { CHECK_EQ(uint64_t(0xffffffffffffffff), m.Call(uint64_t(0xffffffffffffffff))); } +TEST(RunWord64ReverseBytes) { + BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Uint64()); + if (!m.machine()->Word64ReverseBytes().IsSupported()) { + return; + } + + m.Return(m.AddNode(m.machine()->Word64ReverseBytes().op(), m.Parameter(0))); + + CHECK_EQ(uint64_t(0x0000000000000000), m.Call(uint64_t(0x0000000000000000))); + CHECK_EQ(uint64_t(0x1234567890abcdef), m.Call(uint64_t(0xefcdab9078563412))); + CHECK_EQ(uint64_t(0xfedcba0987654321), m.Call(uint64_t(0x2143658709badcfe))); + CHECK_EQ(uint64_t(0x0101010101010101), m.Call(uint64_t(0x0101010101010101))); + CHECK_EQ(uint64_t(0x0102040803060c01), m.Call(uint64_t(0x010c060308040201))); + CHECK_EQ(uint64_t(0xf0703010e060200f), m.Call(uint64_t(0x0f2060e0103070f0))); + CHECK_EQ(uint64_t(0x2f8a6df01c21fa3b), m.Call(uint64_t(0x3bfa211cf06d8a2f))); + CHECK_EQ(uint64_t(0xffffffffffffffff), m.Call(uint64_t(0xffffffffffffffff))); +} TEST(RunWord64Clz) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint64()); @@ -636,6 +705,38 @@ TEST(RunInt64SubWithOverflowInBranchP) { } } +static int64_t RunInt64AddShift(bool is_left, int64_t add_left, + int64_t add_right, int64_t shift_left, + int64_t shit_right) { + RawMachineAssemblerTester<int64_t> m; + Node* shift = m.Word64Shl(m.Int64Constant(4), m.Int64Constant(2)); + Node* add = m.Int64Add(m.Int64Constant(20), m.Int64Constant(22)); + Node* dlsa = is_left ? m.Int64Add(shift, add) : m.Int64Add(add, shift); + m.Return(dlsa); + return m.Call(); +} + +TEST(RunInt64AddShift) { + struct Test_case { + int64_t add_left, add_right, shift_left, shit_right, expected; + }; + + Test_case tc[] = { + {20, 22, 4, 2, 58}, + {20, 22, 4, 1, 50}, + {20, 22, 1, 6, 106}, + {INT64_MAX - 2, 1, 1, 1, + INT64_MIN}, // INT64_MAX - 2 + 1 + (1 << 1), overflow. + }; + const size_t tc_size = sizeof(tc) / sizeof(Test_case); + + for (size_t i = 0; i < tc_size; ++i) { + CHECK_EQ(58, RunInt64AddShift(false, tc[i].add_left, tc[i].add_right, + tc[i].shift_left, tc[i].shit_right)); + CHECK_EQ(58, RunInt64AddShift(true, tc[i].add_left, tc[i].add_right, + tc[i].shift_left, tc[i].shit_right)); + } +} // TODO(titzer): add tests that run 64-bit integer operations. #endif // V8_TARGET_ARCH_64_BIT @@ -1142,94 +1243,6 @@ TEST(RunSwitch4) { } -TEST(RunLoadInt32) { - RawMachineAssemblerTester<int32_t> m; - - int32_t p1 = 0; // loads directly from this location. - m.Return(m.LoadFromPointer(&p1, MachineType::Int32())); - - FOR_INT32_INPUTS(i) { - p1 = *i; - CHECK_EQ(p1, m.Call()); - } -} - - -TEST(RunLoadInt32Offset) { - int32_t p1 = 0; // loads directly from this location. - - int32_t offsets[] = {-2000000, -100, -101, 1, 3, - 7, 120, 2000, 2000000000, 0xff}; - - for (size_t i = 0; i < arraysize(offsets); i++) { - RawMachineAssemblerTester<int32_t> m; - int32_t offset = offsets[i]; - byte* pointer = reinterpret_cast<byte*>(&p1) - offset; - // generate load [#base + #index] - m.Return(m.LoadFromPointer(pointer, MachineType::Int32(), offset)); - - FOR_INT32_INPUTS(j) { - p1 = *j; - CHECK_EQ(p1, m.Call()); - } - } -} - - -TEST(RunLoadStoreFloat32Offset) { - float p1 = 0.0f; // loads directly from this location. - float p2 = 0.0f; // and stores directly into this location. - - FOR_INT32_INPUTS(i) { - int32_t magic = 0x2342aabb + *i * 3; - RawMachineAssemblerTester<int32_t> m; - int32_t offset = *i; - byte* from = reinterpret_cast<byte*>(&p1) - offset; - byte* to = reinterpret_cast<byte*>(&p2) - offset; - // generate load [#base + #index] - Node* load = m.Load(MachineType::Float32(), m.PointerConstant(from), - m.IntPtrConstant(offset)); - m.Store(MachineRepresentation::kFloat32, m.PointerConstant(to), - m.IntPtrConstant(offset), load, kNoWriteBarrier); - m.Return(m.Int32Constant(magic)); - - FOR_FLOAT32_INPUTS(j) { - p1 = *j; - p2 = *j - 5; - CHECK_EQ(magic, m.Call()); - CHECK_DOUBLE_EQ(p1, p2); - } - } -} - - -TEST(RunLoadStoreFloat64Offset) { - double p1 = 0; // loads directly from this location. - double p2 = 0; // and stores directly into this location. - - FOR_INT32_INPUTS(i) { - int32_t magic = 0x2342aabb + *i * 3; - RawMachineAssemblerTester<int32_t> m; - int32_t offset = *i; - byte* from = reinterpret_cast<byte*>(&p1) - offset; - byte* to = reinterpret_cast<byte*>(&p2) - offset; - // generate load [#base + #index] - Node* load = m.Load(MachineType::Float64(), m.PointerConstant(from), - m.IntPtrConstant(offset)); - m.Store(MachineRepresentation::kFloat64, m.PointerConstant(to), - m.IntPtrConstant(offset), load, kNoWriteBarrier); - m.Return(m.Int32Constant(magic)); - - FOR_FLOAT64_INPUTS(j) { - p1 = *j; - p2 = *j - 5; - CHECK_EQ(magic, m.Call()); - CHECK_DOUBLE_EQ(p1, p2); - } - } -} - - TEST(RunInt32AddP) { RawMachineAssemblerTester<int32_t> m; Int32BinopTester bt(&m); @@ -1709,7 +1722,6 @@ TEST(RunInt32SubP) { } } - TEST(RunInt32SubImm) { { FOR_UINT32_INPUTS(i) { @@ -1733,6 +1745,11 @@ TEST(RunInt32SubImm) { } } +TEST(RunInt32SubImm2) { + BufferedRawMachineAssemblerTester<int32_t> r; + r.Return(r.Int32Sub(r.Int32Constant(-1), r.Int32Constant(0))); + CHECK_EQ(-1, r.Call()); +} TEST(RunInt32SubAndWord32SarP) { { @@ -2099,7 +2116,6 @@ TEST(RunInt32MulImm) { } } - TEST(RunInt32MulAndInt32AddP) { { FOR_INT32_INPUTS(i) { @@ -3566,92 +3582,6 @@ TEST(RunDeadInt32Binops) { } -template <typename Type> -static void RunLoadImmIndex(MachineType rep) { - const int kNumElems = 3; - Type buffer[kNumElems]; - - // initialize the buffer with some raw data. - byte* raw = reinterpret_cast<byte*>(buffer); - for (size_t i = 0; i < sizeof(buffer); i++) { - raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); - } - - // Test with various large and small offsets. - for (int offset = -1; offset <= 200000; offset *= -5) { - for (int i = 0; i < kNumElems; i++) { - BufferedRawMachineAssemblerTester<Type> m; - Node* base = m.PointerConstant(buffer - offset); - Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); - m.Return(m.Load(rep, base, index)); - - volatile Type expected = buffer[i]; - volatile Type actual = m.Call(); - CHECK_EQ(expected, actual); - } - } -} - - -TEST(RunLoadImmIndex) { - RunLoadImmIndex<int8_t>(MachineType::Int8()); - RunLoadImmIndex<uint8_t>(MachineType::Uint8()); - RunLoadImmIndex<int16_t>(MachineType::Int16()); - RunLoadImmIndex<uint16_t>(MachineType::Uint16()); - RunLoadImmIndex<int32_t>(MachineType::Int32()); - RunLoadImmIndex<uint32_t>(MachineType::Uint32()); - RunLoadImmIndex<int32_t*>(MachineType::AnyTagged()); - RunLoadImmIndex<float>(MachineType::Float32()); - RunLoadImmIndex<double>(MachineType::Float64()); - if (kPointerSize == 8) { - RunLoadImmIndex<int64_t>(MachineType::Int64()); - } - // TODO(titzer): test various indexing modes. -} - - -template <typename CType> -static void RunLoadStore(MachineType rep) { - const int kNumElems = 4; - CType buffer[kNumElems]; - - for (int32_t x = 0; x < kNumElems; x++) { - int32_t y = kNumElems - x - 1; - // initialize the buffer with raw data. - byte* raw = reinterpret_cast<byte*>(buffer); - for (size_t i = 0; i < sizeof(buffer); i++) { - raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); - } - - RawMachineAssemblerTester<int32_t> m; - int32_t OK = 0x29000 + x; - Node* base = m.PointerConstant(buffer); - Node* index0 = m.IntPtrConstant(x * sizeof(buffer[0])); - Node* load = m.Load(rep, base, index0); - Node* index1 = m.IntPtrConstant(y * sizeof(buffer[0])); - m.Store(rep.representation(), base, index1, load, kNoWriteBarrier); - m.Return(m.Int32Constant(OK)); - - CHECK(buffer[x] != buffer[y]); - CHECK_EQ(OK, m.Call()); - CHECK(buffer[x] == buffer[y]); - } -} - - -TEST(RunLoadStore) { - RunLoadStore<int8_t>(MachineType::Int8()); - RunLoadStore<uint8_t>(MachineType::Uint8()); - RunLoadStore<int16_t>(MachineType::Int16()); - RunLoadStore<uint16_t>(MachineType::Uint16()); - RunLoadStore<int32_t>(MachineType::Int32()); - RunLoadStore<uint32_t>(MachineType::Uint32()); - RunLoadStore<void*>(MachineType::AnyTagged()); - RunLoadStore<float>(MachineType::Float32()); - RunLoadStore<double>(MachineType::Float64()); -} - - TEST(RunFloat32Add) { BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(), MachineType::Float32()); @@ -3673,6 +3603,11 @@ TEST(RunFloat32Sub) { } } +TEST(RunFloat32Neg) { + BufferedRawMachineAssemblerTester<float> m(MachineType::Float32()); + m.Return(m.AddNode(m.machine()->Float32Neg(), m.Parameter(0))); + FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(-0.0f - *i, m.Call(*i)); } +} TEST(RunFloat32Mul) { BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(), @@ -3717,6 +3652,11 @@ TEST(RunFloat64Sub) { } } +TEST(RunFloat64Neg) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.AddNode(m.machine()->Float64Neg(), m.Parameter(0))); + FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(-0.0 - *i, m.Call(*i)); } +} TEST(RunFloat64Mul) { BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), @@ -3808,67 +3748,55 @@ TEST(RunFloat64AddP) { } } - -TEST(RunFloa32MaxP) { +TEST(RunFloat64MaxP) { RawMachineAssemblerTester<int32_t> m; - Float32BinopTester bt(&m); - if (!m.machine()->Float32Max().IsSupported()) return; - - bt.AddReturn(m.Float32Max(bt.param0, bt.param1)); + Float64BinopTester bt(&m); + bt.AddReturn(m.Float64Max(bt.param0, bt.param1)); - FOR_FLOAT32_INPUTS(pl) { - FOR_FLOAT32_INPUTS(pr) { - CHECK_DOUBLE_EQ(*pl > *pr ? *pl : *pr, bt.call(*pl, *pr)); + FOR_FLOAT64_INPUTS(pl) { + FOR_FLOAT64_INPUTS(pr) { + CHECK_DOUBLE_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr)); } } } -TEST(RunFloat64MaxP) { +TEST(RunFloat64MinP) { RawMachineAssemblerTester<int32_t> m; Float64BinopTester bt(&m); - if (!m.machine()->Float64Max().IsSupported()) return; - - bt.AddReturn(m.Float64Max(bt.param0, bt.param1)); + bt.AddReturn(m.Float64Min(bt.param0, bt.param1)); FOR_FLOAT64_INPUTS(pl) { FOR_FLOAT64_INPUTS(pr) { - CHECK_DOUBLE_EQ(*pl > *pr ? *pl : *pr, bt.call(*pl, *pr)); + CHECK_DOUBLE_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr)); } } } - -TEST(RunFloat32MinP) { +TEST(RunFloat32Max) { RawMachineAssemblerTester<int32_t> m; Float32BinopTester bt(&m); - if (!m.machine()->Float32Min().IsSupported()) return; - - bt.AddReturn(m.Float32Min(bt.param0, bt.param1)); + bt.AddReturn(m.Float32Max(bt.param0, bt.param1)); FOR_FLOAT32_INPUTS(pl) { FOR_FLOAT32_INPUTS(pr) { - CHECK_DOUBLE_EQ(*pl < *pr ? *pl : *pr, bt.call(*pl, *pr)); + CHECK_FLOAT_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr)); } } } - -TEST(RunFloat64MinP) { +TEST(RunFloat32Min) { RawMachineAssemblerTester<int32_t> m; - Float64BinopTester bt(&m); - if (!m.machine()->Float64Min().IsSupported()) return; - - bt.AddReturn(m.Float64Min(bt.param0, bt.param1)); + Float32BinopTester bt(&m); + bt.AddReturn(m.Float32Min(bt.param0, bt.param1)); - FOR_FLOAT64_INPUTS(pl) { - FOR_FLOAT64_INPUTS(pr) { - CHECK_DOUBLE_EQ(*pl < *pr ? *pl : *pr, bt.call(*pl, *pr)); + FOR_FLOAT32_INPUTS(pl) { + FOR_FLOAT32_INPUTS(pr) { + CHECK_FLOAT_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr)); } } } - TEST(RunFloat32SubP) { RawMachineAssemblerTester<int32_t> m; Float32BinopTester bt(&m); @@ -4110,9 +4038,15 @@ TEST(RunChangeUint32ToFloat64) { TEST(RunTruncateFloat32ToInt32) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Float32()); m.Return(m.TruncateFloat32ToInt32(m.Parameter(0))); + // The upper bound is (INT32_MAX + 1), which is the lowest float-representable + // number above INT32_MAX which cannot be represented as int32. + float upper_bound = 2147483648.0f; + // We use INT32_MIN as a lower bound because (INT32_MIN - 1) is not + // representable as float, and no number between (INT32_MIN - 1) and INT32_MIN + // is. + float lower_bound = static_cast<float>(INT32_MIN); FOR_FLOAT32_INPUTS(i) { - if (*i <= static_cast<float>(std::numeric_limits<int32_t>::max()) && - *i >= static_cast<float>(std::numeric_limits<int32_t>::min())) { + if (*i < upper_bound && *i >= lower_bound) { CHECK_FLOAT_EQ(static_cast<int32_t>(*i), m.Call(*i)); } } @@ -4122,23 +4056,20 @@ TEST(RunTruncateFloat32ToInt32) { TEST(RunTruncateFloat32ToUint32) { BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float32()); m.Return(m.TruncateFloat32ToUint32(m.Parameter(0))); - { - FOR_UINT32_INPUTS(i) { - float input = static_cast<float>(*i); - // This condition on 'input' is required because - // static_cast<float>(std::numeric_limits<uint32_t>::max()) results in a - // value outside uint32 range. - if (input < static_cast<float>(std::numeric_limits<uint32_t>::max())) { - CHECK_EQ(static_cast<uint32_t>(input), m.Call(input)); - } + // The upper bound is (UINT32_MAX + 1), which is the lowest + // float-representable number above UINT32_MAX which cannot be represented as + // uint32. + double upper_bound = 4294967296.0f; + double lower_bound = -1.0f; + FOR_UINT32_INPUTS(i) { + volatile float input = static_cast<float>(*i); + if (input < upper_bound) { + CHECK_EQ(static_cast<uint32_t>(input), m.Call(input)); } } - { - FOR_FLOAT32_INPUTS(i) { - if (*i <= static_cast<float>(std::numeric_limits<uint32_t>::max()) && - *i >= static_cast<float>(std::numeric_limits<uint32_t>::min())) { - CHECK_FLOAT_EQ(static_cast<uint32_t>(*i), m.Call(*i)); - } + FOR_FLOAT32_INPUTS(j) { + if ((*j < upper_bound) && (*j > lower_bound)) { + CHECK_FLOAT_EQ(static_cast<uint32_t>(*j), m.Call(*j)); } } } @@ -4201,7 +4132,7 @@ uint64_t ToInt64(uint32_t low, uint32_t high) { return (static_cast<uint64_t>(high) << 32) | static_cast<uint64_t>(low); } -#if V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_X87 +#if V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_X87 TEST(RunInt32PairAdd) { BufferedRawMachineAssemblerTester<int32_t> m( MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), @@ -4449,6 +4380,56 @@ TEST(RunWord32PairShlWithSharedInput) { TestWord32PairShlWithSharedInput(1, 1); } +TEST(RunWord32PairShr) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); + + uint32_t high; + uint32_t low; + + Node* PairAdd = + m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2)); + + m.StoreToPointer(&low, MachineRepresentation::kWord32, + m.Projection(0, PairAdd)); + m.StoreToPointer(&high, MachineRepresentation::kWord32, + m.Projection(1, PairAdd)); + m.Return(m.Int32Constant(74)); + + FOR_UINT64_INPUTS(i) { + for (uint32_t j = 0; j < 64; j++) { + m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), j); + CHECK_EQ(*i >> j, ToInt64(low, high)); + } + } +} + +TEST(RunWord32PairSar) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); + + uint32_t high; + uint32_t low; + + Node* PairAdd = + m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2)); + + m.StoreToPointer(&low, MachineRepresentation::kWord32, + m.Projection(0, PairAdd)); + m.StoreToPointer(&high, MachineRepresentation::kWord32, + m.Projection(1, PairAdd)); + m.Return(m.Int32Constant(74)); + + FOR_INT64_INPUTS(i) { + for (uint32_t j = 0; j < 64; j++) { + m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), j); + CHECK_EQ(*i >> j, ToInt64(low, high)); + } + } +} + #endif TEST(RunDeadChangeFloat64ToInt32) { @@ -4968,45 +4949,6 @@ TEST(RunFloat64LessThan) { } -template <typename IntType> -static void LoadStoreTruncation(MachineType kRepresentation) { - IntType input; - - RawMachineAssemblerTester<int32_t> m; - Node* a = m.LoadFromPointer(&input, kRepresentation); - Node* ap1 = m.Int32Add(a, m.Int32Constant(1)); - m.StoreToPointer(&input, kRepresentation.representation(), ap1); - m.Return(ap1); - - const IntType max = std::numeric_limits<IntType>::max(); - const IntType min = std::numeric_limits<IntType>::min(); - - // Test upper bound. - input = max; - CHECK_EQ(max + 1, m.Call()); - CHECK_EQ(min, input); - - // Test lower bound. - input = min; - CHECK_EQ(static_cast<IntType>(max + 2), m.Call()); - CHECK_EQ(min + 1, input); - - // Test all one byte values that are not one byte bounds. - for (int i = -127; i < 127; i++) { - input = i; - int expected = i >= 0 ? i + 1 : max + (i - min) + 2; - CHECK_EQ(static_cast<IntType>(expected), m.Call()); - CHECK_EQ(static_cast<IntType>(i + 1), input); - } -} - - -TEST(RunLoadStoreTruncation) { - LoadStoreTruncation<int8_t>(MachineType::Int8()); - LoadStoreTruncation<int16_t>(MachineType::Int16()); -} - - static void IntPtrCompare(intptr_t left, intptr_t right) { for (int test = 0; test < 7; test++) { RawMachineAssemblerTester<bool> m(MachineType::Pointer(), @@ -5352,6 +5294,98 @@ TEST(RunInt32SubWithOverflowInBranchP) { } } +TEST(RunInt32MulWithOverflowP) { + int32_t actual_val = -1; + RawMachineAssemblerTester<int32_t> m; + Int32BinopTester bt(&m); + Node* add = m.Int32MulWithOverflow(bt.param0, bt.param1); + Node* val = m.Projection(0, add); + Node* ovf = m.Projection(1, add); + m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val); + bt.AddReturn(ovf); + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t expected_val; + int expected_ovf = bits::SignedMulOverflow32(*i, *j, &expected_val); + CHECK_EQ(expected_ovf, bt.call(*i, *j)); + if (!expected_ovf) { + CHECK_EQ(expected_val, actual_val); + } + } + } +} + +TEST(RunInt32MulWithOverflowImm) { + int32_t actual_val = -1, expected_val = 0; + FOR_INT32_INPUTS(i) { + { + RawMachineAssemblerTester<int32_t> m(MachineType::Int32()); + Node* add = m.Int32MulWithOverflow(m.Int32Constant(*i), m.Parameter(0)); + Node* val = m.Projection(0, add); + Node* ovf = m.Projection(1, add); + m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val); + m.Return(ovf); + FOR_INT32_INPUTS(j) { + int expected_ovf = bits::SignedMulOverflow32(*i, *j, &expected_val); + CHECK_EQ(expected_ovf, m.Call(*j)); + if (!expected_ovf) { + CHECK_EQ(expected_val, actual_val); + } + } + } + { + RawMachineAssemblerTester<int32_t> m(MachineType::Int32()); + Node* add = m.Int32MulWithOverflow(m.Parameter(0), m.Int32Constant(*i)); + Node* val = m.Projection(0, add); + Node* ovf = m.Projection(1, add); + m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val); + m.Return(ovf); + FOR_INT32_INPUTS(j) { + int expected_ovf = bits::SignedMulOverflow32(*i, *j, &expected_val); + CHECK_EQ(expected_ovf, m.Call(*j)); + if (!expected_ovf) { + CHECK_EQ(expected_val, actual_val); + } + } + } + FOR_INT32_INPUTS(j) { + RawMachineAssemblerTester<int32_t> m; + Node* add = + m.Int32MulWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j)); + Node* val = m.Projection(0, add); + Node* ovf = m.Projection(1, add); + m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val); + m.Return(ovf); + int expected_ovf = bits::SignedMulOverflow32(*i, *j, &expected_val); + CHECK_EQ(expected_ovf, m.Call()); + if (!expected_ovf) { + CHECK_EQ(expected_val, actual_val); + } + } + } +} + +TEST(RunInt32MulWithOverflowInBranchP) { + int constant = 911777; + RawMachineLabel blocka, blockb; + RawMachineAssemblerTester<int32_t> m; + Int32BinopTester bt(&m); + Node* add = m.Int32MulWithOverflow(bt.param0, bt.param1); + Node* ovf = m.Projection(1, add); + m.Branch(ovf, &blocka, &blockb); + m.Bind(&blocka); + bt.AddReturn(m.Int32Constant(constant)); + m.Bind(&blockb); + Node* val = m.Projection(0, add); + bt.AddReturn(val); + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t expected; + if (bits::SignedMulOverflow32(*i, *j, &expected)) expected = constant; + CHECK_EQ(expected, bt.call(*i, *j)); + } + } +} TEST(RunWord64EqualInBranchP) { int64_t input; @@ -5417,8 +5451,7 @@ TEST(RunTruncateInt64ToInt32P) { } } - -TEST(RunTruncateFloat64ToInt32P) { +TEST(RunTruncateFloat64ToWord32P) { struct { double from; double raw; @@ -5479,8 +5512,7 @@ TEST(RunTruncateFloat64ToInt32P) { {-1.7976931348623157e+308, 0}}; double input = -1.0; RawMachineAssemblerTester<int32_t> m; - m.Return(m.TruncateFloat64ToInt32( - TruncationMode::kJavaScript, + m.Return(m.TruncateFloat64ToWord32( m.LoadFromPointer(&input, MachineType::Float64()))); for (size_t i = 0; i < arraysize(kValues); ++i) { input = kValues[i].from; @@ -5489,6 +5521,12 @@ TEST(RunTruncateFloat64ToInt32P) { } } +TEST(RunTruncateFloat64ToWord32SignExtension) { + BufferedRawMachineAssemblerTester<int32_t> r; + r.Return(r.Int32Sub(r.TruncateFloat64ToWord32(r.Float64Constant(-1.0)), + r.Int32Constant(0))); + CHECK_EQ(-1, r.Call()); +} TEST(RunChangeFloat32ToFloat64) { BufferedRawMachineAssemblerTester<double> m(MachineType::Float32()); @@ -5573,6 +5611,204 @@ TEST(RunFloat64Abs) { FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); } } +TEST(RunFloat64Acos) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Acos(m.Parameter(0))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::acos(*i), m.Call(*i)); } +} + +TEST(RunFloat64Acosh) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Acosh(m.Parameter(0))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::acosh(*i), m.Call(*i)); } +} + +TEST(RunFloat64Asin) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Asin(m.Parameter(0))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::asin(*i), m.Call(*i)); } +} + +TEST(RunFloat64Asinh) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Asinh(m.Parameter(0))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::asinh(*i), m.Call(*i)); } +} + +TEST(RunFloat64Atan) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Atan(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0)); + CHECK_DOUBLE_EQ(0.0, m.Call(0.0)); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::atan(*i), m.Call(*i)); } +} + +TEST(RunFloat64Atanh) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Atanh(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), m.Call(1.0)); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0)); + CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0)); + CHECK_DOUBLE_EQ(0.0, m.Call(0.0)); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::atanh(*i), m.Call(*i)); } +} + +TEST(RunFloat64Atan2) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), + MachineType::Float64()); + m.Return(m.Float64Atan2(m.Parameter(0), m.Parameter(1))); + FOR_FLOAT64_INPUTS(i) { + FOR_FLOAT64_INPUTS(j) { + CHECK_DOUBLE_EQ(ieee754::atan2(*i, *j), m.Call(*i, *j)); + } + } +} + +TEST(RunFloat64Cos) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Cos(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cos(*i), m.Call(*i)); } +} + +TEST(RunFloat64Cosh) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Cosh(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cosh(*i), m.Call(*i)); } +} + +TEST(RunFloat64Exp) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Exp(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK_EQ(0.0, m.Call(-std::numeric_limits<double>::infinity())); + CHECK_DOUBLE_EQ(1.0, m.Call(-0.0)); + CHECK_DOUBLE_EQ(1.0, m.Call(0.0)); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::exp(*i), m.Call(*i)); } +} + +TEST(RunFloat64Expm1) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Expm1(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK_EQ(-1.0, m.Call(-std::numeric_limits<double>::infinity())); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::expm1(*i), m.Call(*i)); } +} + +TEST(RunFloat64Log) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Log(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); + CHECK(std::isnan(m.Call(-1.0))); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); + CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log(*i), m.Call(*i)); } +} + +TEST(RunFloat64Log1p) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Log1p(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0)); + CHECK_DOUBLE_EQ(0.0, m.Call(0.0)); + CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0)); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log1p(*i), m.Call(*i)); } +} + +TEST(RunFloat64Log2) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Log2(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); + CHECK(std::isnan(m.Call(-1.0))); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); + CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log2(*i), m.Call(*i)); } +} + +TEST(RunFloat64Log10) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Log10(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); + CHECK(std::isnan(m.Call(-1.0))); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log10(*i), m.Call(*i)); } +} + +TEST(RunFloat64Cbrt) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Cbrt(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), + m.Call(std::numeric_limits<double>::infinity())); + CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), + m.Call(-std::numeric_limits<double>::infinity())); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cbrt(*i), m.Call(*i)); } +} + +TEST(RunFloat64Sin) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Sin(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::sin(*i), m.Call(*i)); } +} + +TEST(RunFloat64Sinh) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Sinh(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::sinh(*i), m.Call(*i)); } +} + +TEST(RunFloat64Tan) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Tan(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::tan(*i), m.Call(*i)); } +} + +TEST(RunFloat64Tanh) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); + m.Return(m.Float64Tanh(m.Parameter(0))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); + CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); + FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::tanh(*i), m.Call(*i)); } +} static double two_30 = 1 << 30; // 2^30 is a smi boundary. static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. @@ -5854,50 +6090,6 @@ TEST(RunCallCFunction8) { #if V8_TARGET_ARCH_64_BIT // TODO(titzer): run int64 tests on all platforms when supported. -TEST(RunCheckedLoadInt64) { - int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; - RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); - Node* base = m.PointerConstant(buffer); - Node* index = m.Parameter(0); - Node* length = m.Int32Constant(16); - Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base, - index, length); - m.Return(load); - - CHECK_EQ(buffer[0], m.Call(0)); - CHECK_EQ(buffer[1], m.Call(8)); - CHECK_EQ(0, m.Call(16)); -} - - -TEST(RunCheckedStoreInt64) { - const int64_t write = 0x5566778899aabbLL; - const int64_t before = 0x33bbccddeeff0011LL; - int64_t buffer[] = {before, before}; - RawMachineAssemblerTester<int32_t> m(MachineType::Int32()); - Node* base = m.PointerConstant(buffer); - Node* index = m.Parameter(0); - Node* length = m.Int32Constant(16); - Node* value = m.Int64Constant(write); - Node* store = - m.AddNode(m.machine()->CheckedStore(MachineRepresentation::kWord64), base, - index, length, value); - USE(store); - m.Return(m.Int32Constant(11)); - - CHECK_EQ(11, m.Call(16)); - CHECK_EQ(before, buffer[0]); - CHECK_EQ(before, buffer[1]); - - CHECK_EQ(11, m.Call(0)); - CHECK_EQ(write, buffer[0]); - CHECK_EQ(before, buffer[1]); - - CHECK_EQ(11, m.Call(8)); - CHECK_EQ(write, buffer[0]); - CHECK_EQ(write, buffer[1]); -} - TEST(RunBitcastInt64ToFloat64) { int64_t input = 1; @@ -6348,7 +6540,6 @@ TEST(RunComputedCodeObject) { CallDescriptor::kCallCodeObject, // kind MachineType::AnyTagged(), // target_type c->GetInputLocation(0), // target_loc - &sig, // machine_sig &loc, // location_sig 0, // stack count Operator::kNoProperties, // properties 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 bfdcc0e8ca..5c2672f8d4 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -18,6 +18,8 @@ namespace v8 { namespace internal { namespace compiler { +const auto GetRegConfig = RegisterConfiguration::Turbofan; + namespace { typedef float float32; typedef double float64; @@ -76,12 +78,8 @@ class Pairs { class RegisterPairs : public Pairs { public: RegisterPairs() - : Pairs( - 100, - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_general_registers(), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->allocatable_general_codes()) {} + : Pairs(100, GetRegConfig()->num_allocatable_general_registers(), + GetRegConfig()->allocatable_general_codes()) {} }; @@ -89,12 +87,8 @@ class RegisterPairs : public Pairs { class Float32RegisterPairs : public Pairs { public: Float32RegisterPairs() - : Pairs( - 100, - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_aliased_double_registers(), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->allocatable_double_codes()) {} + : Pairs(100, GetRegConfig()->num_allocatable_aliased_double_registers(), + GetRegConfig()->allocatable_double_codes()) {} }; @@ -102,12 +96,8 @@ class Float32RegisterPairs : public Pairs { class Float64RegisterPairs : public Pairs { public: Float64RegisterPairs() - : Pairs( - 100, - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_aliased_double_registers(), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->allocatable_double_codes()) {} + : Pairs(100, GetRegConfig()->num_allocatable_double_registers(), + GetRegConfig()->allocatable_double_codes()) {} }; @@ -136,28 +126,26 @@ struct Allocator { if (IsFloatingPoint(type.representation())) { // Allocate a floating point register/stack location. if (fp_offset < fp_count) { - return LinkageLocation::ForRegister(fp_regs[fp_offset++]); + int code = fp_regs[fp_offset++]; + return LinkageLocation::ForRegister(code, type); } else { int offset = -1 - stack_offset; stack_offset += StackWords(type); - return LinkageLocation::ForCallerFrameSlot(offset); + return LinkageLocation::ForCallerFrameSlot(offset, type); } } else { // Allocate a general purpose register/stack location. if (gp_offset < gp_count) { - return LinkageLocation::ForRegister(gp_regs[gp_offset++]); + return LinkageLocation::ForRegister(gp_regs[gp_offset++], type); } else { int offset = -1 - stack_offset; stack_offset += StackWords(type); - return LinkageLocation::ForCallerFrameSlot(offset); + return LinkageLocation::ForCallerFrameSlot(offset, type); } } } int StackWords(MachineType type) { - // TODO(titzer): hack. float32 occupies 8 bytes on stack. - int size = IsFloatingPoint(type.representation()) - ? kDoubleSize - : (1 << ElementSizeLog2Of(type.representation())); + int size = 1 << ElementSizeLog2Of(type.representation()); return size <= kPointerSize ? 1 : size / kPointerSize; } void Reset() { @@ -200,7 +188,6 @@ class RegisterConfig { CallDescriptor::kCallCodeObject, // kind target_type, // target MachineType target_loc, // target location - msig, // machine_sig locations.Build(), // location_sig stack_param_count, // stack_parameter_count compiler::Operator::kNoProperties, // properties @@ -255,7 +242,7 @@ class Int32Signature : public MachineSignature { Handle<Code> CompileGraph(const char* name, CallDescriptor* desc, Graph* graph, Schedule* schedule = nullptr) { Isolate* isolate = CcTest::InitIsolateOnce(); - CompilationInfo info("testing", isolate, graph->zone()); + CompilationInfo info(ArrayVector("testing"), isolate, graph->zone()); Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, desc, graph, schedule); CHECK(!code.is_null()); @@ -271,9 +258,7 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* desc, Graph* graph, Handle<Code> WrapWithCFunction(Handle<Code> inner, CallDescriptor* desc) { Zone zone(inner->GetIsolate()->allocator()); - MachineSignature* msig = - const_cast<MachineSignature*>(desc->GetMachineSignature()); - int param_count = static_cast<int>(msig->parameter_count()); + int param_count = static_cast<int>(desc->ParameterCount()); GraphAndBuilders caller(&zone); { GraphAndBuilders& b = caller; @@ -299,6 +284,7 @@ Handle<Code> WrapWithCFunction(Handle<Code> inner, CallDescriptor* desc) { b.graph()->SetEnd(ret); } + MachineSignature* msig = desc->GetMachineSignature(&zone); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, msig); return CompileGraph("wrapper", cdesc, caller.graph()); @@ -419,7 +405,7 @@ void ArgsBuffer<float64>::Mutate() { int ParamCount(CallDescriptor* desc) { - return static_cast<int>(desc->GetMachineSignature()->parameter_count()); + return static_cast<int>(desc->ParameterCount()); } @@ -538,8 +524,7 @@ static void TestInt32Sub(CallDescriptor* desc) { Handle<Code> inner_code = CompileGraph("Int32Sub", desc, inner.graph()); Handle<Code> wrapper = WrapWithCFunction(inner_code, desc); - MachineSignature* msig = - const_cast<MachineSignature*>(desc->GetMachineSignature()); + MachineSignature* msig = desc->GetMachineSignature(&zone); CodeRunner<int32_t> runnable(isolate, wrapper, CSignature::FromMachine(&zone, msig)); @@ -636,15 +621,14 @@ static void Test_RunInt32SubWithRet(int retreg) { // Separate tests for parallelization. -#define TEST_INT32_SUB_WITH_RET(x) \ - TEST(Run_Int32Sub_all_allocatable_pairs_##x) { \ - if (x < Register::kNumRegisters && \ - Register::from_code(x).IsAllocatable()) { \ - Test_RunInt32SubWithRet(x); \ - } \ +#define TEST_INT32_SUB_WITH_RET(x) \ + TEST(Run_Int32Sub_all_allocatable_pairs_##x) { \ + if (x < Register::kNumRegisters && \ + GetRegConfig()->IsAllocatableGeneralCode(x)) { \ + Test_RunInt32SubWithRet(x); \ + } \ } - TEST_INT32_SUB_WITH_RET(0) TEST_INT32_SUB_WITH_RET(1) TEST_INT32_SUB_WITH_RET(2) @@ -692,9 +676,7 @@ TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { base::AccountingAllocator allocator; Zone zone(&allocator); int parray[2]; - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; pairs.Next(&parray[0], &parray[1], false); Allocator params(parray, 2, nullptr, 0); Allocator rets(rarray, 1, nullptr, 0); @@ -741,14 +723,12 @@ static int32_t Compute_Int32_WeightedSum(CallDescriptor* desc, int32_t* input) { static void Test_Int32_WeightedSum_of_size(int count) { Int32Signature sig(count); for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { - if (Register::from_code(p0).IsAllocatable()) { + if (GetRegConfig()->IsAllocatableGeneralCode(p0)) { base::AccountingAllocator allocator; Zone zone(&allocator); int parray[] = {p0}; - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; Allocator params(parray, 1, nullptr, 0); Allocator rets(rarray, 1, nullptr, 0); RegisterConfig config(params, rets); @@ -801,12 +781,8 @@ static void RunSelect(CallDescriptor* desc) { template <int which> void Test_Int32_Select() { - int parray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; + int parray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; Allocator params(parray, 1, nullptr, 0); Allocator rets(rarray, 1, nullptr, 0); RegisterConfig config(params, rets); @@ -843,14 +819,10 @@ TEST_INT32_SELECT(63) TEST(Int64Select_registers) { - if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_general_registers() < 2) - return; + if (GetRegConfig()->num_allocatable_general_registers() < 2) return; if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; ArgsBuffer<int64_t>::Sig sig(2); RegisterPairs pairs; @@ -871,14 +843,11 @@ TEST(Int64Select_registers) { TEST(Float32Select_registers) { - if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_double_registers() < 2) { + if (GetRegConfig()->num_allocatable_double_registers() < 2) { return; } - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; ArgsBuffer<float32>::Sig sig(2); Float32RegisterPairs pairs; @@ -899,15 +868,9 @@ TEST(Float32Select_registers) { TEST(Float64Select_registers) { - if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_double_registers() < 2) - return; - if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_general_registers() < 2) - return; - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + if (GetRegConfig()->num_allocatable_double_registers() < 2) return; + if (GetRegConfig()->num_allocatable_general_registers() < 2) return; + int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; ArgsBuffer<float64>::Sig sig(2); Float64RegisterPairs pairs; @@ -928,9 +891,7 @@ TEST(Float64Select_registers) { TEST(Float32Select_stack_params_return_reg) { - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; Allocator params(nullptr, 0, nullptr, 0); Allocator rets(nullptr, 0, rarray, 1); RegisterConfig config(params, rets); @@ -951,9 +912,7 @@ TEST(Float32Select_stack_params_return_reg) { TEST(Float64Select_stack_params_return_reg) { - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; Allocator params(nullptr, 0, nullptr, 0); Allocator rets(nullptr, 0, rarray, 1); RegisterConfig config(params, rets); @@ -1006,9 +965,7 @@ static void Build_Select_With_Call(CallDescriptor* desc, TEST(Float64StackParamsToStackParams) { - int rarray[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; Allocator params(nullptr, 0, nullptr, 0); Allocator rets(nullptr, 0, rarray, 1); @@ -1027,9 +984,7 @@ TEST(Float64StackParamsToStackParams) { void MixedParamTest(int start) { - if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_double_registers() < 2) - return; + if (GetRegConfig()->num_double_registers() < 2) return; // TODO(titzer): mix in 64-bit types on all platforms when supported. #if V8_TARGET_ARCH_32_BIT @@ -1058,22 +1013,12 @@ void MixedParamTest(int start) { const int num_params = static_cast<int>(arraysize(types) - start); // Build call descriptor - int parray_gp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(1)}; - int rarray_gp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; - int parray_fp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(1)}; - int rarray_fp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + int parray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0), + GetRegConfig()->GetAllocatableGeneralCode(1)}; + int rarray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; + int parray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0), + GetRegConfig()->GetAllocatableDoubleCode(1)}; + int rarray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; Allocator palloc(parray_gp, 2, parray_fp, 2); Allocator ralloc(rarray_gp, 1, rarray_fp, 1); RegisterConfig config(palloc, ralloc); @@ -1174,29 +1119,17 @@ void TestStackSlot(MachineType slot_type, T expected) { // Test: Generate with a function f which reserves a stack slot, call an inner // function g from f which writes into the stack slot of f. - if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->num_allocatable_double_registers() < 2) - return; + if (GetRegConfig()->num_allocatable_double_registers() < 2) return; Isolate* isolate = CcTest::InitIsolateOnce(); // Lots of code to generate the build descriptor for the inner function. - int parray_gp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(1)}; - int rarray_gp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableGeneralCode(0)}; - int parray_fp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0), - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(1)}; - int rarray_fp[] = { - RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) - ->GetAllocatableDoubleCode(0)}; + int parray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0), + GetRegConfig()->GetAllocatableGeneralCode(1)}; + int rarray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; + int parray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0), + GetRegConfig()->GetAllocatableDoubleCode(1)}; + int rarray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; Allocator palloc(parray_gp, 2, parray_fp, 2); Allocator ralloc(rarray_gp, 1, rarray_fp, 1); RegisterConfig config(palloc, ralloc); diff --git a/deps/v8/test/cctest/compiler/test-run-stubs.cc b/deps/v8/test/cctest/compiler/test-run-stubs.cc index c7452191bf..feb25c992a 100644 --- a/deps/v8/test/cctest/compiler/test-run-stubs.cc +++ b/deps/v8/test/cctest/compiler/test-run-stubs.cc @@ -27,7 +27,7 @@ TEST(RunStringLengthStub) { // Create code and an accompanying descriptor. StringLengthStub stub(isolate); Handle<Code> code = stub.GenerateCode(); - CompilationInfo info("test", isolate, zone, + CompilationInfo info(ArrayVector("test"), isolate, zone, Code::ComputeFlags(Code::HANDLER)); CallInterfaceDescriptor interface_descriptor = stub.GetCallInterfaceDescriptor(); diff --git a/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc b/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc new file mode 100644 index 0000000000..4536725d4f --- /dev/null +++ b/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc @@ -0,0 +1,58 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test enabled only on supported architectures. +#if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM) || \ + defined(V8_TARGET_ARCH_ARM64) + +#include "test/cctest/compiler/function-tester.h" + +namespace v8 { +namespace internal { +namespace compiler { + +TEST(RunUnwindingInfo) { + FLAG_turbo = true; + FLAG_perf_prof_unwinding_info = true; + + FunctionTester tester( + "(function (x) {\n" + " function f(x) { return x*x; }\n" + " return x > 0 ? x+1 : f(x);\n" + "})"); + + tester.Call(tester.Val(-1)); + + CHECK(tester.function->code()->has_unwinding_info()); +} + +// TODO(ssanfilippo) Build low-level graph and check that state is correctly +// restored in the following situation: +// +// +-----------------+ +// | no frame |---+ +// check that a +-----------------+ | +// a noframe state | construct frame |<--+ +// is restored here --> +-----------------+ | +// | construct frame |<--+ +// +-----------------+ +// +// Same for <construct>/<destruct>/<destruct> (a <construct> status is restored) + +// TODO(ssanfilippo) Intentionally reach a BB with different initial states +// and check that the UnwindingInforWriter fails in debug mode: +// +// +----------------+ +// +---| State A | +// | +----------------+ +// | | State B != A |---+ +// | +----------------+ | +// +-->| Failure here |<--+ +// +----------------+ + +} // namespace compiler +} // namespace internal +} // namespace v8 + +#endif diff --git a/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc new file mode 100644 index 0000000000..0b23669cf7 --- /dev/null +++ b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc @@ -0,0 +1,170 @@ +// 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 <cmath> +#include <functional> +#include <limits> + +#include "src/base/bits.h" +#include "src/base/utils/random-number-generator.h" +#include "src/codegen.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" + +using namespace v8::internal; +using namespace v8::internal::compiler; + +static void UpdateMemoryReferences(Handle<Code> code, Address old_base, + Address new_base, uint32_t old_size, + uint32_t new_size) { + Isolate* isolate = CcTest::i_isolate(); + bool modified = false; + int mode_mask = RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_REFERENCE) | + 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 (modified) { + Assembler::FlushICache(isolate, code->instruction_start(), + code->instruction_size()); + } +} + +template <typename CType> +static void RunLoadStoreRelocation(MachineType rep) { + const int kNumElems = 2; + CType buffer[kNumElems]; + CType new_buffer[kNumElems]; + byte* raw = reinterpret_cast<byte*>(buffer); + byte* new_raw = reinterpret_cast<byte*>(new_buffer); + for (size_t i = 0; i < sizeof(buffer); i++) { + raw[i] = static_cast<byte>((i + sizeof(CType)) ^ 0xAA); + new_raw[i] = static_cast<byte>((i + sizeof(CType)) ^ 0xAA); + } + int32_t OK = 0x29000; + RawMachineAssemblerTester<uint32_t> m; + Node* base = m.RelocatableIntPtrConstant(reinterpret_cast<intptr_t>(raw), + RelocInfo::WASM_MEMORY_REFERENCE); + Node* base1 = m.RelocatableIntPtrConstant( + reinterpret_cast<intptr_t>(raw + sizeof(CType)), + RelocInfo::WASM_MEMORY_REFERENCE); + Node* index = m.Int32Constant(0); + Node* load = m.Load(rep, base, index); + m.Store(rep.representation(), base1, index, load, kNoWriteBarrier); + m.Return(m.Int32Constant(OK)); + CHECK(buffer[0] != buffer[1]); + CHECK_EQ(OK, m.Call()); + CHECK(buffer[0] == buffer[1]); + m.GenerateCode(); + Handle<Code> code = m.GetCode(); + UpdateMemoryReferences(code, raw, new_raw, sizeof(buffer), + sizeof(new_buffer)); + CHECK(new_buffer[0] != new_buffer[1]); + CHECK_EQ(OK, m.Call()); + CHECK(new_buffer[0] == new_buffer[1]); +} + +TEST(RunLoadStoreRelocation) { + RunLoadStoreRelocation<int8_t>(MachineType::Int8()); + RunLoadStoreRelocation<uint8_t>(MachineType::Uint8()); + RunLoadStoreRelocation<int16_t>(MachineType::Int16()); + RunLoadStoreRelocation<uint16_t>(MachineType::Uint16()); + RunLoadStoreRelocation<int32_t>(MachineType::Int32()); + RunLoadStoreRelocation<uint32_t>(MachineType::Uint32()); + RunLoadStoreRelocation<void*>(MachineType::AnyTagged()); + RunLoadStoreRelocation<float>(MachineType::Float32()); + RunLoadStoreRelocation<double>(MachineType::Float64()); +} + +template <typename CType> +static void RunLoadStoreRelocationOffset(MachineType rep) { + RawMachineAssemblerTester<int32_t> r(MachineType::Int32()); + const int kNumElems = 4; + CType buffer[kNumElems]; + CType new_buffer[kNumElems + 1]; + + for (int32_t x = 0; x < kNumElems; x++) { + int32_t y = kNumElems - x - 1; + // initialize the buffer with raw data. + byte* raw = reinterpret_cast<byte*>(buffer); + for (size_t i = 0; i < sizeof(buffer); i++) { + raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); + } + + RawMachineAssemblerTester<int32_t> m; + int32_t OK = 0x29000 + x; + Node* base = m.RelocatableIntPtrConstant(reinterpret_cast<intptr_t>(buffer), + RelocInfo::WASM_MEMORY_REFERENCE); + Node* index0 = m.IntPtrConstant(x * sizeof(buffer[0])); + Node* load = m.Load(rep, base, index0); + Node* index1 = m.IntPtrConstant(y * sizeof(buffer[0])); + m.Store(rep.representation(), base, index1, load, kNoWriteBarrier); + m.Return(m.Int32Constant(OK)); + + CHECK(buffer[x] != buffer[y]); + CHECK_EQ(OK, m.Call()); + CHECK(buffer[x] == buffer[y]); + m.GenerateCode(); + + // Initialize new buffer and set old_buffer to 0 + byte* new_raw = reinterpret_cast<byte*>(new_buffer); + for (size_t i = 0; i < sizeof(buffer); i++) { + raw[i] = 0; + new_raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); + } + + // Perform relocation on generated code + Handle<Code> code = m.GetCode(); + UpdateMemoryReferences(code, raw, new_raw, sizeof(buffer), + sizeof(new_buffer)); + + CHECK(new_buffer[x] != new_buffer[y]); + CHECK_EQ(OK, m.Call()); + CHECK(new_buffer[x] == new_buffer[y]); + } +} + +TEST(RunLoadStoreRelocationOffset) { + RunLoadStoreRelocationOffset<int8_t>(MachineType::Int8()); + RunLoadStoreRelocationOffset<uint8_t>(MachineType::Uint8()); + RunLoadStoreRelocationOffset<int16_t>(MachineType::Int16()); + RunLoadStoreRelocationOffset<uint16_t>(MachineType::Uint16()); + RunLoadStoreRelocationOffset<int32_t>(MachineType::Int32()); + RunLoadStoreRelocationOffset<uint32_t>(MachineType::Uint32()); + RunLoadStoreRelocationOffset<void*>(MachineType::AnyTagged()); + RunLoadStoreRelocationOffset<float>(MachineType::Float32()); + RunLoadStoreRelocationOffset<double>(MachineType::Float64()); +} + +TEST(Uint32LessThanRelocation) { + RawMachineAssemblerTester<uint32_t> m; + RawMachineLabel within_bounds, out_of_bounds; + Node* index = m.Int32Constant(0x200); + Node* limit = + m.RelocatableInt32Constant(0x200, RelocInfo::WASM_MEMORY_SIZE_REFERENCE); + Node* cond = m.AddNode(m.machine()->Uint32LessThan(), index, limit); + m.Branch(cond, &within_bounds, &out_of_bounds); + m.Bind(&within_bounds); + m.Return(m.Int32Constant(0xaced)); + m.Bind(&out_of_bounds); + m.Return(m.Int32Constant(0xdeadbeef)); + // Check that index is out of bounds with current size + CHECK_EQ(0xdeadbeef, m.Call()); + m.GenerateCode(); + + Handle<Code> code = m.GetCode(); + UpdateMemoryReferences(code, reinterpret_cast<Address>(1234), + reinterpret_cast<Address>(1234), 0x200, 0x400); + // Check that after limit is increased, index is within bounds. + CHECK_EQ(0xaced, m.Call()); +} diff --git a/deps/v8/test/cctest/compiler/test-simplified-lowering.cc b/deps/v8/test/cctest/compiler/test-simplified-lowering.cc index b5e992915f..2e3dcd148a 100644 --- a/deps/v8/test/cctest/compiler/test-simplified-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-simplified-lowering.cc @@ -6,13 +6,14 @@ #include "src/ast/scopes.h" #include "src/compiler/access-builder.h" -#include "src/compiler/change-lowering.h" #include "src/compiler/control-builders.h" -#include "src/compiler/graph-reducer.h" +#include "src/compiler/effect-control-linearizer.h" #include "src/compiler/graph-visualizer.h" +#include "src/compiler/memory-optimizer.h" #include "src/compiler/node-properties.h" #include "src/compiler/pipeline.h" #include "src/compiler/representation-change.h" +#include "src/compiler/scheduler.h" #include "src/compiler/simplified-lowering.h" #include "src/compiler/source-position.h" #include "src/compiler/typer.h" @@ -36,14 +37,15 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { SimplifiedLoweringTester(MachineType p0 = MachineType::None(), MachineType p1 = MachineType::None()) : GraphBuilderTester<ReturnType>(p0, p1), - typer(this->isolate(), this->graph()), + typer(new Typer(this->isolate(), this->graph())), javascript(this->zone()), jsgraph(this->isolate(), this->graph(), this->common(), &javascript, this->simplified(), this->machine()), source_positions(jsgraph.graph()), lowering(&jsgraph, this->zone(), &source_positions) {} + ~SimplifiedLoweringTester() final { delete typer; } - Typer typer; + Typer* typer = nullptr; JSOperatorBuilder javascript; JSGraph jsgraph; SourcePositionTable source_positions; @@ -51,20 +53,24 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { void LowerAllNodes() { this->End(); - typer.Run(); + typer->Run(); + delete typer, typer = nullptr; lowering.LowerAllNodes(); } void LowerAllNodesAndLowerChanges() { this->End(); - typer.Run(); + typer->Run(); + delete typer, typer = nullptr; lowering.LowerAllNodes(); - ChangeLowering lowering(&jsgraph); - GraphReducer reducer(this->zone(), this->graph()); - reducer.AddReducer(&lowering); - reducer.ReduceGraph(); - Verifier::Run(this->graph()); + Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), + Scheduler::kNoFlags); + EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); + linearizer.Run(); + + MemoryOptimizer memory_optimizer(&jsgraph, this->zone()); + memory_optimizer.Optimize(); } void CheckNumberCall(double expected, double input) { @@ -99,13 +105,15 @@ TEST(RunNumberToInt32_float64) { double input; int32_t result; SimplifiedLoweringTester<Object*> t; - FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(), - MachineType::Float64()}; + FieldAccess load = {kUntaggedBase, 0, + Handle<Name>(), Type::Number(), + MachineType::Float64(), kNoWriteBarrier}; Node* loaded = t.LoadField(load, t.PointerConstant(&input)); NodeProperties::SetType(loaded, Type::Number()); Node* convert = t.NumberToInt32(loaded); - FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Signed32(), - MachineType::Int32()}; + FieldAccess store = {kUntaggedBase, 0, + Handle<Name>(), Type::Signed32(), + MachineType::Int32(), kNoWriteBarrier}; t.StoreField(store, t.PointerConstant(&result), convert); t.Return(t.jsgraph.TrueConstant()); t.LowerAllNodesAndLowerChanges(); @@ -126,13 +134,15 @@ TEST(RunNumberToUint32_float64) { double input; uint32_t result; SimplifiedLoweringTester<Object*> t; - FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(), - MachineType::Float64()}; + FieldAccess load = {kUntaggedBase, 0, + Handle<Name>(), Type::Number(), + MachineType::Float64(), kNoWriteBarrier}; Node* loaded = t.LoadField(load, t.PointerConstant(&input)); NodeProperties::SetType(loaded, Type::Number()); Node* convert = t.NumberToUint32(loaded); - FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Unsigned32(), - MachineType::Uint32()}; + FieldAccess store = {kUntaggedBase, 0, + Handle<Name>(), Type::Unsigned32(), + MachineType::Uint32(), kNoWriteBarrier}; t.StoreField(store, t.PointerConstant(&result), convert); t.Return(t.jsgraph.TrueConstant()); t.LowerAllNodesAndLowerChanges(); @@ -291,8 +301,12 @@ TEST(RunLoadFieldFromUntaggedBase) { for (size_t i = 0; i < arraysize(smis); i++) { int offset = static_cast<int>(i * sizeof(Smi*)); - FieldAccess access = {kUntaggedBase, offset, Handle<Name>(), - Type::Integral32(), MachineType::AnyTagged()}; + FieldAccess access = {kUntaggedBase, + offset, + Handle<Name>(), + Type::Integral32(), + MachineType::AnyTagged(), + kNoWriteBarrier}; SimplifiedLoweringTester<Object*> t; Node* load = t.LoadField(access, t.PointerConstant(smis)); @@ -313,8 +327,12 @@ TEST(RunStoreFieldToUntaggedBase) { for (size_t i = 0; i < arraysize(smis); i++) { int offset = static_cast<int>(i * sizeof(Smi*)); - FieldAccess access = {kUntaggedBase, offset, Handle<Name>(), - Type::Integral32(), MachineType::AnyTagged()}; + FieldAccess access = {kUntaggedBase, + offset, + Handle<Name>(), + Type::Integral32(), + MachineType::AnyTagged(), + kNoWriteBarrier}; SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); Node* p0 = t.Parameter(0); @@ -340,7 +358,7 @@ TEST(RunLoadElementFromUntaggedBase) { for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index int offset = static_cast<int>(i * sizeof(Smi*)); ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), - MachineType::AnyTagged()}; + MachineType::AnyTagged(), kNoWriteBarrier}; SimplifiedLoweringTester<Object*> t; Node* load = t.LoadElement(access, t.PointerConstant(smis), @@ -366,7 +384,7 @@ TEST(RunStoreElementFromUntaggedBase) { for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index int offset = static_cast<int>(i * sizeof(Smi*)); ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), - MachineType::AnyTagged()}; + MachineType::AnyTagged(), kNoWriteBarrier}; SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); Node* p0 = t.Parameter(0); @@ -518,7 +536,7 @@ class AccessTester : public HandleAndZoneScope { ElementAccess GetElementAccess() { ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase, tagged ? FixedArrayBase::kHeaderSize : 0, - Type::Any(), rep}; + Type::Any(), rep, kFullWriteBarrier}; return access; } @@ -526,7 +544,10 @@ class AccessTester : public HandleAndZoneScope { int offset = field * sizeof(E); FieldAccess access = {tagged ? kTaggedBase : kUntaggedBase, offset + (tagged ? FixedArrayBase::kHeaderSize : 0), - Handle<Name>(), Type::Any(), rep}; + Handle<Name>(), + Type::Any(), + rep, + kFullWriteBarrier}; return access; } @@ -664,7 +685,7 @@ TEST(RunAllocate) { // Fills in most of the nodes of the graph in order to make tests shorter. class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { public: - Typer typer; + Typer* typer = nullptr; JSOperatorBuilder javascript; JSGraph jsgraph; Node* p0; @@ -677,7 +698,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None(), Type* p2_type = Type::None()) : GraphAndBuilders(main_zone()), - typer(main_isolate(), graph()), + typer(new Typer(main_isolate(), graph())), javascript(main_zone()), jsgraph(main_isolate(), graph(), common(), &javascript, simplified(), machine()) { @@ -690,11 +711,12 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { p0 = graph()->NewNode(common()->Parameter(0), start); p1 = graph()->NewNode(common()->Parameter(1), start); p2 = graph()->NewNode(common()->Parameter(2), start); - typer.Run(); + typer->Run(); NodeProperties::SetType(p0, p0_type); NodeProperties::SetType(p1, p1_type); NodeProperties::SetType(p2, p2_type); } + ~TestingGraph() { delete typer; } void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) { Node* node = Return(graph()->NewNode(op, p0, p1)); @@ -718,19 +740,25 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { } void Lower() { + delete typer; SourcePositionTable table(jsgraph.graph()); SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); + typer = new Typer(main_isolate(), graph()); } void LowerAllNodesAndLowerChanges() { + delete typer; SourcePositionTable table(jsgraph.graph()); SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); - ChangeLowering lowering(&jsgraph); - GraphReducer reducer(this->zone(), this->graph()); - reducer.AddReducer(&lowering); - reducer.ReduceGraph(); - Verifier::Run(this->graph()); + Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), + Scheduler::kNoFlags); + EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); + linearizer.Run(); + + MemoryOptimizer memory_optimizer(&jsgraph, this->zone()); + memory_optimizer.Optimize(); + typer = new Typer(main_isolate(), graph()); } // Inserts the node as the return value of the graph. @@ -783,7 +811,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { return graph()->NewNode(machine()->Word32Equal(), node, jsgraph.Int32Constant(1)); } else { - return graph()->NewNode(simplified()->ReferenceEqual(Type::Any()), node, + return graph()->NewNode(simplified()->ReferenceEqual(), node, jsgraph.TrueConstant()); } } @@ -831,7 +859,7 @@ TEST(LowerBooleanNot_bit_tagged) { Node* use = t.Use(inv, MachineType::AnyTagged()); t.Return(use); t.Lower(); - CHECK_EQ(IrOpcode::kChangeBitToBool, use->InputAt(0)->opcode()); + CHECK_EQ(IrOpcode::kChangeBitToTagged, use->InputAt(0)->opcode()); Node* cmp = use->InputAt(0)->InputAt(0); CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); @@ -863,7 +891,7 @@ TEST(LowerBooleanNot_tagged_tagged) { Node* use = t.Use(inv, MachineType::AnyTagged()); t.Return(use); t.Lower(); - CHECK_EQ(IrOpcode::kChangeBitToBool, use->InputAt(0)->opcode()); + CHECK_EQ(IrOpcode::kChangeBitToTagged, use->InputAt(0)->opcode()); Node* cmp = use->InputAt(0)->InputAt(0); CHECK_EQ(t.machine()->WordEqual()->opcode(), cmp->opcode()); CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); @@ -871,63 +899,6 @@ TEST(LowerBooleanNot_tagged_tagged) { CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); } - -TEST(LowerBooleanToNumber_bit_int32) { - // BooleanToNumber(x: kRepBit) used as MachineType::Int32() - TestingGraph t(Type::Boolean()); - Node* b = t.ExampleWithOutput(MachineType::Bool()); - Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); - Node* use = t.Use(cnv, MachineType::Int32()); - t.Return(use); - t.Lower(); - CHECK_EQ(b, use->InputAt(0)); -} - - -TEST(LowerBooleanToNumber_tagged_int32) { - // BooleanToNumber(x: kRepTagged) used as MachineType::Int32() - TestingGraph t(Type::Boolean()); - Node* b = t.p0; - Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); - Node* use = t.Use(cnv, MachineType::Int32()); - t.Return(use); - t.Lower(); - CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode()); - CHECK(b == cnv->InputAt(0) || b == cnv->InputAt(1)); - Node* c = t.jsgraph.TrueConstant(); - CHECK(c == cnv->InputAt(0) || c == cnv->InputAt(1)); -} - - -TEST(LowerBooleanToNumber_bit_tagged) { - // BooleanToNumber(x: kRepBit) used as MachineType::AnyTagged() - TestingGraph t(Type::Boolean()); - Node* b = t.ExampleWithOutput(MachineType::Bool()); - Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); - Node* use = t.Use(cnv, MachineType::AnyTagged()); - t.Return(use); - t.Lower(); - CHECK_EQ(b, use->InputAt(0)->InputAt(0)); - CHECK_EQ(IrOpcode::kChangeUint32ToTagged, use->InputAt(0)->opcode()); -} - - -TEST(LowerBooleanToNumber_tagged_tagged) { - // BooleanToNumber(x: kRepTagged) used as MachineType::AnyTagged() - TestingGraph t(Type::Boolean()); - Node* b = t.p0; - Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); - Node* use = t.Use(cnv, MachineType::AnyTagged()); - t.Return(use); - t.Lower(); - CHECK_EQ(cnv, use->InputAt(0)->InputAt(0)); - CHECK_EQ(IrOpcode::kChangeUint32ToTagged, use->InputAt(0)->opcode()); - CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode()); - CHECK(b == cnv->InputAt(0) || b == cnv->InputAt(1)); - Node* c = t.jsgraph.TrueConstant(); - CHECK(c == cnv->InputAt(0) || c == cnv->InputAt(1)); -} - static Type* test_types[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()}; @@ -1046,8 +1017,7 @@ TEST(LowerNumberToInt32_to_ChangeTaggedToInt32) { CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p0, use->InputAt(0)); } - -TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32) { +TEST(LowerNumberToInt32_to_TruncateFloat64ToWord32) { // NumberToInt32(x: kRepFloat64) used as MachineType::Int32() TestingGraph t(Type::Number()); Node* p0 = t.ExampleWithOutput(MachineType::Float64()); @@ -1055,22 +1025,17 @@ TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32) { Node* use = t.Use(trunc, MachineType::Int32()); t.Return(use); t.Lower(); - CheckChangeOf(IrOpcode::kTruncateFloat64ToInt32, p0, use->InputAt(0)); + CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, p0, use->InputAt(0)); } - -TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32_with_change) { +TEST(LowerNumberToInt32_to_TruncateTaggedToWord32) { // NumberToInt32(x: kTypeNumber | kRepTagged) used as MachineType::Int32() TestingGraph t(Type::Number()); Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), t.p0); Node* use = t.Use(trunc, MachineType::Int32()); t.Return(use); t.Lower(); - Node* node = use->InputAt(0); - CHECK_EQ(IrOpcode::kTruncateFloat64ToInt32, node->opcode()); - Node* of = node->InputAt(0); - CHECK_EQ(IrOpcode::kChangeTaggedToFloat64, of->opcode()); - CHECK_EQ(t.p0, of->InputAt(0)); + CheckChangeOf(IrOpcode::kTruncateTaggedToWord32, t.p0, use->InputAt(0)); } @@ -1084,8 +1049,7 @@ TEST(LowerNumberToUint32_to_ChangeTaggedToUint32) { CheckChangeOf(IrOpcode::kChangeTaggedToUint32, t.p0, use->InputAt(0)); } - -TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32) { +TEST(LowerNumberToUint32_to_TruncateFloat64ToWord32) { // NumberToUint32(x: kRepFloat64) used as MachineType::Uint32() TestingGraph t(Type::Number()); Node* p0 = t.ExampleWithOutput(MachineType::Float64()); @@ -1095,26 +1059,20 @@ TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32) { Node* use = t.Use(trunc, MachineType::Uint32()); t.Return(use); t.Lower(); - CheckChangeOf(IrOpcode::kTruncateFloat64ToInt32, p0, use->InputAt(0)); + CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, p0, use->InputAt(0)); } - -TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_with_change) { +TEST(LowerNumberToUint32_to_TruncateTaggedToWord32) { // NumberToInt32(x: kTypeNumber | kRepTagged) used as MachineType::Uint32() TestingGraph t(Type::Number()); Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), t.p0); Node* use = t.Use(trunc, MachineType::Uint32()); t.Return(use); t.Lower(); - Node* node = use->InputAt(0); - CHECK_EQ(IrOpcode::kTruncateFloat64ToInt32, node->opcode()); - Node* of = node->InputAt(0); - CHECK_EQ(IrOpcode::kChangeTaggedToFloat64, of->opcode()); - CHECK_EQ(t.p0, of->InputAt(0)); + CheckChangeOf(IrOpcode::kTruncateTaggedToWord32, t.p0, use->InputAt(0)); } - -TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_uint32) { +TEST(LowerNumberToUint32_to_TruncateFloat64ToWord32_uint32) { // NumberToUint32(x: kRepFloat64) used as kRepWord32 TestingGraph t(Type::Unsigned32()); Node* input = t.ExampleWithOutput(MachineType::Float64()); @@ -1122,7 +1080,7 @@ TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_uint32) { Node* use = t.Use(trunc, MachineType::RepWord32()); t.Return(use); t.Lower(); - CheckChangeOf(IrOpcode::kTruncateFloat64ToInt32, input, use->InputAt(0)); + CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, input, use->InputAt(0)); } @@ -1130,7 +1088,7 @@ TEST(LowerReferenceEqual_to_wordeq) { TestingGraph t(Type::Any(), Type::Any()); IrOpcode::Value opcode = static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); - t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual(Type::Any())); + t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual()); } void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, @@ -1150,7 +1108,7 @@ TEST(InsertBasicChanges) { MachineType::Int32(), Type::Signed32()); CheckChangeInsertion(IrOpcode::kChangeFloat64ToUint32, MachineType::Float64(), MachineType::Uint32(), Type::Unsigned32()); - CheckChangeInsertion(IrOpcode::kTruncateFloat64ToInt32, + CheckChangeInsertion(IrOpcode::kTruncateFloat64ToWord32, MachineType::Float64(), MachineType::Uint32(), Type::Integral32()); CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, MachineType::AnyTagged(), @@ -1160,7 +1118,7 @@ TEST(InsertBasicChanges) { Type::Unsigned32()); CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, MachineType::Float64(), - MachineType::AnyTagged()); + MachineType::AnyTagged(), Type::Number()); CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64, MachineType::AnyTagged(), MachineType::Float64(), Type::Number()); @@ -1178,8 +1136,7 @@ TEST(InsertBasicChanges) { static void CheckChangesAroundBinop(TestingGraph* t, const Operator* op, IrOpcode::Value input_change, - IrOpcode::Value output_change, - Type* type = Type::Any()) { + IrOpcode::Value output_change, Type* type) { Node* binop = op->ControlInputCount() == 0 ? t->graph()->NewNode(op, t->p0, t->p1) @@ -1222,7 +1179,7 @@ TEST(InsertChangesAroundInt32Cmp) { for (size_t i = 0; i < arraysize(ops); i++) { CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToInt32, - IrOpcode::kChangeBitToBool); + IrOpcode::kChangeBitToTagged, Type::Boolean()); } } @@ -1235,7 +1192,7 @@ TEST(InsertChangesAroundUint32Cmp) { for (size_t i = 0; i < arraysize(ops); i++) { CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToUint32, - IrOpcode::kChangeBitToBool); + IrOpcode::kChangeBitToTagged, Type::Boolean()); } } @@ -1251,7 +1208,7 @@ TEST(InsertChangesAroundFloat64Binops) { for (size_t i = 0; i < arraysize(ops); i++) { CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64, - IrOpcode::kChangeFloat64ToTagged); + IrOpcode::kChangeFloat64ToTagged, Type::Number()); } } @@ -1265,7 +1222,7 @@ TEST(InsertChangesAroundFloat64Cmp) { for (size_t i = 0; i < arraysize(ops); i++) { CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64, - IrOpcode::kChangeBitToBool); + IrOpcode::kChangeBitToTagged, Type::Boolean()); } } @@ -1281,23 +1238,38 @@ void CheckFieldAccessArithmetic(FieldAccess access, Node* load_or_store) { Node* CheckElementAccessArithmetic(ElementAccess access, Node* load_or_store) { Node* index = load_or_store->InputAt(1); if (kPointerSize == 8) { + Int64BinopMatcher mindex(index); + CHECK_EQ(IrOpcode::kInt64Add, mindex.node()->opcode()); + CHECK(mindex.right().Is(access.header_size - access.tag())); + + const int element_size_shift = + ElementSizeLog2Of(access.machine_type.representation()); + Node* index; + if (element_size_shift) { + Int64BinopMatcher shl(mindex.left().node()); + CHECK_EQ(IrOpcode::kWord64Shl, shl.node()->opcode()); + CHECK(shl.right().Is(element_size_shift)); + index = shl.left().node(); + } else { + index = mindex.left().node(); + } CHECK_EQ(IrOpcode::kChangeUint32ToUint64, index->opcode()); - index = index->InputAt(0); - } - - Int32BinopMatcher mindex(index); - CHECK_EQ(IrOpcode::kInt32Add, mindex.node()->opcode()); - CHECK(mindex.right().Is(access.header_size - access.tag())); - - const int element_size_shift = - ElementSizeLog2Of(access.machine_type.representation()); - if (element_size_shift) { - Int32BinopMatcher shl(mindex.left().node()); - CHECK_EQ(IrOpcode::kWord32Shl, shl.node()->opcode()); - CHECK(shl.right().Is(element_size_shift)); - return shl.left().node(); + return index->InputAt(0); } else { - return mindex.left().node(); + Int32BinopMatcher mindex(index); + CHECK_EQ(IrOpcode::kInt32Add, mindex.node()->opcode()); + CHECK(mindex.right().Is(access.header_size - access.tag())); + + const int element_size_shift = + ElementSizeLog2Of(access.machine_type.representation()); + if (element_size_shift) { + Int32BinopMatcher shl(mindex.left().node()); + CHECK_EQ(IrOpcode::kWord32Shl, shl.node()->opcode()); + CHECK(shl.right().Is(element_size_shift)); + return shl.left().node(); + } else { + return mindex.left().node(); + } } } @@ -1311,11 +1283,11 @@ const MachineType kMachineReps[] = { TEST(LowerLoadField_to_load) { - TestingGraph t(Type::Any(), Type::Signed32()); - for (size_t i = 0; i < arraysize(kMachineReps); i++) { - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), kMachineReps[i]}; + TestingGraph t(Type::Any(), Type::Signed32()); + FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, + Handle<Name>::null(), Type::Any(), + kMachineReps[i], kNoWriteBarrier}; Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, t.start, t.start); @@ -1337,9 +1309,9 @@ TEST(LowerStoreField_to_store) { TestingGraph t(Type::Any(), Type::Signed32()); for (size_t i = 0; i < arraysize(kMachineReps); i++) { - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), kMachineReps[i]}; - + FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, + Handle<Name>::null(), Type::Any(), + kMachineReps[i], kNoWriteBarrier}; Node* val = t.ExampleWithOutput(kMachineReps[i]); Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, @@ -1352,7 +1324,7 @@ TEST(LowerStoreField_to_store) { StoreRepresentation rep = StoreRepresentationOf(store->op()); if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { - CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); + CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); } CHECK_EQ(kMachineReps[i].representation(), rep.representation()); } @@ -1362,9 +1334,9 @@ TEST(LowerStoreField_to_store) { Zone* z = scope.main_zone(); TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z)); - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), - MachineType::AnyTagged()}; + FieldAccess access = { + kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), + Type::Any(), MachineType::AnyTagged(), kNoWriteBarrier}; Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, t.p1, t.start, t.start); t.Effect(store); @@ -1378,11 +1350,10 @@ TEST(LowerStoreField_to_store) { TEST(LowerLoadElement_to_load) { - TestingGraph t(Type::Any(), Type::Signed32()); - for (size_t i = 0; i < arraysize(kMachineReps); i++) { + TestingGraph t(Type::Any(), Type::Signed32()); ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Any(), kMachineReps[i]}; + Type::Any(), kMachineReps[i], kNoWriteBarrier}; Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1, t.start, t.start); @@ -1401,11 +1372,11 @@ TEST(LowerLoadElement_to_load) { TEST(LowerStoreElement_to_store) { { - TestingGraph t(Type::Any(), Type::Signed32()); - for (size_t i = 0; i < arraysize(kMachineReps); i++) { + TestingGraph t(Type::Any(), Type::Signed32()); + ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Any(), kMachineReps[i]}; + Type::Any(), kMachineReps[i], kNoWriteBarrier}; Node* val = t.ExampleWithOutput(kMachineReps[i]); Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), @@ -1418,7 +1389,7 @@ TEST(LowerStoreElement_to_store) { StoreRepresentation rep = StoreRepresentationOf(store->op()); if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { - CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); + CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); } CHECK_EQ(kMachineReps[i].representation(), rep.representation()); } @@ -1430,7 +1401,8 @@ TEST(LowerStoreElement_to_store) { Type::Any(), Type::Signed32(), Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z)); ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Any(), MachineType::AnyTagged()}; + Type::Any(), MachineType::AnyTagged(), + kNoWriteBarrier}; Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, t.p1, t.p2, t.start, t.start); t.Effect(store); @@ -1448,7 +1420,7 @@ TEST(InsertChangeForLoadElementIndex) { // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) TestingGraph t(Type::Any(), Type::Signed32()); ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::AnyTagged()}; + MachineType::AnyTagged(), kNoWriteBarrier}; Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1, t.start, t.start); @@ -1465,7 +1437,7 @@ TEST(InsertChangeForStoreElementIndex) { // Store(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k), val) TestingGraph t(Type::Any(), Type::Signed32()); ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::AnyTagged()}; + MachineType::AnyTagged(), kFullWriteBarrier}; Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, t.p1, @@ -1481,8 +1453,9 @@ TEST(InsertChangeForStoreElementIndex) { TEST(InsertChangeForLoadElement) { // TODO(titzer): test all load/store representation change insertions. TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::Float64()}; + ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, + Type::Number(), MachineType::Float64(), + kNoWriteBarrier}; Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1, t.start, t.start); @@ -1497,9 +1470,9 @@ TEST(InsertChangeForLoadElement) { TEST(InsertChangeForLoadField) { // TODO(titzer): test all load/store representation change insertions. TestingGraph t(Type::Any(), Type::Signed32()); - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), - MachineType::Float64()}; + FieldAccess access = { + kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), + Type::Number(), MachineType::Float64(), kNoWriteBarrier}; Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, t.start, t.start); @@ -1515,7 +1488,7 @@ TEST(InsertChangeForStoreElement) { // TODO(titzer): test all load/store representation change insertions. TestingGraph t(Type::Any(), Type::Signed32()); ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::Float64()}; + MachineType::Float64(), kFullWriteBarrier}; Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, @@ -1532,9 +1505,9 @@ TEST(InsertChangeForStoreElement) { TEST(InsertChangeForStoreField) { // TODO(titzer): test all load/store representation change insertions. TestingGraph t(Type::Any(), Type::Signed32()); - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), - MachineType::Float64()}; + FieldAccess access = { + kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), + Type::Any(), MachineType::Float64(), kNoWriteBarrier}; Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, t.p1, t.start, t.start); @@ -1554,8 +1527,9 @@ TEST(UpdatePhi) { Type* kTypes[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()}; for (size_t i = 0; i < arraysize(kMachineTypes); i++) { - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), kTypes[i], kMachineTypes[i]}; + FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, + Handle<Name>::null(), kTypes[i], + kMachineTypes[i], kFullWriteBarrier}; Node* load0 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, t.start, t.start); @@ -1573,84 +1547,6 @@ TEST(UpdatePhi) { } -TEST(RunNumberDivide_minus_1_TruncatingToInt32) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToInt32(t.Parameter(0)); - Node* div = t.NumberDivide(num, t.jsgraph.Constant(-1)); - Node* trunc = t.NumberToInt32(div); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_INT32_INPUTS(i) { - int32_t x = 0 - *i; - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } -} - - -TEST(RunNumberMultiply_TruncatingToInt32) { - int32_t constants[] = {-100, -10, -1, 0, 1, 100, 1000, 3000999}; - - for (size_t i = 0; i < arraysize(constants); i++) { - double k = static_cast<double>(constants[i]); - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToInt32(t.Parameter(0)); - Node* mul = t.NumberMultiply(num, t.jsgraph.Constant(k)); - Node* trunc = t.NumberToInt32(mul); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_INT32_INPUTS(i) { - int32_t x = DoubleToInt32(static_cast<double>(*i) * k); - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } - } -} - - -TEST(RunNumberMultiply_TruncatingToUint32) { - uint32_t constants[] = {0, 1, 2, 3, 4, 100, 1000, 1024, 2048, 3000999}; - - for (size_t i = 0; i < arraysize(constants); i++) { - double k = static_cast<double>(constants[i]); - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToUint32(t.Parameter(0)); - Node* mul = t.NumberMultiply(num, t.jsgraph.Constant(k)); - Node* trunc = t.NumberToUint32(mul); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_UINT32_INPUTS(i) { - uint32_t x = DoubleToUint32(static_cast<double>(*i) * k); - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } - } -} - - -TEST(RunNumberDivide_2_TruncatingToUint32) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToUint32(t.Parameter(0)); - Node* div = t.NumberDivide(num, t.jsgraph.Constant(2)); - Node* trunc = t.NumberToUint32(div); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_UINT32_INPUTS(i) { - uint32_t x = DoubleToUint32(static_cast<double>(*i / 2.0)); - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } -} - - TEST(NumberMultiply_ConstantOutOfRange) { TestingGraph t(Type::Signed32()); Node* k = t.jsgraph.Constant(1000000023); @@ -1690,29 +1586,6 @@ TEST(NumberDivide_TruncatingToInt32) { } -TEST(RunNumberDivide_TruncatingToInt32) { - int32_t constants[] = {-100, -10, -1, 1, 2, 100, 1000, 1024, 2048}; - - for (size_t i = 0; i < arraysize(constants); i++) { - int32_t k = constants[i]; - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToInt32(t.Parameter(0)); - Node* div = t.NumberDivide(num, t.jsgraph.Constant(k)); - Node* trunc = t.NumberToInt32(div); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_INT32_INPUTS(i) { - if (*i == INT_MAX) continue; // exclude max int. - int32_t x = DoubleToInt32(static_cast<double>(*i) / k); - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } - } -} - - TEST(NumberDivide_TruncatingToUint32) { double constants[] = {1, 3, 100, 1000, 100998348}; @@ -1729,28 +1602,6 @@ TEST(NumberDivide_TruncatingToUint32) { } -TEST(RunNumberDivide_TruncatingToUint32) { - uint32_t constants[] = {100, 10, 1, 1, 2, 4, 1000, 1024, 2048}; - - for (size_t i = 0; i < arraysize(constants); i++) { - uint32_t k = constants[i]; - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToUint32(t.Parameter(0)); - Node* div = t.NumberDivide(num, t.jsgraph.Constant(static_cast<double>(k))); - Node* trunc = t.NumberToUint32(div); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_UINT32_INPUTS(i) { - uint32_t x = *i / k; - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } - } -} - - TEST(NumberDivide_BadConstants) { { TestingGraph t(Type::Signed32()); @@ -1805,29 +1656,6 @@ TEST(NumberModulus_TruncatingToInt32) { } -TEST(RunNumberModulus_TruncatingToInt32) { - int32_t constants[] = {-100, -10, -1, 1, 2, 100, 1000, 1024, 2048}; - - for (size_t i = 0; i < arraysize(constants); i++) { - int32_t k = constants[i]; - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToInt32(t.Parameter(0)); - Node* mod = t.NumberModulus(num, t.jsgraph.Constant(k)); - Node* trunc = t.NumberToInt32(mod); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_INT32_INPUTS(i) { - if (*i == INT_MAX) continue; // exclude max int. - int32_t x = DoubleToInt32(std::fmod(static_cast<double>(*i), k)); - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } - } -} - - TEST(NumberModulus_TruncatingToUint32) { double constants[] = {1, 3, 100, 1000, 100998348}; @@ -1844,29 +1672,6 @@ TEST(NumberModulus_TruncatingToUint32) { } -TEST(RunNumberModulus_TruncatingToUint32) { - uint32_t constants[] = {1, 2, 100, 1000, 1024, 2048}; - - for (size_t i = 0; i < arraysize(constants); i++) { - uint32_t k = constants[i]; - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* num = t.NumberToUint32(t.Parameter(0)); - Node* mod = - t.NumberModulus(num, t.jsgraph.Constant(static_cast<double>(k))); - Node* trunc = t.NumberToUint32(mod); - t.Return(trunc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_UINT32_INPUTS(i) { - uint32_t x = *i % k; - t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i)); - } - } -} - - TEST(NumberModulus_Int32) { int32_t constants[] = {-100, -10, 1, 4, 100, 1000}; diff --git a/deps/v8/test/cctest/compiler/value-helper.h b/deps/v8/test/cctest/compiler/value-helper.h index 7d26dbaf0c..297bccb05b 100644 --- a/deps/v8/test/cctest/compiler/value-helper.h +++ b/deps/v8/test/cctest/compiler/value-helper.h @@ -82,6 +82,9 @@ class ValueHelper { -4.66622e+11f, -2.22581e+11f, -1.45381e+10f, + -2147483904.0f, // First float32 after INT32_MIN + -2147483648.0f, // INT32_MIN + -2147483520.0f, // Last float32 before INT32_MIN -1.3956e+09f, -1.32951e+09f, -1.30721e+09f, @@ -110,7 +113,9 @@ class ValueHelper { -3.63759e-10f, -4.30175e-14f, -5.27385e-15f, + -1.5707963267948966f, -1.48084e-15f, + -2.220446049250313e-16f, -1.05755e-19f, -3.2995e-21f, -1.67354e-23f, @@ -129,6 +134,7 @@ class ValueHelper { 6.25073e-22f, 4.1723e-13f, 1.44343e-09f, + 1.5707963267948966f, 5.27004e-08f, 9.48298e-08f, 5.57888e-07f, @@ -148,11 +154,13 @@ class ValueHelper { 20309.0f, 797056.0f, 1.77219e+09f, + 2147483648.0f, // INT32_MAX + 1 + 4294967296.0f, // UINT32_MAX + 1 1.51116e+11f, 4.18193e+13f, 3.59167e+16f, - 9223372036854775807.0f, // INT64_MAX - 18446744073709551615.0f, // UINT64_MAX + 9223372036854775808.0f, // INT64_MAX + 1 + 18446744073709551616.0f, // UINT64_MAX + 1 3.38211e+19f, 2.67488e+20f, 1.78831e+21f, @@ -177,6 +185,7 @@ class ValueHelper { static std::vector<double> float64_vector() { static const double nan = std::numeric_limits<double>::quiet_NaN(); static const double values[] = {-2e66, + -2.220446049250313e-16, -9223373136366403584.0, -9223372036854775808.0, // INT64_MIN -2147483649.5, @@ -188,6 +197,7 @@ class ValueHelper { -999.75, -2e66, -1.75, + -1.5707963267948966, -1.0, -0.5, -0.0, @@ -198,7 +208,11 @@ class ValueHelper { 0.375, 0.5, 1.0, + 1.17549e-38, + 1.56657e-37, + 1.0000001, 1.25, + 1.5707963267948966, 2, 3.1e7, 5.125, @@ -211,9 +225,9 @@ class ValueHelper { 2147483648.0, 2147483648.25, 2147483649.25, - 9223372036854775807.0, // INT64_MAX + 9223372036854775808.0, // INT64_MAX + 1 9223373136366403584.0, - 18446744073709551615.0, // UINT64_MAX + 18446744073709551616.0, // UINT64_MAX + 1 2e66, V8_INFINITY, -V8_INFINITY, @@ -318,6 +332,7 @@ static inline void CheckFloatEq(volatile float x, volatile float y) { CHECK(std::isnan(y)); } else { CHECK_EQ(x, y); + CHECK_EQ(std::signbit(x), std::signbit(y)); } } @@ -332,6 +347,7 @@ static inline void CheckDoubleEq(volatile double x, volatile double y) { CHECK(std::isnan(y)); } else { CHECK_EQ(x, y); + CHECK_EQ(std::signbit(x), std::signbit(y)); } } diff --git a/deps/v8/test/cctest/expression-type-collector.cc b/deps/v8/test/cctest/expression-type-collector.cc deleted file mode 100644 index c5218b3ec4..0000000000 --- a/deps/v8/test/cctest/expression-type-collector.cc +++ /dev/null @@ -1,63 +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 "test/cctest/expression-type-collector.h" - -#include "src/ast/ast.h" -#include "src/ast/scopes.h" -#include "src/codegen.h" - -namespace v8 { -namespace internal { -namespace { - -struct { - AstNode::NodeType type; - const char* name; -} NodeTypeNameList[] = { -#define DECLARE_VISIT(type) \ - { AstNode::k##type, #type } \ - , - AST_NODE_LIST(DECLARE_VISIT) -#undef DECLARE_VISIT -}; - -} // namespace - - -ExpressionTypeCollector::ExpressionTypeCollector( - Isolate* isolate, FunctionLiteral* root, - ZoneVector<ExpressionTypeEntry>* dst) - : AstExpressionVisitor(isolate, root), result_(dst) {} - - -void ExpressionTypeCollector::Run() { - result_->clear(); - AstExpressionVisitor::Run(); -} - - -void ExpressionTypeCollector::VisitExpression(Expression* expression) { - ExpressionTypeEntry e; - e.depth = depth(); - VariableProxy* proxy = expression->AsVariableProxy(); - if (proxy) { - e.name = proxy->raw_name(); - } - e.bounds = expression->bounds(); - AstNode::NodeType type = expression->node_type(); - e.kind = "unknown"; - for (size_t i = 0; i < arraysize(NodeTypeNameList); ++i) { - if (NodeTypeNameList[i].type == type) { - e.kind = NodeTypeNameList[i].name; - break; - } - } - result_->push_back(e); -} - -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/cctest/expression-type-collector.h b/deps/v8/test/cctest/expression-type-collector.h deleted file mode 100644 index 37bb9a3c02..0000000000 --- a/deps/v8/test/cctest/expression-type-collector.h +++ /dev/null @@ -1,39 +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. - -#ifndef V8_EXPRESSION_TYPE_COLLECTOR_H_ -#define V8_EXPRESSION_TYPE_COLLECTOR_H_ - -#include "src/ast/ast-expression-visitor.h" - -namespace v8 { -namespace internal { - -// A Visitor over an AST that collects a human readable string summarizing -// structure and types. Used for testing of the typing information attached -// to the expression nodes of an AST. - -struct ExpressionTypeEntry { - int depth; - const char* kind; - const AstRawString* name; - Bounds bounds; -}; - -class ExpressionTypeCollector : public AstExpressionVisitor { - public: - ExpressionTypeCollector(Isolate* isolate, FunctionLiteral* root, - ZoneVector<ExpressionTypeEntry>* dst); - void Run(); - - protected: - void VisitExpression(Expression* expression); - - private: - ZoneVector<ExpressionTypeEntry>* result_; -}; -} // namespace internal -} // namespace v8 - -#endif // V8_EXPRESSION_TYPE_COLLECTOR_H_ diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h index 599c5d8be2..674bdcb1cc 100644 --- a/deps/v8/test/cctest/heap/heap-tester.h +++ b/deps/v8/test/cctest/heap/heap-tester.h @@ -17,6 +17,7 @@ V(CompactionPartiallyAbortedPageWithStoreBufferEntries) \ V(CompactionSpaceDivideMultiplePages) \ V(CompactionSpaceDivideSinglePage) \ + V(TestNewSpaceRefsInCopiedCode) \ V(GCFlags) \ V(MarkCompactCollector) \ V(NoPromotion) \ diff --git a/deps/v8/test/cctest/heap/utils-inl.h b/deps/v8/test/cctest/heap/heap-utils.cc index 56033c151e..7d4d4bf40d 100644 --- a/deps/v8/test/cctest/heap/utils-inl.h +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -1,9 +1,8 @@ -// Copyright 2015 the V8 project authors. All rights reserved. +// Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef HEAP_UTILS_H_ -#define HEAP_UTILS_H_ +#include "test/cctest/heap/heap-utils.h" #include "src/factory.h" #include "src/heap/heap-inl.h" @@ -11,18 +10,27 @@ #include "src/heap/mark-compact.h" #include "src/isolate.h" - namespace v8 { namespace internal { +namespace heap { + +void SealCurrentObjects(Heap* heap) { + heap->CollectAllGarbage(); + heap->CollectAllGarbage(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); + heap->old_space()->EmptyAllocationInfo(); + for (Page* page : *heap->old_space()) { + page->MarkNeverAllocateForTesting(); + } +} -static int LenFromSize(int size) { +int FixedArrayLenFromSize(int size) { return (size - FixedArray::kHeaderSize) / kPointerSize; } - -static inline std::vector<Handle<FixedArray>> CreatePadding( - Heap* heap, int padding_size, PretenureFlag tenure, - int object_size = Page::kMaxRegularHeapObjectSize) { +std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, + PretenureFlag tenure, + int object_size) { std::vector<Handle<FixedArray>> handles; Isolate* isolate = heap->isolate(); int allocate_memory; @@ -42,14 +50,17 @@ static inline std::vector<Handle<FixedArray>> CreatePadding( while (free_memory > 0) { if (free_memory > object_size) { allocate_memory = object_size; - length = LenFromSize(allocate_memory); + length = FixedArrayLenFromSize(allocate_memory); } else { allocate_memory = free_memory; - length = LenFromSize(allocate_memory); + length = FixedArrayLenFromSize(allocate_memory); if (length <= 0) { // Not enough room to create another fixed array. Let's create a filler. - heap->CreateFillerObjectAt(*heap->old_space()->allocation_top_address(), - free_memory, ClearRecordedSlots::kNo); + if (free_memory > (2 * kPointerSize)) { + heap->CreateFillerObjectAt( + *heap->old_space()->allocation_top_address(), free_memory, + ClearRecordedSlots::kNo); + } break; } } @@ -61,55 +72,46 @@ static inline std::vector<Handle<FixedArray>> CreatePadding( return handles; } - -// Helper function that simulates a full new-space in the heap. -static inline bool FillUpOnePage(v8::internal::NewSpace* space) { - space->DisableInlineAllocationSteps(); - int space_remaining = static_cast<int>(*space->allocation_limit_address() - - *space->allocation_top_address()); - if (space_remaining == 0) return false; - CreatePadding(space->heap(), space_remaining, i::NOT_TENURED); - return true; -} - - -// Helper function that simulates a fill new-space in the heap. -static inline void AllocateAllButNBytes(v8::internal::NewSpace* space, - int extra_bytes) { +void AllocateAllButNBytes(v8::internal::NewSpace* space, int extra_bytes, + std::vector<Handle<FixedArray>>* out_handles) { space->DisableInlineAllocationSteps(); int space_remaining = static_cast<int>(*space->allocation_limit_address() - *space->allocation_top_address()); CHECK(space_remaining >= extra_bytes); int new_linear_size = space_remaining - extra_bytes; if (new_linear_size == 0) return; - CreatePadding(space->heap(), new_linear_size, i::NOT_TENURED); + std::vector<Handle<FixedArray>> handles = + heap::CreatePadding(space->heap(), new_linear_size, i::NOT_TENURED); + if (out_handles != nullptr) + out_handles->insert(out_handles->end(), handles.begin(), handles.end()); } - -static inline void FillCurrentPage(v8::internal::NewSpace* space) { - AllocateAllButNBytes(space, 0); +void FillCurrentPage(v8::internal::NewSpace* space, + std::vector<Handle<FixedArray>>* out_handles) { + heap::AllocateAllButNBytes(space, 0, out_handles); } - -static inline void SimulateFullSpace(v8::internal::NewSpace* space) { - FillCurrentPage(space); - while (FillUpOnePage(space)) { - } +bool FillUpOnePage(v8::internal::NewSpace* space, + std::vector<Handle<FixedArray>>* out_handles) { + space->DisableInlineAllocationSteps(); + int space_remaining = static_cast<int>(*space->allocation_limit_address() - + *space->allocation_top_address()); + if (space_remaining == 0) return false; + std::vector<Handle<FixedArray>> handles = + heap::CreatePadding(space->heap(), space_remaining, i::NOT_TENURED); + if (out_handles != nullptr) + out_handles->insert(out_handles->end(), handles.begin(), handles.end()); + return true; } - -// Helper function that simulates a full old-space in the heap. -static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { - space->EmptyAllocationInfo(); - space->ResetFreeList(); - space->ClearStats(); +void SimulateFullSpace(v8::internal::NewSpace* space, + std::vector<Handle<FixedArray>>* out_handles) { + heap::FillCurrentPage(space, out_handles); + while (heap::FillUpOnePage(space, out_handles) || space->AddFreshPage()) { + } } - -// Helper function that simulates many incremental marking steps until -// marking is completed. -static inline void SimulateIncrementalMarking(i::Heap* heap, - bool force_completion = true) { +void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) { i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); if (collector->sweeping_in_progress()) { @@ -131,7 +133,26 @@ static inline void SimulateIncrementalMarking(i::Heap* heap, CHECK(marking->IsComplete()); } +void SimulateFullSpace(v8::internal::PagedSpace* space) { + space->EmptyAllocationInfo(); + space->ResetFreeList(); + space->ClearStats(); +} + +void AbandonCurrentlyFreeMemory(PagedSpace* space) { + space->EmptyAllocationInfo(); + for (Page* page : *space) { + page->MarkNeverAllocateForTesting(); + } +} + +void GcAndSweep(Heap* heap, AllocationSpace space) { + heap->CollectGarbage(space); + if (heap->mark_compact_collector()->sweeping_in_progress()) { + heap->mark_compact_collector()->EnsureSweepingCompleted(); + } +} + +} // namespace heap } // namespace internal } // namespace v8 - -#endif // HEAP_UTILS_H_ diff --git a/deps/v8/test/cctest/heap/heap-utils.h b/deps/v8/test/cctest/heap/heap-utils.h new file mode 100644 index 0000000000..e03e6fa6e0 --- /dev/null +++ b/deps/v8/test/cctest/heap/heap-utils.h @@ -0,0 +1,51 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef HEAP_HEAP_UTILS_H_ +#define HEAP_HEAP_UTILS_H_ + +#include "src/heap/heap.h" + +namespace v8 { +namespace internal { +namespace heap { + +void SealCurrentObjects(Heap* heap); + +int FixedArrayLenFromSize(int size); + +std::vector<Handle<FixedArray>> CreatePadding( + Heap* heap, int padding_size, PretenureFlag tenure, + int object_size = Page::kMaxRegularHeapObjectSize); + +void AllocateAllButNBytes( + v8::internal::NewSpace* space, int extra_bytes, + std::vector<Handle<FixedArray>>* out_handles = nullptr); + +void FillCurrentPage(v8::internal::NewSpace* space, + std::vector<Handle<FixedArray>>* out_handles = nullptr); + +// Helper function that simulates a full new-space in the heap. +bool FillUpOnePage(v8::internal::NewSpace* space, + std::vector<Handle<FixedArray>>* out_handles = nullptr); + +void SimulateFullSpace(v8::internal::NewSpace* space, + std::vector<Handle<FixedArray>>* out_handles = nullptr); + +// Helper function that simulates many incremental marking steps until +// marking is completed. +void SimulateIncrementalMarking(i::Heap* heap, bool force_completion = true); + +// Helper function that simulates a full old-space in the heap. +void SimulateFullSpace(v8::internal::PagedSpace* space); + +void AbandonCurrentlyFreeMemory(PagedSpace* space); + +void GcAndSweep(Heap* heap, AllocationSpace space); + +} // namespace heap +} // namespace internal +} // namespace v8 + +#endif // HEAP_HEAP_UTILS_H_ diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc index 1b969b21ff..348ba1979d 100644 --- a/deps/v8/test/cctest/heap/test-alloc.cc +++ b/deps/v8/test/cctest/heap/test-alloc.cc @@ -31,7 +31,7 @@ #include "src/accessors.h" #include "src/api.h" #include "test/cctest/heap/heap-tester.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" using namespace v8::internal; @@ -52,11 +52,11 @@ AllocationResult v8::internal::HeapTester::AllocateAfterFailures() { heap->CopyJSObject(JSObject::cast(object)).ToObjectChecked(); // Old data space. - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); heap->AllocateByteArray(100, TENURED).ToObjectChecked(); // Old pointer space. - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); heap->AllocateFixedArray(10000, TENURED).ToObjectChecked(); // Large object space. @@ -72,12 +72,12 @@ AllocationResult v8::internal::HeapTester::AllocateAfterFailures() { kLargeObjectSpaceFillerLength, TENURED).ToObjectChecked(); // Map space. - SimulateFullSpace(heap->map_space()); + heap::SimulateFullSpace(heap->map_space()); int instance_size = JSObject::kHeaderSize; heap->AllocateMap(JS_OBJECT_TYPE, instance_size).ToObjectChecked(); // Test that we can allocate in old pointer space and code space. - SimulateFullSpace(heap->code_space()); + heap::SimulateFullSpace(heap->code_space()); heap->AllocateFixedArray(100, TENURED).ToObjectChecked(); heap->CopyCode(CcTest::i_isolate()->builtins()->builtin( Builtins::kIllegal)).ToObjectChecked(); @@ -102,7 +102,7 @@ HEAP_TEST(StressHandles) { v8::Local<v8::Context> env = v8::Context::New(CcTest::isolate()); env->Enter(); Handle<Object> o = TestAllocateAfterFailures(); - CHECK(o->IsTrue()); + CHECK(o->IsTrue(CcTest::i_isolate())); env->Exit(); } @@ -211,8 +211,7 @@ TEST(CodeRange) { const size_t code_range_size = 32*MB; CcTest::InitializeVM(); CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate())); - code_range.SetUp(code_range_size + - kReservedCodeRangePages * v8::base::OS::CommitPageSize()); + code_range.SetUp(code_range_size); size_t current_allocated = 0; size_t total_allocated = 0; List< ::Block> blocks(1000); diff --git a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc new file mode 100644 index 0000000000..b331f6bf3a --- /dev/null +++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc @@ -0,0 +1,318 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/heap/array-buffer-tracker.h" +#include "test/cctest/cctest.h" +#include "test/cctest/heap/heap-utils.h" + +namespace { + +typedef i::LocalArrayBufferTracker LocalTracker; + +bool IsTracked(i::JSArrayBuffer* buf) { + return i::ArrayBufferTracker::IsTracked(buf); +} + +} // namespace + +namespace v8 { +namespace internal { + +// The following tests make sure that JSArrayBuffer tracking works expected when +// moving the objects through various spaces during GC phases. + +TEST(ArrayBuffer_OnlyMC) { + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + + JSArrayBuffer* raw_ab = nullptr; + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(IsTracked(*buf)); + raw_ab = *buf; + // Prohibit page from being released. + Page::FromAddress(buf->address())->MarkNeverEvacuate(); + } + // 2 GCs are needed because we promote to old space as live, meaning that + // we will survive one GC. + heap::GcAndSweep(heap, OLD_SPACE); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(!IsTracked(raw_ab)); +} + +TEST(ArrayBuffer_OnlyScavenge) { + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + + JSArrayBuffer* raw_ab = nullptr; + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + raw_ab = *buf; + // Prohibit page from being released. + Page::FromAddress(buf->address())->MarkNeverEvacuate(); + } + // 2 GCs are needed because we promote to old space as live, meaning that + // we will survive one GC. + heap::GcAndSweep(heap, OLD_SPACE); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(!IsTracked(raw_ab)); +} + +TEST(ArrayBuffer_ScavengeAndMC) { + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + + JSArrayBuffer* raw_ab = nullptr; + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + raw_ab = *buf; + // Prohibit page from being released. + Page::FromAddress(buf->address())->MarkNeverEvacuate(); + } + // 2 GCs are needed because we promote to old space as live, meaning that + // we will survive one GC. + heap::GcAndSweep(heap, OLD_SPACE); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(!IsTracked(raw_ab)); +} + +TEST(ArrayBuffer_Compaction) { + FLAG_manual_evacuation_candidates_selection = true; + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + heap::AbandonCurrentlyFreeMemory(heap->old_space()); + + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); + CHECK(IsTracked(*buf1)); + heap::GcAndSweep(heap, NEW_SPACE); + heap::GcAndSweep(heap, NEW_SPACE); + + Page* page_before_gc = Page::FromAddress(buf1->address()); + page_before_gc->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + CHECK(IsTracked(*buf1)); + + heap->CollectAllGarbage(); + + Page* page_after_gc = Page::FromAddress(buf1->address()); + CHECK(IsTracked(*buf1)); + + CHECK_NE(page_before_gc, page_after_gc); +} + +TEST(ArrayBuffer_UnregisterDuringSweep) { +// Regular pages in old space (without compaction) are processed concurrently +// in the sweeper. If we happen to unregister a buffer (either explicitly, or +// implicitly through e.g. |Externalize|) we need to sync with the sweeper +// task. +// +// Note: This test will will only fail on TSAN configurations. + +// Disable verify-heap since it forces sweeping to be completed in the +// epilogue of the GC. +#ifdef VERIFY_HEAP + i::FLAG_verify_heap = false; +#endif // VERIFY_HEAP + + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + + { + v8::HandleScope handle_scope(isolate); + // Allocate another buffer on the same page to force processing a + // non-empty set of buffers in the last GC. + Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); + CHECK(IsTracked(*buf)); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + CHECK(IsTracked(*buf)); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(*buf)); + CHECK(IsTracked(*buf2)); + } + + heap->CollectGarbage(OLD_SPACE); + // |Externalize| will cause the buffer to be |Unregister|ed. Without + // barriers and proper synchronization this will trigger a data race on + // TSAN. + v8::ArrayBuffer::Contents contents = ab->Externalize(); + heap->isolate()->array_buffer_allocator()->Free(contents.Data(), + contents.ByteLength()); + } +} + +TEST(ArrayBuffer_NonLivePromotion) { + // The test verifies that the marking state is preserved when promoting + // a buffer to old space. + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + + JSArrayBuffer* raw_ab = nullptr; + { + v8::HandleScope handle_scope(isolate); + Handle<FixedArray> root = + heap->isolate()->factory()->NewFixedArray(1, TENURED); + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + root->set(0, *buf); // Buffer that should not be promoted as live. + } + heap::SimulateIncrementalMarking(heap, false); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + raw_ab = JSArrayBuffer::cast(root->get(0)); + root->set(0, heap->undefined_value()); + heap::SimulateIncrementalMarking(heap, true); + // Prohibit page from being released. + Page::FromAddress(raw_ab->address())->MarkNeverEvacuate(); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(!IsTracked(raw_ab)); + } +} + +TEST(ArrayBuffer_LivePromotion) { + // The test verifies that the marking state is preserved when promoting + // a buffer to old space. + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + + JSArrayBuffer* raw_ab = nullptr; + { + v8::HandleScope handle_scope(isolate); + Handle<FixedArray> root = + heap->isolate()->factory()->NewFixedArray(1, TENURED); + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + root->set(0, *buf); // Buffer that should be promoted as live. + } + heap::SimulateIncrementalMarking(heap, true); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + heap::GcAndSweep(heap, NEW_SPACE); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + raw_ab = JSArrayBuffer::cast(root->get(0)); + root->set(0, heap->undefined_value()); + // Prohibit page from being released. + Page::FromAddress(raw_ab->address())->MarkNeverEvacuate(); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(IsTracked(raw_ab)); + } +} + +TEST(ArrayBuffer_SemiSpaceCopyThenPagePromotion) { + // The test verifies that the marking state is preserved across semispace + // copy. + CcTest::InitializeVM(); + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); + + heap::SealCurrentObjects(heap); + { + v8::HandleScope handle_scope(isolate); + Handle<FixedArray> root = + heap->isolate()->factory()->NewFixedArray(1, TENURED); + { + v8::HandleScope handle_scope(isolate); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); + root->set(0, *buf); // Buffer that should be promoted as live. + Page::FromAddress(buf->address())->MarkNeverEvacuate(); + } + std::vector<Handle<FixedArray>> handles; + // Make the whole page transition from new->old, getting the buffers + // processed in the sweeper (relying on marking information) instead of + // processing during newspace evacuation. + heap::FillCurrentPage(heap->new_space(), &handles); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + heap::GcAndSweep(heap, NEW_SPACE); + heap::SimulateIncrementalMarking(heap, true); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); + } +} + +UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) { + if (FLAG_optimize_for_size) return; + // Test allocates JSArrayBuffer on different pages before triggering a + // full GC that performs the semispace copy. If parallelized, this test + // ensures proper synchronization in TSAN configurations. + FLAG_min_semi_space_size = 2 * Page::kPageSize / MB; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + v8::Isolate* isolate = v8::Isolate::New(create_params); + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::New(isolate)->Enter(); + Heap* heap = i_isolate->heap(); + + Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); + heap::FillCurrentPage(heap->new_space()); + Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); + Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); + CHECK_NE(Page::FromAddress(buf1->address()), + Page::FromAddress(buf2->address())); + heap::GcAndSweep(heap, OLD_SPACE); + } +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-compaction.cc b/deps/v8/test/cctest/heap/test-compaction.cc index 0feee5fc46..f61f7e1c41 100644 --- a/deps/v8/test/cctest/heap/test-compaction.cc +++ b/deps/v8/test/cctest/heap/test-compaction.cc @@ -4,12 +4,14 @@ #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" namespace v8 { namespace internal { -static void CheckInvariantsOfAbortedPage(Page* page) { +namespace { + +void CheckInvariantsOfAbortedPage(Page* page) { // Check invariants: // 1) Markbits are cleared // 2) The page is not marked as evacuation candidate anymore @@ -19,6 +21,14 @@ static void CheckInvariantsOfAbortedPage(Page* page) { CHECK(!page->IsFlagSet(Page::COMPACTION_WAS_ABORTED)); } +void CheckAllObjectsOnPage(std::vector<Handle<FixedArray>>& handles, + Page* page) { + for (auto& fixed_array : handles) { + CHECK(Page::FromAddress(fixed_array->address()) == page); + } +} + +} // namespace HEAP_TEST(CompactionFullAbortedPage) { // Test the scenario where we reach OOM during compaction and the whole page @@ -33,23 +43,23 @@ HEAP_TEST(CompactionFullAbortedPage) { Heap* heap = isolate->heap(); { HandleScope scope1(isolate); - PageIterator it(heap->old_space()); - while (it.has_next()) { - it.next()->MarkNeverAllocateForTesting(); - } + + heap::SealCurrentObjects(heap); { HandleScope scope2(isolate); CHECK(heap->old_space()->Expand()); auto compaction_page_handles = - CreatePadding(heap, Page::kAllocatableMemory, TENURED); + heap::CreatePadding(heap, Page::kAllocatableMemory, TENURED); Page* to_be_aborted_page = Page::FromAddress(compaction_page_handles.front()->address()); to_be_aborted_page->SetFlag( MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page); heap->set_force_oom(true); heap->CollectAllGarbage(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); // Check that all handles still point to the same page, i.e., compaction // has been aborted on the page. @@ -71,29 +81,29 @@ HEAP_TEST(CompactionPartiallyAbortedPage) { FLAG_concurrent_sweeping = false; FLAG_manual_evacuation_candidates_selection = true; - const int object_size = 128 * KB; + const int objects_per_page = 10; + const int object_size = Page::kAllocatableMemory / objects_per_page; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); { HandleScope scope1(isolate); - PageIterator it(heap->old_space()); - while (it.has_next()) { - it.next()->MarkNeverAllocateForTesting(); - } + + heap::SealCurrentObjects(heap); { HandleScope scope2(isolate); // Fill another page with objects of size {object_size} (last one is // properly adjusted). CHECK(heap->old_space()->Expand()); - auto compaction_page_handles = - CreatePadding(heap, Page::kAllocatableMemory, TENURED, object_size); + auto compaction_page_handles = heap::CreatePadding( + heap, Page::kAllocatableMemory, TENURED, object_size); Page* to_be_aborted_page = Page::FromAddress(compaction_page_handles.front()->address()); to_be_aborted_page->SetFlag( MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page); { // Add another page that is filled with {num_objects} objects of size @@ -101,13 +111,15 @@ HEAP_TEST(CompactionPartiallyAbortedPage) { HandleScope scope3(isolate); CHECK(heap->old_space()->Expand()); const int num_objects = 3; - std::vector<Handle<FixedArray>> page_to_fill_handles = CreatePadding( - heap, object_size * num_objects, TENURED, object_size); + std::vector<Handle<FixedArray>> page_to_fill_handles = + heap::CreatePadding(heap, object_size * num_objects, TENURED, + object_size); Page* page_to_fill = Page::FromAddress(page_to_fill_handles.front()->address()); heap->set_force_oom(true); heap->CollectAllGarbage(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); bool migration_aborted = false; for (Handle<FixedArray> object : compaction_page_handles) { @@ -143,7 +155,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { FLAG_concurrent_sweeping = false; FLAG_manual_evacuation_candidates_selection = true; - const int object_size = 128 * KB; + const int objects_per_page = 10; + const int object_size = Page::kAllocatableMemory / objects_per_page; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -153,10 +166,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { Handle<FixedArray> root_array = isolate->factory()->NewFixedArray(10, TENURED); - PageIterator it(heap->old_space()); - while (it.has_next()) { - it.next()->MarkNeverAllocateForTesting(); - } + heap::SealCurrentObjects(heap); Page* to_be_aborted_page = nullptr; { @@ -165,7 +175,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { // properly adjusted). CHECK(heap->old_space()->Expand()); std::vector<Handle<FixedArray>> compaction_page_handles = - CreatePadding(heap, Page::kAllocatableMemory, TENURED, object_size); + heap::CreatePadding(heap, Page::kAllocatableMemory, TENURED, + object_size); to_be_aborted_page = Page::FromAddress(compaction_page_handles.front()->address()); to_be_aborted_page->SetFlag( @@ -174,8 +185,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { compaction_page_handles[i]->set(0, *compaction_page_handles[i - 1]); } root_array->set(0, *compaction_page_handles.back()); + CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page); } - { // Add another page that is filled with {num_objects} objects of size // {object_size}. @@ -184,12 +195,13 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { const int num_objects = 2; int used_memory = object_size * num_objects; std::vector<Handle<FixedArray>> page_to_fill_handles = - CreatePadding(heap, used_memory, TENURED, object_size); + heap::CreatePadding(heap, used_memory, TENURED, object_size); Page* page_to_fill = Page::FromAddress(page_to_fill_handles.front()->address()); heap->set_force_oom(true); heap->CollectAllGarbage(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); // The following check makes sure that we compacted "some" objects, while // leaving others in place. @@ -230,7 +242,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { FLAG_concurrent_sweeping = false; FLAG_manual_evacuation_candidates_selection = true; - const int object_size = 128 * KB; + const int objects_per_page = 10; + const int object_size = Page::kAllocatableMemory / objects_per_page; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -239,10 +252,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { HandleScope scope1(isolate); Handle<FixedArray> root_array = isolate->factory()->NewFixedArray(10, TENURED); - PageIterator it(heap->old_space()); - while (it.has_next()) { - it.next()->MarkNeverAllocateForTesting(); - } + heap::SealCurrentObjects(heap); Page* to_be_aborted_page = nullptr; { @@ -250,8 +260,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { // Fill another page with objects of size {object_size} (last one is // properly adjusted). CHECK(heap->old_space()->Expand()); - auto compaction_page_handles = - CreatePadding(heap, Page::kAllocatableMemory, TENURED, object_size); + auto compaction_page_handles = heap::CreatePadding( + heap, Page::kAllocatableMemory, TENURED, object_size); // Sanity check that we have enough space for linking up arrays. CHECK_GE(compaction_page_handles.front()->length(), 2); to_be_aborted_page = @@ -267,6 +277,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { isolate->factory()->NewFixedArray(1, NOT_TENURED); CHECK(heap->InNewSpace(*new_space_array)); compaction_page_handles.front()->set(1, *new_space_array); + CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page); } { @@ -277,12 +288,13 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { const int num_objects = 2; int used_memory = object_size * num_objects; std::vector<Handle<FixedArray>> page_to_fill_handles = - CreatePadding(heap, used_memory, TENURED, object_size); + heap::CreatePadding(heap, used_memory, TENURED, object_size); Page* page_to_fill = Page::FromAddress(page_to_fill_handles.front()->address()); heap->set_force_oom(true); heap->CollectAllGarbage(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); // The following check makes sure that we compacted "some" objects, while // leaving others in place. diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index 424e9870d8..80c4cc7c34 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -31,6 +31,7 @@ #include "src/compilation-cache.h" #include "src/context-measure.h" #include "src/deoptimizer.h" +#include "src/elements.h" #include "src/execution.h" #include "src/factory.h" #include "src/field-type.h" @@ -43,7 +44,7 @@ #include "src/snapshot/snapshot.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" #include "test/cctest/test-feedback-vector.h" @@ -98,6 +99,48 @@ static void CheckNumber(Isolate* isolate, double value, const char* string) { CHECK(String::cast(*print_string)->IsUtf8EqualTo(CStrVector(string))); } +void CheckEmbeddedObjectsAreEqual(Handle<Code> lhs, Handle<Code> rhs) { + int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); + RelocIterator lhs_it(*lhs, mode_mask); + RelocIterator rhs_it(*rhs, mode_mask); + while (!lhs_it.done() && !rhs_it.done()) { + CHECK(lhs_it.rinfo()->target_object() == rhs_it.rinfo()->target_object()); + + lhs_it.next(); + rhs_it.next(); + } + CHECK(lhs_it.done() == rhs_it.done()); +} + +HEAP_TEST(TestNewSpaceRefsInCopiedCode) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + Heap* heap = isolate->heap(); + HandleScope sc(isolate); + + Handle<Object> value = factory->NewNumber(1.000123); + CHECK(heap->InNewSpace(*value)); + + i::byte buffer[i::Assembler::kMinimalBufferSize]; + MacroAssembler masm(isolate, buffer, sizeof(buffer), + v8::internal::CodeObjectRequired::kYes); + // Add a new-space reference to the code. + masm.Push(value); + + CodeDesc desc; + masm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + Code* tmp = nullptr; + heap->CopyCode(*code).To(&tmp); + Handle<Code> copy(tmp); + + CheckEmbeddedObjectsAreEqual(code, copy); + heap->CollectAllAvailableGarbage(); + CheckEmbeddedObjectsAreEqual(code, copy); +} static void CheckFindCodeObject(Isolate* isolate) { // Test FindCodeObject @@ -577,7 +620,7 @@ TEST(GlobalHandles) { static bool WeakPointerCleared = false; static void TestWeakGlobalHandleCallback( - const v8::WeakCallbackData<v8::Value, void>& data) { + const v8::WeakCallbackInfo<void>& data) { std::pair<v8::Persistent<v8::Value>*, int>* p = reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( data.GetParameter()); @@ -610,9 +653,9 @@ TEST(WeakGlobalHandlesScavenge) { } std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234); - GlobalHandles::MakeWeak(h2.location(), - reinterpret_cast<void*>(&handle_and_id), - &TestWeakGlobalHandleCallback); + GlobalHandles::MakeWeak( + h2.location(), reinterpret_cast<void*>(&handle_and_id), + &TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter); // Scavenge treats weak pointers as normal roots. heap->CollectGarbage(NEW_SPACE); @@ -657,9 +700,9 @@ TEST(WeakGlobalHandlesMark) { CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2)); std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234); - GlobalHandles::MakeWeak(h2.location(), - reinterpret_cast<void*>(&handle_and_id), - &TestWeakGlobalHandleCallback); + GlobalHandles::MakeWeak( + h2.location(), reinterpret_cast<void*>(&handle_and_id), + &TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter); CHECK(!GlobalHandles::IsNearDeath(h1.location())); CHECK(!GlobalHandles::IsNearDeath(h2.location())); @@ -695,9 +738,9 @@ TEST(DeleteWeakGlobalHandle) { } std::pair<Handle<Object>*, int> handle_and_id(&h, 1234); - GlobalHandles::MakeWeak(h.location(), - reinterpret_cast<void*>(&handle_and_id), - &TestWeakGlobalHandleCallback); + GlobalHandles::MakeWeak(h.location(), reinterpret_cast<void*>(&handle_and_id), + &TestWeakGlobalHandleCallback, + v8::WeakCallbackType::kParameter); // Scanvenge does not recognize weak reference. heap->CollectGarbage(NEW_SPACE); @@ -710,6 +753,45 @@ TEST(DeleteWeakGlobalHandle) { CHECK(WeakPointerCleared); } +TEST(DoNotPromoteWhiteObjectsOnScavenge) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + Factory* factory = isolate->factory(); + + HandleScope scope(isolate); + Handle<Object> white = factory->NewStringFromStaticChars("white"); + + CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*white)))); + + heap->CollectGarbage(NEW_SPACE); + + CHECK(heap->InNewSpace(*white)); +} + +TEST(PromoteGreyOrBlackObjectsOnScavenge) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + Factory* factory = isolate->factory(); + + HandleScope scope(isolate); + Handle<Object> marked = factory->NewStringFromStaticChars("marked"); + + IncrementalMarking* marking = heap->incremental_marking(); + marking->Stop(); + heap->StartIncrementalMarking(); + while ( + Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { + marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_MARKING, + IncrementalMarking::DO_NOT_FORCE_COMPLETION); + } + + heap->CollectGarbage(NEW_SPACE); + + CHECK(!heap->InNewSpace(*marked)); +} TEST(BytecodeArray) { static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; @@ -724,7 +806,7 @@ TEST(BytecodeArray) { Factory* factory = isolate->factory(); HandleScope scope(isolate); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); Handle<FixedArray> constant_pool = factory->NewFixedArray(5, TENURED); for (int i = 0; i < 5; i++) { Handle<Object> number = factory->NewHeapNumber(i); @@ -1349,7 +1431,7 @@ TEST(TestCodeFlushingIncremental) { // Simulate several GCs that use incremental marking. const int kAgingThreshold = 6; for (int i = 0; i < kAgingThreshold; i++) { - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); } CHECK(!function->shared()->is_compiled() || function->IsOptimized()); @@ -1363,8 +1445,9 @@ TEST(TestCodeFlushingIncremental) { // Simulate several GCs that use incremental marking but make sure // the loop breaks once the function is enqueued as a candidate. for (int i = 0; i < kAgingThreshold; i++) { - SimulateIncrementalMarking(CcTest::heap()); - if (!function->next_function_link()->IsUndefined()) break; + heap::SimulateIncrementalMarking(CcTest::heap()); + if (!function->next_function_link()->IsUndefined(CcTest::i_isolate())) + break; CcTest::heap()->CollectAllGarbage(); } @@ -1439,7 +1522,7 @@ TEST(TestCodeFlushingIncrementalScavenge) { // Simulate incremental marking so that the functions are enqueued as // code flushing candidates. Then kill one of the functions. Finally // perform a scavenge while incremental marking is still running. - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap(), false); *function2.location() = NULL; CcTest::heap()->CollectGarbage(NEW_SPACE, "test scavenge while marking"); @@ -1493,16 +1576,16 @@ TEST(TestCodeFlushingIncrementalAbort) { // Simulate incremental marking so that the function is enqueued as // code flushing candidate. - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); // Enable the debugger and add a breakpoint while incremental marking // is running so that incremental marking aborts and code flushing is // disabled. - int position = 0; + int position = function->shared()->start_position(); Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); EnableDebugger(CcTest::isolate()); isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); - isolate->debug()->ClearAllBreakPoints(); + isolate->debug()->ClearBreakPoint(breakpoint_object); DisableDebugger(CcTest::isolate()); // Force optimization now that code flushing is disabled. @@ -1546,12 +1629,9 @@ TEST(TestUseOfIncrementalBarrierOnCompileLazy) { Handle<Object> g_value = Object::GetProperty(isolate->global_object(), g_name).ToHandleChecked(); Handle<JSFunction> g_function = Handle<JSFunction>::cast(g_value); - // TODO(mvstanton): change to check that g is *not* compiled when optimized - // cache - // map lookup moves to the compile lazy builtin. - CHECK(g_function->is_compiled()); + CHECK(!g_function->is_compiled()); - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); CompileRun("%OptimizeFunctionOnNextCall(f); f();"); // g should now have available an optimized function, unmarked by gc. The @@ -1590,25 +1670,11 @@ TEST(CompilationCacheCachingBehavior) { CompileRun(raw_source); } - // On first compilation, only a hash is inserted in the code cache. We can't - // find that value. + // The script should be in the cache now. MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( source, Handle<Object>(), 0, 0, v8::ScriptOriginOptions(false, true, false), native_context, language_mode); - CHECK(info.is_null()); - - { - v8::HandleScope scope(CcTest::isolate()); - CompileRun(raw_source); - } - - // On second compilation, the hash is replaced by a real cache entry mapping - // the source to the shared function info containing the code. - info = compilation_cache->LookupScript( - source, Handle<Object>(), 0, 0, - v8::ScriptOriginOptions(false, true, false), native_context, - language_mode); CHECK(!info.is_null()); // Check that the code cache entry survives at least on GC. @@ -1640,36 +1706,6 @@ TEST(CompilationCacheCachingBehavior) { v8::ScriptOriginOptions(false, true, false), native_context, language_mode); CHECK(info.is_null()); - - { - v8::HandleScope scope(CcTest::isolate()); - CompileRun(raw_source); - } - - // On first compilation, only a hash is inserted in the code cache. We can't - // find that value. - info = compilation_cache->LookupScript( - source, Handle<Object>(), 0, 0, - v8::ScriptOriginOptions(false, true, false), native_context, - language_mode); - CHECK(info.is_null()); - - for (int i = 0; i < CompilationCacheTable::kHashGenerations; i++) { - compilation_cache->MarkCompactPrologue(); - } - - { - v8::HandleScope scope(CcTest::isolate()); - CompileRun(raw_source); - } - - // If we aged the cache before caching the script, ensure that we didn't cache - // on next compilation. - info = compilation_cache->LookupScript( - source, Handle<Object>(), 0, 0, - v8::ScriptOriginOptions(false, true, false), native_context, - language_mode); - CHECK(info.is_null()); } @@ -1690,9 +1726,9 @@ static void OptimizeEmptyFunction(const char* name) { int CountNativeContexts() { int count = 0; Object* object = CcTest::heap()->native_contexts_list(); - while (!object->IsUndefined()) { + while (!object->IsUndefined(CcTest::i_isolate())) { count++; - object = Context::cast(object)->get(Context::NEXT_CONTEXT_LINK); + object = Context::cast(object)->next_context_link(); } return count; } @@ -1826,12 +1862,11 @@ static int CountNativeContextsWithGC(Isolate* isolate, int n) { Heap* heap = isolate->heap(); int count = 0; Handle<Object> object(heap->native_contexts_list(), isolate); - while (!object->IsUndefined()) { + while (!object->IsUndefined(isolate)) { count++; if (count == n) heap->CollectAllGarbage(); object = - Handle<Object>(Context::cast(*object)->get(Context::NEXT_CONTEXT_LINK), - isolate); + Handle<Object>(Context::cast(*object)->next_context_link(), isolate); } return count; } @@ -1933,11 +1968,7 @@ TEST(TestSizeOfRegExpCode) { // Get initial heap size after several full GCs, which will stabilize // the heap size and return with sweeping finished completely. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::heap()->CollectAllAvailableGarbage("initial cleanup"); MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector(); if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); @@ -1970,19 +2001,16 @@ TEST(TestSizeOfRegExpCode) { HEAP_TEST(TestSizeOfObjects) { v8::V8::Initialize(); + Heap* heap = CcTest::heap(); + MarkCompactCollector* collector = heap->mark_compact_collector(); // Get initial heap size after several full GCs, which will stabilize // the heap size and return with sweeping finished completely. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); - MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector(); + heap->CollectAllAvailableGarbage("initial cleanup"); if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); } - int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects()); + int initial_size = static_cast<int>(heap->SizeOfObjects()); { // Allocate objects on several different old-space pages so that @@ -1991,25 +2019,22 @@ HEAP_TEST(TestSizeOfObjects) { AlwaysAllocateScope always_allocate(CcTest::i_isolate()); int filler_size = static_cast<int>(FixedArray::SizeFor(8192)); for (int i = 1; i <= 100; i++) { - CcTest::heap()->AllocateFixedArray(8192, TENURED).ToObjectChecked(); + heap->AllocateFixedArray(8192, TENURED).ToObjectChecked(); CHECK_EQ(initial_size + i * filler_size, - static_cast<int>(CcTest::heap()->SizeOfObjects())); + static_cast<int>(heap->SizeOfObjects())); } } // The heap size should go back to initial size after a full GC, even // though sweeping didn't finish yet. - CcTest::heap()->CollectAllGarbage(); - + heap->CollectAllGarbage(); // Normally sweeping would not be complete here, but no guarantees. - - CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); - + CHECK_EQ(initial_size, static_cast<int>(heap->SizeOfObjects())); // Waiting for sweeper threads should not change heap size. if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); } - CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); + CHECK_EQ(initial_size, static_cast<int>(heap->SizeOfObjects())); } @@ -2296,16 +2321,20 @@ TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { // on the heap. if (size_of_objects_1 > size_of_objects_2) { intptr_t delta = size_of_objects_1 - size_of_objects_2; - PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " - "Iterator: %" V8_PTR_PREFIX "d, " - "delta: %" V8_PTR_PREFIX "d\n", + PrintF("Heap::SizeOfObjects: %" V8PRIdPTR + ", " + "Iterator: %" V8PRIdPTR + ", " + "delta: %" V8PRIdPTR "\n", size_of_objects_1, size_of_objects_2, delta); CHECK_GT(size_of_objects_1 / 20, delta); } else { intptr_t delta = size_of_objects_2 - size_of_objects_1; - PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " - "Iterator: %" V8_PTR_PREFIX "d, " - "delta: %" V8_PTR_PREFIX "d\n", + PrintF("Heap::SizeOfObjects: %" V8PRIdPTR + ", " + "Iterator: %" V8PRIdPTR + ", " + "delta: %" V8PRIdPTR "\n", size_of_objects_1, size_of_objects_2, delta); CHECK_GT(size_of_objects_2 / 20, delta); } @@ -2636,7 +2665,7 @@ TEST(InstanceOfStubWriteBarrier) { CHECK(f->IsOptimized()); - while (!Marking::IsBlack(Marking::MarkBitFrom(f->code())) && + while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && !marking->IsStopped()) { // Discard any pending GC requests otherwise we will get GC when we enter // code below. @@ -2657,6 +2686,14 @@ TEST(InstanceOfStubWriteBarrier) { CcTest::heap()->CollectGarbage(OLD_SPACE); } +namespace { + +int GetProfilerTicks(SharedFunctionInfo* shared) { + return FLAG_ignition ? shared->profiler_ticks() + : shared->code()->profiler_ticks(); +} + +} // namespace TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { i::FLAG_stress_compaction = false; @@ -2687,16 +2724,18 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); CHECK(f->IsOptimized()); - IncrementalMarking* marking = CcTest::heap()->incremental_marking(); - marking->Stop(); + // Make sure incremental marking it not running. + CcTest::heap()->incremental_marking()->Stop(); + CcTest::heap()->StartIncrementalMarking(); // The following calls will increment CcTest::heap()->global_ic_age(). CcTest::isolate()->ContextDisposedNotification(); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); + CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); CHECK_EQ(0, f->shared()->opt_count()); - CHECK_EQ(0, f->shared()->code()->profiler_ticks()); + CHECK_EQ(0, GetProfilerTicks(f->shared())); } @@ -2727,9 +2766,9 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); - CHECK(f->IsOptimized()); + // Make sure incremental marking it not running. CcTest::heap()->incremental_marking()->Stop(); // The following two calls will increment CcTest::heap()->global_ic_age(). @@ -2738,7 +2777,7 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); CHECK_EQ(0, f->shared()->opt_count()); - CHECK_EQ(0, f->shared()->code()->profiler_ticks()); + CHECK_EQ(0, GetProfilerTicks(f->shared())); } @@ -2776,12 +2815,13 @@ HEAP_TEST(GCFlags) { TEST(IdleNotificationFinishMarking) { i::FLAG_allow_natives_syntax = true; CcTest::InitializeVM(); - SimulateFullSpace(CcTest::heap()->old_space()); + const int initial_gc_count = CcTest::heap()->gc_count(); + heap::SimulateFullSpace(CcTest::heap()->old_space()); IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); CcTest::heap()->StartIncrementalMarking(); - CHECK_EQ(CcTest::heap()->gc_count(), 0); + CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); // TODO(hpayer): We cannot write proper unit test right now for heap. // The ideal test would call kMaxIdleMarkingDelayCounter to test the @@ -2816,7 +2856,7 @@ TEST(IdleNotificationFinishMarking) { (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + kLongIdleTime); - CHECK_EQ(CcTest::heap()->gc_count(), 1); + CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count + 1); } @@ -2828,7 +2868,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) { if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); - SimulateFullSpace(CcTest::heap()->new_space()); + heap::SimulateFullSpace(CcTest::heap()->new_space()); AlwaysAllocateScope always_allocate(CcTest::i_isolate()); v8::Local<v8::Value> res = CompileRun( "function c(x) {" @@ -3303,7 +3343,7 @@ TEST(Regress1465) { CompileRun("%DebugPrint(root);"); CHECK_EQ(transitions_count, transitions_before); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); // Count number of live transitions after marking. Note that one transition @@ -3473,7 +3513,7 @@ TEST(Regress2143a) { "root.foo = 0;" "root = new Object;"); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); // Compile a StoreIC that performs the prepared map transition. This // will restart incremental marking and should make sure the root is @@ -3513,7 +3553,7 @@ TEST(Regress2143b) { "root.foo = 0;" "root = new Object;"); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); // Compile an optimized LStoreNamedField that performs the prepared // map transition. This will restart incremental marking and should @@ -3557,6 +3597,8 @@ TEST(ReleaseOverReservedPages) { // Concurrent sweeping adds non determinism, depending on when memory is // available for further reuse. i::FLAG_concurrent_sweeping = false; + // Fast evacuation of pages may result in a different page count in old space. + i::FLAG_page_promotion = false; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); @@ -3566,28 +3608,29 @@ TEST(ReleaseOverReservedPages) { // Prepare many pages with low live-bytes count. PagedSpace* old_space = heap->old_space(); - CHECK_EQ(1, old_space->CountTotalPages()); + const int initial_page_count = old_space->CountTotalPages(); + const int overall_page_count = number_of_test_pages + initial_page_count; for (int i = 0; i < number_of_test_pages; i++) { AlwaysAllocateScope always_allocate(isolate); - SimulateFullSpace(old_space); + heap::SimulateFullSpace(old_space); factory->NewFixedArray(1, TENURED); } - CHECK_EQ(number_of_test_pages + 1, old_space->CountTotalPages()); + CHECK_EQ(overall_page_count, old_space->CountTotalPages()); // Triggering one GC will cause a lot of garbage to be discovered but // even spread across all allocated pages. heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, "triggered for preparation"); - CHECK_GE(number_of_test_pages + 1, old_space->CountTotalPages()); + CHECK_GE(overall_page_count, old_space->CountTotalPages()); // Triggering subsequent GCs should cause at least half of the pages // to be released to the OS after at most two cycles. heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, "triggered by test 1"); - CHECK_GE(number_of_test_pages + 1, old_space->CountTotalPages()); + CHECK_GE(overall_page_count, old_space->CountTotalPages()); heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, "triggered by test 2"); - CHECK_GE(number_of_test_pages + 1, old_space->CountTotalPages() * 2); + CHECK_GE(overall_page_count, old_space->CountTotalPages() * 2); // Triggering a last-resort GC should cause all pages to be released to the // OS so that other processes can seize the memory. If we get a failure here @@ -3597,7 +3640,7 @@ TEST(ReleaseOverReservedPages) { // boots, but if the 20 small arrays don't fit on the first page then that's // an indication that it is too small. heap->CollectAllAvailableGarbage("triggered really hard"); - CHECK_EQ(1, old_space->CountTotalPages()); + CHECK_EQ(initial_page_count, old_space->CountTotalPages()); } static int forced_gc_counter = 0; @@ -3670,7 +3713,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) { v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper feedback_helper(feedback_vector); int expected_slots = 2; @@ -3680,7 +3723,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) { CHECK(feedback_vector->Get(feedback_helper.slot(slot1))->IsWeakCell()); CHECK(feedback_vector->Get(feedback_helper.slot(slot2))->IsWeakCell()); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); CHECK(!WeakCell::cast(feedback_vector->Get(feedback_helper.slot(slot1))) @@ -3707,7 +3750,7 @@ static Code* FindFirstIC(Code* code, Code::Kind kind) { static void CheckVectorIC(Handle<JSFunction> f, int slot_index, InlineCacheState desired_state) { Handle<TypeFeedbackVector> vector = - Handle<TypeFeedbackVector>(f->shared()->feedback_vector()); + Handle<TypeFeedbackVector>(f->feedback_vector()); FeedbackVectorHelper helper(vector); FeedbackVectorSlot slot = helper.slot(slot_index); if (vector->GetKind(slot) == FeedbackVectorSlotKind::LOAD_IC) { @@ -3720,16 +3763,6 @@ static void CheckVectorIC(Handle<JSFunction> f, int slot_index, } } - -static void CheckVectorICCleared(Handle<JSFunction> f, int slot_index) { - Handle<TypeFeedbackVector> vector = - Handle<TypeFeedbackVector>(f->shared()->feedback_vector()); - FeedbackVectorSlot slot(slot_index); - LoadICNexus nexus(vector, slot); - CHECK(IC::IsCleared(&nexus)); -} - - TEST(IncrementalMarkingPreservesMonomorphicConstructor) { if (i::FLAG_always_opt) return; CcTest::InitializeVM(); @@ -3744,54 +3777,15 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) { v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); - Handle<TypeFeedbackVector> vector(f->shared()->feedback_vector()); + Handle<TypeFeedbackVector> vector(f->feedback_vector()); CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); } - -TEST(IncrementalMarkingClearsMonomorphicConstructor) { - if (i::FLAG_always_opt) return; - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - v8::HandleScope scope(CcTest::isolate()); - v8::Local<v8::Value> fun1; - v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); - - { - LocalContext env; - CompileRun("function fun() { this.x = 1; };"); - fun1 = env->Global()->Get(env.local(), v8_str("fun")).ToLocalChecked(); - } - - // Prepare function f that contains a monomorphic constructor for object - // originating from a different native context. - CHECK(CcTest::global()->Set(ctx, v8_str("fun1"), fun1).FromJust()); - CompileRun( - "function fun() { this.x = 1; };" - "function f(o) { return new o(); } f(fun1); f(fun1);"); - Handle<JSFunction> f = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); - - - Handle<TypeFeedbackVector> vector(f->shared()->feedback_vector()); - CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); - - // Fire context dispose notification. - CcTest::isolate()->ContextDisposedNotification(); - SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); - - CHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(isolate), - vector->Get(FeedbackVectorSlot(0))); -} - - TEST(IncrementalMarkingPreservesMonomorphicIC) { if (i::FLAG_always_opt) return; CcTest::InitializeVM(); @@ -3807,45 +3801,12 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) { CheckVectorIC(f, 0, MONOMORPHIC); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); CheckVectorIC(f, 0, MONOMORPHIC); } - -TEST(IncrementalMarkingClearsMonomorphicIC) { - if (i::FLAG_always_opt) return; - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - v8::Local<v8::Value> obj1; - v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); - - { - LocalContext env; - CompileRun("function fun() { this.x = 1; }; var obj = new fun();"); - obj1 = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked(); - } - - // Prepare function f that contains a monomorphic IC for object - // originating from a different native context. - CHECK(CcTest::global()->Set(ctx, v8_str("obj1"), obj1).FromJust()); - CompileRun("function f(o) { return o.x; } f(obj1); f(obj1);"); - Handle<JSFunction> f = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); - - CheckVectorIC(f, 0, MONOMORPHIC); - - // Fire context dispose notification. - CcTest::isolate()->ContextDisposedNotification(); - SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); - - CheckVectorICCleared(f, 0); -} - - TEST(IncrementalMarkingPreservesPolymorphicIC) { if (i::FLAG_always_opt) return; CcTest::InitializeVM(); @@ -3877,14 +3838,13 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) { CheckVectorIC(f, 0, POLYMORPHIC); // Fire context dispose notification. - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); CheckVectorIC(f, 0, POLYMORPHIC); } - -TEST(IncrementalMarkingClearsPolymorphicIC) { +TEST(ContextDisposeDoesntClearPolymorphicIC) { if (i::FLAG_always_opt) return; CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -3916,10 +3876,10 @@ TEST(IncrementalMarkingClearsPolymorphicIC) { // Fire context dispose notification. CcTest::isolate()->ContextDisposedNotification(); - SimulateIncrementalMarking(CcTest::heap()); + heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::heap()->CollectAllGarbage(); - CheckVectorICCleared(f, 0); + CheckVectorIC(f, 0, POLYMORPHIC); } @@ -4088,7 +4048,7 @@ TEST(Regress159140) { // Simulate incremental marking so that the functions are enqueued as // code flushing candidates. Then optimize one function. Finally // finish the GC to complete code flushing. - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); CompileRun("%OptimizeFunctionOnNextCall(g); g(3);"); heap->CollectAllGarbage(); @@ -4134,7 +4094,7 @@ TEST(Regress165495) { // Simulate incremental marking so that unoptimized code is flushed // even though it still is cached in the optimized code map. - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); heap->CollectAllGarbage(); // Make a new closure that will get code installed from the code map. @@ -4202,7 +4162,7 @@ TEST(Regress169209) { } // Simulate incremental marking and collect code flushing candidates. - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); CHECK(shared1->code()->gc_metadata() != NULL); // Optimize function and make sure the unoptimized code is replaced. @@ -4258,9 +4218,9 @@ TEST(Regress169928) { array_data->set(0, Smi::FromInt(1)); array_data->set(1, Smi::FromInt(2)); - AllocateAllButNBytes(CcTest::heap()->new_space(), - JSArray::kSize + AllocationMemento::kSize + - kPointerSize); + heap::AllocateAllButNBytes( + CcTest::heap()->new_space(), + JSArray::kSize + AllocationMemento::kSize + kPointerSize); Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, FAST_SMI_ELEMENTS); @@ -4333,9 +4293,10 @@ TEST(Regress513507) { if (!code->is_optimized_code()) return; } - Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector()); + Handle<TypeFeedbackVector> vector = + TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata())); Handle<LiteralsArray> lit = - LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED); + 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 @@ -4390,7 +4351,8 @@ TEST(Regress514122) { if (!code->is_optimized_code()) return; } - Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector()); + Handle<TypeFeedbackVector> vector = + TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata())); Handle<LiteralsArray> lit = LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED); Handle<Context> context(isolate->context()); @@ -4409,11 +4371,10 @@ TEST(Regress514122) { HandleScope inner_scope(isolate); AlwaysAllocateScope always_allocate(isolate); // Make sure literal is placed on an old-space evacuation candidate. - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); // Make sure there the number of literals is > 0. - Handle<LiteralsArray> lit = - LiteralsArray::New(isolate, vector, 23, TENURED); + Handle<LiteralsArray> lit = LiteralsArray::New(isolate, vector, 23); evac_page = Page::FromAddress(lit->address()); BailoutId id = BailoutId(100); @@ -4424,7 +4385,7 @@ TEST(Regress514122) { // simulate incremental marking to enqueue optimized code map. FLAG_manual_evacuation_candidates_selection = true; evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); // No matter whether reachable or not, {boomer} is doomed. Handle<Object> boomer(shared->optimized_code_map(), isolate); @@ -4621,7 +4582,7 @@ TEST(LargeObjectSlotRecording) { HandleScope scope(isolate); // Create an object on an evacuation candidate. - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); Page* evac_page = Page::FromAddress(lit->address()); evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); @@ -4634,7 +4595,7 @@ TEST(LargeObjectSlotRecording) { CHECK(heap->lo_space()->Contains(*lo)); // Start incremental marking to active write barrier. - SimulateIncrementalMarking(heap, false); + heap::SimulateIncrementalMarking(heap, false); heap->incremental_marking()->AdvanceIncrementalMarking( 10000000, IncrementalMarking::IdleStepActions()); @@ -4735,7 +4696,7 @@ TEST(DisableInlineAllocation) { static int AllocationSitesCount(Heap* heap) { int count = 0; for (Object* site = heap->allocation_sites_list(); - !(site->IsUndefined()); + !(site->IsUndefined(heap->isolate())); site = AllocationSite::cast(site)->weak_next()) { count++; } @@ -4774,18 +4735,31 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) { CompileRun("%OptimizeFunctionOnNextCall(bar); bar();"); - CHECK_EQ(DependentCode::kAllocationSiteTransitionChangedGroup, - site->dependent_code()->group()); - CHECK_EQ(1, site->dependent_code()->count()); - CHECK(site->dependent_code()->object_at(0)->IsWeakCell()); - Code* function_bar = Code::cast( - WeakCell::cast(site->dependent_code()->object_at(0))->value()); Handle<JSFunction> bar_handle = Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( CcTest::global() ->Get(context.local(), v8_str("bar")) .ToLocalChecked()))); - CHECK_EQ(bar_handle->code(), function_bar); + + int dependency_group_count = 0; + DependentCode* dependency = site->dependent_code(); + while (dependency != heap->empty_fixed_array()) { + CHECK(dependency->group() == + DependentCode::kAllocationSiteTransitionChangedGroup || + dependency->group() == + DependentCode::kAllocationSiteTenuringChangedGroup); + CHECK_EQ(1, dependency->count()); + CHECK(dependency->object_at(0)->IsWeakCell()); + Code* function_bar = + Code::cast(WeakCell::cast(dependency->object_at(0))->value()); + CHECK_EQ(bar_handle->code(), function_bar); + dependency = dependency->next_link(); + dependency_group_count++; + } + + // TurboFan respects pretenuring feedback from allocation sites, Crankshaft + // does not. Either is fine for the purposes of this test. + CHECK(dependency_group_count == 1 || dependency_group_count == 2); } // Now make sure that a gc should get rid of the function, even though we @@ -4888,6 +4862,67 @@ TEST(ObjectsInOptimizedCodeAreWeak) { CHECK(code->marked_for_deoptimization()); } +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(); + v8::internal::Heap* heap = CcTest::heap(); + + if (!isolate->use_crankshaft()) return; + HandleScope outer_scope(heap->isolate()); + Handle<Code> code; + { + LocalContext context; + HandleScope scope(heap->isolate()); + + CompileRun( + "var foo;" + "var bar;" + "(function() {" + " function foo_func(x) { with (x) { return 1 + x; } };" + " %NeverOptimizeFunction(foo_func);" + " function bar_func() {" + " return foo(1);" + " };" + " bar = bar_func;" + " foo = foo_func;" + " bar_func();" + " bar_func();" + " bar_func();" + " %OptimizeFunctionOnNextCall(bar_func);" + " bar_func();" + "})();"); + + Handle<JSFunction> bar = Handle<JSFunction>::cast(v8::Utils::OpenHandle( + *v8::Local<v8::Function>::Cast(CcTest::global() + ->Get(context.local(), v8_str("bar")) + .ToLocalChecked()))); + + Handle<JSFunction> foo = Handle<JSFunction>::cast(v8::Utils::OpenHandle( + *v8::Local<v8::Function>::Cast(CcTest::global() + ->Get(context.local(), v8_str("foo")) + .ToLocalChecked()))); + + CHECK(heap->InNewSpace(*foo)); + heap->CollectGarbage(NEW_SPACE); + heap->CollectGarbage(NEW_SPACE); + CHECK(!heap->InNewSpace(*foo)); +#ifdef VERIFY_HEAP + heap->Verify(); +#endif + CHECK(!bar->code()->marked_for_deoptimization()); + code = scope.CloseAndEscape(Handle<Code>(bar->code())); + } + + // Now make sure that a gc should get rid of the function + for (int i = 0; i < 4; i++) { + heap->CollectAllGarbage(); + } + + CHECK(code->marked_for_deoptimization()); +} TEST(NoWeakHashTableLeakWithIncrementalMarking) { if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; @@ -4900,7 +4935,7 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) { Isolate* isolate = CcTest::i_isolate(); // Do not run for no-snap builds. - if (!i::Snapshot::HaveASnapshotToStartFrom(isolate)) return; + if (!i::Snapshot::HasContextSnapshot(isolate, 0)) return; v8::internal::Heap* heap = CcTest::heap(); @@ -4911,7 +4946,7 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) { if (!isolate->use_crankshaft()) return; HandleScope outer_scope(heap->isolate()); for (int i = 0; i < 3; i++) { - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); { LocalContext context; HandleScope scope(heap->isolate()); @@ -5095,7 +5130,7 @@ TEST(WeakFunctionInConstructor) { // cleared. Now, verify that one additional call with a new function // allows monomorphicity. Handle<TypeFeedbackVector> feedback_vector = Handle<TypeFeedbackVector>( - createObj->shared()->feedback_vector(), CcTest::i_isolate()); + createObj->feedback_vector(), CcTest::i_isolate()); for (int i = 0; i < 20; i++) { Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0)); CHECK(slot_value->IsWeakCell()); @@ -5296,12 +5331,11 @@ Handle<JSFunction> GetFunctionByName(Isolate* isolate, const char* name) { return Handle<JSFunction>::cast(obj); } - -void CheckIC(Code* code, Code::Kind kind, SharedFunctionInfo* shared, - int slot_index, InlineCacheState state) { +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) { - TypeFeedbackVector* vector = shared->feedback_vector(); + TypeFeedbackVector* vector = function->feedback_vector(); FeedbackVectorSlot slot(slot_index); if (kind == Code::LOAD_IC) { LoadICNexus nexus(vector, slot); @@ -5314,9 +5348,10 @@ void CheckIC(Code* code, Code::Kind kind, SharedFunctionInfo* shared, CHECK_EQ(nexus.StateFromFeedback(), state); } } else { - Code* ic = FindFirstIC(code, kind); + Code* ic = FindFirstIC(function->code(), kind); CHECK(ic->is_inline_cache_stub()); - CHECK(ic->ic_state() == state); + CHECK(!IC::ICUseVector(kind)); + CHECK_EQ(state, IC::StateFromCode(ic)); } } @@ -5345,12 +5380,12 @@ TEST(MonomorphicStaysMonomorphicAfterGC) { CompileRun("(testIC())"); } heap->CollectAllGarbage(); - CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, MONOMORPHIC); + CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC); { v8::HandleScope scope(CcTest::isolate()); CompileRun("(testIC())"); } - CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, MONOMORPHIC); + CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC); } @@ -5381,12 +5416,12 @@ TEST(PolymorphicStaysPolymorphicAfterGC) { CompileRun("(testIC())"); } heap->CollectAllGarbage(); - CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, POLYMORPHIC); + CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC); { v8::HandleScope scope(CcTest::isolate()); CompileRun("(testIC())"); } - CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, POLYMORPHIC); + CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC); } @@ -5547,19 +5582,21 @@ UNINITIALIZED_TEST(Regress538257) { isolate->Enter(); { i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + Heap* heap = i_isolate->heap(); HandleScope handle_scope(i_isolate); - PagedSpace* old_space = i_isolate->heap()->old_space(); + PagedSpace* old_space = heap->old_space(); const int kMaxObjects = 10000; const int kFixedArrayLen = 512; Handle<FixedArray> objects[kMaxObjects]; - for (int i = 0; (i < kMaxObjects) && old_space->CanExpand(Page::kPageSize); + for (int i = 0; (i < kMaxObjects) && + heap->CanExpandOldGeneration(old_space->AreaSize()); i++) { objects[i] = i_isolate->factory()->NewFixedArray(kFixedArrayLen, TENURED); Page::FromAddress(objects[i]->address()) ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); } - SimulateFullSpace(old_space); - i_isolate->heap()->CollectGarbage(OLD_SPACE); + heap::SimulateFullSpace(old_space); + heap->CollectGarbage(OLD_SPACE); // If we get this far, we've successfully aborted compaction. Any further // allocations might trigger OOM. } @@ -5618,7 +5655,7 @@ TEST(Regress507979) { UNINITIALIZED_TEST(PromotionQueue) { i::FLAG_expose_gc = true; - i::FLAG_max_semi_space_size = 2 * (Page::kPageSize / MB); + i::FLAG_max_semi_space_size = 2 * Page::kPageSize / MB; i::FLAG_min_semi_space_size = i::FLAG_max_semi_space_size; v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); @@ -5671,7 +5708,7 @@ UNINITIALIZED_TEST(PromotionQueue) { CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity()); // Fill-up the first semi-space page. - FillUpOnePage(new_space); + heap::FillUpOnePage(new_space); // Create a small object to initialize the bump pointer on the second // semi-space page. @@ -5680,7 +5717,7 @@ UNINITIALIZED_TEST(PromotionQueue) { CHECK(heap->InNewSpace(*small)); // Fill-up the second semi-space page. - FillUpOnePage(new_space); + heap::FillUpOnePage(new_space); // This scavenge will corrupt memory if the promotion queue is not // evacuated. @@ -5710,9 +5747,9 @@ TEST(Regress388880) { // Allocate padding objects in old pointer space so, that object allocated // afterwards would end at the end of the page. - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); int padding_size = desired_offset - Page::kObjectStartOffset; - CreatePadding(heap, padding_size, TENURED); + heap::CreatePadding(heap, padding_size, TENURED); Handle<JSObject> o = factory->NewJSObjectFromMap(map1, TENURED); o->set_properties(*factory->empty_fixed_array()); @@ -5760,7 +5797,7 @@ TEST(Regress3631) { v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); while (!Marking::IsBlack( - Marking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && + ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && !marking->IsStopped()) { marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); } @@ -5859,11 +5896,11 @@ void CheckMapRetainingFor(int n) { Handle<WeakCell> weak_cell = AddRetainedMap(isolate, heap); CHECK(!weak_cell->cleared()); for (int i = 0; i < n; i++) { - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); heap->CollectGarbage(OLD_SPACE); } CHECK(!weak_cell->cleared()); - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); heap->CollectGarbage(OLD_SPACE); CHECK(weak_cell->cleared()); } @@ -5892,7 +5929,7 @@ TEST(RegressArrayListGC) { heap->CollectGarbage(OLD_SPACE); // Force GC in old space on next addition of retained map. Map::WeakCellForMap(map); - SimulateFullSpace(CcTest::heap()->new_space()); + heap::SimulateFullSpace(CcTest::heap()->new_space()); for (int i = 0; i < 10; i++) { heap->AddRetainedMap(map); } @@ -6037,7 +6074,7 @@ TEST(BootstrappingExports) { v8::Isolate* isolate = CcTest::isolate(); LocalContext env; - if (Snapshot::HaveASnapshotToStartFrom(CcTest::i_isolate())) return; + if (Snapshot::HasContextSnapshot(CcTest::i_isolate(), 0)) return; utils_has_been_collected = false; @@ -6169,57 +6206,11 @@ TEST(OldSpaceAllocationCounter) { } -TEST(NewSpaceAllocationThroughput) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - GCTracer* tracer = heap->tracer(); - int time1 = 100; - size_t counter1 = 1000; - tracer->SampleAllocation(time1, counter1, 0); - int time2 = 200; - size_t counter2 = 2000; - tracer->SampleAllocation(time2, counter2, 0); - size_t throughput = - tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(); - CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput); - int time3 = 1000; - size_t counter3 = 30000; - tracer->SampleAllocation(time3, counter3, 0); - throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(); - CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); -} - - -TEST(NewSpaceAllocationThroughput2) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - GCTracer* tracer = heap->tracer(); - int time1 = 100; - size_t counter1 = 1000; - tracer->SampleAllocation(time1, counter1, 0); - int time2 = 200; - size_t counter2 = 2000; - tracer->SampleAllocation(time2, counter2, 0); - size_t throughput = - tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100); - CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput); - int time3 = 1000; - size_t counter3 = 30000; - tracer->SampleAllocation(time3, counter3, 0); - throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100); - CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); -} - - static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = CcTest::i_isolate(); Object* message = *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); - CHECK(message->IsTheHole()); + CHECK(message->IsTheHole(isolate)); } @@ -6304,54 +6295,29 @@ TEST(CanonicalSharedFunctionInfo) { "check(g1, g2);"); } - -TEST(OldGenerationAllocationThroughput) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - GCTracer* tracer = heap->tracer(); - int time1 = 100; - size_t counter1 = 1000; - tracer->SampleAllocation(time1, 0, counter1); - int time2 = 200; - size_t counter2 = 2000; - tracer->SampleAllocation(time2, 0, counter2); - size_t throughput = static_cast<size_t>( - tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100)); - CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput); - int time3 = 1000; - size_t counter3 = 30000; - tracer->SampleAllocation(time3, 0, counter3); - throughput = static_cast<size_t>( - tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100)); - CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); -} - - -TEST(AllocationThroughput) { +TEST(RemoveCodeFromSharedFunctionInfoButNotFromClosure) { CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - GCTracer* tracer = heap->tracer(); - int time1 = 100; - size_t counter1 = 1000; - tracer->SampleAllocation(time1, counter1, counter1); - int time2 = 200; - size_t counter2 = 2000; - tracer->SampleAllocation(time2, counter2, counter2); - size_t throughput = static_cast<size_t>( - tracer->AllocationThroughputInBytesPerMillisecond(100)); - CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); - int time3 = 1000; - size_t counter3 = 30000; - tracer->SampleAllocation(time3, counter3, counter3); - throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); - CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); + global->Set(isolate, "check", v8::FunctionTemplate::New( + isolate, CheckEqualSharedFunctionInfos)); + global->Set(isolate, "remove", + v8::FunctionTemplate::New(isolate, RemoveCodeAndGC)); + v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); + v8::Context::Scope cscope(context); + CompileRun( + "function f() { return function g() {}; }" + "var g1 = f();" + "var g2 = f();" + "check(g1, g2);" + "g1();" + "g2();" + "remove(g1);" + "g2();" + "check(g1, g2);"); } - TEST(ContextMeasure) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -6452,7 +6418,7 @@ TEST(Regress519319) { parent.Reset(isolate, v8::Object::New(isolate)); child.Reset(isolate, v8::Object::New(isolate)); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); heap->CollectGarbage(OLD_SPACE); { UniqueId id = MakeUniqueId(parent); @@ -6511,7 +6477,7 @@ HEAP_TEST(Regress587004) { array->set(i, *number); } heap->CollectGarbage(OLD_SPACE); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1); heap->mark_compact_collector()->EnsureSweepingCompleted(); ByteArray* byte_array; @@ -6594,7 +6560,7 @@ HEAP_TEST(Regress589413) { } } } - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); for (size_t j = 0; j < arrays.size(); j++) { heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); } @@ -6604,6 +6570,106 @@ HEAP_TEST(Regress589413) { heap->CollectGarbage(OLD_SPACE); } +TEST(Regress598319) { + // This test ensures that no white objects can cross the progress bar of large + // objects during incremental marking. It checks this by using Shift() during + // incremental marking. + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + + const int kNumberOfObjects = Page::kMaxRegularHeapObjectSize / kPointerSize; + + struct Arr { + Arr(Isolate* isolate, int number_of_objects) { + root = isolate->factory()->NewFixedArray(1, TENURED); + { + // Temporary scope to avoid getting any other objects into the root set. + v8::HandleScope scope(CcTest::isolate()); + Handle<FixedArray> tmp = + isolate->factory()->NewFixedArray(number_of_objects); + root->set(0, *tmp); + for (int i = 0; i < get()->length(); i++) { + tmp = isolate->factory()->NewFixedArray(100, TENURED); + get()->set(i, *tmp); + } + } + } + + FixedArray* get() { return FixedArray::cast(root->get(0)); } + + Handle<FixedArray> root; + } arr(isolate, kNumberOfObjects); + + CHECK_EQ(arr.get()->length(), kNumberOfObjects); + CHECK(heap->lo_space()->Contains(arr.get())); + LargePage* page = heap->lo_space()->FindPage(arr.get()->address()); + CHECK_NOT_NULL(page); + + // GC to cleanup state + heap->CollectGarbage(OLD_SPACE); + MarkCompactCollector* collector = heap->mark_compact_collector(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + + CHECK(heap->lo_space()->Contains(arr.get())); + CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(arr.get()))); + for (int i = 0; i < arr.get()->length(); i++) { + CHECK(Marking::IsWhite( + ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); + } + + // Start incremental marking. + IncrementalMarking* marking = heap->incremental_marking(); + CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsStopped()) { + heap->StartIncrementalMarking(); + } + CHECK(marking->IsMarking()); + + // Check that we have not marked the interesting array during root scanning. + for (int i = 0; i < arr.get()->length(); i++) { + CHECK(Marking::IsWhite( + ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); + } + + // Now we search for a state where we are in incremental marking and have + // only partially marked the large object. + while (!marking->IsComplete()) { + marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { + CHECK_NE(page->progress_bar(), arr.get()->Size()); + { + // Shift by 1, effectively moving one white object across the progress + // bar, meaning that we will miss marking it. + v8::HandleScope scope(CcTest::isolate()); + Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( + Handle<FixedArray>(arr.get())); + js_array->GetElementsAccessor()->Shift(js_array); + } + break; + } + } + + // Finish marking with bigger steps to speed up test. + while (!marking->IsComplete()) { + marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + if (marking->IsReadyToOverApproximateWeakClosure()) { + marking->FinalizeIncrementally(); + } + } + CHECK(marking->IsComplete()); + + // All objects need to be black after marking. If a white object crossed the + // progress bar, we would fail here. + for (int i = 0; i < arr.get()->length(); i++) { + CHECK(Marking::IsBlack( + ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); + } +} + TEST(Regress609761) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -6617,5 +6683,406 @@ TEST(Regress609761) { CHECK_EQ(size_after, size_before + array->Size()); } +TEST(Regress615489) { + FLAG_black_allocation = true; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + heap->CollectAllGarbage(); + + i::MarkCompactCollector* collector = heap->mark_compact_collector(); + i::IncrementalMarking* marking = heap->incremental_marking(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsStopped()) { + heap->StartIncrementalMarking(); + } + CHECK(marking->IsMarking()); + marking->StartBlackAllocationForTesting(); + { + AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + v8::HandleScope inner(CcTest::isolate()); + isolate->factory()->NewFixedArray(500, TENURED)->Size(); + } + while (!marking->IsComplete()) { + marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + if (marking->IsReadyToOverApproximateWeakClosure()) { + marking->FinalizeIncrementally(); + } + } + CHECK(marking->IsComplete()); + intptr_t size_before = heap->SizeOfObjects(); + CcTest::heap()->CollectAllGarbage(); + intptr_t size_after = heap->SizeOfObjects(); + // Live size does not increase after garbage collection. + CHECK_LE(size_after, size_before); +} + +class StaticOneByteResource : public v8::String::ExternalOneByteStringResource { + public: + explicit StaticOneByteResource(const char* data) : data_(data) {} + + ~StaticOneByteResource() {} + + const char* data() const { return data_; } + + size_t length() const { return strlen(data_); } + + private: + const char* data_; +}; + +TEST(Regress631969) { + FLAG_manual_evacuation_candidates_selection = true; + FLAG_parallel_compaction = false; + FLAG_concurrent_sweeping = false; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + // Get the heap in clean state. + heap->CollectGarbage(OLD_SPACE); + heap->CollectGarbage(OLD_SPACE); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + // Allocate two strings in a fresh page and mark the page as evacuation + // candidate. + heap::SimulateFullSpace(heap->old_space()); + Handle<String> s1 = factory->NewStringFromStaticChars("123456789", TENURED); + Handle<String> s2 = factory->NewStringFromStaticChars("01234", TENURED); + Page::FromAddress(s1->address()) + ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + + heap::SimulateIncrementalMarking(heap, false); + + // Allocate a cons string and promote it to a fresh page in the old space. + heap::SimulateFullSpace(heap->old_space()); + Handle<String> s3; + factory->NewConsString(s1, s2).ToHandle(&s3); + heap->CollectGarbage(NEW_SPACE); + heap->CollectGarbage(NEW_SPACE); + + // Finish incremental marking. + IncrementalMarking* marking = heap->incremental_marking(); + while (!marking->IsComplete()) { + marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + if (marking->IsReadyToOverApproximateWeakClosure()) { + marking->FinalizeIncrementally(); + } + } + + { + StaticOneByteResource external_string("12345678901234"); + s3->MakeExternal(&external_string); + heap->CollectGarbage(OLD_SPACE); + } +} + +TEST(LeftTrimFixedArrayInBlackArea) { + FLAG_black_allocation = true; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + heap->CollectAllGarbage(); + + i::MarkCompactCollector* collector = heap->mark_compact_collector(); + i::IncrementalMarking* marking = heap->incremental_marking(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsStopped()) { + heap->StartIncrementalMarking(); + } + CHECK(marking->IsMarking()); + marking->StartBlackAllocationForTesting(); + + // Ensure that we allocate a new page, set up a bump pointer area, and + // perform the allocation in a black area. + heap::SimulateFullSpace(heap->old_space()); + isolate->factory()->NewFixedArray(4, TENURED); + Handle<FixedArray> array = isolate->factory()->NewFixedArray(50, TENURED); + CHECK(heap->old_space()->Contains(*array)); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*array))); + + // Now left trim the allocated black area. A filler has to be installed + // for the trimmed area and all mark bits of the trimmed area have to be + // cleared. + FixedArrayBase* trimmed = heap->LeftTrimFixedArray(*array, 10); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed))); + + heap::GcAndSweep(heap, OLD_SPACE); +} + +TEST(ContinuousLeftTrimFixedArrayInBlackArea) { + FLAG_black_allocation = true; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + heap->CollectAllGarbage(); + + i::MarkCompactCollector* collector = heap->mark_compact_collector(); + i::IncrementalMarking* marking = heap->incremental_marking(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsStopped()) { + heap->StartIncrementalMarking(); + } + CHECK(marking->IsMarking()); + marking->StartBlackAllocationForTesting(); + + // Ensure that we allocate a new page, set up a bump pointer area, and + // perform the allocation in a black area. + heap::SimulateFullSpace(heap->old_space()); + isolate->factory()->NewFixedArray(10, TENURED); + + // Allocate the fixed array that will be trimmed later. + Handle<FixedArray> array = isolate->factory()->NewFixedArray(100, TENURED); + Address start_address = array->address(); + Address end_address = start_address + array->Size(); + Page* page = Page::FromAddress(start_address); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*array))); + CHECK(page->markbits()->AllBitsSetInRange( + page->AddressToMarkbitIndex(start_address), + page->AddressToMarkbitIndex(end_address))); + CHECK(heap->old_space()->Contains(*array)); + + FixedArrayBase* previous = *array; + FixedArrayBase* trimmed; + + // First trim in one word steps. + for (int i = 0; i < 10; i++) { + trimmed = heap->LeftTrimFixedArray(previous, 1); + HeapObject* filler = HeapObject::FromAddress(previous->address()); + CHECK(filler->IsFiller()); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed))); + CHECK(Marking::IsImpossible(ObjectMarking::MarkBitFrom(previous))); + previous = trimmed; + } + + // Then trim in two and three word steps. + for (int i = 2; i <= 3; i++) { + for (int j = 0; j < 10; j++) { + trimmed = heap->LeftTrimFixedArray(previous, i); + HeapObject* filler = HeapObject::FromAddress(previous->address()); + CHECK(filler->IsFiller()); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed))); + CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); + previous = trimmed; + } + } + + heap::GcAndSweep(heap, OLD_SPACE); +} + +TEST(ContinuousRightTrimFixedArrayInBlackArea) { + FLAG_black_allocation = true; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + heap->CollectAllGarbage(); + + i::MarkCompactCollector* collector = heap->mark_compact_collector(); + i::IncrementalMarking* marking = heap->incremental_marking(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsStopped()) { + heap->StartIncrementalMarking(); + } + CHECK(marking->IsMarking()); + marking->StartBlackAllocationForTesting(); + + // Ensure that we allocate a new page, set up a bump pointer area, and + // perform the allocation in a black area. + heap::SimulateFullSpace(heap->old_space()); + isolate->factory()->NewFixedArray(10, TENURED); + + // Allocate the fixed array that will be trimmed later. + Handle<FixedArray> array = isolate->factory()->NewFixedArray(100, TENURED); + Address start_address = array->address(); + Address end_address = start_address + array->Size(); + Page* page = Page::FromAddress(start_address); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*array))); + CHECK(page->markbits()->AllBitsSetInRange( + page->AddressToMarkbitIndex(start_address), + page->AddressToMarkbitIndex(end_address))); + CHECK(heap->old_space()->Contains(*array)); + + // Trim it once by one word to make checking for white marking color uniform. + Address previous = end_address - kPointerSize; + heap->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(*array, 1); + HeapObject* filler = HeapObject::FromAddress(previous); + CHECK(filler->IsFiller()); + CHECK(Marking::IsImpossible(ObjectMarking::MarkBitFrom(previous))); + + // Trim 10 times by one, two, and three word. + for (int i = 1; i <= 3; i++) { + for (int j = 0; j < 10; j++) { + previous -= kPointerSize * i; + heap->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(*array, i); + HeapObject* filler = HeapObject::FromAddress(previous); + CHECK(filler->IsFiller()); + CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(previous))); + } + } + + heap::GcAndSweep(heap, OLD_SPACE); +} + +TEST(SlotFilteringAfterBlackAreas) { + FLAG_black_allocation = true; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector(); + heap->CollectAllGarbage(); + + i::MarkCompactCollector* collector = heap->mark_compact_collector(); + i::IncrementalMarking* marking = heap->incremental_marking(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsStopped()) { + heap->StartIncrementalMarking(); + } + CHECK(marking->IsMarking()); + marking->StartBlackAllocationForTesting(); + + // Ensure that we allocate a new page, set up a bump pointer area, and + // perform the allocation in a black area. + heap::SimulateFullSpace(heap->old_space()); + Handle<FixedArray> array = isolate->factory()->NewFixedArray(10, TENURED); + Page* page = Page::FromAddress(array->address()); + + // After allocation we empty the allocation info to limit the black area + // only on the allocated array. + heap->old_space()->EmptyAllocationInfo(); + + // Slots in the black area are part of the black object. + CHECK(mark_compact_collector->IsSlotInBlackObject(page, array->address())); + CHECK(mark_compact_collector->IsSlotInBlackObject( + page, array->address() + array->Size() - kPointerSize)); + + // Slots after the black area are not part of the black object and have to + // be filtered out. + CHECK(!mark_compact_collector->IsSlotInBlackObject( + page, array->address() + array->Size())); +} + +TEST(Regress618958) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + bool isolate_is_locked = true; + heap->update_external_memory(100 * MB); + int mark_sweep_count_before = heap->ms_count(); + heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, + isolate_is_locked); + int mark_sweep_count_after = heap->ms_count(); + int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; + // The memory pressuer handler either performed two GCs or performed one and + // started incremental marking. + CHECK(mark_sweeps_performed == 2 || + (mark_sweeps_performed == 1 && + !heap->incremental_marking()->IsStopped())); +} + +TEST(UncommitUnusedLargeObjectMemory) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + + Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); + MemoryChunk* chunk = MemoryChunk::FromAddress(array->address()); + CHECK(chunk->owner()->identity() == LO_SPACE); + + intptr_t size_before = array->Size(); + size_t committed_memory_before = chunk->CommittedPhysicalMemory(); + + array->Shrink(1); + CHECK(array->Size() < size_before); + + CcTest::heap()->CollectAllGarbage(); + CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before); + size_t shrinked_size = + RoundUp((array->address() - chunk->address()) + array->Size(), + base::OS::CommitPageSize()); + CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory()); +} + +TEST(RememberedSetRemoveRange) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + + Handle<FixedArray> array = isolate->factory()->NewFixedArray(Page::kPageSize / + kPointerSize); + MemoryChunk* chunk = MemoryChunk::FromAddress(array->address()); + CHECK(chunk->owner()->identity() == LO_SPACE); + Address start = array->address(); + // Maps slot to boolean indicator of whether the slot should be in the set. + std::map<Address, bool> slots; + slots[start + 0] = true; + slots[start + kPointerSize] = true; + slots[start + Page::kPageSize - kPointerSize] = true; + slots[start + Page::kPageSize] = true; + slots[start + Page::kPageSize + kPointerSize] = true; + slots[chunk->area_end() - kPointerSize] = true; + + for (auto x : slots) { + RememberedSet<OLD_TO_NEW>::Insert(chunk, x.first); + } + + RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { + CHECK(slots[addr]); + return KEEP_SLOT; + }); + + RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, start + kPointerSize); + slots[start] = false; + RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { + CHECK(slots[addr]); + return KEEP_SLOT; + }); + + RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start + kPointerSize, + start + Page::kPageSize); + slots[start + kPointerSize] = false; + slots[start + Page::kPageSize - kPointerSize] = false; + RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { + CHECK(slots[addr]); + return KEEP_SLOT; + }); + + RememberedSet<OLD_TO_NEW>::RemoveRange( + chunk, start, start + Page::kPageSize + kPointerSize); + slots[start + Page::kPageSize] = false; + RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { + CHECK(slots[addr]); + return KEEP_SLOT; + }); + + RememberedSet<OLD_TO_NEW>::RemoveRange( + chunk, chunk->area_end() - kPointerSize, chunk->area_end()); + slots[chunk->area_end() - kPointerSize] = false; + RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { + CHECK(slots[addr]); + return KEEP_SLOT; + }); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc index 765ae53afb..59697a94a1 100644 --- a/deps/v8/test/cctest/heap/test-incremental-marking.cc +++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc @@ -19,8 +19,7 @@ #include "src/full-codegen/full-codegen.h" #include "src/global-handles.h" #include "test/cctest/cctest.h" -#include "test/cctest/heap/utils-inl.h" - +#include "test/cctest/heap/heap-utils.h" using v8::IdleTask; using v8::Task; @@ -86,7 +85,7 @@ class MockPlatform : public v8::Platform { } uint64_t AddTraceEvent(char phase, const uint8_t* categoryEnabledFlag, - const char* name, uint64_t id, + const char* name, const char* scope, uint64_t id, uint64_t bind_id, int numArgs, const char** argNames, const uint8_t* argTypes, const uint64_t* argValues, unsigned int flags) override { @@ -120,7 +119,7 @@ TEST(IncrementalMarkingUsingIdleTasks) { v8::Platform* old_platform = i::V8::GetCurrentPlatform(); MockPlatform platform(old_platform); i::V8::SetPlatformForTesting(&platform); - SimulateFullSpace(CcTest::heap()->old_space()); + i::heap::SimulateFullSpace(CcTest::heap()->old_space()); i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); marking->Start(); @@ -145,7 +144,7 @@ TEST(IncrementalMarkingUsingIdleTasksAfterGC) { v8::Platform* old_platform = i::V8::GetCurrentPlatform(); MockPlatform platform(old_platform); i::V8::SetPlatformForTesting(&platform); - SimulateFullSpace(CcTest::heap()->old_space()); + i::heap::SimulateFullSpace(CcTest::heap()->old_space()); CcTest::heap()->CollectAllGarbage(); i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); @@ -171,7 +170,7 @@ TEST(IncrementalMarkingUsingDelayedTasks) { v8::Platform* old_platform = i::V8::GetCurrentPlatform(); MockPlatform platform(old_platform); i::V8::SetPlatformForTesting(&platform); - SimulateFullSpace(CcTest::heap()->old_space()); + i::heap::SimulateFullSpace(CcTest::heap()->old_space()); i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); marking->Start(); diff --git a/deps/v8/test/cctest/heap/test-lab.cc b/deps/v8/test/cctest/heap/test-lab.cc index bf4d3cc999..5a0ff2fbc4 100644 --- a/deps/v8/test/cctest/heap/test-lab.cc +++ b/deps/v8/test/cctest/heap/test-lab.cc @@ -170,7 +170,7 @@ TEST(MergeSuccessful) { CcTest::InitializeVM(); Heap* heap = CcTest::heap(); const int kLabSize = 2 * KB; - Address base1 = AllocateLabBackingStore(heap, kLabSize); + Address base1 = AllocateLabBackingStore(heap, 2 * kLabSize); Address limit1 = base1 + kLabSize; Address base2 = limit1; Address limit2 = base2 + kLabSize; @@ -226,7 +226,7 @@ TEST(MergeFailed) { CcTest::InitializeVM(); Heap* heap = CcTest::heap(); const int kLabSize = 2 * KB; - Address base1 = AllocateLabBackingStore(heap, kLabSize); + Address base1 = AllocateLabBackingStore(heap, 3 * kLabSize); Address base2 = base1 + kLabSize; Address base3 = base2 + kLabSize; diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc index cfcf149c61..1e5d30d0e7 100644 --- a/deps/v8/test/cctest/heap/test-mark-compact.cc +++ b/deps/v8/test/cctest/heap/test-mark-compact.cc @@ -43,8 +43,7 @@ #include "src/global-handles.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" -#include "test/cctest/heap/utils-inl.h" - +#include "test/cctest/heap/heap-utils.h" using namespace v8::internal; using v8::Just; @@ -76,58 +75,49 @@ TEST(MarkingDeque) { DeleteArray(mem); } - -HEAP_TEST(Promotion) { +TEST(Promotion) { CcTest::InitializeVM(); - Heap* heap = CcTest::heap(); - heap->ConfigureHeap(1, 1, 1, 0); - - v8::HandleScope sc(CcTest::isolate()); - - // Allocate a fixed array in the new space. - int array_length = - (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / - (4 * kPointerSize); - Object* obj = heap->AllocateFixedArray(array_length).ToObjectChecked(); - Handle<FixedArray> array(FixedArray::cast(obj)); + Isolate* isolate = CcTest::i_isolate(); + { + v8::HandleScope sc(CcTest::isolate()); + Heap* heap = isolate->heap(); - // Array should be in the new space. - CHECK(heap->InSpace(*array, NEW_SPACE)); + heap::SealCurrentObjects(heap); - // Call mark compact GC, so array becomes an old object. - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + int array_length = + heap::FixedArrayLenFromSize(Page::kMaxRegularHeapObjectSize); + Handle<FixedArray> array = isolate->factory()->NewFixedArray(array_length); - // Array now sits in the old space - CHECK(heap->InSpace(*array, OLD_SPACE)); + // Array should be in the new space. + CHECK(heap->InSpace(*array, NEW_SPACE)); + heap->CollectAllGarbage(); + heap->CollectAllGarbage(); + CHECK(heap->InSpace(*array, OLD_SPACE)); + } } - HEAP_TEST(NoPromotion) { CcTest::InitializeVM(); - Heap* heap = CcTest::heap(); - heap->ConfigureHeap(1, 1, 1, 0); - - v8::HandleScope sc(CcTest::isolate()); - - // Allocate a big fixed array in the new space. - int array_length = - (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / - (2 * kPointerSize); - Object* obj = heap->AllocateFixedArray(array_length).ToObjectChecked(); - Handle<FixedArray> array(FixedArray::cast(obj)); + Isolate* isolate = CcTest::i_isolate(); + { + v8::HandleScope sc(CcTest::isolate()); + Heap* heap = isolate->heap(); - // Array should be in the new space. - CHECK(heap->InSpace(*array, NEW_SPACE)); + heap::SealCurrentObjects(heap); - // Simulate a full old space to make promotion fail. - SimulateFullSpace(heap->old_space()); + int array_length = + heap::FixedArrayLenFromSize(Page::kMaxRegularHeapObjectSize); + Handle<FixedArray> array = isolate->factory()->NewFixedArray(array_length); - // Call mark compact GC, and it should pass. - heap->CollectGarbage(OLD_SPACE); + heap->set_force_oom(true); + // Array should be in the new space. + CHECK(heap->InSpace(*array, NEW_SPACE)); + heap->CollectAllGarbage(); + heap->CollectAllGarbage(); + CHECK(heap->InSpace(*array, NEW_SPACE)); + } } - HEAP_TEST(MarkCompactCollector) { FLAG_incremental_marking = false; FLAG_retain_maps_for_n_gc = 0; @@ -236,8 +226,7 @@ TEST(MapCompact) { static int NumberOfWeakCalls = 0; -static void WeakPointerCallback( - const v8::WeakCallbackData<v8::Value, void>& data) { +static void WeakPointerCallback(const v8::WeakCallbackInfo<void>& data) { std::pair<v8::Persistent<v8::Value>*, int>* p = reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( data.GetParameter()); @@ -262,17 +251,17 @@ HEAP_TEST(ObjectGroups) { Handle<Object> g1c1 = global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked()); std::pair<Handle<Object>*, int> g1s1_and_id(&g1s1, 1234); - GlobalHandles::MakeWeak(g1s1.location(), - reinterpret_cast<void*>(&g1s1_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g1s1.location(), reinterpret_cast<void*>(&g1s1_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); std::pair<Handle<Object>*, int> g1s2_and_id(&g1s2, 1234); - GlobalHandles::MakeWeak(g1s2.location(), - reinterpret_cast<void*>(&g1s2_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g1s2.location(), reinterpret_cast<void*>(&g1s2_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); std::pair<Handle<Object>*, int> g1c1_and_id(&g1c1, 1234); - GlobalHandles::MakeWeak(g1c1.location(), - reinterpret_cast<void*>(&g1c1_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g1c1.location(), reinterpret_cast<void*>(&g1c1_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); Handle<Object> g2s1 = global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked()); @@ -281,17 +270,17 @@ HEAP_TEST(ObjectGroups) { Handle<Object> g2c1 = global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked()); std::pair<Handle<Object>*, int> g2s1_and_id(&g2s1, 1234); - GlobalHandles::MakeWeak(g2s1.location(), - reinterpret_cast<void*>(&g2s1_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g2s1.location(), reinterpret_cast<void*>(&g2s1_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); std::pair<Handle<Object>*, int> g2s2_and_id(&g2s2, 1234); - GlobalHandles::MakeWeak(g2s2.location(), - reinterpret_cast<void*>(&g2s2_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g2s2.location(), reinterpret_cast<void*>(&g2s2_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); std::pair<Handle<Object>*, int> g2c1_and_id(&g2c1, 1234); - GlobalHandles::MakeWeak(g2c1.location(), - reinterpret_cast<void*>(&g2c1_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g2c1.location(), reinterpret_cast<void*>(&g2c1_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); Handle<Object> root = global_handles->Create(*g1s1); // make a root. @@ -317,9 +306,9 @@ HEAP_TEST(ObjectGroups) { // Weaken the root. std::pair<Handle<Object>*, int> root_and_id(&root, 1234); - GlobalHandles::MakeWeak(root.location(), - reinterpret_cast<void*>(&root_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + root.location(), reinterpret_cast<void*>(&root_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); // But make children strong roots---all the objects (except for children) // should be collectable now. global_handles->ClearWeakness(g1c1.location()); @@ -343,12 +332,12 @@ HEAP_TEST(ObjectGroups) { CHECK_EQ(5, NumberOfWeakCalls); // And now make children weak again and collect them. - GlobalHandles::MakeWeak(g1c1.location(), - reinterpret_cast<void*>(&g1c1_and_id), - &WeakPointerCallback); - GlobalHandles::MakeWeak(g2c1.location(), - reinterpret_cast<void*>(&g2c1_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + g1c1.location(), reinterpret_cast<void*>(&g1c1_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); + GlobalHandles::MakeWeak( + g2c1.location(), reinterpret_cast<void*>(&g2c1_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); heap->CollectGarbage(OLD_SPACE); CHECK_EQ(7, NumberOfWeakCalls); diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc new file mode 100644 index 0000000000..4ec2e2a416 --- /dev/null +++ b/deps/v8/test/cctest/heap/test-page-promotion.cc @@ -0,0 +1,129 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/heap/array-buffer-tracker.h" +#include "test/cctest/cctest.h" +#include "test/cctest/heap/heap-utils.h" + +namespace { + +v8::Isolate* NewIsolateForPagePromotion() { + i::FLAG_page_promotion = true; + i::FLAG_page_promotion_threshold = 0; // % + i::FLAG_min_semi_space_size = 8 * (i::Page::kPageSize / i::MB); + // We cannot optimize for size as we require a new space with more than one + // page. + i::FLAG_optimize_for_size = false; + // Set max_semi_space_size because it could've been initialized by an + // implication of optimize_for_size. + i::FLAG_max_semi_space_size = i::FLAG_min_semi_space_size; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + v8::Isolate* isolate = v8::Isolate::New(create_params); + return isolate; +} + +} // namespace + +namespace v8 { +namespace internal { + +UNINITIALIZED_TEST(PagePromotion_NewToOld) { + v8::Isolate* isolate = NewIsolateForPagePromotion(); + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::New(isolate)->Enter(); + Heap* heap = i_isolate->heap(); + + std::vector<Handle<FixedArray>> handles; + heap::SimulateFullSpace(heap->new_space(), &handles); + heap->CollectGarbage(NEW_SPACE); + CHECK_GT(handles.size(), 0u); + // First object in handle should be on the first page. + Handle<FixedArray> first_object = handles.front(); + Page* first_page = Page::FromAddress(first_object->address()); + // To perform a sanity check on live bytes we need to mark the heap. + heap::SimulateIncrementalMarking(heap, true); + // Sanity check that the page meets the requirements for promotion. + const int threshold_bytes = + FLAG_page_promotion_threshold * Page::kAllocatableMemory / 100; + CHECK_GE(first_page->LiveBytes(), threshold_bytes); + + // Actual checks: The page is in new space first, but is moved to old space + // during a full GC. + CHECK(heap->new_space()->ContainsSlow(first_page->address())); + CHECK(!heap->old_space()->ContainsSlow(first_page->address())); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(!heap->new_space()->ContainsSlow(first_page->address())); + CHECK(heap->old_space()->ContainsSlow(first_page->address())); + } +} + +UNINITIALIZED_TEST(PagePromotion_NewToNew) { + v8::Isolate* isolate = NewIsolateForPagePromotion(); + Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::New(isolate)->Enter(); + Heap* heap = i_isolate->heap(); + + std::vector<Handle<FixedArray>> handles; + heap::SimulateFullSpace(heap->new_space(), &handles); + CHECK_GT(handles.size(), 0u); + // Last object in handles should definitely be on the last page which does + // not contain the age mark. + Handle<FixedArray> last_object = handles.back(); + Page* to_be_promoted_page = Page::FromAddress(last_object->address()); + CHECK(to_be_promoted_page->Contains(last_object->address())); + CHECK(heap->new_space()->ToSpaceContainsSlow(last_object->address())); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(heap->new_space()->ToSpaceContainsSlow(last_object->address())); + CHECK(to_be_promoted_page->Contains(last_object->address())); + } +} + +UNINITIALIZED_TEST(PagePromotion_NewToNewJSArrayBuffer) { + // Test makes sure JSArrayBuffer backing stores are still tracked after + // new-to-new promotion. + v8::Isolate* isolate = NewIsolateForPagePromotion(); + Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::New(isolate)->Enter(); + Heap* heap = i_isolate->heap(); + + // Fill the current page which potentially contains the age mark. + heap::FillCurrentPage(heap->new_space()); + + // Allocate a buffer we would like to check against. + Handle<JSArrayBuffer> buffer = + i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); + 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); + CHECK_GT(handles.size(), 0u); + // Last object in handles should definitely be on the last page which does + // not contain the age mark. + Handle<FixedArray> first_object = handles.front(); + Page* to_be_promoted_page = Page::FromAddress(first_object->address()); + CHECK(to_be_promoted_page->Contains(first_object->address())); + CHECK(to_be_promoted_page->Contains(buffer->address())); + CHECK(heap->new_space()->ToSpaceContainsSlow(first_object->address())); + CHECK(heap->new_space()->ToSpaceContainsSlow(buffer->address())); + heap::GcAndSweep(heap, OLD_SPACE); + CHECK(heap->new_space()->ToSpaceContainsSlow(first_object->address())); + CHECK(heap->new_space()->ToSpaceContainsSlow(buffer->address())); + CHECK(to_be_promoted_page->Contains(first_object->address())); + CHECK(to_be_promoted_page->Contains(buffer->address())); + CHECK(ArrayBufferTracker::IsTracked(*buffer)); + } +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc index 5eb1549e11..2328518f2a 100644 --- a/deps/v8/test/cctest/heap/test-spaces.cc +++ b/deps/v8/test/cctest/heap/test-spaces.cc @@ -32,7 +32,6 @@ #include "src/v8.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" -#include "test/cctest/heap/utils-inl.h" namespace v8 { namespace internal { @@ -107,13 +106,12 @@ TEST(Page) { class TestMemoryAllocatorScope { public: TestMemoryAllocatorScope(Isolate* isolate, MemoryAllocator* allocator) - : isolate_(isolate), - old_allocator_(isolate->memory_allocator_) { - isolate->memory_allocator_ = allocator; + : isolate_(isolate), old_allocator_(isolate->heap()->memory_allocator()) { + isolate->heap()->memory_allocator_ = allocator; } ~TestMemoryAllocatorScope() { - isolate_->memory_allocator_ = old_allocator_; + isolate_->heap()->memory_allocator_ = old_allocator_; } private: @@ -129,12 +127,12 @@ class TestCodeRangeScope { public: TestCodeRangeScope(Isolate* isolate, CodeRange* code_range) : isolate_(isolate), - old_code_range_(isolate->code_range_) { - isolate->code_range_ = code_range; + old_code_range_(isolate->heap()->memory_allocator()->code_range()) { + isolate->heap()->memory_allocator()->code_range_ = code_range; } ~TestCodeRangeScope() { - isolate_->code_range_ = old_code_range_; + isolate_->heap()->memory_allocator()->code_range_ = old_code_range_; } private: @@ -153,50 +151,49 @@ static void VerifyMemoryChunk(Isolate* isolate, size_t second_commit_area_size, Executability executable) { MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); - CHECK(memory_allocator->SetUp(heap->MaxReserved(), - heap->MaxExecutableSize())); - TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); - TestCodeRangeScope test_code_range_scope(isolate, code_range); - - size_t header_size = (executable == EXECUTABLE) - ? MemoryAllocator::CodePageGuardStartOffset() - : MemoryChunk::kObjectStartOffset; - size_t guard_size = (executable == EXECUTABLE) - ? MemoryAllocator::CodePageGuardSize() - : 0; - - MemoryChunk* memory_chunk = memory_allocator->AllocateChunk(reserve_area_size, - commit_area_size, - executable, - NULL); - size_t alignment = code_range != NULL && code_range->valid() - ? MemoryChunk::kAlignment - : base::OS::CommitPageSize(); - size_t reserved_size = - ((executable == EXECUTABLE)) - ? RoundUp(header_size + guard_size + reserve_area_size + guard_size, - alignment) - : RoundUp(header_size + reserve_area_size, - base::OS::CommitPageSize()); - CHECK(memory_chunk->size() == reserved_size); - CHECK(memory_chunk->area_start() < memory_chunk->address() + - memory_chunk->size()); - CHECK(memory_chunk->area_end() <= memory_chunk->address() + - memory_chunk->size()); - CHECK(static_cast<size_t>(memory_chunk->area_size()) == commit_area_size); - - Address area_start = memory_chunk->area_start(); - - memory_chunk->CommitArea(second_commit_area_size); - CHECK(area_start == memory_chunk->area_start()); - CHECK(memory_chunk->area_start() < memory_chunk->address() + - memory_chunk->size()); - CHECK(memory_chunk->area_end() <= memory_chunk->address() + - memory_chunk->size()); - CHECK(static_cast<size_t>(memory_chunk->area_size()) == - second_commit_area_size); - - memory_allocator->Free(memory_chunk); + CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), + 0)); + { + TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); + TestCodeRangeScope test_code_range_scope(isolate, code_range); + + size_t header_size = (executable == EXECUTABLE) + ? MemoryAllocator::CodePageGuardStartOffset() + : MemoryChunk::kObjectStartOffset; + size_t guard_size = + (executable == EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0; + + MemoryChunk* memory_chunk = memory_allocator->AllocateChunk( + reserve_area_size, commit_area_size, executable, NULL); + size_t alignment = code_range != NULL && code_range->valid() + ? MemoryChunk::kAlignment + : base::OS::CommitPageSize(); + size_t reserved_size = + ((executable == EXECUTABLE)) + ? RoundUp(header_size + guard_size + reserve_area_size + guard_size, + alignment) + : RoundUp(header_size + reserve_area_size, + base::OS::CommitPageSize()); + CHECK(memory_chunk->size() == reserved_size); + CHECK(memory_chunk->area_start() < + memory_chunk->address() + memory_chunk->size()); + CHECK(memory_chunk->area_end() <= + memory_chunk->address() + memory_chunk->size()); + CHECK(static_cast<size_t>(memory_chunk->area_size()) == commit_area_size); + + Address area_start = memory_chunk->area_start(); + + memory_chunk->CommitArea(second_commit_area_size); + CHECK(area_start == memory_chunk->area_start()); + CHECK(memory_chunk->area_start() < + memory_chunk->address() + memory_chunk->size()); + CHECK(memory_chunk->area_end() <= + memory_chunk->address() + memory_chunk->size()); + CHECK(static_cast<size_t>(memory_chunk->area_size()) == + second_commit_area_size); + + memory_allocator->Free<MemoryAllocator::kFull>(memory_chunk); + } memory_allocator->TearDown(); delete memory_allocator; } @@ -205,36 +202,32 @@ static void VerifyMemoryChunk(Isolate* isolate, TEST(Regress3540) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); - const int pageSize = Page::kPageSize; MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); - CHECK( - memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize())); + CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), + 0)); TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); CodeRange* code_range = new CodeRange(isolate); - const size_t code_range_size = 4 * pageSize; - if (!code_range->SetUp( - code_range_size + - RoundUp(v8::base::OS::CommitPageSize() * kReservedCodeRangePages, - MemoryChunk::kAlignment) + - v8::internal::MemoryAllocator::CodePageAreaSize())) { + size_t code_range_size = + kMinimumCodeRangeSize > 0 ? kMinimumCodeRangeSize : 3 * Page::kPageSize; + if (!code_range->SetUp(code_range_size)) { return; } Address address; size_t size; - size_t request_size = code_range_size - 2 * pageSize; + size_t request_size = code_range_size - Page::kPageSize; address = code_range->AllocateRawMemory( request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), &size); - CHECK(address != NULL); + CHECK_NOT_NULL(address); Address null_address; size_t null_size; - request_size = code_range_size - pageSize; + request_size = code_range_size - Page::kPageSize; null_address = code_range->AllocateRawMemory( request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), &null_size); - CHECK(null_address == NULL); + CHECK_NULL(null_address); code_range->FreeRawMemory(address, size); delete code_range; @@ -283,8 +276,8 @@ TEST(MemoryChunk) { NOT_EXECUTABLE); delete code_range; - // Without CodeRange. - code_range = NULL; + // Without a valid CodeRange, i.e., omitting SetUp. + code_range = new CodeRange(isolate); VerifyMemoryChunk(isolate, heap, code_range, @@ -300,6 +293,7 @@ TEST(MemoryChunk) { initial_commit_area_size, second_commit_area_size, NOT_EXECUTABLE); + delete code_range; } } @@ -310,14 +304,14 @@ TEST(MemoryAllocator) { MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); CHECK(memory_allocator != nullptr); - CHECK(memory_allocator->SetUp(heap->MaxReserved(), - heap->MaxExecutableSize())); + CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), + 0)); TestMemoryAllocatorScope test_scope(isolate, memory_allocator); { int total_pages = 0; OldSpace faked_space(heap, OLD_SPACE, NOT_EXECUTABLE); - Page* first_page = memory_allocator->AllocatePage<Page>( + Page* first_page = memory_allocator->AllocatePage( faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space), NOT_EXECUTABLE); @@ -331,7 +325,7 @@ TEST(MemoryAllocator) { } // Again, we should get n or n - 1 pages. - Page* other = memory_allocator->AllocatePage<Page>( + Page* other = memory_allocator->AllocatePage( faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space), NOT_EXECUTABLE); CHECK(Page::IsValid(other)); @@ -358,8 +352,8 @@ TEST(NewSpace) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); - CHECK(memory_allocator->SetUp(heap->MaxReserved(), - heap->MaxExecutableSize())); + CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), + 0)); TestMemoryAllocatorScope test_scope(isolate, memory_allocator); NewSpace new_space(heap); @@ -385,8 +379,8 @@ TEST(OldSpace) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); - CHECK(memory_allocator->SetUp(heap->MaxReserved(), - heap->MaxExecutableSize())); + CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), + 0)); TestMemoryAllocatorScope test_scope(isolate, memory_allocator); OldSpace* s = new OldSpace(heap, OLD_SPACE, NOT_EXECUTABLE); @@ -409,8 +403,8 @@ TEST(CompactionSpace) { Heap* heap = isolate->heap(); MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); CHECK(memory_allocator != nullptr); - CHECK( - memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize())); + CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), + 0)); TestMemoryAllocatorScope test_scope(isolate, memory_allocator); CompactionSpace* compaction_space = @@ -491,7 +485,15 @@ TEST(SizeOfFirstPageIsLargeEnough) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); if (!isolate->snapshot_available()) return; - if (Snapshot::EmbedsScript(isolate)) return; + HandleScope scope(isolate); + v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); + // Skip this test on the custom snapshot builder. + if (!CcTest::global() + ->Get(context, v8_str("assertEquals")) + .ToLocalChecked() + ->IsUndefined()) { + return; + } // If this test fails due to enabling experimental natives that are not part // of the snapshot, we may need to adjust CalculateFirstPageSizes. @@ -504,7 +506,6 @@ TEST(SizeOfFirstPageIsLargeEnough) { } // Executing the empty script gets by with one page per space. - HandleScope scope(isolate); CompileRun("/*empty*/"); for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { // Debug code can be very large, so skip CODE_SPACE if we are generating it. diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc index bf43b95402..507875742d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc @@ -4,6 +4,7 @@ #include "test/cctest/interpreter/bytecode-expectations-printer.h" +#include <iomanip> #include <iostream> #include <vector> @@ -11,14 +12,15 @@ #include "include/v8.h" #include "src/base/logging.h" -#include "src/base/smart-pointers.h" #include "src/compiler.h" #include "src/runtime/runtime.h" #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecode-generator.h" #include "src/interpreter/bytecodes.h" +#include "src/interpreter/interpreter-intrinsics.h" #include "src/interpreter/interpreter.h" +#include "src/source-position-table.h" namespace v8 { namespace internal { @@ -27,6 +29,7 @@ namespace interpreter { // static const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName = "__genbckexp_wrapper__"; +const char* const BytecodeExpectationsPrinter::kIndent = " "; v8::Local<v8::String> BytecodeExpectationsPrinter::V8StringFromUTF8( const char* data) const { @@ -95,18 +98,12 @@ void BytecodeExpectationsPrinter::PrintEscapedString( } } -namespace { -i::Runtime::FunctionId IndexToFunctionId(uint32_t index) { - return static_cast<i::Runtime::FunctionId>(index); -} -} // namespace - void BytecodeExpectationsPrinter::PrintBytecodeOperand( - std::ostream& stream, const BytecodeArrayIterator& bytecode_iter, + std::ostream& stream, const BytecodeArrayIterator& bytecode_iterator, const Bytecode& bytecode, int op_index, int parameter_count) const { OperandType op_type = Bytecodes::GetOperandType(bytecode, op_index); OperandSize op_size = Bytecodes::GetOperandSize( - bytecode, op_index, bytecode_iter.current_operand_scale()); + bytecode, op_index, bytecode_iterator.current_operand_scale()); const char* size_tag; switch (op_size) { @@ -125,7 +122,7 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( } if (Bytecodes::IsRegisterOperandType(op_type)) { - Register register_value = bytecode_iter.GetRegisterOperand(op_index); + Register register_value = bytecode_iterator.GetRegisterOperand(op_index); stream << 'R'; if (op_size != OperandSize::kByte) stream << size_tag; if (register_value.is_new_target()) { @@ -149,21 +146,27 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( switch (op_type) { case OperandType::kFlag8: - stream << bytecode_iter.GetFlagOperand(op_index); + stream << bytecode_iterator.GetFlagOperand(op_index); break; case OperandType::kIdx: - stream << bytecode_iter.GetIndexOperand(op_index); + stream << bytecode_iterator.GetIndexOperand(op_index); break; case OperandType::kImm: - stream << bytecode_iter.GetImmediateOperand(op_index); + stream << bytecode_iterator.GetImmediateOperand(op_index); break; case OperandType::kRegCount: - stream << bytecode_iter.GetRegisterCountOperand(op_index); + stream << bytecode_iterator.GetRegisterCountOperand(op_index); break; case OperandType::kRuntimeId: { - uint32_t operand = bytecode_iter.GetRuntimeIdOperand(op_index); - stream << "Runtime::k" - << i::Runtime::FunctionForId(IndexToFunctionId(operand))->name; + Runtime::FunctionId id = + bytecode_iterator.GetRuntimeIdOperand(op_index); + stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; + break; + } + case OperandType::kIntrinsicId: { + Runtime::FunctionId id = + bytecode_iterator.GetIntrinsicIdOperand(op_index); + stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; break; } default: @@ -175,10 +178,10 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( } void BytecodeExpectationsPrinter::PrintBytecode( - std::ostream& stream, const BytecodeArrayIterator& bytecode_iter, + std::ostream& stream, const BytecodeArrayIterator& bytecode_iterator, int parameter_count) const { - Bytecode bytecode = bytecode_iter.current_bytecode(); - OperandScale operand_scale = bytecode_iter.current_operand_scale(); + Bytecode bytecode = bytecode_iterator.current_bytecode(); + OperandScale operand_scale = bytecode_iterator.current_operand_scale(); if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale)) { Bytecode prefix = Bytecodes::OperandScaleToPrefixBytecode(operand_scale); stream << "B(" << Bytecodes::ToString(prefix) << "), "; @@ -187,11 +190,30 @@ void BytecodeExpectationsPrinter::PrintBytecode( int operands_count = Bytecodes::NumberOfOperands(bytecode); for (int op_index = 0; op_index < operands_count; ++op_index) { stream << ", "; - PrintBytecodeOperand(stream, bytecode_iter, bytecode, op_index, + PrintBytecodeOperand(stream, bytecode_iterator, bytecode, op_index, parameter_count); } } +void BytecodeExpectationsPrinter::PrintSourcePosition( + std::ostream& stream, SourcePositionTableIterator& source_iterator, + int bytecode_offset) const { + static const size_t kPositionWidth = 4; + if (!source_iterator.done() && + source_iterator.code_offset() == bytecode_offset) { + stream << "/* " << std::setw(kPositionWidth) + << source_iterator.source_position(); + if (source_iterator.is_statement()) { + stream << " S> */ "; + } else { + stream << " E> */ "; + } + source_iterator.Advance(); + } else { + stream << " " << std::setw(kPositionWidth) << ' ' << " "; + } +} + void BytecodeExpectationsPrinter::PrintV8String(std::ostream& stream, i::String* string) const { stream << '"'; @@ -246,10 +268,15 @@ void BytecodeExpectationsPrinter::PrintBytecodeSequence( std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const { stream << "bytecode array length: " << bytecode_array->length() << "\nbytecodes: [\n"; - BytecodeArrayIterator bytecode_iter(bytecode_array); - for (; !bytecode_iter.done(); bytecode_iter.Advance()) { - stream << " "; - PrintBytecode(stream, bytecode_iter, bytecode_array->parameter_count()); + + SourcePositionTableIterator source_iterator( + bytecode_array->source_position_table()); + BytecodeArrayIterator bytecode_iterator(bytecode_array); + for (; !bytecode_iterator.done(); bytecode_iterator.Advance()) { + stream << kIndent; + PrintSourcePosition(stream, source_iterator, + bytecode_iterator.current_offset()); + PrintBytecode(stream, bytecode_iterator, bytecode_array->parameter_count()); stream << ",\n"; } stream << "]\n"; @@ -261,7 +288,7 @@ void BytecodeExpectationsPrinter::PrintConstantPool( int num_constants = constant_pool->length(); if (num_constants > 0) { for (int i = 0; i < num_constants; ++i) { - stream << " "; + stream << kIndent; PrintConstant(stream, i::FixedArray::get(constant_pool, i, i_isolate())); stream << ",\n"; } @@ -275,7 +302,7 @@ void BytecodeExpectationsPrinter::PrintCodeSnippet( std::stringstream body_stream(body); std::string body_line; while (std::getline(body_stream, body_line)) { - stream << " "; + stream << kIndent; PrintEscapedString(stream, body_line); stream << '\n'; } diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h index 0fcead5716..c64ca90c81 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h @@ -17,6 +17,9 @@ namespace v8 { class Isolate; namespace internal { + +class SourcePositionTableIterator; + namespace interpreter { class BytecodeArrayIterator; @@ -65,12 +68,15 @@ class BytecodeExpectationsPrinter final { void PrintEscapedString(std::ostream& stream, // NOLINT const std::string& string) const; void PrintBytecodeOperand(std::ostream& stream, // NOLINT - const BytecodeArrayIterator& bytecode_iter, + const BytecodeArrayIterator& bytecode_iterator, const Bytecode& bytecode, int op_index, int parameter_count) const; void PrintBytecode(std::ostream& stream, // NOLINT - const BytecodeArrayIterator& bytecode_iter, + const BytecodeArrayIterator& bytecode_iterator, int parameter_count) const; + void PrintSourcePosition(std::ostream& stream, // NOLINT + SourcePositionTableIterator& source_iterator, + int bytecode_offset) const; void PrintV8String(std::ostream& stream, // NOLINT i::String* string) const; void PrintConstant(std::ostream& stream, // NOLINT @@ -111,6 +117,7 @@ class BytecodeExpectationsPrinter final { std::string test_function_name_; static const char* const kDefaultTopFunctionName; + static const char* const kIndent; }; } // namespace interpreter diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden index 4c9753f389..4997d1a004 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 51 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -29,28 +29,25 @@ handlers: [ snippet: " var a = 1; return [ a, a + 1 ]; " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 39 +bytecode array length: 35 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Star), R(2), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(0), - B(KeyedStoreICSloppy), R(2), R(1), U8(1), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(3), - B(LdaSmi), U8(1), - B(Add), R(3), - B(KeyedStoreICSloppy), R(2), R(1), U8(1), - B(Ldar), R(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(Star), R(2), + B(LdaZero), + B(Star), R(1), + B(Ldar), R(0), + /* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(2), + B(LdaSmi), U8(1), + B(Star), R(1), + /* 57 E> */ B(AddSmi), U8(1), R(0), U8(1), + B(StaKeyedPropertySloppy), R(2), R(1), U8(2), + B(Ldar), R(2), + /* 66 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -66,9 +63,9 @@ frame size: 0 parameter count: 1 bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(CreateArrayLiteral), U8(0), U8(2), U8(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(2), + /* 62 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -80,40 +77,37 @@ handlers: [ snippet: " var a = 1; return [ [ a, 2 ], [ a + 2 ] ]; " -frame size: 6 +frame size: 5 parameter count: 1 -bytecode array length: 69 +bytecode array length: 65 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(CreateArrayLiteral), U8(0), U8(2), U8(2), - B(Star), R(2), - B(LdaZero), - B(Star), R(1), - B(CreateArrayLiteral), U8(1), U8(0), U8(3), - B(Star), R(4), - B(LdaZero), - B(Star), R(3), - B(Ldar), R(0), - B(KeyedStoreICSloppy), R(4), R(3), U8(1), - B(Ldar), R(4), - B(KeyedStoreICSloppy), R(2), R(1), U8(5), - B(LdaSmi), U8(1), - B(Star), R(1), - B(CreateArrayLiteral), U8(2), U8(1), U8(3), - B(Star), R(4), - B(LdaZero), - B(Star), R(3), - B(Ldar), R(0), - B(Star), R(5), - B(LdaSmi), U8(2), - B(Add), R(5), - B(KeyedStoreICSloppy), R(4), R(3), U8(3), - B(Ldar), R(4), - B(KeyedStoreICSloppy), R(2), R(1), U8(5), - B(Ldar), R(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(2), + B(Star), R(2), + B(LdaZero), + B(Star), R(1), + B(CreateArrayLiteral), U8(1), U8(0), U8(3), + B(Star), R(4), + B(LdaZero), + B(Star), R(3), + B(Ldar), R(0), + /* 56 E> */ B(StaKeyedPropertySloppy), R(4), R(3), U8(1), + B(Ldar), R(4), + B(StaKeyedPropertySloppy), R(2), R(1), U8(6), + B(LdaSmi), U8(1), + B(Star), R(1), + B(CreateArrayLiteral), U8(2), U8(1), U8(3), + B(Star), R(4), + B(LdaZero), + B(Star), R(3), + /* 66 E> */ B(AddSmi), U8(2), R(0), U8(3), + B(StaKeyedPropertySloppy), R(4), R(3), U8(4), + B(Ldar), R(4), + B(StaKeyedPropertySloppy), R(2), R(1), U8(6), + B(Ldar), R(2), + /* 77 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden index 2077b792d4..9f9a25120b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden @@ -272,521 +272,521 @@ frame size: 1 parameter count: 1 bytecode array length: 1033 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(CreateArrayLiteral), U16(256), U16(0), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 41 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 51 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 61 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 71 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 81 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 91 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 101 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 111 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 121 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 131 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 141 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 151 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 161 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 171 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 181 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 191 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 201 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 211 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 221 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 231 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 241 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 251 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 261 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 271 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 281 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 291 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 301 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 311 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 321 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 331 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 341 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 351 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 361 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 371 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 381 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 391 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 401 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 411 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 421 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 431 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 441 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 451 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 461 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 471 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 481 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 491 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 501 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 511 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 521 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 531 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 541 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 551 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 561 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 571 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 581 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 591 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 601 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 611 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 621 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 631 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 641 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 651 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 661 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 671 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 681 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 691 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 701 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 711 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 721 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 731 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 741 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 751 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 761 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 771 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 781 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 791 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 801 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 811 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 821 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 831 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 841 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 851 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 861 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 871 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 881 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 891 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 901 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 911 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 921 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 931 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 941 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 951 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 961 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 971 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 981 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 991 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1001 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1011 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1021 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1031 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1041 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1051 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1061 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1071 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1081 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1091 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1101 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1111 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1121 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1131 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1141 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1151 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1161 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1171 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1181 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1191 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1201 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1211 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1221 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1231 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1241 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1251 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1261 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1271 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1281 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1291 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1301 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1311 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1321 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1331 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1341 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1351 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1361 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1371 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1381 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1391 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1401 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1411 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1421 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1431 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1441 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1451 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1461 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1471 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1481 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1491 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1501 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1511 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1521 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1531 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1541 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1551 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1561 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1571 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1581 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1591 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1601 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1611 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1621 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1631 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1641 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1651 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1661 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1671 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1681 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 1691 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 1701 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 1711 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 1721 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 1731 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 1741 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 1751 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 1761 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 1771 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 1781 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 1791 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 1801 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 1811 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 1821 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 1831 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 1841 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 1851 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 1861 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 1871 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 1881 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 1891 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 1901 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 1911 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 1921 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 1931 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 1941 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 1951 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 1961 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 1971 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 1981 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 1991 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2001 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2011 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2021 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2031 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2041 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2051 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2061 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2071 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2081 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2091 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2101 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2111 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2121 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2131 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2141 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2151 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2161 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2171 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2181 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2191 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2201 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2211 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2221 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2231 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2241 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2251 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2261 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2271 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2281 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2291 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2301 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2311 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2321 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2331 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2341 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2351 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2361 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2371 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2381 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2391 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2401 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2411 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2421 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2431 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2441 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2451 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2461 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2471 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2481 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2491 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2501 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2511 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2521 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 2531 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 2541 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 2551 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 2561 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 2571 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 2581 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 2591 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 2601 S> */ B(Wide), B(CreateArrayLiteral), U16(256), U16(0), U8(3), + /* 2619 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden index f569bab161..5a1efc2889 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden @@ -16,20 +16,20 @@ frame size: 2 parameter count: 1 bytecode array length: 25 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(0), - B(LdaSmi), U8(3), - B(Star), R(1), - B(LdaSmi), U8(4), - B(Star), R(0), - B(LdaSmi), U8(5), - B(Star), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 49 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 52 S> */ B(LdaSmi), U8(2), + B(Star), R(0), + B(LdaSmi), U8(3), + B(Star), R(1), + B(LdaSmi), U8(4), + B(Star), R(0), + B(LdaSmi), U8(5), + B(Star), R(1), + /* 89 S> */ B(Return), ] constant pool: [ ] @@ -44,15 +44,16 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 12 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(55), - B(Star), R(0), - B(LdaSmi), U8(100), - B(Star), R(0), - B(Star), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(55), + B(Star), R(0), + /* 57 S> */ B(LdaSmi), U8(100), + B(Star), R(0), + B(Star), R(1), + /* 65 S> */ B(Nop), + /* 75 S> */ B(Return), ] constant pool: [ ] @@ -67,21 +68,22 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 24 +bytecode array length: 28 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(55), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(100), - B(Star), R(0), - B(Add), R(1), - B(Star), R(2), - B(LdaSmi), U8(101), - B(Star), R(0), - B(Add), R(2), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(55), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(100), + B(Mov), R(0), R(1), + B(Star), R(0), + /* 57 E> */ B(Add), R(1), U8(1), + B(Star), R(2), + B(LdaSmi), U8(101), + B(Star), R(0), + /* 69 E> */ B(Add), R(2), U8(2), + B(Star), R(0), + /* 77 S> */ B(Nop), + /* 87 S> */ B(Return), ] constant pool: [ ] @@ -97,26 +99,23 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 29 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(55), - B(Star), R(0), - B(LdaSmi), U8(56), - B(Star), R(0), - B(Star), R(1), - B(Ldar), R(0), - B(Sub), R(1), - B(Star), R(2), - B(LdaSmi), U8(57), - B(Star), R(0), - B(Add), R(2), - B(Star), R(0), - B(ToNumber), - B(Star), R(1), - B(Inc), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(55), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(56), + B(Star), R(0), + /* 61 E> */ B(Sub), R(0), U8(1), + B(Star), R(2), + B(LdaSmi), U8(57), + B(Star), R(0), + /* 68 E> */ B(Add), R(2), U8(2), + B(Star), R(0), + /* 75 S> */ B(Inc), U8(3), + B(Star), R(0), + /* 80 S> */ B(Nop), + /* 90 S> */ B(Return), ] constant pool: [ ] @@ -131,25 +130,26 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 32 +bytecode array length: 37 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(55), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Add), R(2), - B(Star), R(3), - B(LdaSmi), U8(2), - B(Star), R(0), - B(Add), R(3), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Star), R(0), - B(Add), R(2), - B(Star), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(55), + B(Star), R(0), + /* 76 S> */ B(LdaSmi), U8(1), + B(Mov), R(0), R(2), + B(Star), R(0), + /* 61 E> */ B(Add), R(2), U8(1), + B(Star), R(3), + B(LdaSmi), U8(2), + B(Star), R(0), + /* 71 E> */ B(Add), R(3), U8(2), + B(Star), R(2), + B(LdaSmi), U8(3), + B(Star), R(0), + /* 81 E> */ B(Add), R(2), U8(3), + B(Star), R(1), + /* 87 S> */ B(Nop), + /* 97 S> */ B(Return), ] constant pool: [ ] @@ -164,25 +164,26 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 37 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(55), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Add), R(1), - B(Star), R(2), - B(LdaSmi), U8(2), - B(Star), R(0), - B(Add), R(2), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Star), R(0), - B(Add), R(1), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(55), + B(Star), R(0), + /* 76 S> */ B(LdaSmi), U8(1), + B(Mov), R(0), R(1), + B(Star), R(0), + /* 61 E> */ B(Add), R(1), U8(1), + B(Star), R(2), + B(LdaSmi), U8(2), + B(Star), R(0), + /* 71 E> */ B(Add), R(2), U8(2), + B(Star), R(1), + B(LdaSmi), U8(3), + B(Star), R(0), + /* 81 E> */ B(Add), R(1), U8(3), + B(Star), R(0), + /* 87 S> */ B(Nop), + /* 97 S> */ B(Return), ] constant pool: [ ] @@ -196,44 +197,40 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 70 +bytecode array length: 72 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Add), R(2), - B(Star), R(3), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(4), - B(LdaSmi), U8(2), - B(Star), R(1), - B(Mul), R(4), - B(Add), R(3), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Star), R(1), - B(Add), R(2), - B(Star), R(3), - B(LdaSmi), U8(4), - B(Star), R(0), - B(Add), R(3), - B(Star), R(2), - B(LdaSmi), U8(5), - B(Star), R(1), - B(Add), R(2), - B(Star), R(3), - B(Ldar), R(1), - B(Add), R(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 50 S> */ B(LdaSmi), U8(20), + B(Star), R(1), + /* 54 S> */ B(LdaSmi), U8(1), + B(Mov), R(0), R(2), + B(Star), R(0), + /* 68 E> */ B(Add), R(2), U8(1), + B(Star), R(3), + /* 76 E> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(4), + B(LdaSmi), U8(2), + B(Star), R(1), + /* 88 E> */ B(Mul), R(4), U8(3), + B(Add), R(3), U8(4), + B(Star), R(2), + B(LdaSmi), U8(3), + B(Star), R(1), + /* 98 E> */ B(Add), R(2), U8(5), + B(Star), R(3), + B(LdaSmi), U8(4), + B(Star), R(0), + /* 108 E> */ B(Add), R(3), U8(6), + B(Star), R(2), + B(LdaSmi), U8(5), + B(Star), R(1), + /* 118 E> */ B(Add), R(2), U8(7), + B(Star), R(3), + B(Ldar), R(1), + /* 125 E> */ B(Add), R(3), U8(8), + /* 128 S> */ B(Return), ] constant pool: [ ] @@ -247,30 +244,28 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 38 +bytecode array length: 41 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(17), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Ldar), R(0), - B(Add), R(1), - B(Star), R(2), - B(Ldar), R(0), - B(ToNumber), - B(Star), R(1), - B(Inc), - B(Star), R(0), - B(Ldar), R(1), - B(Add), R(2), - B(Star), R(3), - B(Ldar), R(0), - B(ToNumber), - B(Inc), - B(Star), R(0), - B(Add), R(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(17), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Ldar), R(0), + /* 57 E> */ B(Add), R(1), U8(1), + B(Star), R(2), + B(Ldar), R(0), + B(ToNumber), R(1), + B(Inc), U8(2), + B(Star), R(0), + B(Ldar), R(1), + /* 63 E> */ B(Add), R(2), U8(3), + B(Star), R(3), + B(Ldar), R(0), + B(Inc), U8(4), + B(Star), R(0), + /* 72 E> */ B(Add), R(3), U8(5), + /* 76 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden index ee98e5a19d..422fad3283 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden @@ -11,23 +11,21 @@ wrap: yes snippet: " var a = 1; if (a || a < 0) { return 1; } " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 21 +bytecode array length: 17 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanTrue), U8(9), - B(Ldar), R(0), - B(Star), R(1), - B(LdaZero), - B(TestLessThan), R(1), - B(JumpIfToBooleanFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanTrue), U8(7), + B(LdaZero), + /* 56 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(5), + /* 63 S> */ B(LdaSmi), U8(1), + /* 75 S> */ B(Return), + B(LdaUndefined), + /* 75 S> */ B(Return), ] constant pool: [ ] @@ -38,23 +36,21 @@ handlers: [ snippet: " var a = 1; if (a && a < 0) { return 1; } " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 21 +bytecode array length: 17 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(9), - B(Ldar), R(0), - B(Star), R(1), - B(LdaZero), - B(TestLessThan), R(1), - B(JumpIfToBooleanFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(10), + B(LdaZero), + /* 56 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(5), + /* 63 S> */ B(LdaSmi), U8(1), + /* 75 S> */ B(Return), + B(LdaUndefined), + /* 75 S> */ B(Return), ] constant pool: [ ] @@ -65,25 +61,23 @@ handlers: [ snippet: " var a = 1; a = (a || a < 0) ? 2 : 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 26 +bytecode array length: 22 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanTrue), U8(9), - B(Ldar), R(0), - B(Star), R(1), - B(LdaZero), - B(TestLessThan), R(1), - B(JumpIfToBooleanFalse), U8(6), - B(LdaSmi), U8(2), - B(Jump), U8(4), - B(LdaSmi), U8(3), - B(Star), R(0), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanTrue), U8(7), + B(LdaZero), + /* 57 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(6), + B(LdaSmi), U8(2), + B(Jump), U8(4), + B(LdaSmi), U8(3), + B(Star), R(0), + B(LdaUndefined), + /* 71 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden index 05ee657105..6dcd2692af 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden @@ -15,12 +15,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 88 S> */ B(Nop), + /* 98 S> */ B(Return), ] constant pool: [ ] @@ -37,12 +38,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 77 S> */ B(Nop), + /* 87 S> */ B(Return), ] constant pool: [ ] @@ -61,45 +63,35 @@ snippet: " } return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 66 +bytecode array length: 49 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(10), - B(TestLessThan), R(2), - B(JumpIfFalse), U8(47), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(12), - B(Mul), R(2), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(3), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(-39), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(4), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(4), - B(Jump), U8(-53), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 65 S> */ B(LdaSmi), U8(10), + /* 65 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(34), + /* 56 E> */ B(StackCheck), + /* 75 S> */ B(LdaSmi), U8(12), + B(Mul), R(1), U8(1), + B(Star), R(1), + /* 89 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 102 S> */ B(LdaSmi), U8(3), + /* 108 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 114 S> */ B(Jump), U8(10), + /* 126 S> */ B(LdaSmi), U8(4), + /* 132 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 138 S> */ B(Jump), U8(4), + B(Jump), U8(-36), + /* 147 S> */ B(Ldar), R(1), + /* 157 S> */ B(Return), ] constant pool: [ ] @@ -119,52 +111,39 @@ snippet: " } return i; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 79 +bytecode array length: 55 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaZero), - B(TestLessThan), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(-10), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(50), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(4), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(38), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(10), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(-46), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(5), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(14), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-70), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 E> */ B(StackCheck), + /* 62 S> */ B(LdaZero), + /* 68 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(4), + /* 73 S> */ B(Jump), U8(40), + /* 85 S> */ B(LdaSmi), U8(3), + /* 91 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 97 S> */ B(Jump), U8(34), + /* 106 S> */ B(LdaSmi), U8(4), + /* 112 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 118 S> */ B(Jump), U8(26), + /* 127 S> */ B(LdaSmi), U8(10), + /* 133 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 140 S> */ B(Jump), U8(16), + /* 152 S> */ B(LdaSmi), U8(5), + /* 158 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 164 S> */ B(Jump), U8(10), + /* 173 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-46), + /* 186 S> */ B(Ldar), R(0), + /* 196 S> */ B(Return), ] constant pool: [ ] @@ -184,41 +163,30 @@ snippet: " } return i; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 57 +bytecode array length: 39 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(TestLessThan), R(1), - B(JumpIfFalse), U8(27), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(14), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-33), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(4), - B(Jump), U8(-48), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 E> */ B(StackCheck), + /* 71 S> */ B(LdaSmi), U8(3), + /* 71 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(19), + /* 62 E> */ B(StackCheck), + /* 82 S> */ B(LdaSmi), U8(2), + /* 88 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 94 S> */ B(Jump), U8(10), + /* 105 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-21), + /* 122 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 135 S> */ B(Jump), U8(2), + /* 144 S> */ B(Ldar), R(0), + /* 154 S> */ B(Return), ] constant pool: [ ] @@ -235,31 +203,26 @@ snippet: " } return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 39 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfToBooleanFalse), U8(25), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(12), - B(Mul), R(2), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Sub), R(2), - B(Star), R(0), - B(Jump), U8(-25), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 54 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 64 S> */ B(Ldar), R(0), + B(JumpIfToBooleanFalse), U8(18), + /* 57 E> */ B(StackCheck), + /* 71 S> */ B(LdaSmi), U8(12), + B(Mul), R(1), U8(1), + B(Star), R(1), + /* 85 S> */ B(SubSmi), U8(1), R(0), U8(2), + B(Star), R(0), + B(Jump), U8(-18), + /* 98 S> */ B(Ldar), R(1), + /* 108 S> */ B(Return), ] constant pool: [ ] @@ -277,45 +240,34 @@ snippet: " } while (x < 10); return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 66 +bytecode array length: 47 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(10), - B(Mul), R(2), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(5), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(34), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(6), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(12), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(0), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(10), - B(TestLessThan), R(2), - B(JumpIfTrue), U8(-53), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 56 E> */ B(StackCheck), + /* 63 S> */ B(LdaSmi), U8(10), + B(Mul), R(1), U8(1), + B(Star), R(1), + /* 77 S> */ B(LdaSmi), U8(5), + /* 83 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 89 S> */ B(Jump), U8(22), + /* 98 S> */ B(LdaSmi), U8(6), + /* 104 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 110 S> */ B(Jump), U8(8), + /* 122 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 144 S> */ B(LdaSmi), U8(10), + /* 144 E> */ B(TestLessThan), R(0), + B(JumpIfTrue), U8(-34), + /* 151 S> */ B(Ldar), R(1), + /* 161 S> */ B(Return), ] constant pool: [ ] @@ -332,30 +284,24 @@ snippet: " } while (x); return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 37 +bytecode array length: 28 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(12), - B(Mul), R(2), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Sub), R(2), - B(Star), R(0), - B(Ldar), R(0), - B(JumpIfToBooleanTrue), U8(-23), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 54 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 57 E> */ B(StackCheck), + /* 64 S> */ B(LdaSmi), U8(12), + B(Mul), R(1), U8(1), + B(Star), R(1), + /* 78 S> */ B(SubSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 98 S> */ B(JumpIfToBooleanTrue), U8(-14), + /* 102 S> */ B(Ldar), R(1), + /* 112 S> */ B(Return), ] constant pool: [ ] @@ -373,39 +319,31 @@ snippet: " } while (false); return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 54 +bytecode array length: 41 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(10), - B(Mul), R(2), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(5), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(22), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(6), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(2), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 56 E> */ B(StackCheck), + /* 63 S> */ B(LdaSmi), U8(10), + B(Mul), R(1), U8(1), + B(Star), R(1), + /* 77 S> */ B(LdaSmi), U8(5), + /* 83 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 89 S> */ B(Jump), U8(16), + /* 98 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 111 S> */ B(LdaSmi), U8(6), + /* 117 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 123 S> */ B(Jump), U8(2), + /* 150 S> */ B(Ldar), R(1), + /* 160 S> */ B(Return), ] constant pool: [ ] @@ -423,40 +361,32 @@ snippet: " } while (true); return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 56 +bytecode array length: 43 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(10), - B(Mul), R(2), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(5), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(24), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(6), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(-41), - B(Jump), U8(-43), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 56 E> */ B(StackCheck), + /* 63 S> */ B(LdaSmi), U8(10), + B(Mul), R(1), U8(1), + B(Star), R(1), + /* 77 S> */ B(LdaSmi), U8(5), + /* 83 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 89 S> */ B(Jump), U8(18), + /* 98 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 111 S> */ B(LdaSmi), U8(6), + /* 117 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 123 S> */ B(Jump), U8(2), + B(Jump), U8(-30), + /* 149 S> */ B(Ldar), R(1), + /* 159 S> */ B(Return), ] constant pool: [ ] @@ -472,34 +402,27 @@ snippet: " x = x + 1; } " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 43 +bytecode array length: 31 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(26), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(-23), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-35), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 E> */ B(StackCheck), + /* 58 S> */ B(LdaSmi), U8(1), + /* 64 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 70 S> */ B(Jump), U8(18), + /* 79 S> */ B(LdaSmi), U8(2), + /* 85 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 91 S> */ B(Jump), U8(8), + /* 103 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-23), + B(LdaUndefined), + /* 116 S> */ B(Return), ] constant pool: [ ] @@ -514,34 +437,27 @@ snippet: " x = x + 1; } " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 43 +bytecode array length: 31 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(26), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(-23), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-35), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 47 S> */ B(LdaZero), + B(Star), R(0), + /* 34 E> */ B(StackCheck), + /* 56 S> */ B(LdaSmi), U8(1), + /* 62 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 68 S> */ B(Jump), U8(18), + /* 77 S> */ B(LdaSmi), U8(2), + /* 83 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 89 S> */ B(Jump), U8(8), + /* 101 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-23), + B(LdaUndefined), + /* 114 S> */ B(Return), ] constant pool: [ ] @@ -556,34 +472,27 @@ snippet: " if (x == 2) continue; } " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 43 +bytecode array length: 31 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(26), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(2), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-35), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 E> */ B(StackCheck), + /* 68 S> */ B(LdaSmi), U8(1), + /* 74 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 80 S> */ B(Jump), U8(18), + /* 89 S> */ B(LdaSmi), U8(2), + /* 95 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 101 S> */ B(Jump), U8(2), + /* 55 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-23), + B(LdaUndefined), + /* 113 S> */ B(Return), ] constant pool: [ ] @@ -597,34 +506,27 @@ snippet: " if (x == 2) continue; } " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 43 +bytecode array length: 31 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(26), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(2), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-35), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 47 S> */ B(LdaZero), + B(Star), R(0), + /* 34 E> */ B(StackCheck), + /* 66 S> */ B(LdaSmi), U8(1), + /* 72 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 78 S> */ B(Jump), U8(18), + /* 87 S> */ B(LdaSmi), U8(2), + /* 93 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 99 S> */ B(Jump), U8(2), + /* 53 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-23), + B(LdaUndefined), + /* 111 S> */ B(Return), ] constant pool: [ ] @@ -639,35 +541,27 @@ snippet: " continue; } " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 44 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(100), - B(TestLessThan), R(2), - B(JumpIfFalse), U8(27), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(0), - B(Jump), U8(2), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(1), - B(Jump), U8(-33), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 58 S> */ B(LdaZero), + B(Star), R(1), + /* 63 S> */ B(LdaSmi), U8(100), + /* 63 E> */ B(TestLessThan), R(1), + B(JumpIfFalse), U8(19), + /* 45 E> */ B(StackCheck), + /* 85 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 98 S> */ B(Jump), U8(2), + /* 72 S> */ B(AddSmi), U8(1), R(1), U8(1), + B(Star), R(1), + B(Jump), U8(-21), + B(LdaUndefined), + /* 110 S> */ B(Return), ] constant pool: [ ] @@ -682,30 +576,27 @@ snippet: " } return y; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 35 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(LdaSmi), U8(10), - B(Star), R(1), - B(Ldar), R(1), - B(JumpIfToBooleanFalse), U8(21), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(12), - B(Mul), R(2), - B(Star), R(0), - B(Ldar), R(1), - B(ToNumber), - B(Dec), - B(Star), R(1), - B(Jump), U8(-21), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 58 S> */ B(LdaSmi), U8(10), + B(Star), R(1), + /* 62 S> */ B(Ldar), R(1), + B(JumpIfToBooleanFalse), U8(18), + /* 45 E> */ B(StackCheck), + /* 74 S> */ B(LdaSmi), U8(12), + B(Mul), R(0), U8(2), + B(Star), R(0), + /* 67 S> */ B(Ldar), R(1), + B(Dec), U8(1), + B(Star), R(1), + B(Jump), U8(-18), + /* 88 S> */ B(Ldar), R(0), + /* 98 S> */ B(Return), ] constant pool: [ ] @@ -724,13 +615,13 @@ frame size: 2 parameter count: 1 bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 58 S> */ B(LdaZero), + B(Star), R(1), + /* 91 S> */ B(Ldar), R(0), + /* 101 S> */ B(Return), ] constant pool: [ ] @@ -746,33 +637,28 @@ snippet: " }; return x; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 39 +bytecode array length: 33 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(20), - B(TestEqual), R(2), - B(JumpIfFalse), U8(4), - B(Jump), U8(10), - B(Ldar), R(1), - B(ToNumber), - B(Inc), - B(Star), R(1), - B(Jump), U8(-27), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 58 S> */ B(LdaZero), + B(Star), R(1), + /* 45 E> */ B(StackCheck), + /* 76 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(Star), R(0), + /* 89 S> */ B(LdaSmi), U8(20), + /* 95 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + /* 102 S> */ B(Jump), U8(10), + /* 69 S> */ B(Ldar), R(1), + B(Inc), U8(1), + B(Star), R(1), + B(Jump), U8(-21), + /* 112 S> */ B(Ldar), R(0), + /* 122 S> */ B(Return), ] constant pool: [ ] @@ -791,69 +677,58 @@ snippet: " } } " -frame size: 7 +frame size: 6 parameter count: 1 -bytecode array length: 120 +bytecode array length: 97 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(1), - B(JumpIfToBooleanFalse), U8(112), - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(4), - B(Ldar), R(closure), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kPushBlockContext), R(4), U8(2), - B(PushContext), R(3), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(1), U8(0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(Star), R(2), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(3), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(JumpIfToBooleanFalse), U8(8), - B(PopContext), R(3), - B(PopContext), R(3), - B(Jump), U8(-69), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(3), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(ToNumber), - B(Star), R(4), - B(Inc), - B(Star), R(5), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(3), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(6), U8(1), - B(Ldar), R(5), - B(StaContextSlot), R(context), U8(4), - B(PopContext), R(3), - B(Jump), U8(-112), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(1), + /* 52 S> */ B(Ldar), R(1), + B(JumpIfToBooleanFalse), U8(89), + /* 45 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(3), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(1), U8(2), + B(Star), R(0), + /* 73 S> */ B(LdaSmi), U8(1), + /* 73 E> */ B(StaContextSlot), R(context), U8(4), + B(Mov), R(0), R(2), + /* 106 S> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(JumpIfToBooleanFalse), U8(8), + /* 113 S> */ B(PopContext), R(3), + B(PopContext), R(3), + B(Jump), U8(41), + /* 126 S> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(Inc), U8(1), + B(Star), R(4), + /* 127 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), + B(Ldar), R(4), + B(StaContextSlot), R(context), U8(4), + B(PopContext), R(3), + B(Jump), U8(-89), + B(LdaUndefined), + /* 137 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, InstanceType::SHARED_FUNCTION_INFO_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden index 162297d1e2..bae9bd4da3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden @@ -17,20 +17,18 @@ snippet: " } return x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 15 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(2), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 56 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(0), + /* 69 S> */ B(Jump), U8(2), + /* 97 S> */ B(Ldar), R(0), + /* 107 S> */ B(Return), ] constant pool: [ ] @@ -52,52 +50,43 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 75 +bytecode array length: 64 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(1), - B(Star), R(3), - B(LdaSmi), U8(10), - B(TestLessThan), R(3), - B(JumpIfFalse), U8(57), - B(StackCheck), - B(LdaZero), - B(Star), R(2), - B(Ldar), R(2), - B(Star), R(3), - B(LdaSmi), U8(3), - B(TestLessThan), R(3), - B(JumpIfFalse), U8(35), - B(StackCheck), - B(Ldar), R(0), - B(ToNumber), - B(Inc), - B(Star), R(0), - B(Ldar), R(1), - B(Star), R(3), - B(Ldar), R(2), - B(Add), R(3), - B(Star), R(4), - B(LdaSmi), U8(12), - B(TestEqual), R(4), - B(JumpIfFalse), U8(4), - B(Jump), U8(18), - B(Ldar), R(2), - B(ToNumber), - B(Inc), - B(Star), R(2), - B(Jump), U8(-41), - B(Ldar), R(1), - B(ToNumber), - B(Inc), - B(Star), R(1), - B(Jump), U8(-63), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaZero), + B(Star), R(0), + /* 71 S> */ B(LdaZero), + B(Star), R(1), + /* 76 S> */ B(LdaSmi), U8(10), + /* 76 E> */ B(TestLessThan), R(1), + B(JumpIfFalse), U8(50), + /* 58 E> */ B(StackCheck), + /* 106 S> */ B(LdaZero), + B(Star), R(2), + /* 111 S> */ B(LdaSmi), U8(3), + /* 111 E> */ B(TestLessThan), R(2), + B(JumpIfFalse), U8(32), + /* 93 E> */ B(StackCheck), + /* 129 S> */ B(Ldar), R(0), + B(Inc), U8(3), + B(Star), R(0), + /* 142 S> */ B(Ldar), R(2), + /* 150 E> */ B(Add), R(1), U8(4), + B(Star), R(4), + B(LdaSmi), U8(12), + /* 152 E> */ B(TestEqual), R(4), + B(JumpIfFalse), U8(4), + /* 161 S> */ B(Jump), U8(18), + /* 118 S> */ B(Ldar), R(2), + B(Inc), U8(2), + B(Star), R(2), + B(Jump), U8(-34), + /* 84 S> */ B(Ldar), R(1), + B(Inc), U8(1), + B(Star), R(1), + B(Jump), U8(-52), + /* 188 S> */ B(Ldar), R(0), + /* 200 S> */ B(Return), ] constant pool: [ ] @@ -112,38 +101,30 @@ snippet: " break outer; } " -frame size: 5 +frame size: 3 parameter count: 1 -bytecode array length: 51 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(3), - B(Ldar), R(closure), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kPushBlockContext), R(3), U8(2), - B(PushContext), R(2), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(1), U8(0), - B(Star), R(0), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Star), R(1), - B(Jump), U8(2), - B(PopContext), R(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(2), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(1), U8(2), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(10), + /* 53 E> */ B(StaContextSlot), R(context), U8(4), + B(Mov), R(0), R(1), + B(Ldar), R(0), + /* 88 S> */ B(Jump), U8(2), + B(PopContext), R(2), + B(LdaUndefined), + /* 103 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -163,69 +144,60 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 131 +bytecode array length: 107 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(2), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(LdaConstant), U8(0), - B(Star), R(4), - B(Ldar), R(closure), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kPushBlockContext), R(4), U8(2), - B(PushContext), R(3), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(1), U8(0), - B(Star), R(0), - B(LdaSmi), U8(2), - B(StaContextSlot), R(context), U8(4), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(Star), R(1), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(3), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(JumpIfToBooleanFalse), U8(6), - B(PopContext), R(3), - B(Jump), U8(27), - B(LdaSmi), U8(3), - B(Star), R(4), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(3), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), - B(Ldar), R(4), - B(StaContextSlot), R(context), U8(4), - B(PopContext), R(3), - B(LdaSmi), U8(4), - B(Star), R(4), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(4), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), - B(Ldar), R(4), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(2), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(3), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(1), U8(2), + B(Star), R(0), + /* 76 S> */ B(LdaSmi), U8(2), + /* 76 E> */ B(StaContextSlot), R(context), U8(4), + B(Mov), R(0), R(1), + /* 118 S> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(JumpIfToBooleanFalse), U8(6), + /* 125 S> */ B(PopContext), R(3), + B(Jump), U8(27), + /* 142 S> */ B(LdaSmi), U8(3), + B(Star), R(4), + /* 144 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), + B(Ldar), R(4), + B(StaContextSlot), R(context), U8(4), + B(PopContext), R(3), + /* 155 S> */ B(LdaSmi), U8(4), + B(Star), R(4), + /* 157 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(3), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), + B(Ldar), R(4), + B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 162 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, InstanceType::SHARED_FUNCTION_INFO_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_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 04bc3a9ded..45fb07ad08 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden @@ -16,18 +16,15 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(1), - B(LdaGlobal), U8(0), U8(3), - B(Star), R(0), - B(Call), R(0), R(1), U8(1), U8(1), - B(Return), + /* 27 E> */ B(StackCheck), + /* 32 S> */ B(LdrUndefined), R(1), + B(LdrGlobal), U8(3), R(0), + /* 39 E> */ B(Call), R(0), R(1), U8(1), U8(1), + /* 44 S> */ B(Return), ] constant pool: [ - "t", ] handlers: [ ] @@ -40,24 +37,21 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 27 +bytecode array length: 24 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(1), - B(LdaGlobal), U8(0), U8(3), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(2), - B(LdaSmi), U8(2), - B(Star), R(3), - B(LdaSmi), U8(3), - B(Star), R(4), - B(Call), R(0), R(1), U8(4), U8(1), - B(Return), + /* 34 E> */ B(StackCheck), + /* 39 S> */ B(LdrUndefined), R(1), + B(LdrGlobal), U8(3), R(0), + B(LdaSmi), U8(1), + B(Star), R(2), + B(LdaSmi), U8(2), + B(Star), R(3), + B(LdaSmi), U8(3), + B(Star), R(4), + /* 46 E> */ B(Call), R(0), R(1), U8(4), U8(1), + /* 58 S> */ B(Return), ] constant pool: [ - "t", ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden index 30b69d3eae..9438503ae4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden @@ -11,41 +11,43 @@ wrap: yes snippet: " g = function(){}; eval(''); return g(); " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 85 +bytecode array length: 86 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - B(StackCheck), - B(CreateClosure), U8(0), U8(0), - B(StaLookupSlotSloppy), U8(1), - B(LdaConstant), U8(2), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - B(LdaConstant), U8(3), - B(Star), R(3), - B(Mov), R(1), R(4), - B(Mov), R(3), R(5), - B(Mov), R(closure), R(6), - B(LdaZero), - B(Star), R(7), - B(LdaSmi), U8(30), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5), - B(Star), R(1), - B(Call), R(1), R(2), U8(2), U8(0), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - B(Call), R(1), R(2), U8(1), U8(3), - B(Return), + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(6), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateClosure), U8(0), U8(2), + /* 36 E> */ B(StaLookupSlotSloppy), U8(1), + /* 52 S> */ B(LdaConstant), U8(2), + B(Star), R(3), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(LdaConstant), U8(3), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(30), + B(Star), R(8), + B(LdaSmi), U8(52), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 52 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 62 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + /* 69 E> */ B(Call), R(1), R(2), U8(1), U8(3), + /* 74 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden index 4952c73ddc..2ee9613b59 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden @@ -18,14 +18,13 @@ frame size: 1 parameter count: 1 bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(2), - B(Star), R(0), - B(New), R(0), R(0), U8(0), - B(Return), + /* 45 E> */ B(StackCheck), + /* 50 S> */ B(LdrGlobal), U8(3), R(0), + B(Ldar), R(0), + /* 57 E> */ B(New), R(0), R(0), U8(0), + /* 68 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -38,19 +37,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 15 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(2), - B(Star), R(0), - B(LdaSmi), U8(3), - B(Star), R(1), - B(Ldar), R(0), - B(New), R(0), R(1), U8(1), - B(Return), + /* 58 E> */ B(StackCheck), + /* 63 S> */ B(LdrGlobal), U8(3), R(0), + B(LdaSmi), U8(3), + B(Star), R(1), + B(Ldar), R(0), + /* 70 E> */ B(New), R(0), R(1), U8(1), + /* 82 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -68,23 +65,21 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 25 +bytecode array length: 23 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(2), - B(Star), R(0), - B(LdaSmi), U8(3), - B(Star), R(1), - B(LdaSmi), U8(4), - B(Star), R(2), - B(LdaSmi), U8(5), - B(Star), R(3), - B(Ldar), R(0), - B(New), R(0), R(1), U8(3), - B(Return), + /* 100 E> */ B(StackCheck), + /* 105 S> */ B(LdrGlobal), U8(3), R(0), + B(LdaSmi), U8(3), + B(Star), R(1), + B(LdaSmi), U8(4), + B(Star), R(2), + B(LdaSmi), U8(5), + B(Star), R(3), + B(Ldar), R(0), + /* 112 E> */ B(New), R(0), R(1), U8(3), + /* 130 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden index ec10e67c10..aa2a994507 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden @@ -17,10 +17,10 @@ frame size: 0 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), + B(LdaUndefined), + /* 26 S> */ B(Return), ] constant pool: [ ] @@ -32,15 +32,13 @@ snippet: " function f(a) { return %IsArray(a) } f(undefined); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 11 +bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(CallRuntime), U16(Runtime::kIsArray), R(0), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(CallRuntime), U16(Runtime::kIsArray), R(arg0), U8(1), + /* 35 S> */ B(Return), ] constant pool: [ ] @@ -56,13 +54,13 @@ frame size: 2 parameter count: 1 bytecode array length: 15 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kAdd), R(0), U8(2), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + B(LdaSmi), U8(2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kAdd), R(0), U8(2), + /* 33 S> */ B(Return), ] constant pool: [ ] @@ -76,15 +74,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(0), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Star), R(1), - B(CallJSRuntime), U8(115), R(0), U8(2), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdrUndefined), R(0), + B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(Star), R(1), + B(CallJSRuntime), U8(134), R(0), U8(2), + /* 44 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden index 6869c5bc58..865a4c3000 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden @@ -22,37 +22,25 @@ snippet: " test(); })(); " -frame size: 7 +frame size: 6 parameter count: 1 -bytecode array length: 57 +bytecode array length: 36 bytecodes: [ - B(Ldar), R(closure), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(this), - B(Star), R(3), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(6), U8(1), - B(Star), R(6), - B(LdaConstant), U8(1), - B(KeyedLoadIC), R(6), U8(3), - B(Star), R(4), - B(LdaConstant), U8(2), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kLoadFromSuper), R(3), U8(3), - B(Mov), R(3), R(2), - B(Star), R(1), - B(Call), R(1), R(2), U8(1), U8(1), - B(Star), R(3), - B(LdaSmi), U8(1), - B(Add), R(3), - B(Return), + B(Mov), R(closure), R(0), + /* 99 E> */ B(StackCheck), + /* 104 S> */ B(LdaConstant), U8(0), + /* 111 E> */ B(LdrKeyedProperty), R(closure), U8(3), R(4), + B(LdaConstant), U8(1), + B(Star), R(5), + B(Mov), R(this), R(3), + B(CallRuntime), U16(Runtime::kLoadFromSuper), R(3), U8(3), + B(Star), R(1), + /* 117 E> */ B(Call), R(1), R(this), U8(1), U8(1), + B(Star), R(3), + B(AddSmi), U8(1), R(3), U8(7), + /* 131 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::SYMBOL_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] @@ -74,47 +62,29 @@ snippet: " test(); })(); " -frame size: 6 +frame size: 5 parameter count: 1 -bytecode array length: 80 +bytecode array length: 45 bytecodes: [ - B(Ldar), R(closure), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(this), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), - B(Star), R(5), - B(LdaConstant), U8(1), - B(KeyedLoadIC), R(5), U8(1), - B(Star), R(2), - B(LdaConstant), U8(2), - B(Star), R(3), - B(LdaSmi), U8(2), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4), - B(Ldar), R(this), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(Star), R(4), - B(LdaConstant), U8(1), - B(KeyedLoadIC), R(4), U8(3), - B(Star), R(2), - B(LdaConstant), U8(2), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kLoadFromSuper), R(1), U8(3), - B(Return), + B(Mov), R(closure), R(0), + /* 125 E> */ B(StackCheck), + /* 130 S> */ B(LdaConstant), U8(0), + /* 130 E> */ B(LdrKeyedProperty), R(closure), U8(1), R(2), + B(LdaConstant), U8(1), + B(Star), R(3), + B(LdaSmi), U8(2), + B(Star), R(4), + B(Mov), R(this), R(1), + /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4), + /* 143 S> */ B(LdaConstant), U8(0), + /* 150 E> */ B(LdrKeyedProperty), R(closure), U8(3), R(2), + B(LdaConstant), U8(1), + B(Star), R(3), + B(Mov), R(this), R(1), + B(CallRuntime), U16(Runtime::kLoadFromSuper), R(1), U8(3), + /* 159 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::SYMBOL_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] @@ -134,59 +104,45 @@ snippet: " test = new B().constructor; })(); " -frame size: 5 +frame size: 4 parameter count: 1 -bytecode array length: 106 +bytecode array length: 79 bytecodes: [ - B(Ldar), R(closure), - B(Star), R(1), - B(Ldar), R(new_target), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(1), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(2), U8(1), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(3), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(New), R(2), R(3), U8(1), - B(Star), R(2), - B(Ldar), R(this), - B(JumpIfNotHole), U8(4), - B(Jump), U8(11), - B(LdaConstant), U8(2), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Ldar), R(2), - B(Star), R(this), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Star), R(2), - B(LdaSmi), U8(2), - B(StoreICStrict), R(2), U8(3), U8(4), - B(Ldar), R(this), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Return), + B(Mov), R(closure), R(1), + B(Mov), R(new_target), R(0), + /* 113 E> */ B(StackCheck), + /* 118 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(closure), U8(1), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(3), + B(Ldar), R(new_target), + /* 118 E> */ B(New), R(2), R(3), U8(1), + B(Star), R(2), + B(Ldar), R(this), + B(JumpIfNotHole), U8(4), + B(Jump), U8(11), + B(LdaConstant), U8(0), + B(Star), R(3), + /* 118 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + B(Mov), R(2), R(this), + /* 128 S> */ B(Ldar), R(this), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + B(Star), R(2), + B(LdaSmi), U8(2), + /* 136 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), + B(Ldar), R(this), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + /* 141 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -206,55 +162,41 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 102 +bytecode array length: 75 bytecodes: [ - B(Ldar), R(closure), - B(Star), R(1), - B(Ldar), R(new_target), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(1), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(2), U8(1), - B(Star), R(2), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(New), R(2), R(0), U8(0), - B(Star), R(2), - B(Ldar), R(this), - B(JumpIfNotHole), U8(4), - B(Jump), U8(11), - B(LdaConstant), U8(2), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Ldar), R(2), - B(Star), R(this), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Star), R(2), - B(LdaSmi), U8(2), - B(StoreICStrict), R(2), U8(3), U8(4), - B(Ldar), R(this), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Return), + B(Mov), R(closure), R(1), + B(Mov), R(new_target), R(0), + /* 112 E> */ B(StackCheck), + /* 117 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(closure), U8(1), + B(Star), R(2), + B(Ldar), R(new_target), + /* 117 E> */ B(New), R(2), R(0), U8(0), + B(Star), R(2), + B(Ldar), R(this), + B(JumpIfNotHole), U8(4), + B(Jump), U8(11), + B(LdaConstant), U8(0), + B(Star), R(3), + /* 117 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + B(Mov), R(2), R(this), + /* 126 S> */ B(Ldar), R(this), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + B(Star), R(2), + B(LdaSmi), U8(2), + /* 134 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), + B(Ldar), R(this), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + /* 139 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index db42c5018a..d7ebabc8e4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -14,42 +14,42 @@ snippet: " speak() { console.log(this.name + ' is speaking.'); } } " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 73 +bytecode array length: 74 bytecodes: [ - B(LdaTheHole), - B(Star), R(1), - B(StackCheck), - B(LdaTheHole), - B(Star), R(0), - B(LdaTheHole), - B(Star), R(2), - B(CreateClosure), U8(0), U8(0), - B(Star), R(3), - B(LdaSmi), U8(34), - B(Star), R(4), - B(Wide), B(LdaSmi), U16(148), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), - B(Star), R(2), - B(LoadIC), R(2), U8(1), U8(1), - B(Star), R(3), - B(Mov), R(3), R(4), - B(LdaConstant), U8(2), - B(Star), R(5), - B(CreateClosure), U8(3), U8(0), - B(Star), R(6), - B(LdaSmi), U8(2), - B(Star), R(7), - B(LdaZero), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(5), - B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2), - B(Star), R(0), - B(Star), R(1), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + B(LdaTheHole), + B(Star), R(0), + /* 34 S> */ B(LdaTheHole), + B(Star), R(3), + B(CreateClosure), U8(0), U8(2), + B(Star), R(4), + B(LdaSmi), U8(34), + B(Star), R(5), + B(Wide), B(LdaSmi), U16(148), + B(Star), R(6), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), + B(Star), R(3), + B(LdrNamedProperty), R(3), U8(1), U8(1), R(4), + B(LdaConstant), U8(2), + B(ToName), R(6), + B(CreateClosure), U8(3), U8(2), + B(Star), R(7), + B(LdaSmi), U8(2), + B(Star), R(8), + B(LdaZero), + B(Star), R(9), + B(Mov), R(4), R(5), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(5), + B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + B(LdaUndefined), + /* 149 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -67,42 +67,42 @@ snippet: " speak() { console.log(this.name + ' is speaking.'); } } " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 73 +bytecode array length: 74 bytecodes: [ - B(LdaTheHole), - B(Star), R(1), - B(StackCheck), - B(LdaTheHole), - B(Star), R(0), - B(LdaTheHole), - B(Star), R(2), - B(CreateClosure), U8(0), U8(0), - B(Star), R(3), - B(LdaSmi), U8(34), - B(Star), R(4), - B(Wide), B(LdaSmi), U16(148), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), - B(Star), R(2), - B(LoadIC), R(2), U8(1), U8(1), - B(Star), R(3), - B(Mov), R(3), R(4), - B(LdaConstant), U8(2), - B(Star), R(5), - B(CreateClosure), U8(3), U8(0), - B(Star), R(6), - B(LdaSmi), U8(2), - B(Star), R(7), - B(LdaZero), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(5), - B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2), - B(Star), R(0), - B(Star), R(1), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + B(LdaTheHole), + B(Star), R(0), + /* 34 S> */ B(LdaTheHole), + B(Star), R(3), + B(CreateClosure), U8(0), U8(2), + B(Star), R(4), + B(LdaSmi), U8(34), + B(Star), R(5), + B(Wide), B(LdaSmi), U16(148), + B(Star), R(6), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), + B(Star), R(3), + B(LdrNamedProperty), R(3), U8(1), U8(1), R(4), + B(LdaConstant), U8(2), + B(ToName), R(6), + B(CreateClosure), U8(3), U8(2), + B(Star), R(7), + B(LdaSmi), U8(2), + B(Star), R(8), + B(LdaZero), + B(Star), R(9), + B(Mov), R(4), R(5), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(5), + B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + B(LdaUndefined), + /* 149 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -122,62 +122,60 @@ snippet: " static [n1]() { return n1; } } " -frame size: 10 +frame size: 11 parameter count: 1 -bytecode array length: 127 +bytecode array length: 123 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(2), - B(LdaTheHole), - B(Star), R(1), - B(StackCheck), - B(LdaConstant), U8(0), - B(StaContextSlot), R(context), U8(4), - B(LdaConstant), U8(1), - B(StaContextSlot), R(context), U8(5), - B(LdaTheHole), - B(Star), R(0), - B(LdaTheHole), - B(Star), R(3), - B(CreateClosure), U8(2), U8(0), - B(Star), R(4), - B(LdaSmi), U8(62), - B(Star), R(5), - B(Wide), B(LdaSmi), U16(128), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), - B(Star), R(3), - B(LoadIC), R(3), U8(3), U8(1), - B(Star), R(4), - B(Mov), R(4), R(5), - B(LdaContextSlot), R(context), U8(4), - B(ToName), - B(Star), R(6), - B(CreateClosure), U8(4), U8(0), - B(Star), R(7), - B(LdaSmi), U8(2), - B(Star), R(8), - B(LdaSmi), U8(1), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(5), - B(Mov), R(3), R(5), - B(LdaContextSlot), R(context), U8(5), - B(ToName), - B(Star), R(6), - B(LdaConstant), U8(3), - B(TestEqualStrict), R(6), - B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(CreateClosure), U8(5), U8(0), - B(Star), R(7), - B(LdaSmi), U8(1), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(5), - B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(3), U8(2), - B(Star), R(0), - B(Star), R(1), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(2), + B(PushContext), R(3), + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + /* 43 S> */ B(LdaConstant), U8(0), + /* 43 E> */ B(StaContextSlot), R(context), U8(4), + /* 57 S> */ B(LdaConstant), U8(1), + /* 57 E> */ B(StaContextSlot), R(context), U8(5), + B(LdaTheHole), + B(Star), R(0), + /* 62 S> */ B(LdaTheHole), + B(Star), R(4), + B(CreateClosure), U8(2), U8(2), + B(Star), R(5), + B(LdaSmi), U8(62), + B(Star), R(6), + B(Wide), B(LdaSmi), U16(128), + B(Star), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(LdrNamedProperty), R(4), U8(3), U8(1), R(5), + /* 75 E> */ B(LdaContextSlot), R(context), U8(4), + B(ToName), R(7), + B(CreateClosure), U8(4), U8(2), + B(Star), R(8), + B(LdaSmi), U8(2), + B(Star), R(9), + B(LdaSmi), U8(1), + B(Star), R(10), + B(Mov), R(5), R(6), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(6), U8(5), + /* 106 E> */ B(LdaContextSlot), R(context), U8(5), + B(ToName), R(7), + B(LdaConstant), U8(3), + B(TestEqualStrict), R(7), + B(Mov), R(4), R(6), + B(JumpIfToBooleanFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), + B(CreateClosure), U8(5), U8(2), + B(Star), R(8), + B(LdaSmi), U8(1), + B(Star), R(10), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(6), U8(5), + B(CallRuntime), U16(Runtime::kToFastProperties), R(4), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + B(LdaUndefined), + /* 129 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -196,41 +194,41 @@ snippet: " class C { constructor() { count++; }} return new C(); " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 74 +bytecode array length: 72 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(2), - B(LdaTheHole), - B(Star), R(1), - B(StackCheck), - B(LdaZero), - B(StaContextSlot), R(context), U8(4), - B(LdaTheHole), - B(Star), R(0), - B(LdaTheHole), - B(Star), R(3), - B(CreateClosure), U8(0), U8(0), - B(Star), R(4), - B(LdaSmi), U8(49), - B(Star), R(5), - B(LdaSmi), U8(86), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), - B(Star), R(3), - B(LoadIC), R(3), U8(1), U8(1), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(3), U8(2), - B(Star), R(0), - B(Star), R(1), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(Star), R(3), - B(New), R(3), R(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(3), + B(LdaTheHole), + B(Star), R(2), + /* 30 E> */ B(StackCheck), + /* 46 S> */ B(LdaZero), + /* 46 E> */ B(StaContextSlot), R(context), U8(4), + B(LdaTheHole), + B(Star), R(0), + /* 49 S> */ B(LdaTheHole), + B(Star), R(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(5), + B(LdaSmi), U8(49), + B(Star), R(6), + B(LdaSmi), U8(86), + B(Star), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(LdrNamedProperty), R(4), U8(1), U8(1), R(5), + B(CallRuntime), U16(Runtime::kToFastProperties), R(4), U8(1), + B(Star), R(0), + B(Star), R(1), + B(Star), R(2), + /* 87 S> */ B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), + B(Star), R(4), + /* 94 E> */ B(New), R(4), R(0), U8(0), + /* 103 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden index ccabedc490..873857a613 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden @@ -13,17 +13,16 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 16 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Add), R(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(AddSmi), U8(2), R(0), U8(1), + B(Mov), R(0), R(1), + B(Star), R(0), + B(LdaUndefined), + /* 53 S> */ B(Return), ] constant pool: [ ] @@ -36,17 +35,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 17 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Div), R(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(2), + B(Div), R(0), U8(1), + B(Mov), R(0), R(1), + B(Star), R(0), + B(LdaUndefined), + /* 53 S> */ B(Return), ] constant pool: [ ] @@ -59,20 +58,17 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 27 +bytecode array length: 25 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LoadIC), R(1), U8(1), U8(1), - B(Star), R(2), - B(LdaSmi), U8(2), - B(Mul), R(2), - B(StoreICSloppy), R(1), U8(1), U8(3), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 54 S> */ B(LdrNamedProperty), R(0), U8(1), U8(1), R(2), + B(LdaSmi), U8(2), + B(Mul), R(2), U8(3), + /* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), + B(LdaUndefined), + /* 67 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -87,22 +83,19 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 30 +bytecode array length: 28 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Star), R(2), - B(KeyedLoadIC), R(1), U8(1), - B(Star), R(3), - B(LdaSmi), U8(2), - B(BitwiseXor), R(3), - B(KeyedStoreICSloppy), R(1), R(2), U8(3), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 52 S> */ B(LdaSmi), U8(1), + B(Star), R(2), + B(LdrKeyedProperty), R(0), U8(1), R(3), + B(LdaSmi), U8(2), + B(BitwiseXor), R(3), U8(3), + /* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(4), + B(LdaUndefined), + /* 63 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -116,21 +109,19 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 30 +bytecode array length: 26 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(1), - B(LdaSmi), U8(24), - B(BitwiseOr), R(1), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 45 S> */ B(CreateClosure), U8(0), U8(2), + /* 75 S> */ B(LdrContextSlot), R(context), U8(4), R(1), + B(BitwiseOrSmi), U8(24), R(1), U8(1), + /* 77 E> */ B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 84 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden index 17327a508d..ddaf989ca3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden @@ -13,15 +13,11 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 12 +bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(JumpIfToBooleanFalse), U8(6), - B(LdaSmi), U8(2), - B(Jump), U8(4), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(2), + /* 52 S> */ B(Return), ] constant pool: [ ] @@ -34,19 +30,58 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 20 +bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(JumpIfToBooleanFalse), U8(14), - B(LdaSmi), U8(2), - B(JumpIfToBooleanFalse), U8(6), - B(LdaSmi), U8(3), - B(Jump), U8(4), - B(LdaSmi), U8(4), - B(Jump), U8(4), - B(LdaSmi), U8(5), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(3), + /* 60 S> */ B(Return), +] +constant pool: [ +] +handlers: [ +] + +--- +snippet: " + return 0 < 1 ? 2 : 3; +" +frame size: 1 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaZero), + B(Star), R(0), + B(LdaSmi), U8(1), + /* 43 E> */ B(TestLessThan), R(0), + B(JumpIfFalse), U8(6), + B(LdaSmi), U8(2), + B(Jump), U8(4), + B(LdaSmi), U8(3), + /* 56 S> */ B(Return), +] +constant pool: [ +] +handlers: [ +] + +--- +snippet: " + var x = 0; + return x ? 2 : 3; +" +frame size: 1 +parameter count: 1 +bytecode array length: 13 +bytecodes: [ + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(6), + B(LdaSmi), U8(2), + B(Jump), U8(4), + B(LdaSmi), U8(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 d3fb484960..f2120cf876 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden @@ -15,13 +15,13 @@ frame size: 1 parameter count: 1 bytecode array length: 10 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + B(LdaUndefined), + /* 48 S> */ B(Return), ] constant pool: [ ] @@ -36,16 +36,16 @@ frame size: 2 parameter count: 1 bytecode array length: 20 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 48 S> */ B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), + /* 58 S> */ B(Return), ] constant pool: [ "x", @@ -59,23 +59,22 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 30 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Ldar), R(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 48 S> */ B(LdaSmi), U8(20), + B(Star), R(1), + B(Ldar), R(0), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + /* 48 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + B(Star), R(0), + B(LdaUndefined), + /* 55 S> */ B(Return), ] constant pool: [ "x", @@ -89,25 +88,23 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 36 +bytecode array length: 32 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Ldar), R(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 48 S> */ B(LdaSmi), U8(20), + B(Star), R(1), + B(Ldar), R(0), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + /* 50 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + B(LdaUndefined), + /* 56 S> */ B(Return), ] constant pool: [ "x", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden index 3b445c1ccb..8bc1afcf37 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden @@ -13,19 +13,19 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 24 +bytecode array length: 21 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(10), + /* 44 E> */ B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 74 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -39,23 +39,23 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 37 +bytecode array length: 34 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(10), + /* 44 E> */ B(StaContextSlot), R(context), U8(4), + /* 74 S> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + /* 84 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -70,28 +70,26 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 50 +bytecode array length: 42 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(20), - B(Star), R(2), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 47 S> */ B(LdaSmi), U8(20), + B(Star), R(2), + /* 47 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + /* 47 E> */ B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 80 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -106,29 +104,27 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 52 +bytecode array length: 44 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(LdaSmi), U8(20), - B(Star), R(2), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(10), + /* 44 E> */ B(StaContextSlot), R(context), U8(4), + /* 48 S> */ B(LdaSmi), U8(20), + B(Star), R(2), + /* 50 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + B(LdaUndefined), + /* 82 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden index fb74600241..f07e5ce4d7 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden @@ -15,15 +15,15 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 17 +bytecode array length: 14 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), - B(StackCheck), - B(CreateClosure), U8(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + B(Ldar), R(arg0), + B(StaContextSlot), R(context), U8(4), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(CreateClosure), U8(0), U8(2), + /* 52 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -38,17 +38,17 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 22 +bytecode array length: 19 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), - B(StackCheck), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(LdaContextSlot), R(context), U8(4), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(Ldar), R(arg0), + B(StaContextSlot), R(context), U8(4), + /* 10 E> */ B(StackCheck), + /* 27 S> */ B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 53 S> */ B(LdaContextSlot), R(context), U8(4), + /* 66 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -63,17 +63,17 @@ snippet: " " frame size: 1 parameter count: 5 -bytecode array length: 22 +bytecode array length: 19 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(arg2), - B(StaContextSlot), R(context), U8(4), - B(StackCheck), - B(CreateClosure), U8(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(2), + B(PushContext), R(0), + B(Ldar), R(arg0), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(arg2), + B(StaContextSlot), R(context), U8(4), + /* 10 E> */ B(StackCheck), + /* 29 S> */ B(CreateClosure), U8(0), U8(2), + /* 61 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -88,15 +88,15 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 14 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + /* 10 E> */ B(StackCheck), + /* 26 S> */ B(Ldar), R(this), + /* 26 E> */ B(StaContextSlot), R(context), U8(4), + /* 32 S> */ B(CreateClosure), U8(0), U8(2), + /* 65 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden index b86e22bb67..b3226e0d64 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden @@ -13,13 +13,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 9 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(CreateClosure), U8(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + /* 30 E> */ B(StackCheck), + /* 41 S> */ B(CreateClosure), U8(0), U8(2), + /* 71 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -33,15 +33,15 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 14 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 45 S> */ B(CreateClosure), U8(0), U8(2), + /* 75 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -55,17 +55,17 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 22 +bytecode array length: 19 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(LdaSmi), U8(2), - B(StaContextSlot), R(context), U8(5), - B(CreateClosure), U8(0), U8(0), - B(Return), + B(CreateFunctionContext), U8(2), + B(PushContext), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 53 S> */ B(LdaSmi), U8(2), + /* 53 E> */ B(StaContextSlot), R(context), U8(5), + /* 56 S> */ B(CreateClosure), U8(0), U8(2), + /* 92 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -79,18 +79,17 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 25 +bytecode array length: 21 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(LdaUndefined), - B(Star), R(2), - B(CreateClosure), U8(0), U8(0), - B(Star), R(1), - B(Call), R(1), R(2), U8(1), U8(1), - B(LdaContextSlot), R(context), U8(4), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + /* 30 E> */ B(StackCheck), + /* 41 S> */ B(LdrUndefined), R(2), + B(CreateClosure), U8(0), U8(2), + B(Star), R(1), + /* 64 E> */ B(Call), R(1), R(2), U8(1), U8(1), + /* 68 S> */ B(LdaContextSlot), R(context), U8(4), + /* 78 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -104,30 +103,27 @@ snippet: " let a = 1; { let b = 2; return function() { a + b; }; } " -frame size: 4 +frame size: 2 parameter count: 1 -bytecode array length: 47 +bytecode array length: 35 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(LdaConstant), U8(0), - B(Star), R(2), - B(Ldar), R(closure), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kPushBlockContext), R(2), U8(2), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(LdaSmi), U8(2), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(1), U8(0), - B(PopContext), R(0), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + /* 30 E> */ B(StackCheck), + /* 56 S> */ B(LdaSmi), U8(1), + /* 56 E> */ B(StaContextSlot), R(context), U8(4), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + /* 69 S> */ B(LdaSmi), U8(2), + /* 69 E> */ B(StaContextSlot), R(context), U8(4), + /* 72 S> */ B(CreateClosure), U8(1), U8(2), + B(PopContext), R(0), + /* 104 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -394,527 +390,524 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 1046 +bytecode array length: 1040 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateUnmappedArguments), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - B(StackCheck), - B(LdaZero), - B(StaContextSlot), R(context), U8(7), - B(LdaZero), - B(StaContextSlot), R(context), U8(8), - B(LdaZero), - B(StaContextSlot), R(context), U8(9), - B(LdaZero), - B(StaContextSlot), R(context), U8(10), - B(LdaZero), - B(StaContextSlot), R(context), U8(11), - B(LdaZero), - B(StaContextSlot), R(context), U8(12), - B(LdaZero), - B(StaContextSlot), R(context), U8(13), - B(LdaZero), - B(StaContextSlot), R(context), U8(14), - B(LdaZero), - B(StaContextSlot), R(context), U8(15), - B(LdaZero), - B(StaContextSlot), R(context), U8(16), - B(LdaZero), - B(StaContextSlot), R(context), U8(17), - B(LdaZero), - B(StaContextSlot), R(context), U8(18), - B(LdaZero), - B(StaContextSlot), R(context), U8(19), - B(LdaZero), - B(StaContextSlot), R(context), U8(20), - B(LdaZero), - B(StaContextSlot), R(context), U8(21), - B(LdaZero), - B(StaContextSlot), R(context), U8(22), - B(LdaZero), - B(StaContextSlot), R(context), U8(23), - B(LdaZero), - B(StaContextSlot), R(context), U8(24), - B(LdaZero), - B(StaContextSlot), R(context), U8(25), - B(LdaZero), - B(StaContextSlot), R(context), U8(26), - B(LdaZero), - B(StaContextSlot), R(context), U8(27), - B(LdaZero), - B(StaContextSlot), R(context), U8(28), - B(LdaZero), - B(StaContextSlot), R(context), U8(29), - B(LdaZero), - B(StaContextSlot), R(context), U8(30), - B(LdaZero), - B(StaContextSlot), R(context), U8(31), - B(LdaZero), - B(StaContextSlot), R(context), U8(32), - B(LdaZero), - B(StaContextSlot), R(context), U8(33), - B(LdaZero), - B(StaContextSlot), R(context), U8(34), - B(LdaZero), - B(StaContextSlot), R(context), U8(35), - B(LdaZero), - B(StaContextSlot), R(context), U8(36), - B(LdaZero), - B(StaContextSlot), R(context), U8(37), - B(LdaZero), - B(StaContextSlot), R(context), U8(38), - B(LdaZero), - B(StaContextSlot), R(context), U8(39), - B(LdaZero), - B(StaContextSlot), R(context), U8(40), - B(LdaZero), - B(StaContextSlot), R(context), U8(41), - B(LdaZero), - B(StaContextSlot), R(context), U8(42), - B(LdaZero), - B(StaContextSlot), R(context), U8(43), - B(LdaZero), - B(StaContextSlot), R(context), U8(44), - B(LdaZero), - B(StaContextSlot), R(context), U8(45), - B(LdaZero), - B(StaContextSlot), R(context), U8(46), - B(LdaZero), - B(StaContextSlot), R(context), U8(47), - B(LdaZero), - B(StaContextSlot), R(context), U8(48), - B(LdaZero), - B(StaContextSlot), R(context), U8(49), - B(LdaZero), - B(StaContextSlot), R(context), U8(50), - B(LdaZero), - B(StaContextSlot), R(context), U8(51), - B(LdaZero), - B(StaContextSlot), R(context), U8(52), - B(LdaZero), - B(StaContextSlot), R(context), U8(53), - B(LdaZero), - B(StaContextSlot), R(context), U8(54), - B(LdaZero), - B(StaContextSlot), R(context), U8(55), - B(LdaZero), - B(StaContextSlot), R(context), U8(56), - B(LdaZero), - B(StaContextSlot), R(context), U8(57), - B(LdaZero), - B(StaContextSlot), R(context), U8(58), - B(LdaZero), - B(StaContextSlot), R(context), U8(59), - B(LdaZero), - B(StaContextSlot), R(context), U8(60), - B(LdaZero), - B(StaContextSlot), R(context), U8(61), - B(LdaZero), - B(StaContextSlot), R(context), U8(62), - B(LdaZero), - B(StaContextSlot), R(context), U8(63), - B(LdaZero), - B(StaContextSlot), R(context), U8(64), - B(LdaZero), - B(StaContextSlot), R(context), U8(65), - B(LdaZero), - B(StaContextSlot), R(context), U8(66), - B(LdaZero), - B(StaContextSlot), R(context), U8(67), - B(LdaZero), - B(StaContextSlot), R(context), U8(68), - B(LdaZero), - B(StaContextSlot), R(context), U8(69), - B(LdaZero), - B(StaContextSlot), R(context), U8(70), - B(LdaZero), - B(StaContextSlot), R(context), U8(71), - B(LdaZero), - B(StaContextSlot), R(context), U8(72), - B(LdaZero), - B(StaContextSlot), R(context), U8(73), - B(LdaZero), - B(StaContextSlot), R(context), U8(74), - B(LdaZero), - B(StaContextSlot), R(context), U8(75), - B(LdaZero), - B(StaContextSlot), R(context), U8(76), - B(LdaZero), - B(StaContextSlot), R(context), U8(77), - B(LdaZero), - B(StaContextSlot), R(context), U8(78), - B(LdaZero), - B(StaContextSlot), R(context), U8(79), - B(LdaZero), - B(StaContextSlot), R(context), U8(80), - B(LdaZero), - B(StaContextSlot), R(context), U8(81), - B(LdaZero), - B(StaContextSlot), R(context), U8(82), - B(LdaZero), - B(StaContextSlot), R(context), U8(83), - B(LdaZero), - B(StaContextSlot), R(context), U8(84), - B(LdaZero), - B(StaContextSlot), R(context), U8(85), - B(LdaZero), - B(StaContextSlot), R(context), U8(86), - B(LdaZero), - B(StaContextSlot), R(context), U8(87), - B(LdaZero), - B(StaContextSlot), R(context), U8(88), - B(LdaZero), - B(StaContextSlot), R(context), U8(89), - B(LdaZero), - B(StaContextSlot), R(context), U8(90), - B(LdaZero), - B(StaContextSlot), R(context), U8(91), - B(LdaZero), - B(StaContextSlot), R(context), U8(92), - B(LdaZero), - B(StaContextSlot), R(context), U8(93), - B(LdaZero), - B(StaContextSlot), R(context), U8(94), - B(LdaZero), - B(StaContextSlot), R(context), U8(95), - B(LdaZero), - B(StaContextSlot), R(context), U8(96), - B(LdaZero), - B(StaContextSlot), R(context), U8(97), - B(LdaZero), - B(StaContextSlot), R(context), U8(98), - B(LdaZero), - B(StaContextSlot), R(context), U8(99), - B(LdaZero), - B(StaContextSlot), R(context), U8(100), - B(LdaZero), - B(StaContextSlot), R(context), U8(101), - B(LdaZero), - B(StaContextSlot), R(context), U8(102), - B(LdaZero), - B(StaContextSlot), R(context), U8(103), - B(LdaZero), - B(StaContextSlot), R(context), U8(104), - B(LdaZero), - B(StaContextSlot), R(context), U8(105), - B(LdaZero), - B(StaContextSlot), R(context), U8(106), - B(LdaZero), - B(StaContextSlot), R(context), U8(107), - B(LdaZero), - B(StaContextSlot), R(context), U8(108), - B(LdaZero), - B(StaContextSlot), R(context), U8(109), - B(LdaZero), - B(StaContextSlot), R(context), U8(110), - B(LdaZero), - B(StaContextSlot), R(context), U8(111), - B(LdaZero), - B(StaContextSlot), R(context), U8(112), - B(LdaZero), - B(StaContextSlot), R(context), U8(113), - B(LdaZero), - B(StaContextSlot), R(context), U8(114), - B(LdaZero), - B(StaContextSlot), R(context), U8(115), - B(LdaZero), - B(StaContextSlot), R(context), U8(116), - B(LdaZero), - B(StaContextSlot), R(context), U8(117), - B(LdaZero), - B(StaContextSlot), R(context), U8(118), - B(LdaZero), - B(StaContextSlot), R(context), U8(119), - B(LdaZero), - B(StaContextSlot), R(context), U8(120), - B(LdaZero), - B(StaContextSlot), R(context), U8(121), - B(LdaZero), - B(StaContextSlot), R(context), U8(122), - B(LdaZero), - B(StaContextSlot), R(context), U8(123), - B(LdaZero), - B(StaContextSlot), R(context), U8(124), - B(LdaZero), - B(StaContextSlot), R(context), U8(125), - B(LdaZero), - B(StaContextSlot), R(context), U8(126), - B(LdaZero), - B(StaContextSlot), R(context), U8(127), - B(LdaZero), - B(StaContextSlot), R(context), U8(128), - B(LdaZero), - B(StaContextSlot), R(context), U8(129), - B(LdaZero), - B(StaContextSlot), R(context), U8(130), - B(LdaZero), - B(StaContextSlot), R(context), U8(131), - B(LdaZero), - B(StaContextSlot), R(context), U8(132), - B(LdaZero), - B(StaContextSlot), R(context), U8(133), - B(LdaZero), - B(StaContextSlot), R(context), U8(134), - B(LdaZero), - B(StaContextSlot), R(context), U8(135), - B(LdaZero), - B(StaContextSlot), R(context), U8(136), - B(LdaZero), - B(StaContextSlot), R(context), U8(137), - B(LdaZero), - B(StaContextSlot), R(context), U8(138), - B(LdaZero), - B(StaContextSlot), R(context), U8(139), - B(LdaZero), - B(StaContextSlot), R(context), U8(140), - B(LdaZero), - B(StaContextSlot), R(context), U8(141), - B(LdaZero), - B(StaContextSlot), R(context), U8(142), - B(LdaZero), - B(StaContextSlot), R(context), U8(143), - B(LdaZero), - B(StaContextSlot), R(context), U8(144), - B(LdaZero), - B(StaContextSlot), R(context), U8(145), - B(LdaZero), - B(StaContextSlot), R(context), U8(146), - B(LdaZero), - B(StaContextSlot), R(context), U8(147), - B(LdaZero), - B(StaContextSlot), R(context), U8(148), - B(LdaZero), - B(StaContextSlot), R(context), U8(149), - B(LdaZero), - B(StaContextSlot), R(context), U8(150), - B(LdaZero), - B(StaContextSlot), R(context), U8(151), - B(LdaZero), - B(StaContextSlot), R(context), U8(152), - B(LdaZero), - B(StaContextSlot), R(context), U8(153), - B(LdaZero), - B(StaContextSlot), R(context), U8(154), - B(LdaZero), - B(StaContextSlot), R(context), U8(155), - B(LdaZero), - B(StaContextSlot), R(context), U8(156), - B(LdaZero), - B(StaContextSlot), R(context), U8(157), - B(LdaZero), - B(StaContextSlot), R(context), U8(158), - B(LdaZero), - B(StaContextSlot), R(context), U8(159), - B(LdaZero), - B(StaContextSlot), R(context), U8(160), - B(LdaZero), - B(StaContextSlot), R(context), U8(161), - B(LdaZero), - B(StaContextSlot), R(context), U8(162), - B(LdaZero), - B(StaContextSlot), R(context), U8(163), - B(LdaZero), - B(StaContextSlot), R(context), U8(164), - B(LdaZero), - B(StaContextSlot), R(context), U8(165), - B(LdaZero), - B(StaContextSlot), R(context), U8(166), - B(LdaZero), - B(StaContextSlot), R(context), U8(167), - B(LdaZero), - B(StaContextSlot), R(context), U8(168), - B(LdaZero), - B(StaContextSlot), R(context), U8(169), - B(LdaZero), - B(StaContextSlot), R(context), U8(170), - B(LdaZero), - B(StaContextSlot), R(context), U8(171), - B(LdaZero), - B(StaContextSlot), R(context), U8(172), - B(LdaZero), - B(StaContextSlot), R(context), U8(173), - B(LdaZero), - B(StaContextSlot), R(context), U8(174), - B(LdaZero), - B(StaContextSlot), R(context), U8(175), - B(LdaZero), - B(StaContextSlot), R(context), U8(176), - B(LdaZero), - B(StaContextSlot), R(context), U8(177), - B(LdaZero), - B(StaContextSlot), R(context), U8(178), - B(LdaZero), - B(StaContextSlot), R(context), U8(179), - B(LdaZero), - B(StaContextSlot), R(context), U8(180), - B(LdaZero), - B(StaContextSlot), R(context), U8(181), - B(LdaZero), - B(StaContextSlot), R(context), U8(182), - B(LdaZero), - B(StaContextSlot), R(context), U8(183), - B(LdaZero), - B(StaContextSlot), R(context), U8(184), - B(LdaZero), - B(StaContextSlot), R(context), U8(185), - B(LdaZero), - B(StaContextSlot), R(context), U8(186), - B(LdaZero), - B(StaContextSlot), R(context), U8(187), - B(LdaZero), - B(StaContextSlot), R(context), U8(188), - B(LdaZero), - B(StaContextSlot), R(context), U8(189), - B(LdaZero), - B(StaContextSlot), R(context), U8(190), - B(LdaZero), - B(StaContextSlot), R(context), U8(191), - B(LdaZero), - B(StaContextSlot), R(context), U8(192), - B(LdaZero), - B(StaContextSlot), R(context), U8(193), - B(LdaZero), - B(StaContextSlot), R(context), U8(194), - B(LdaZero), - B(StaContextSlot), R(context), U8(195), - B(LdaZero), - B(StaContextSlot), R(context), U8(196), - B(LdaZero), - B(StaContextSlot), R(context), U8(197), - B(LdaZero), - B(StaContextSlot), R(context), U8(198), - B(LdaZero), - B(StaContextSlot), R(context), U8(199), - B(LdaZero), - B(StaContextSlot), R(context), U8(200), - B(LdaZero), - B(StaContextSlot), R(context), U8(201), - B(LdaZero), - B(StaContextSlot), R(context), U8(202), - B(LdaZero), - B(StaContextSlot), R(context), U8(203), - B(LdaZero), - B(StaContextSlot), R(context), U8(204), - B(LdaZero), - B(StaContextSlot), R(context), U8(205), - B(LdaZero), - B(StaContextSlot), R(context), U8(206), - B(LdaZero), - B(StaContextSlot), R(context), U8(207), - B(LdaZero), - B(StaContextSlot), R(context), U8(208), - B(LdaZero), - B(StaContextSlot), R(context), U8(209), - B(LdaZero), - B(StaContextSlot), R(context), U8(210), - B(LdaZero), - B(StaContextSlot), R(context), U8(211), - B(LdaZero), - B(StaContextSlot), R(context), U8(212), - B(LdaZero), - B(StaContextSlot), R(context), U8(213), - B(LdaZero), - B(StaContextSlot), R(context), U8(214), - B(LdaZero), - B(StaContextSlot), R(context), U8(215), - B(LdaZero), - B(StaContextSlot), R(context), U8(216), - B(LdaZero), - B(StaContextSlot), R(context), U8(217), - B(LdaZero), - B(StaContextSlot), R(context), U8(218), - B(LdaZero), - B(StaContextSlot), R(context), U8(219), - B(LdaZero), - B(StaContextSlot), R(context), U8(220), - B(LdaZero), - B(StaContextSlot), R(context), U8(221), - B(LdaZero), - B(StaContextSlot), R(context), U8(222), - B(LdaZero), - B(StaContextSlot), R(context), U8(223), - B(LdaZero), - B(StaContextSlot), R(context), U8(224), - B(LdaZero), - B(StaContextSlot), R(context), U8(225), - B(LdaZero), - B(StaContextSlot), R(context), U8(226), - B(LdaZero), - B(StaContextSlot), R(context), U8(227), - B(LdaZero), - B(StaContextSlot), R(context), U8(228), - B(LdaZero), - B(StaContextSlot), R(context), U8(229), - B(LdaZero), - B(StaContextSlot), R(context), U8(230), - B(LdaZero), - B(StaContextSlot), R(context), U8(231), - B(LdaZero), - B(StaContextSlot), R(context), U8(232), - B(LdaZero), - B(StaContextSlot), R(context), U8(233), - B(LdaZero), - B(StaContextSlot), R(context), U8(234), - B(LdaZero), - B(StaContextSlot), R(context), U8(235), - B(LdaZero), - B(StaContextSlot), R(context), U8(236), - B(LdaZero), - B(StaContextSlot), R(context), U8(237), - B(LdaZero), - B(StaContextSlot), R(context), U8(238), - B(LdaZero), - B(StaContextSlot), R(context), U8(239), - B(LdaZero), - B(StaContextSlot), R(context), U8(240), - B(LdaZero), - B(StaContextSlot), R(context), U8(241), - B(LdaZero), - B(StaContextSlot), R(context), U8(242), - B(LdaZero), - B(StaContextSlot), R(context), U8(243), - B(LdaZero), - B(StaContextSlot), R(context), U8(244), - B(LdaZero), - B(StaContextSlot), R(context), U8(245), - B(LdaZero), - B(StaContextSlot), R(context), U8(246), - B(LdaZero), - B(StaContextSlot), R(context), U8(247), - B(LdaZero), - B(StaContextSlot), R(context), U8(248), - B(LdaZero), - B(StaContextSlot), R(context), U8(249), - B(LdaZero), - B(StaContextSlot), R(context), U8(250), - B(LdaZero), - B(StaContextSlot), R(context), U8(251), - B(LdaZero), - B(StaContextSlot), R(context), U8(252), - B(LdaZero), - B(StaContextSlot), R(context), U8(253), - B(LdaZero), - B(StaContextSlot), R(context), U8(254), - B(LdaZero), - B(StaContextSlot), R(context), U8(255), - B(LdaUndefined), - B(Star), R(2), - B(LdaGlobal), U8(0), U8(1), - B(Star), R(1), - B(Call), R(1), R(2), U8(1), U8(0), - B(LdaSmi), U8(100), - B(Wide), B(StaContextSlot), R16(context), U16(256), - B(Wide), B(LdaContextSlot), R16(context), U16(256), - B(Return), + B(CreateFunctionContext), U8(253), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + B(CreateUnmappedArguments), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(6), + /* 30 E> */ B(StackCheck), + /* 57 S> */ B(LdaZero), + /* 57 E> */ B(StaContextSlot), R(context), U8(7), + /* 69 S> */ B(LdaZero), + /* 69 E> */ B(StaContextSlot), R(context), U8(8), + /* 81 S> */ B(LdaZero), + /* 81 E> */ B(StaContextSlot), R(context), U8(9), + /* 93 S> */ B(LdaZero), + /* 93 E> */ B(StaContextSlot), R(context), U8(10), + /* 105 S> */ B(LdaZero), + /* 105 E> */ B(StaContextSlot), R(context), U8(11), + /* 117 S> */ B(LdaZero), + /* 117 E> */ B(StaContextSlot), R(context), U8(12), + /* 129 S> */ B(LdaZero), + /* 129 E> */ B(StaContextSlot), R(context), U8(13), + /* 141 S> */ B(LdaZero), + /* 141 E> */ B(StaContextSlot), R(context), U8(14), + /* 153 S> */ B(LdaZero), + /* 153 E> */ B(StaContextSlot), R(context), U8(15), + /* 165 S> */ B(LdaZero), + /* 165 E> */ B(StaContextSlot), R(context), U8(16), + /* 178 S> */ B(LdaZero), + /* 178 E> */ B(StaContextSlot), R(context), U8(17), + /* 191 S> */ B(LdaZero), + /* 191 E> */ B(StaContextSlot), R(context), U8(18), + /* 204 S> */ B(LdaZero), + /* 204 E> */ B(StaContextSlot), R(context), U8(19), + /* 217 S> */ B(LdaZero), + /* 217 E> */ B(StaContextSlot), R(context), U8(20), + /* 230 S> */ B(LdaZero), + /* 230 E> */ B(StaContextSlot), R(context), U8(21), + /* 243 S> */ B(LdaZero), + /* 243 E> */ B(StaContextSlot), R(context), U8(22), + /* 256 S> */ B(LdaZero), + /* 256 E> */ B(StaContextSlot), R(context), U8(23), + /* 269 S> */ B(LdaZero), + /* 269 E> */ B(StaContextSlot), R(context), U8(24), + /* 282 S> */ B(LdaZero), + /* 282 E> */ B(StaContextSlot), R(context), U8(25), + /* 295 S> */ B(LdaZero), + /* 295 E> */ B(StaContextSlot), R(context), U8(26), + /* 308 S> */ B(LdaZero), + /* 308 E> */ B(StaContextSlot), R(context), U8(27), + /* 321 S> */ B(LdaZero), + /* 321 E> */ B(StaContextSlot), R(context), U8(28), + /* 334 S> */ B(LdaZero), + /* 334 E> */ B(StaContextSlot), R(context), U8(29), + /* 347 S> */ B(LdaZero), + /* 347 E> */ B(StaContextSlot), R(context), U8(30), + /* 360 S> */ B(LdaZero), + /* 360 E> */ B(StaContextSlot), R(context), U8(31), + /* 373 S> */ B(LdaZero), + /* 373 E> */ B(StaContextSlot), R(context), U8(32), + /* 386 S> */ B(LdaZero), + /* 386 E> */ B(StaContextSlot), R(context), U8(33), + /* 399 S> */ B(LdaZero), + /* 399 E> */ B(StaContextSlot), R(context), U8(34), + /* 412 S> */ B(LdaZero), + /* 412 E> */ B(StaContextSlot), R(context), U8(35), + /* 425 S> */ B(LdaZero), + /* 425 E> */ B(StaContextSlot), R(context), U8(36), + /* 438 S> */ B(LdaZero), + /* 438 E> */ B(StaContextSlot), R(context), U8(37), + /* 451 S> */ B(LdaZero), + /* 451 E> */ B(StaContextSlot), R(context), U8(38), + /* 464 S> */ B(LdaZero), + /* 464 E> */ B(StaContextSlot), R(context), U8(39), + /* 477 S> */ B(LdaZero), + /* 477 E> */ B(StaContextSlot), R(context), U8(40), + /* 490 S> */ B(LdaZero), + /* 490 E> */ B(StaContextSlot), R(context), U8(41), + /* 503 S> */ B(LdaZero), + /* 503 E> */ B(StaContextSlot), R(context), U8(42), + /* 516 S> */ B(LdaZero), + /* 516 E> */ B(StaContextSlot), R(context), U8(43), + /* 529 S> */ B(LdaZero), + /* 529 E> */ B(StaContextSlot), R(context), U8(44), + /* 542 S> */ B(LdaZero), + /* 542 E> */ B(StaContextSlot), R(context), U8(45), + /* 555 S> */ B(LdaZero), + /* 555 E> */ B(StaContextSlot), R(context), U8(46), + /* 568 S> */ B(LdaZero), + /* 568 E> */ B(StaContextSlot), R(context), U8(47), + /* 581 S> */ B(LdaZero), + /* 581 E> */ B(StaContextSlot), R(context), U8(48), + /* 594 S> */ B(LdaZero), + /* 594 E> */ B(StaContextSlot), R(context), U8(49), + /* 607 S> */ B(LdaZero), + /* 607 E> */ B(StaContextSlot), R(context), U8(50), + /* 620 S> */ B(LdaZero), + /* 620 E> */ B(StaContextSlot), R(context), U8(51), + /* 633 S> */ B(LdaZero), + /* 633 E> */ B(StaContextSlot), R(context), U8(52), + /* 646 S> */ B(LdaZero), + /* 646 E> */ B(StaContextSlot), R(context), U8(53), + /* 659 S> */ B(LdaZero), + /* 659 E> */ B(StaContextSlot), R(context), U8(54), + /* 672 S> */ B(LdaZero), + /* 672 E> */ B(StaContextSlot), R(context), U8(55), + /* 685 S> */ B(LdaZero), + /* 685 E> */ B(StaContextSlot), R(context), U8(56), + /* 698 S> */ B(LdaZero), + /* 698 E> */ B(StaContextSlot), R(context), U8(57), + /* 711 S> */ B(LdaZero), + /* 711 E> */ B(StaContextSlot), R(context), U8(58), + /* 724 S> */ B(LdaZero), + /* 724 E> */ B(StaContextSlot), R(context), U8(59), + /* 737 S> */ B(LdaZero), + /* 737 E> */ B(StaContextSlot), R(context), U8(60), + /* 750 S> */ B(LdaZero), + /* 750 E> */ B(StaContextSlot), R(context), U8(61), + /* 763 S> */ B(LdaZero), + /* 763 E> */ B(StaContextSlot), R(context), U8(62), + /* 776 S> */ B(LdaZero), + /* 776 E> */ B(StaContextSlot), R(context), U8(63), + /* 789 S> */ B(LdaZero), + /* 789 E> */ B(StaContextSlot), R(context), U8(64), + /* 802 S> */ B(LdaZero), + /* 802 E> */ B(StaContextSlot), R(context), U8(65), + /* 815 S> */ B(LdaZero), + /* 815 E> */ B(StaContextSlot), R(context), U8(66), + /* 828 S> */ B(LdaZero), + /* 828 E> */ B(StaContextSlot), R(context), U8(67), + /* 841 S> */ B(LdaZero), + /* 841 E> */ B(StaContextSlot), R(context), U8(68), + /* 854 S> */ B(LdaZero), + /* 854 E> */ B(StaContextSlot), R(context), U8(69), + /* 867 S> */ B(LdaZero), + /* 867 E> */ B(StaContextSlot), R(context), U8(70), + /* 880 S> */ B(LdaZero), + /* 880 E> */ B(StaContextSlot), R(context), U8(71), + /* 893 S> */ B(LdaZero), + /* 893 E> */ B(StaContextSlot), R(context), U8(72), + /* 906 S> */ B(LdaZero), + /* 906 E> */ B(StaContextSlot), R(context), U8(73), + /* 919 S> */ B(LdaZero), + /* 919 E> */ B(StaContextSlot), R(context), U8(74), + /* 932 S> */ B(LdaZero), + /* 932 E> */ B(StaContextSlot), R(context), U8(75), + /* 945 S> */ B(LdaZero), + /* 945 E> */ B(StaContextSlot), R(context), U8(76), + /* 958 S> */ B(LdaZero), + /* 958 E> */ B(StaContextSlot), R(context), U8(77), + /* 971 S> */ B(LdaZero), + /* 971 E> */ B(StaContextSlot), R(context), U8(78), + /* 984 S> */ B(LdaZero), + /* 984 E> */ B(StaContextSlot), R(context), U8(79), + /* 997 S> */ B(LdaZero), + /* 997 E> */ B(StaContextSlot), R(context), U8(80), + /* 1010 S> */ B(LdaZero), + /* 1010 E> */ B(StaContextSlot), R(context), U8(81), + /* 1023 S> */ B(LdaZero), + /* 1023 E> */ B(StaContextSlot), R(context), U8(82), + /* 1036 S> */ B(LdaZero), + /* 1036 E> */ B(StaContextSlot), R(context), U8(83), + /* 1049 S> */ B(LdaZero), + /* 1049 E> */ B(StaContextSlot), R(context), U8(84), + /* 1062 S> */ B(LdaZero), + /* 1062 E> */ B(StaContextSlot), R(context), U8(85), + /* 1075 S> */ B(LdaZero), + /* 1075 E> */ B(StaContextSlot), R(context), U8(86), + /* 1088 S> */ B(LdaZero), + /* 1088 E> */ B(StaContextSlot), R(context), U8(87), + /* 1101 S> */ B(LdaZero), + /* 1101 E> */ B(StaContextSlot), R(context), U8(88), + /* 1114 S> */ B(LdaZero), + /* 1114 E> */ B(StaContextSlot), R(context), U8(89), + /* 1127 S> */ B(LdaZero), + /* 1127 E> */ B(StaContextSlot), R(context), U8(90), + /* 1140 S> */ B(LdaZero), + /* 1140 E> */ B(StaContextSlot), R(context), U8(91), + /* 1153 S> */ B(LdaZero), + /* 1153 E> */ B(StaContextSlot), R(context), U8(92), + /* 1166 S> */ B(LdaZero), + /* 1166 E> */ B(StaContextSlot), R(context), U8(93), + /* 1179 S> */ B(LdaZero), + /* 1179 E> */ B(StaContextSlot), R(context), U8(94), + /* 1192 S> */ B(LdaZero), + /* 1192 E> */ B(StaContextSlot), R(context), U8(95), + /* 1205 S> */ B(LdaZero), + /* 1205 E> */ B(StaContextSlot), R(context), U8(96), + /* 1218 S> */ B(LdaZero), + /* 1218 E> */ B(StaContextSlot), R(context), U8(97), + /* 1231 S> */ B(LdaZero), + /* 1231 E> */ B(StaContextSlot), R(context), U8(98), + /* 1244 S> */ B(LdaZero), + /* 1244 E> */ B(StaContextSlot), R(context), U8(99), + /* 1257 S> */ B(LdaZero), + /* 1257 E> */ B(StaContextSlot), R(context), U8(100), + /* 1270 S> */ B(LdaZero), + /* 1270 E> */ B(StaContextSlot), R(context), U8(101), + /* 1283 S> */ B(LdaZero), + /* 1283 E> */ B(StaContextSlot), R(context), U8(102), + /* 1296 S> */ B(LdaZero), + /* 1296 E> */ B(StaContextSlot), R(context), U8(103), + /* 1309 S> */ B(LdaZero), + /* 1309 E> */ B(StaContextSlot), R(context), U8(104), + /* 1322 S> */ B(LdaZero), + /* 1322 E> */ B(StaContextSlot), R(context), U8(105), + /* 1335 S> */ B(LdaZero), + /* 1335 E> */ B(StaContextSlot), R(context), U8(106), + /* 1349 S> */ B(LdaZero), + /* 1349 E> */ B(StaContextSlot), R(context), U8(107), + /* 1363 S> */ B(LdaZero), + /* 1363 E> */ B(StaContextSlot), R(context), U8(108), + /* 1377 S> */ B(LdaZero), + /* 1377 E> */ B(StaContextSlot), R(context), U8(109), + /* 1391 S> */ B(LdaZero), + /* 1391 E> */ B(StaContextSlot), R(context), U8(110), + /* 1405 S> */ B(LdaZero), + /* 1405 E> */ B(StaContextSlot), R(context), U8(111), + /* 1419 S> */ B(LdaZero), + /* 1419 E> */ B(StaContextSlot), R(context), U8(112), + /* 1433 S> */ B(LdaZero), + /* 1433 E> */ B(StaContextSlot), R(context), U8(113), + /* 1447 S> */ B(LdaZero), + /* 1447 E> */ B(StaContextSlot), R(context), U8(114), + /* 1461 S> */ B(LdaZero), + /* 1461 E> */ B(StaContextSlot), R(context), U8(115), + /* 1475 S> */ B(LdaZero), + /* 1475 E> */ B(StaContextSlot), R(context), U8(116), + /* 1489 S> */ B(LdaZero), + /* 1489 E> */ B(StaContextSlot), R(context), U8(117), + /* 1503 S> */ B(LdaZero), + /* 1503 E> */ B(StaContextSlot), R(context), U8(118), + /* 1517 S> */ B(LdaZero), + /* 1517 E> */ B(StaContextSlot), R(context), U8(119), + /* 1531 S> */ B(LdaZero), + /* 1531 E> */ B(StaContextSlot), R(context), U8(120), + /* 1545 S> */ B(LdaZero), + /* 1545 E> */ B(StaContextSlot), R(context), U8(121), + /* 1559 S> */ B(LdaZero), + /* 1559 E> */ B(StaContextSlot), R(context), U8(122), + /* 1573 S> */ B(LdaZero), + /* 1573 E> */ B(StaContextSlot), R(context), U8(123), + /* 1587 S> */ B(LdaZero), + /* 1587 E> */ B(StaContextSlot), R(context), U8(124), + /* 1601 S> */ B(LdaZero), + /* 1601 E> */ B(StaContextSlot), R(context), U8(125), + /* 1615 S> */ B(LdaZero), + /* 1615 E> */ B(StaContextSlot), R(context), U8(126), + /* 1629 S> */ B(LdaZero), + /* 1629 E> */ B(StaContextSlot), R(context), U8(127), + /* 1643 S> */ B(LdaZero), + /* 1643 E> */ B(StaContextSlot), R(context), U8(128), + /* 1657 S> */ B(LdaZero), + /* 1657 E> */ B(StaContextSlot), R(context), U8(129), + /* 1671 S> */ B(LdaZero), + /* 1671 E> */ B(StaContextSlot), R(context), U8(130), + /* 1685 S> */ B(LdaZero), + /* 1685 E> */ B(StaContextSlot), R(context), U8(131), + /* 1699 S> */ B(LdaZero), + /* 1699 E> */ B(StaContextSlot), R(context), U8(132), + /* 1713 S> */ B(LdaZero), + /* 1713 E> */ B(StaContextSlot), R(context), U8(133), + /* 1727 S> */ B(LdaZero), + /* 1727 E> */ B(StaContextSlot), R(context), U8(134), + /* 1741 S> */ B(LdaZero), + /* 1741 E> */ B(StaContextSlot), R(context), U8(135), + /* 1755 S> */ B(LdaZero), + /* 1755 E> */ B(StaContextSlot), R(context), U8(136), + /* 1769 S> */ B(LdaZero), + /* 1769 E> */ B(StaContextSlot), R(context), U8(137), + /* 1783 S> */ B(LdaZero), + /* 1783 E> */ B(StaContextSlot), R(context), U8(138), + /* 1797 S> */ B(LdaZero), + /* 1797 E> */ B(StaContextSlot), R(context), U8(139), + /* 1811 S> */ B(LdaZero), + /* 1811 E> */ B(StaContextSlot), R(context), U8(140), + /* 1825 S> */ B(LdaZero), + /* 1825 E> */ B(StaContextSlot), R(context), U8(141), + /* 1839 S> */ B(LdaZero), + /* 1839 E> */ B(StaContextSlot), R(context), U8(142), + /* 1853 S> */ B(LdaZero), + /* 1853 E> */ B(StaContextSlot), R(context), U8(143), + /* 1867 S> */ B(LdaZero), + /* 1867 E> */ B(StaContextSlot), R(context), U8(144), + /* 1881 S> */ B(LdaZero), + /* 1881 E> */ B(StaContextSlot), R(context), U8(145), + /* 1895 S> */ B(LdaZero), + /* 1895 E> */ B(StaContextSlot), R(context), U8(146), + /* 1909 S> */ B(LdaZero), + /* 1909 E> */ B(StaContextSlot), R(context), U8(147), + /* 1923 S> */ B(LdaZero), + /* 1923 E> */ B(StaContextSlot), R(context), U8(148), + /* 1937 S> */ B(LdaZero), + /* 1937 E> */ B(StaContextSlot), R(context), U8(149), + /* 1951 S> */ B(LdaZero), + /* 1951 E> */ B(StaContextSlot), R(context), U8(150), + /* 1965 S> */ B(LdaZero), + /* 1965 E> */ B(StaContextSlot), R(context), U8(151), + /* 1979 S> */ B(LdaZero), + /* 1979 E> */ B(StaContextSlot), R(context), U8(152), + /* 1993 S> */ B(LdaZero), + /* 1993 E> */ B(StaContextSlot), R(context), U8(153), + /* 2007 S> */ B(LdaZero), + /* 2007 E> */ B(StaContextSlot), R(context), U8(154), + /* 2021 S> */ B(LdaZero), + /* 2021 E> */ B(StaContextSlot), R(context), U8(155), + /* 2035 S> */ B(LdaZero), + /* 2035 E> */ B(StaContextSlot), R(context), U8(156), + /* 2049 S> */ B(LdaZero), + /* 2049 E> */ B(StaContextSlot), R(context), U8(157), + /* 2063 S> */ B(LdaZero), + /* 2063 E> */ B(StaContextSlot), R(context), U8(158), + /* 2077 S> */ B(LdaZero), + /* 2077 E> */ B(StaContextSlot), R(context), U8(159), + /* 2091 S> */ B(LdaZero), + /* 2091 E> */ B(StaContextSlot), R(context), U8(160), + /* 2105 S> */ B(LdaZero), + /* 2105 E> */ B(StaContextSlot), R(context), U8(161), + /* 2119 S> */ B(LdaZero), + /* 2119 E> */ B(StaContextSlot), R(context), U8(162), + /* 2133 S> */ B(LdaZero), + /* 2133 E> */ B(StaContextSlot), R(context), U8(163), + /* 2147 S> */ B(LdaZero), + /* 2147 E> */ B(StaContextSlot), R(context), U8(164), + /* 2161 S> */ B(LdaZero), + /* 2161 E> */ B(StaContextSlot), R(context), U8(165), + /* 2175 S> */ B(LdaZero), + /* 2175 E> */ B(StaContextSlot), R(context), U8(166), + /* 2189 S> */ B(LdaZero), + /* 2189 E> */ B(StaContextSlot), R(context), U8(167), + /* 2203 S> */ B(LdaZero), + /* 2203 E> */ B(StaContextSlot), R(context), U8(168), + /* 2217 S> */ B(LdaZero), + /* 2217 E> */ B(StaContextSlot), R(context), U8(169), + /* 2231 S> */ B(LdaZero), + /* 2231 E> */ B(StaContextSlot), R(context), U8(170), + /* 2245 S> */ B(LdaZero), + /* 2245 E> */ B(StaContextSlot), R(context), U8(171), + /* 2259 S> */ B(LdaZero), + /* 2259 E> */ B(StaContextSlot), R(context), U8(172), + /* 2273 S> */ B(LdaZero), + /* 2273 E> */ B(StaContextSlot), R(context), U8(173), + /* 2287 S> */ B(LdaZero), + /* 2287 E> */ B(StaContextSlot), R(context), U8(174), + /* 2301 S> */ B(LdaZero), + /* 2301 E> */ B(StaContextSlot), R(context), U8(175), + /* 2315 S> */ B(LdaZero), + /* 2315 E> */ B(StaContextSlot), R(context), U8(176), + /* 2329 S> */ B(LdaZero), + /* 2329 E> */ B(StaContextSlot), R(context), U8(177), + /* 2343 S> */ B(LdaZero), + /* 2343 E> */ B(StaContextSlot), R(context), U8(178), + /* 2357 S> */ B(LdaZero), + /* 2357 E> */ B(StaContextSlot), R(context), U8(179), + /* 2371 S> */ B(LdaZero), + /* 2371 E> */ B(StaContextSlot), R(context), U8(180), + /* 2385 S> */ B(LdaZero), + /* 2385 E> */ B(StaContextSlot), R(context), U8(181), + /* 2399 S> */ B(LdaZero), + /* 2399 E> */ B(StaContextSlot), R(context), U8(182), + /* 2413 S> */ B(LdaZero), + /* 2413 E> */ B(StaContextSlot), R(context), U8(183), + /* 2427 S> */ B(LdaZero), + /* 2427 E> */ B(StaContextSlot), R(context), U8(184), + /* 2441 S> */ B(LdaZero), + /* 2441 E> */ B(StaContextSlot), R(context), U8(185), + /* 2455 S> */ B(LdaZero), + /* 2455 E> */ B(StaContextSlot), R(context), U8(186), + /* 2469 S> */ B(LdaZero), + /* 2469 E> */ B(StaContextSlot), R(context), U8(187), + /* 2483 S> */ B(LdaZero), + /* 2483 E> */ B(StaContextSlot), R(context), U8(188), + /* 2497 S> */ B(LdaZero), + /* 2497 E> */ B(StaContextSlot), R(context), U8(189), + /* 2511 S> */ B(LdaZero), + /* 2511 E> */ B(StaContextSlot), R(context), U8(190), + /* 2525 S> */ B(LdaZero), + /* 2525 E> */ B(StaContextSlot), R(context), U8(191), + /* 2539 S> */ B(LdaZero), + /* 2539 E> */ B(StaContextSlot), R(context), U8(192), + /* 2553 S> */ B(LdaZero), + /* 2553 E> */ B(StaContextSlot), R(context), U8(193), + /* 2567 S> */ B(LdaZero), + /* 2567 E> */ B(StaContextSlot), R(context), U8(194), + /* 2581 S> */ B(LdaZero), + /* 2581 E> */ B(StaContextSlot), R(context), U8(195), + /* 2595 S> */ B(LdaZero), + /* 2595 E> */ B(StaContextSlot), R(context), U8(196), + /* 2609 S> */ B(LdaZero), + /* 2609 E> */ B(StaContextSlot), R(context), U8(197), + /* 2623 S> */ B(LdaZero), + /* 2623 E> */ B(StaContextSlot), R(context), U8(198), + /* 2637 S> */ B(LdaZero), + /* 2637 E> */ B(StaContextSlot), R(context), U8(199), + /* 2651 S> */ B(LdaZero), + /* 2651 E> */ B(StaContextSlot), R(context), U8(200), + /* 2665 S> */ B(LdaZero), + /* 2665 E> */ B(StaContextSlot), R(context), U8(201), + /* 2679 S> */ B(LdaZero), + /* 2679 E> */ B(StaContextSlot), R(context), U8(202), + /* 2693 S> */ B(LdaZero), + /* 2693 E> */ B(StaContextSlot), R(context), U8(203), + /* 2707 S> */ B(LdaZero), + /* 2707 E> */ B(StaContextSlot), R(context), U8(204), + /* 2721 S> */ B(LdaZero), + /* 2721 E> */ B(StaContextSlot), R(context), U8(205), + /* 2735 S> */ B(LdaZero), + /* 2735 E> */ B(StaContextSlot), R(context), U8(206), + /* 2749 S> */ B(LdaZero), + /* 2749 E> */ B(StaContextSlot), R(context), U8(207), + /* 2763 S> */ B(LdaZero), + /* 2763 E> */ B(StaContextSlot), R(context), U8(208), + /* 2777 S> */ B(LdaZero), + /* 2777 E> */ B(StaContextSlot), R(context), U8(209), + /* 2791 S> */ B(LdaZero), + /* 2791 E> */ B(StaContextSlot), R(context), U8(210), + /* 2805 S> */ B(LdaZero), + /* 2805 E> */ B(StaContextSlot), R(context), U8(211), + /* 2819 S> */ B(LdaZero), + /* 2819 E> */ B(StaContextSlot), R(context), U8(212), + /* 2833 S> */ B(LdaZero), + /* 2833 E> */ B(StaContextSlot), R(context), U8(213), + /* 2847 S> */ B(LdaZero), + /* 2847 E> */ B(StaContextSlot), R(context), U8(214), + /* 2861 S> */ B(LdaZero), + /* 2861 E> */ B(StaContextSlot), R(context), U8(215), + /* 2875 S> */ B(LdaZero), + /* 2875 E> */ B(StaContextSlot), R(context), U8(216), + /* 2889 S> */ B(LdaZero), + /* 2889 E> */ B(StaContextSlot), R(context), U8(217), + /* 2903 S> */ B(LdaZero), + /* 2903 E> */ B(StaContextSlot), R(context), U8(218), + /* 2917 S> */ B(LdaZero), + /* 2917 E> */ B(StaContextSlot), R(context), U8(219), + /* 2931 S> */ B(LdaZero), + /* 2931 E> */ B(StaContextSlot), R(context), U8(220), + /* 2945 S> */ B(LdaZero), + /* 2945 E> */ B(StaContextSlot), R(context), U8(221), + /* 2959 S> */ B(LdaZero), + /* 2959 E> */ B(StaContextSlot), R(context), U8(222), + /* 2973 S> */ B(LdaZero), + /* 2973 E> */ B(StaContextSlot), R(context), U8(223), + /* 2987 S> */ B(LdaZero), + /* 2987 E> */ B(StaContextSlot), R(context), U8(224), + /* 3001 S> */ B(LdaZero), + /* 3001 E> */ B(StaContextSlot), R(context), U8(225), + /* 3015 S> */ B(LdaZero), + /* 3015 E> */ B(StaContextSlot), R(context), U8(226), + /* 3029 S> */ B(LdaZero), + /* 3029 E> */ B(StaContextSlot), R(context), U8(227), + /* 3043 S> */ B(LdaZero), + /* 3043 E> */ B(StaContextSlot), R(context), U8(228), + /* 3057 S> */ B(LdaZero), + /* 3057 E> */ B(StaContextSlot), R(context), U8(229), + /* 3071 S> */ B(LdaZero), + /* 3071 E> */ B(StaContextSlot), R(context), U8(230), + /* 3085 S> */ B(LdaZero), + /* 3085 E> */ B(StaContextSlot), R(context), U8(231), + /* 3099 S> */ B(LdaZero), + /* 3099 E> */ B(StaContextSlot), R(context), U8(232), + /* 3113 S> */ B(LdaZero), + /* 3113 E> */ B(StaContextSlot), R(context), U8(233), + /* 3127 S> */ B(LdaZero), + /* 3127 E> */ B(StaContextSlot), R(context), U8(234), + /* 3141 S> */ B(LdaZero), + /* 3141 E> */ B(StaContextSlot), R(context), U8(235), + /* 3155 S> */ B(LdaZero), + /* 3155 E> */ B(StaContextSlot), R(context), U8(236), + /* 3169 S> */ B(LdaZero), + /* 3169 E> */ B(StaContextSlot), R(context), U8(237), + /* 3183 S> */ B(LdaZero), + /* 3183 E> */ B(StaContextSlot), R(context), U8(238), + /* 3197 S> */ B(LdaZero), + /* 3197 E> */ B(StaContextSlot), R(context), U8(239), + /* 3211 S> */ B(LdaZero), + /* 3211 E> */ B(StaContextSlot), R(context), U8(240), + /* 3225 S> */ B(LdaZero), + /* 3225 E> */ B(StaContextSlot), R(context), U8(241), + /* 3239 S> */ B(LdaZero), + /* 3239 E> */ B(StaContextSlot), R(context), U8(242), + /* 3253 S> */ B(LdaZero), + /* 3253 E> */ B(StaContextSlot), R(context), U8(243), + /* 3267 S> */ B(LdaZero), + /* 3267 E> */ B(StaContextSlot), R(context), U8(244), + /* 3281 S> */ B(LdaZero), + /* 3281 E> */ B(StaContextSlot), R(context), U8(245), + /* 3295 S> */ B(LdaZero), + /* 3295 E> */ B(StaContextSlot), R(context), U8(246), + /* 3309 S> */ B(LdaZero), + /* 3309 E> */ B(StaContextSlot), R(context), U8(247), + /* 3323 S> */ B(LdaZero), + /* 3323 E> */ B(StaContextSlot), R(context), U8(248), + /* 3337 S> */ B(LdaZero), + /* 3337 E> */ B(StaContextSlot), R(context), U8(249), + /* 3351 S> */ B(LdaZero), + /* 3351 E> */ B(StaContextSlot), R(context), U8(250), + /* 3365 S> */ B(LdaZero), + /* 3365 E> */ B(StaContextSlot), R(context), U8(251), + /* 3379 S> */ B(LdaZero), + /* 3379 E> */ B(StaContextSlot), R(context), U8(252), + /* 3393 S> */ B(LdaZero), + /* 3393 E> */ B(StaContextSlot), R(context), U8(253), + /* 3407 S> */ B(LdaZero), + /* 3407 E> */ B(StaContextSlot), R(context), U8(254), + /* 3421 S> */ B(LdaZero), + /* 3421 E> */ B(StaContextSlot), R(context), U8(255), + /* 3424 S> */ B(LdrUndefined), R(2), + /* 3424 E> */ B(LdrGlobal), U8(1), R(1), + /* 3424 E> */ B(Call), R(1), R(2), U8(1), U8(0), + /* 3440 S> */ B(LdaSmi), U8(100), + /* 3440 E> */ B(Wide), B(StaContextSlot), R16(context), U16(256), + /* 3445 S> */ B(Wide), B(LdaContextSlot), R16(context), U16(256), + /* 3454 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden index 885778992a..aef4e1456c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden @@ -15,13 +15,12 @@ frame size: 1 parameter count: 1 bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(ToNumber), - B(Inc), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(Inc), U8(1), + B(Star), R(0), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -36,15 +35,14 @@ frame size: 2 parameter count: 1 bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(ToNumber), - B(Star), R(1), - B(Inc), - B(Star), R(0), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(ToNumber), R(1), + B(Inc), U8(1), + B(Star), R(0), + B(Ldar), R(1), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -59,13 +57,12 @@ frame size: 1 parameter count: 1 bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(ToNumber), - B(Dec), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(Dec), U8(1), + B(Star), R(0), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -80,15 +77,14 @@ frame size: 2 parameter count: 1 bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(ToNumber), - B(Star), R(1), - B(Dec), - B(Star), R(0), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(ToNumber), R(1), + B(Dec), U8(1), + B(Star), R(0), + B(Ldar), R(1), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -101,20 +97,17 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 26 +bytecode array length: 24 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LoadIC), R(1), U8(1), U8(1), - B(ToNumber), - B(Star), R(2), - B(Inc), - B(StoreICSloppy), R(1), U8(1), U8(3), - B(Ldar), R(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), + B(ToNumber), R(2), + B(Inc), U8(5), + /* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3), + B(Ldar), R(2), + /* 70 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -129,18 +122,15 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 22 +bytecode array length: 20 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LoadIC), R(1), U8(1), U8(1), - B(ToNumber), - B(Dec), - B(StoreICSloppy), R(1), U8(1), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), + B(Dec), U8(5), + /* 65 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3), + /* 70 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -155,24 +145,20 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 33 +bytecode array length: 29 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CreateObjectLiteral), U8(1), U8(0), U8(5), - B(Star), R(2), - B(Star), R(1), - B(Star), R(2), - B(Ldar), R(0), - B(Star), R(3), - B(KeyedLoadIC), R(2), U8(1), - B(ToNumber), - B(Star), R(4), - B(Dec), - B(KeyedStoreICSloppy), R(2), R(3), U8(3), - B(Ldar), R(4), - B(Return), + /* 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), + B(Mov), R(2), R(1), + /* 72 S> */ B(Ldar), R(0), + /* 81 E> */ B(LdaKeyedProperty), R(1), U8(1), + B(ToNumber), R(4), + B(Dec), U8(5), + /* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(3), + B(Ldar), R(4), + /* 90 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -185,24 +171,20 @@ handlers: [ snippet: " var name = 'var'; var a = { val: 1 }; return ++a[name]; " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 29 +bytecode array length: 25 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CreateObjectLiteral), U8(1), U8(0), U8(5), - B(Star), R(2), - B(Star), R(1), - B(Star), R(2), - B(Ldar), R(0), - B(Star), R(3), - B(KeyedLoadIC), R(2), U8(1), - B(ToNumber), - B(Inc), - B(KeyedStoreICSloppy), R(2), R(3), U8(3), - B(Return), + /* 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), + B(Mov), R(2), R(1), + /* 72 S> */ B(Ldar), R(0), + /* 83 E> */ B(LdaKeyedProperty), R(1), U8(1), + B(Inc), U8(5), + /* 87 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(3), + /* 90 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -217,20 +199,19 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 27 +bytecode array length: 24 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(LdaContextSlot), R(context), U8(4), - B(ToNumber), - B(Inc), - B(StaContextSlot), R(context), U8(4), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 53 S> */ B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 78 S> */ B(LdaContextSlot), R(context), U8(4), + B(Inc), U8(1), + /* 87 E> */ B(StaContextSlot), R(context), U8(4), + /* 90 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -244,22 +225,21 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 31 +bytecode array length: 28 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(StackCheck), - B(LdaSmi), U8(1), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(LdaContextSlot), R(context), U8(4), - B(ToNumber), - B(Star), R(2), - B(Dec), - B(StaContextSlot), R(context), U8(4), - B(Ldar), R(2), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 53 S> */ B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 78 S> */ B(LdaContextSlot), R(context), U8(4), + B(ToNumber), R(2), + B(Dec), U8(1), + /* 86 E> */ B(StaContextSlot), R(context), U8(4), + B(Ldar), R(2), + /* 90 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -273,22 +253,20 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 28 +bytecode array length: 26 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Star), R(1), - B(Star), R(2), - B(Ldar), R(0), - B(ToNumber), - B(Star), R(3), - B(Inc), - B(Star), R(0), - B(LdaSmi), U8(2), - B(KeyedStoreICSloppy), R(2), R(3), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 44 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 55 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(Star), R(1), + /* 63 S> */ B(Ldar), R(0), + B(ToNumber), R(3), + B(Inc), U8(1), + B(Star), R(0), + B(LdaSmi), U8(2), + /* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(2), + /* 84 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden index ab60ba49b8..1668c81302 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden @@ -15,13 +15,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - B(CreateMappedArguments), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Return), + B(CreateMappedArguments), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(Nop), + /* 33 S> */ B(Return), ] constant pool: [ ] @@ -33,18 +33,16 @@ snippet: " function f() { return arguments[0]; } f(); " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 9 bytecodes: [ - B(CreateMappedArguments), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaZero), - B(KeyedLoadIC), R(1), U8(1), - B(Return), + B(CreateMappedArguments), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaZero), + /* 31 E> */ B(LdaKeyedProperty), R(0), U8(1), + /* 36 S> */ B(Return), ] constant pool: [ ] @@ -58,13 +56,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - B(CreateUnmappedArguments), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Return), + B(CreateUnmappedArguments), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 29 S> */ B(Nop), + /* 47 S> */ B(Return), ] constant pool: [ ] @@ -76,22 +74,20 @@ snippet: " function f(a) { return arguments[0]; } f(); " -frame size: 3 +frame size: 2 parameter count: 2 -bytecode array length: 25 +bytecode array length: 18 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(2), - B(LdaZero), - B(KeyedLoadIC), R(2), U8(1), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(Ldar), R(arg0), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(LdaZero), + /* 32 E> */ B(LdaKeyedProperty), R(0), U8(1), + /* 37 S> */ B(Return), ] constant pool: [ ] @@ -105,21 +101,21 @@ snippet: " " frame size: 2 parameter count: 4 -bytecode array length: 29 +bytecode array length: 25 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(6), - B(Ldar), R(arg1), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(arg2), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Return), + B(CreateFunctionContext), U8(3), + B(PushContext), R(1), + B(Ldar), R(arg0), + B(StaContextSlot), R(context), U8(6), + B(Ldar), R(arg1), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(arg2), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 22 S> */ B(Nop), + /* 40 S> */ B(Return), ] constant pool: [ ] @@ -133,13 +129,13 @@ snippet: " " frame size: 1 parameter count: 4 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - B(CreateUnmappedArguments), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Return), + B(CreateUnmappedArguments), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 36 S> */ B(Nop), + /* 54 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden index e43a8cd76c..afa349ac3e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden @@ -15,13 +15,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - B(CreateRestParameter), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Return), + B(CreateRestParameter), + B(Star), R(0), + /* 10 E> */ B(StackCheck), + /* 26 S> */ B(Nop), + /* 43 S> */ B(Return), ] constant pool: [ ] @@ -35,17 +35,16 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - B(CreateRestParameter), - B(Star), R(0), - B(LdaTheHole), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(0), - B(Return), + B(CreateRestParameter), + B(Star), R(0), + B(LdaTheHole), + B(Star), R(1), + /* 10 E> */ B(StackCheck), + B(Mov), R(arg0), R(1), + /* 29 S> */ B(Ldar), R(0), + /* 46 S> */ B(Return), ] constant pool: [ ] @@ -57,22 +56,19 @@ snippet: " function f(a, ...restArgs) { return restArgs[0]; } f(); " -frame size: 3 +frame size: 2 parameter count: 2 -bytecode array length: 20 +bytecode array length: 15 bytecodes: [ - B(CreateRestParameter), - B(Star), R(0), - B(LdaTheHole), - B(Star), R(1), - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaZero), - B(KeyedLoadIC), R(2), U8(1), - B(Return), + B(CreateRestParameter), + B(Star), R(0), + B(LdaTheHole), + B(Star), R(1), + /* 10 E> */ B(StackCheck), + B(Mov), R(arg0), R(1), + /* 29 S> */ B(LdaZero), + /* 44 E> */ B(LdaKeyedProperty), R(0), U8(1), + /* 49 S> */ B(Return), ] constant pool: [ ] @@ -86,28 +82,22 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 35 +bytecode array length: 26 bytecodes: [ - B(CreateUnmappedArguments), - B(Star), R(0), - B(CreateRestParameter), - B(Star), R(1), - B(LdaTheHole), - B(Star), R(2), - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(2), - B(Ldar), R(1), - B(Star), R(3), - B(LdaZero), - B(KeyedLoadIC), R(3), U8(1), - B(Star), R(4), - B(Ldar), R(0), - B(Star), R(3), - B(LdaZero), - B(KeyedLoadIC), R(3), U8(3), - B(Add), R(4), - B(Return), + B(CreateUnmappedArguments), + B(Star), R(0), + B(CreateRestParameter), + B(Star), R(1), + B(LdaTheHole), + B(Star), R(2), + /* 10 E> */ B(StackCheck), + B(Mov), R(arg0), R(2), + /* 29 S> */ B(LdaZero), + /* 44 E> */ B(LdrKeyedProperty), R(1), U8(1), R(4), + B(LdaZero), + /* 59 E> */ B(LdaKeyedProperty), R(0), U8(3), + B(Add), R(4), U8(5), + /* 64 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden index 0c7c176c07..2530404379 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden @@ -15,9 +15,9 @@ frame size: 1 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaUndefined), + /* 58 S> */ B(Return), ] constant pool: [ ] @@ -32,11 +32,11 @@ frame size: 1 parameter count: 1 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 66 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + B(LdaUndefined), + /* 69 S> */ B(Return), ] constant pool: [ ] @@ -51,9 +51,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 46 S> */ B(LdaSmi), U8(1), + /* 78 S> */ B(Return), ] constant pool: [ ] @@ -68,14 +68,14 @@ frame size: 1 parameter count: 1 bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(LdaSmi), U8(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(5), + /* 54 S> */ B(LdaSmi), U8(1), + /* 77 S> */ B(Return), + /* 67 S> */ B(LdaSmi), U8(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 bedbe31a95..9d16d06aff 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -14,23 +14,24 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 31 +bytecode array length: 34 bytecodes: [ - B(LdaConstant), U8(0), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), - B(StackCheck), - B(LdaConstant), U8(1), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), - B(LdaUndefined), - B(Return), + B(LdaConstant), U8(0), + B(Star), R(1), + B(LdaZero), + B(Star), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), + /* 0 E> */ B(StackCheck), + /* 8 S> */ B(LdaConstant), U8(1), + B(Star), R(1), + B(LdaZero), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), + B(LdaUndefined), + /* 10 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -43,18 +44,19 @@ handlers: [ snippet: " function f() {} " -frame size: 2 +frame size: 3 parameter count: 1 -bytecode array length: 15 +bytecode array length: 18 bytecodes: [ - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(0), U8(2), - B(StackCheck), - B(LdaUndefined), - B(Return), + B(LdaConstant), U8(0), + B(Star), R(0), + B(LdaZero), + B(Star), R(1), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(0), U8(3), + /* 0 E> */ B(StackCheck), + B(LdaUndefined), + /* 15 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -69,25 +71,26 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 37 +bytecode array length: 40 bytecodes: [ - B(LdaConstant), U8(0), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), - B(StackCheck), - B(LdaConstant), U8(1), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), - B(LdaSmi), U8(2), - B(StaGlobalSloppy), U8(1), U8(3), - B(Star), R(0), - B(Return), + B(LdaConstant), U8(0), + B(Star), R(1), + B(LdaZero), + B(Star), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), + /* 0 E> */ B(StackCheck), + /* 8 S> */ B(LdaConstant), U8(1), + B(Star), R(1), + B(LdaZero), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), + /* 11 S> */ B(LdaSmi), U8(2), + /* 12 E> */ B(StaGlobalSloppy), U8(1), U8(3), + B(Star), R(0), + /* 15 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -101,27 +104,25 @@ snippet: " function f() {} f(); " -frame size: 3 +frame size: 4 parameter count: 1 bytecode array length: 29 bytecodes: [ - B(LdaConstant), U8(0), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), - B(StackCheck), - B(LdaUndefined), - B(Star), R(2), - B(LdaGlobal), U8(1), U8(1), - B(Star), R(1), - B(Call), R(1), R(2), U8(1), U8(3), - B(Star), R(0), - B(Return), + B(LdaConstant), U8(0), + B(Star), R(1), + B(LdaZero), + B(Star), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), + /* 0 E> */ B(StackCheck), + /* 16 S> */ B(LdrUndefined), R(2), + B(LdrGlobal), U8(1), R(1), + /* 16 E> */ B(Call), R(1), R(2), U8(1), U8(3), + B(Star), R(0), + /* 20 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden index 369c158efe..aeebe7a3c2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden @@ -13,16 +13,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LdaConstant), U8(1), - B(DeletePropertySloppy), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 56 S> */ B(LdaConstant), U8(1), + B(DeletePropertySloppy), R(0), + /* 75 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -37,16 +35,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LdaConstant), U8(1), - B(DeletePropertyStrict), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 70 S> */ B(LdaConstant), U8(1), + B(DeletePropertyStrict), R(0), + /* 89 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -61,16 +57,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(DeletePropertySloppy), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 56 S> */ B(LdaSmi), U8(2), + B(DeletePropertySloppy), R(0), + /* 76 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -86,11 +80,11 @@ frame size: 1 parameter count: 1 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaFalse), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 46 S> */ B(LdaFalse), + /* 63 S> */ B(Return), ] constant pool: [ ] @@ -106,20 +100,19 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 30 +bytecode array length: 27 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(1), U8(0), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(1), - B(LdaSmi), U8(1), - B(DeletePropertyStrict), R(1), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(0), + /* 30 E> */ B(StackCheck), + /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Ldar), R(1), + /* 56 E> */ B(StaContextSlot), R(context), U8(4), + /* 64 S> */ B(CreateClosure), U8(1), U8(2), + /* 93 S> */ B(LdrContextSlot), R(context), U8(4), R(1), + B(LdaSmi), U8(1), + B(DeletePropertyStrict), R(1), + /* 113 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -136,9 +129,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaTrue), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaTrue), + /* 56 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden index b36f421caa..dcc72134b2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden @@ -23,12 +23,12 @@ frame size: 1 parameter count: 1 bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), + B(LdaUndefined), + /* 25 S> */ B(Return), ] constant pool: [ "x", @@ -51,9 +51,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaFalse), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaFalse), + /* 32 S> */ B(Return), ] constant pool: [ ] @@ -75,11 +75,11 @@ frame size: 1 parameter count: 1 bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), + /* 32 S> */ B(Return), ] constant pool: [ "z", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden index ca260651c0..ac0b2ee8d4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden @@ -15,10 +15,10 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(Debugger), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(Debugger), + B(LdaUndefined), + /* 44 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden index b46fa571de..e04e131928 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden @@ -14,12 +14,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 6 +bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(Mov), R(0), R(1), + /* 50 S> */ B(Ldar), R(1), + /* 60 S> */ B(Return), ] constant pool: [ ] @@ -32,15 +32,16 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 11 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(100), - B(Star), R(1), - B(LdaUndefined), - B(Star), R(0), - B(Star), R(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 55 S> */ B(LdaSmi), U8(100), + B(Star), R(1), + /* 42 S> */ B(LdrUndefined), R(0), + B(Ldar), R(0), + B(Star), R(2), + /* 63 S> */ B(Nop), + /* 73 S> */ B(Return), ] constant pool: [ ] @@ -53,24 +54,18 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 26 +bytecode array length: 16 bytecodes: [ - B(StackCheck), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(1), - B(ToNumber), - B(Inc), - B(Star), R(1), - B(Star), R(0), - B(Jump), U8(12), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(20), - B(Star), R(1), - B(Jump), U8(-21), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 E> */ B(StackCheck), + /* 56 S> */ B(LdaSmi), U8(10), + B(Star), R(1), + /* 69 S> */ B(Inc), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 74 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 94 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden index e3e48bcf5a..f8ee37a398 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden @@ -11,35 +11,37 @@ wrap: yes snippet: " return eval('1;'); " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 65 +bytecode array length: 66 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(1), R(4), - B(Mov), R(3), R(5), - B(Mov), R(closure), R(6), - B(LdaZero), - B(Star), R(7), - B(LdaSmi), U8(30), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5), - B(Star), R(1), - B(Call), R(1), R(2), U8(2), U8(0), - B(Return), + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(6), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaConstant), U8(0), + B(Star), R(3), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(LdaConstant), U8(1), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(30), + B(Star), R(8), + B(LdaSmi), U8(41), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 41 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 53 S> */ B(Return), ] constant pool: [ "eval", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden index 9f0c64a952..b6a8df8636 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden @@ -15,9 +15,9 @@ frame size: 2 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(LdaUndefined), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -32,9 +32,9 @@ frame size: 2 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(LdaUndefined), + /* 62 S> */ B(Return), ] constant pool: [ ] @@ -49,9 +49,9 @@ frame size: 2 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(LdaUndefined), + /* 62 S> */ B(Return), ] constant pool: [ ] @@ -65,32 +65,31 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 45 +bytecode array length: 44 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(1), - B(JumpIfUndefined), U8(38), - B(JumpIfNull), U8(36), - B(ToObject), - B(Star), R(3), - B(ForInPrepare), R(4), - B(LdaZero), - B(Star), R(7), - B(ForInDone), R(7), R(6), - B(JumpIfTrue), U8(23), - B(ForInNext), R(3), R(7), R(4), U8(1), - B(JumpIfUndefined), U8(10), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(2), - B(Return), - B(ForInStep), R(7), - B(Star), R(7), - B(Jump), U8(-24), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(1), + /* 68 S> */ B(JumpIfUndefined), U8(37), + B(JumpIfNull), U8(35), + B(ToObject), R(3), + B(ForInPrepare), R(3), R(4), + B(LdaZero), + B(Star), R(7), + /* 63 S> */ B(ForInDone), R(7), R(6), + B(JumpIfTrue), U8(22), + B(ForInNext), R(3), R(7), R(4), U8(1), + B(JumpIfUndefined), U8(9), + B(Star), R(0), + /* 54 E> */ B(StackCheck), + B(Star), R(2), + /* 73 S> */ B(Nop), + /* 85 S> */ B(Return), + B(ForInStep), R(7), + B(Star), R(7), + B(Jump), U8(-23), + B(LdaUndefined), + /* 85 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -105,37 +104,34 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 57 +bytecode array length: 55 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(1), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(JumpIfUndefined), U8(47), - B(JumpIfNull), U8(45), - B(ToObject), - B(Star), R(3), - B(ForInPrepare), R(4), - B(LdaZero), - B(Star), R(7), - B(ForInDone), R(7), R(6), - B(JumpIfTrue), U8(32), - B(ForInNext), R(3), R(7), R(4), U8(1), - B(JumpIfUndefined), U8(19), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(2), - B(Ldar), R(1), - B(Star), R(8), - B(Ldar), R(2), - B(Add), R(8), - B(Star), R(1), - B(ForInStep), R(7), - B(Star), R(7), - B(Jump), U8(-33), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(1), + /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(JumpIfUndefined), U8(45), + B(JumpIfNull), U8(43), + B(ToObject), R(3), + B(ForInPrepare), R(3), R(4), + B(LdaZero), + B(Star), R(7), + /* 54 S> */ B(ForInDone), R(7), R(6), + B(JumpIfTrue), U8(30), + B(ForInNext), R(3), R(7), R(4), U8(2), + B(JumpIfUndefined), U8(17), + B(Star), R(0), + /* 45 E> */ B(StackCheck), + B(Star), R(2), + /* 70 S> */ B(Ldar), R(0), + /* 75 E> */ B(Add), R(1), U8(1), + B(Mov), R(1), R(8), + B(Star), R(1), + /* 72 E> */ B(ForInStep), R(7), + B(Star), R(7), + B(Jump), U8(-31), + B(LdaUndefined), + /* 80 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -153,51 +149,42 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 94 +bytecode array length: 80 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Star), R(0), - B(CreateArrayLiteral), U8(1), U8(1), U8(3), - B(JumpIfUndefined), U8(79), - B(JumpIfNull), U8(77), - B(ToObject), - B(Star), R(1), - B(ForInPrepare), R(2), - B(LdaZero), - B(Star), R(5), - B(ForInDone), R(5), R(4), - B(JumpIfTrue), U8(64), - B(ForInNext), R(1), R(5), R(2), U8(9), - B(JumpIfUndefined), U8(51), - B(Star), R(6), - B(Ldar), R(0), - B(Star), R(7), - B(Ldar), R(6), - B(StoreICSloppy), R(7), U8(2), U8(7), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(6), - B(LoadIC), R(6), U8(2), U8(3), - B(Star), R(7), - B(LdaSmi), U8(10), - B(TestEqual), R(7), - B(JumpIfFalse), U8(4), - B(Jump), U8(20), - B(Ldar), R(0), - B(Star), R(6), - B(LoadIC), R(6), U8(2), U8(5), - B(Star), R(7), - B(LdaSmi), U8(20), - B(TestEqual), R(7), - B(JumpIfFalse), U8(4), - B(Jump), U8(8), - B(ForInStep), R(5), - B(Star), R(5), - B(Jump), U8(-65), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Mov), R(1), R(0), + /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), + B(JumpIfUndefined), U8(65), + B(JumpIfNull), U8(63), + B(ToObject), R(1), + B(ForInPrepare), R(1), R(2), + B(LdaZero), + B(Star), R(5), + /* 68 S> */ B(ForInDone), R(5), R(4), + B(JumpIfTrue), U8(50), + B(ForInNext), R(1), R(5), R(2), U8(9), + B(JumpIfUndefined), U8(37), + B(Star), R(6), + /* 67 E> */ B(StaNamedPropertySloppy), R(0), U8(2), U8(7), + /* 62 E> */ B(StackCheck), + /* 95 S> */ B(Nop), + /* 100 E> */ B(LdrNamedProperty), R(0), U8(2), U8(3), R(7), + B(LdaSmi), U8(10), + /* 106 E> */ B(TestEqual), R(7), + B(JumpIfFalse), U8(4), + /* 113 S> */ B(Jump), U8(16), + /* 125 S> */ B(Nop), + /* 130 E> */ B(LdrNamedProperty), R(0), U8(2), U8(5), R(7), + B(LdaSmi), U8(20), + /* 136 E> */ B(TestEqual), R(7), + B(JumpIfFalse), U8(4), + /* 143 S> */ B(Jump), U8(8), + B(ForInStep), R(5), + B(Star), R(5), + B(Jump), U8(-51), + B(LdaUndefined), + /* 152 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -214,41 +201,36 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 69 +bytecode array length: 61 bytecodes: [ - B(StackCheck), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Star), R(0), - B(CreateArrayLiteral), U8(1), U8(1), U8(3), - B(JumpIfUndefined), U8(56), - B(JumpIfNull), U8(54), - B(ToObject), - B(Star), R(1), - B(ForInPrepare), R(2), - B(LdaZero), - B(Star), R(5), - B(ForInDone), R(5), R(4), - B(JumpIfTrue), U8(41), - B(ForInNext), R(1), R(5), R(2), U8(7), - B(JumpIfUndefined), U8(28), - B(Star), R(6), - B(Ldar), R(0), - B(Star), R(7), - B(LdaZero), - B(Star), R(8), - B(Ldar), R(6), - B(KeyedStoreICSloppy), R(7), R(8), U8(5), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(6), - B(LdaSmi), U8(3), - B(KeyedLoadIC), R(6), U8(3), - B(Return), - B(ForInStep), R(5), - B(Star), R(5), - B(Jump), U8(-42), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(Star), R(0), + /* 72 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), + B(JumpIfUndefined), U8(48), + B(JumpIfNull), U8(46), + B(ToObject), R(1), + B(ForInPrepare), R(1), R(2), + B(LdaZero), + B(Star), R(5), + /* 65 S> */ B(ForInDone), R(5), R(4), + B(JumpIfTrue), U8(33), + B(ForInNext), R(1), R(5), R(2), U8(7), + B(JumpIfUndefined), U8(20), + B(Star), R(6), + B(LdaZero), + B(Star), R(8), + B(Ldar), R(6), + /* 64 E> */ B(StaKeyedPropertySloppy), R(0), R(8), U8(5), + /* 59 E> */ B(StackCheck), + /* 83 S> */ B(LdaSmi), U8(3), + /* 91 E> */ B(LdaKeyedProperty), R(0), U8(3), + /* 98 S> */ B(Return), + B(ForInStep), R(5), + B(Star), R(5), + B(Jump), U8(-34), + B(LdaUndefined), + /* 98 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index 9b10f41894..01121e5017 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -11,161 +11,119 @@ wrap: yes snippet: " for (var p of [0, 1, 2]) {} " -frame size: 16 +frame size: 15 parameter count: 1 -bytecode array length: 347 +bytecode array length: 268 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(4), - B(LdaZero), - B(Star), R(3), - B(Mov), R(context), R(11), - B(Mov), R(context), R(12), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Star), R(14), - B(LdaConstant), U8(1), - B(KeyedLoadIC), R(14), U8(3), - B(Star), R(13), - B(Call), R(13), R(14), U8(1), U8(1), - B(Star), R(1), - B(Ldar), R(1), - B(Star), R(15), - B(LoadIC), R(15), U8(2), U8(7), - B(Star), R(14), - B(Call), R(14), R(15), U8(1), U8(5), - B(Star), R(2), - B(Star), R(13), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(13), U8(1), - B(LogicalNot), - B(JumpIfFalse), U8(11), - B(Ldar), R(2), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), - B(Ldar), R(2), - B(Star), R(13), - B(LoadIC), R(13), U8(3), U8(9), - B(JumpIfToBooleanTrue), U8(28), - B(LdaSmi), U8(2), - B(Star), R(3), - B(Ldar), R(2), - B(Star), R(13), - B(LoadIC), R(13), U8(4), U8(11), - B(Star), R(0), - B(Ldar), R(4), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(7), - B(LdaZero), - B(Star), R(3), - B(Jump), U8(-70), - B(Jump), U8(47), - B(Star), R(14), - B(LdaConstant), U8(5), - B(Star), R(13), - B(Ldar), R(closure), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(13), U8(3), - B(Star), R(12), - B(PushContext), R(8), - B(Ldar), R(3), - B(Star), R(13), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(13), - B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), - B(Star), R(3), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), - B(PopContext), R(8), - B(LdaSmi), U8(-1), - B(Star), R(9), - B(Jump), U8(7), - B(Star), R(10), - B(LdaZero), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(11), - B(Ldar), R(3), - B(Star), R(12), - B(LdaZero), - B(TestEqualStrict), R(12), - B(JumpIfTrue), U8(9), - B(Ldar), R(1), - B(Star), R(12), - B(LdaUndefined), - B(TestEqualStrict), R(12), - B(LogicalNot), - B(JumpIfFalseConstant), U8(9), - B(Ldar), R(1), - B(Star), R(12), - B(LoadIC), R(12), U8(6), U8(13), - B(Star), R(5), - B(Star), R(12), - B(LdaNull), - B(TestEqual), R(12), - B(JumpIfFalse), U8(4), - B(Jump), U8(124), - B(Ldar), R(3), - B(Star), R(12), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(12), - B(JumpIfFalse), U8(79), - B(Ldar), R(5), - B(TypeOf), - B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), - B(JumpIfFalse), U8(4), - B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(139), - B(Star), R(12), - B(LdaConstant), U8(8), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), - B(Throw), - B(Mov), R(context), R(12), - B(Ldar), R(5), - B(Star), R(13), - B(Ldar), R(1), - B(Star), R(14), - B(CallRuntime), U16(Runtime::k_Call), R(13), U8(2), - B(Jump), U8(30), - B(Star), R(14), - B(LdaConstant), U8(5), - B(Star), R(13), - B(Ldar), R(closure), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(13), U8(3), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(12), - B(PushContext), R(8), - B(PopContext), R(8), - B(Jump), U8(37), - B(Ldar), R(5), - B(Star), R(12), - B(Ldar), R(1), - B(Star), R(13), - B(CallRuntime), U16(Runtime::k_Call), R(12), U8(2), - B(Star), R(6), - B(Star), R(12), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(12), U8(1), - B(JumpIfToBooleanFalse), U8(4), - B(Jump), U8(11), - B(Ldar), R(6), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), - B(LdaZero), - B(TestEqualStrict), R(9), - B(JumpIfTrue), U8(4), - B(Jump), U8(5), - B(Ldar), R(10), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(LdaZero), + B(Star), R(3), + B(Mov), R(context), R(11), + B(Mov), R(context), R(12), + /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(Star), R(14), + B(LdaConstant), U8(1), + /* 48 E> */ B(LdrKeyedProperty), R(14), U8(3), R(13), + /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(1), + B(Star), R(1), + /* 45 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(14), + /* 45 E> */ B(Call), R(14), R(1), U8(1), U8(5), + B(Star), R(2), + /* 45 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(3), U8(9), + B(JumpIfToBooleanTrue), U8(23), + B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdaSmi), U8(2), + B(Star), R(3), + B(Mov), R(4), R(0), + /* 34 E> */ B(StackCheck), + B(Mov), R(0), R(7), + B(LdaZero), + B(Star), R(3), + B(Jump), U8(-49), + B(Jump), U8(34), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(5), + B(Star), R(12), + B(PushContext), R(8), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(3), + B(JumpIfFalse), U8(6), + B(LdaSmi), U8(1), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(4), R(13), + B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), + B(PopContext), R(8), + B(LdaSmi), U8(-1), + B(Star), R(9), + B(Jump), U8(7), + B(Star), R(10), + B(LdaZero), + B(Star), R(9), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(11), + B(LdaZero), + B(TestEqualStrict), R(3), + B(JumpIfTrue), U8(116), + B(LdaUndefined), + B(TestEqualStrict), R(1), + B(JumpIfTrue), U8(111), + B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(LdaNull), + B(TestEqual), R(5), + B(JumpIfFalse), U8(4), + B(Jump), U8(99), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(3), + B(JumpIfFalse), U8(68), + B(Ldar), R(5), + B(TypeOf), + B(Star), R(12), + B(LdaConstant), U8(7), + B(TestEqualStrict), R(12), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), U16(129), + B(Star), R(12), + B(LdaConstant), U8(8), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), + B(Throw), + B(Mov), R(context), R(12), + B(Mov), R(5), R(13), + B(Mov), R(1), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(Jump), U8(22), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(5), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(12), + B(PushContext), R(8), + B(PopContext), R(8), + B(Jump), U8(27), + B(Mov), R(5), R(12), + B(Mov), R(1), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Star), R(6), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), + B(LdaZero), + B(TestEqualStrict), R(9), + B(JumpIfTrue), U8(4), + B(Jump), U8(5), + B(Ldar), R(10), + B(ReThrow), + B(LdaUndefined), + /* 62 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -177,12 +135,11 @@ constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - kInstanceTypeDontCare, ] handlers: [ - [10, 152, 158], - [13, 105, 107], - [250, 263, 265], + [7, 114, 120], + [10, 80, 82], + [192, 202, 204], ] --- @@ -190,170 +147,125 @@ snippet: " var x = 'potatoes'; for (var p of x) { return p; } " -frame size: 17 +frame size: 16 parameter count: 1 -bytecode array length: 363 +bytecode array length: 279 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(7), - B(LdaUndefined), - B(Star), R(4), - B(LdaZero), - B(Star), R(3), - B(Mov), R(context), R(12), - B(Mov), R(context), R(13), - B(Ldar), R(7), - B(Star), R(15), - B(LdaConstant), U8(1), - B(KeyedLoadIC), R(15), U8(3), - B(Star), R(14), - B(Call), R(14), R(15), U8(1), U8(1), - B(Star), R(1), - B(Ldar), R(1), - B(Star), R(16), - B(LoadIC), R(16), U8(2), U8(7), - B(Star), R(15), - B(Call), R(15), R(16), U8(1), U8(5), - B(Star), R(2), - B(Star), R(14), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(14), U8(1), - B(LogicalNot), - B(JumpIfFalse), U8(11), - B(Ldar), R(2), - B(Star), R(14), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(14), U8(1), - B(Ldar), R(2), - B(Star), R(14), - B(LoadIC), R(14), U8(3), U8(9), - B(JumpIfToBooleanTrue), U8(32), - B(LdaSmi), U8(2), - B(Star), R(3), - B(Ldar), R(2), - B(Star), R(14), - B(LoadIC), R(14), U8(4), U8(11), - B(Star), R(0), - B(Ldar), R(4), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(8), - B(Star), R(11), - B(LdaZero), - B(Star), R(10), - B(Jump), U8(63), - B(Jump), U8(-74), - B(Jump), U8(47), - B(Star), R(15), - B(LdaConstant), U8(5), - B(Star), R(14), - B(Ldar), R(closure), - B(Star), R(16), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(14), U8(3), - B(Star), R(13), - B(PushContext), R(9), - B(Ldar), R(3), - B(Star), R(14), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(14), - B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), - B(Star), R(3), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(14), - B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), - B(PopContext), R(9), - B(LdaSmi), U8(-1), - B(Star), R(10), - B(Jump), U8(8), - B(Star), R(11), - B(LdaSmi), U8(1), - B(Star), R(10), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(12), - B(Ldar), R(3), - B(Star), R(13), - B(LdaZero), - B(TestEqualStrict), R(13), - B(JumpIfTrue), U8(9), - B(Ldar), R(1), - B(Star), R(13), - B(LdaUndefined), - B(TestEqualStrict), R(13), - B(LogicalNot), - B(JumpIfFalseConstant), U8(9), - B(Ldar), R(1), - B(Star), R(13), - B(LoadIC), R(13), U8(6), U8(13), - B(Star), R(5), - B(Star), R(13), - B(LdaNull), - B(TestEqual), R(13), - B(JumpIfFalse), U8(4), - B(Jump), U8(124), - B(Ldar), R(3), - B(Star), R(13), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(13), - B(JumpIfFalse), U8(79), - B(Ldar), R(5), - B(TypeOf), - B(Star), R(13), - B(LdaConstant), U8(7), - B(TestEqualStrict), R(13), - B(JumpIfFalse), U8(4), - B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(139), - B(Star), R(13), - B(LdaConstant), U8(8), - B(Star), R(14), - B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), - B(Throw), - B(Mov), R(context), R(13), - B(Ldar), R(5), - B(Star), R(14), - B(Ldar), R(1), - B(Star), R(15), - B(CallRuntime), U16(Runtime::k_Call), R(14), U8(2), - B(Jump), U8(30), - B(Star), R(15), - B(LdaConstant), U8(5), - B(Star), R(14), - B(Ldar), R(closure), - B(Star), R(16), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(14), U8(3), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(13), - B(PushContext), R(9), - B(PopContext), R(9), - B(Jump), U8(37), - B(Ldar), R(5), - B(Star), R(13), - B(Ldar), R(1), - B(Star), R(14), - B(CallRuntime), U16(Runtime::k_Call), R(13), U8(2), - B(Star), R(6), - B(Star), R(13), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(13), U8(1), - B(JumpIfToBooleanFalse), U8(4), - B(Jump), U8(11), - B(Ldar), R(6), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(12), U8(1), - B(LdaZero), - B(TestEqualStrict), R(10), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(10), - B(JumpIfTrue), U8(7), - B(Jump), U8(8), - B(Ldar), R(11), - B(Return), - B(Ldar), R(11), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(7), + B(LdaZero), + B(Star), R(3), + B(Mov), R(context), R(12), + B(Mov), R(context), R(13), + /* 68 S> */ B(LdaConstant), U8(1), + /* 68 E> */ B(LdrKeyedProperty), R(7), U8(3), R(14), + /* 68 E> */ B(Call), R(14), R(7), U8(1), U8(1), + B(Star), R(1), + /* 65 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(15), + /* 65 E> */ B(Call), R(15), R(1), U8(1), U8(5), + B(Star), R(2), + /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), + B(LdaNamedProperty), R(2), U8(3), U8(9), + B(JumpIfToBooleanTrue), U8(26), + B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdaSmi), U8(2), + B(Star), R(3), + B(Mov), R(4), R(0), + /* 54 E> */ B(StackCheck), + B(Mov), R(0), R(8), + /* 73 S> */ B(LdaZero), + B(Star), R(10), + B(Mov), R(0), R(11), + B(Jump), U8(48), + B(Jump), U8(34), + B(Star), R(14), + B(Ldar), R(closure), + B(CreateCatchContext), R(14), U8(5), + B(Star), R(13), + B(PushContext), R(9), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(3), + B(JumpIfFalse), U8(6), + B(LdaSmi), U8(1), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(4), R(14), + B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), + B(PopContext), R(9), + B(LdaSmi), U8(-1), + B(Star), R(10), + B(Jump), U8(8), + B(Star), R(11), + B(LdaSmi), U8(1), + B(Star), R(10), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(12), + B(LdaZero), + B(TestEqualStrict), R(3), + B(JumpIfTrue), U8(116), + B(LdaUndefined), + B(TestEqualStrict), R(1), + B(JumpIfTrue), U8(111), + B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(LdaNull), + B(TestEqual), R(5), + B(JumpIfFalse), U8(4), + B(Jump), U8(99), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(3), + B(JumpIfFalse), U8(68), + B(Ldar), R(5), + B(TypeOf), + B(Star), R(13), + B(LdaConstant), U8(7), + B(TestEqualStrict), R(13), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), U16(129), + B(Star), R(13), + B(LdaConstant), U8(8), + B(Star), R(14), + B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), + B(Throw), + B(Mov), R(context), R(13), + B(Mov), R(5), R(14), + B(Mov), R(1), R(15), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), + B(Jump), U8(22), + B(Star), R(14), + B(Ldar), R(closure), + B(CreateCatchContext), R(14), U8(5), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(13), + B(PushContext), R(9), + B(PopContext), R(9), + B(Jump), U8(27), + B(Mov), R(5), R(13), + B(Mov), R(1), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(Star), R(6), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(12), U8(1), + B(LdaZero), + B(TestEqualStrict), R(10), + B(JumpIfTrue), U8(10), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(10), + B(JumpIfTrue), U8(7), + B(Jump), U8(8), + B(Ldar), R(11), + /* 85 S> */ B(Return), + B(Ldar), R(11), + B(ReThrow), + B(LdaUndefined), + /* 85 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -365,12 +277,11 @@ constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - kInstanceTypeDontCare, ] handlers: [ - [14, 158, 164], - [17, 111, 113], - [257, 270, 272], + [11, 115, 121], + [14, 81, 83], + [194, 204, 206], ] --- @@ -380,172 +291,127 @@ snippet: " if (x == 20) break; } " -frame size: 16 +frame size: 15 parameter count: 1 -bytecode array length: 369 +bytecode array length: 284 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(4), - B(LdaZero), - B(Star), R(3), - B(Mov), R(context), R(11), - B(Mov), R(context), R(12), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(Star), R(14), - B(LdaConstant), U8(1), - B(KeyedLoadIC), R(14), U8(3), - B(Star), R(13), - B(Call), R(13), R(14), U8(1), U8(1), - B(Star), R(1), - B(Ldar), R(1), - B(Star), R(15), - B(LoadIC), R(15), U8(2), U8(7), - B(Star), R(14), - B(Call), R(14), R(15), U8(1), U8(5), - B(Star), R(2), - B(Star), R(13), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(13), U8(1), - B(LogicalNot), - B(JumpIfFalse), U8(11), - B(Ldar), R(2), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), - B(Ldar), R(2), - B(Star), R(13), - B(LoadIC), R(13), U8(3), U8(9), - B(JumpIfToBooleanTrue), U8(50), - B(LdaSmi), U8(2), - B(Star), R(3), - B(Ldar), R(2), - B(Star), R(13), - B(LoadIC), R(13), U8(4), U8(11), - B(Star), R(0), - B(Ldar), R(4), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(7), - B(Star), R(13), - B(LdaSmi), U8(10), - B(TestEqual), R(13), - B(JumpIfFalse), U8(4), - B(Jump), U8(-75), - B(Ldar), R(7), - B(Star), R(13), - B(LdaSmi), U8(20), - B(TestEqual), R(13), - B(JumpIfFalse), U8(4), - B(Jump), U8(7), - B(LdaZero), - B(Star), R(3), - B(Jump), U8(-92), - B(Jump), U8(47), - B(Star), R(14), - B(LdaConstant), U8(5), - B(Star), R(13), - B(Ldar), R(closure), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(13), U8(3), - B(Star), R(12), - B(PushContext), R(8), - B(Ldar), R(3), - B(Star), R(13), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(13), - B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), - B(Star), R(3), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), - B(PopContext), R(8), - B(LdaSmi), U8(-1), - B(Star), R(9), - B(Jump), U8(7), - B(Star), R(10), - B(LdaZero), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(11), - B(Ldar), R(3), - B(Star), R(12), - B(LdaZero), - B(TestEqualStrict), R(12), - B(JumpIfTrue), U8(9), - B(Ldar), R(1), - B(Star), R(12), - B(LdaUndefined), - B(TestEqualStrict), R(12), - B(LogicalNot), - B(JumpIfFalseConstant), U8(9), - B(Ldar), R(1), - B(Star), R(12), - B(LoadIC), R(12), U8(6), U8(13), - B(Star), R(5), - B(Star), R(12), - B(LdaNull), - B(TestEqual), R(12), - B(JumpIfFalse), U8(4), - B(Jump), U8(124), - B(Ldar), R(3), - B(Star), R(12), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(12), - B(JumpIfFalse), U8(79), - B(Ldar), R(5), - B(TypeOf), - B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), - B(JumpIfFalse), U8(4), - B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(139), - B(Star), R(12), - B(LdaConstant), U8(8), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), - B(Throw), - B(Mov), R(context), R(12), - B(Ldar), R(5), - B(Star), R(13), - B(Ldar), R(1), - B(Star), R(14), - B(CallRuntime), U16(Runtime::k_Call), R(13), U8(2), - B(Jump), U8(30), - B(Star), R(14), - B(LdaConstant), U8(5), - B(Star), R(13), - B(Ldar), R(closure), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(13), U8(3), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(12), - B(PushContext), R(8), - B(PopContext), R(8), - B(Jump), U8(37), - B(Ldar), R(5), - B(Star), R(12), - B(Ldar), R(1), - B(Star), R(13), - B(CallRuntime), U16(Runtime::k_Call), R(12), U8(2), - B(Star), R(6), - B(Star), R(12), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(12), U8(1), - B(JumpIfToBooleanFalse), U8(4), - B(Jump), U8(11), - B(Ldar), R(6), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), - B(LdaZero), - B(TestEqualStrict), R(9), - B(JumpIfTrue), U8(4), - B(Jump), U8(5), - B(Ldar), R(10), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(LdaZero), + B(Star), R(3), + B(Mov), R(context), R(11), + B(Mov), R(context), R(12), + /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(Star), R(14), + B(LdaConstant), U8(1), + /* 48 E> */ B(LdrKeyedProperty), R(14), U8(3), R(13), + /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(1), + B(Star), R(1), + /* 45 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(14), + /* 45 E> */ B(Call), R(14), R(1), U8(1), U8(5), + B(Star), R(2), + /* 45 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(3), U8(9), + B(JumpIfToBooleanTrue), U8(39), + B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdaSmi), U8(2), + B(Star), R(3), + B(Mov), R(4), R(0), + /* 34 E> */ B(StackCheck), + B(Mov), R(0), R(7), + /* 66 S> */ B(LdaSmi), U8(10), + /* 72 E> */ B(TestEqual), R(7), + B(JumpIfFalse), U8(4), + /* 79 S> */ B(Jump), U8(13), + /* 91 S> */ B(LdaSmi), U8(20), + /* 97 E> */ B(TestEqual), R(7), + B(JumpIfFalse), U8(4), + /* 104 S> */ B(Jump), U8(7), + B(LdaZero), + B(Star), R(3), + B(Jump), U8(-65), + B(Jump), U8(34), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(5), + B(Star), R(12), + B(PushContext), R(8), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(3), + B(JumpIfFalse), U8(6), + B(LdaSmi), U8(1), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(4), R(13), + B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), + B(PopContext), R(8), + B(LdaSmi), U8(-1), + B(Star), R(9), + B(Jump), U8(7), + B(Star), R(10), + B(LdaZero), + B(Star), R(9), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(11), + B(LdaZero), + B(TestEqualStrict), R(3), + B(JumpIfTrue), U8(116), + B(LdaUndefined), + B(TestEqualStrict), R(1), + B(JumpIfTrue), U8(111), + B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(LdaNull), + B(TestEqual), R(5), + B(JumpIfFalse), U8(4), + B(Jump), U8(99), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(3), + B(JumpIfFalse), U8(68), + B(Ldar), R(5), + B(TypeOf), + B(Star), R(12), + B(LdaConstant), U8(7), + B(TestEqualStrict), R(12), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), U16(129), + B(Star), R(12), + B(LdaConstant), U8(8), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), + B(Throw), + B(Mov), R(context), R(12), + B(Mov), R(5), R(13), + B(Mov), R(1), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(Jump), U8(22), + B(Star), R(13), + B(Ldar), R(closure), + B(CreateCatchContext), R(13), U8(5), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(12), + B(PushContext), R(8), + B(PopContext), R(8), + B(Jump), U8(27), + B(Mov), R(5), R(12), + B(Mov), R(1), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Star), R(6), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), + B(LdaZero), + B(TestEqualStrict), R(9), + B(JumpIfTrue), U8(4), + B(Jump), U8(5), + B(Ldar), R(10), + B(ReThrow), + B(LdaUndefined), + /* 113 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -557,12 +423,11 @@ constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - kInstanceTypeDontCare, ] handlers: [ - [10, 174, 180], - [13, 127, 129], - [272, 285, 287], + [7, 130, 136], + [10, 96, 98], + [208, 218, 220], ] --- @@ -570,174 +435,128 @@ snippet: " var x = { 'a': 1, 'b': 2 }; for (x['a'] of [1,2,3]) { return x['a']; } " -frame size: 15 +frame size: 14 parameter count: 1 -bytecode array length: 379 +bytecode array length: 292 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(8), - B(Star), R(6), - B(LdaUndefined), - B(Star), R(3), - B(LdaZero), - B(Star), R(2), - B(Mov), R(context), R(10), - B(Mov), R(context), R(11), - B(CreateArrayLiteral), U8(1), U8(1), U8(3), - B(Star), R(13), - B(LdaConstant), U8(2), - B(KeyedLoadIC), R(13), U8(3), - B(Star), R(12), - B(Call), R(12), R(13), U8(1), U8(1), - B(Star), R(0), - B(Ldar), R(0), - B(Star), R(14), - B(LoadIC), R(14), U8(3), U8(7), - B(Star), R(13), - B(Call), R(13), R(14), U8(1), U8(5), - B(Star), R(1), - B(Star), R(12), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(12), U8(1), - B(LogicalNot), - B(JumpIfFalse), U8(11), - B(Ldar), R(1), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), - B(Ldar), R(1), - B(Star), R(12), - B(LoadIC), R(12), U8(4), U8(9), - B(JumpIfToBooleanTrue), U8(42), - B(LdaSmi), U8(2), - B(Star), R(2), - B(Ldar), R(6), - B(Star), R(12), - B(Ldar), R(1), - B(Star), R(13), - B(LoadIC), R(13), U8(5), U8(11), - B(StoreICSloppy), R(12), U8(6), U8(13), - B(Ldar), R(3), - B(StackCheck), - B(Ldar), R(6), - B(Star), R(12), - B(LoadIC), R(12), U8(6), U8(15), - B(Star), R(9), - B(LdaZero), - B(Star), R(8), - B(Jump), U8(63), - B(Jump), U8(-84), - B(Jump), U8(47), - B(Star), R(13), - B(LdaConstant), U8(7), - B(Star), R(12), - B(Ldar), R(closure), - B(Star), R(14), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(12), U8(3), - B(Star), R(11), - B(PushContext), R(7), - B(Ldar), R(2), - B(Star), R(12), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(12), - B(JumpIfFalse), U8(6), - B(LdaSmi), U8(1), - B(Star), R(2), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), - B(PopContext), R(7), - B(LdaSmi), U8(-1), - B(Star), R(8), - B(Jump), U8(8), - B(Star), R(9), - B(LdaSmi), U8(1), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(10), - B(Ldar), R(2), - B(Star), R(11), - B(LdaZero), - B(TestEqualStrict), R(11), - B(JumpIfTrue), U8(9), - B(Ldar), R(0), - B(Star), R(11), - B(LdaUndefined), - B(TestEqualStrict), R(11), - B(LogicalNot), - B(JumpIfFalseConstant), U8(11), - B(Ldar), R(0), - B(Star), R(11), - B(LoadIC), R(11), U8(8), U8(17), - B(Star), R(4), - B(Star), R(11), - B(LdaNull), - B(TestEqual), R(11), - B(JumpIfFalse), U8(4), - B(Jump), U8(124), - B(Ldar), R(2), - B(Star), R(11), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(11), - B(JumpIfFalse), U8(79), - B(Ldar), R(4), - B(TypeOf), - B(Star), R(11), - B(LdaConstant), U8(9), - B(TestEqualStrict), R(11), - B(JumpIfFalse), U8(4), - B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(139), - B(Star), R(11), - B(LdaConstant), U8(10), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), - B(Throw), - B(Mov), R(context), R(11), - B(Ldar), R(4), - B(Star), R(12), - B(Ldar), R(0), - B(Star), R(13), - B(CallRuntime), U16(Runtime::k_Call), R(12), U8(2), - B(Jump), U8(30), - B(Star), R(13), - B(LdaConstant), U8(7), - B(Star), R(12), - B(Ldar), R(closure), - B(Star), R(14), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(12), U8(3), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(11), - B(PushContext), R(7), - B(PopContext), R(7), - B(Jump), U8(37), - B(Ldar), R(4), - B(Star), R(11), - B(Ldar), R(0), - B(Star), R(12), - B(CallRuntime), U16(Runtime::k_Call), R(11), U8(2), - B(Star), R(5), - B(Star), R(11), - B(InvokeIntrinsic), U16(Runtime::k_IsJSReceiver), R(11), U8(1), - B(JumpIfToBooleanFalse), U8(4), - B(Jump), U8(11), - B(Ldar), R(5), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(10), U8(1), - B(LdaZero), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(7), - B(Jump), U8(8), - B(Ldar), R(9), - B(Return), - B(Ldar), R(9), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8), + B(Mov), R(8), R(6), + B(LdaZero), + B(Star), R(2), + B(Mov), R(context), R(10), + B(Mov), R(context), R(11), + /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), + B(Star), R(13), + B(LdaConstant), U8(2), + /* 77 E> */ B(LdrKeyedProperty), R(13), U8(3), R(12), + /* 77 E> */ B(Call), R(12), R(13), U8(1), U8(1), + B(Star), R(0), + /* 74 S> */ B(LdrNamedProperty), R(0), U8(3), U8(7), R(13), + /* 74 E> */ B(Call), R(13), R(0), U8(1), U8(5), + B(Star), R(1), + /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(1), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1), + B(LdaNamedProperty), R(1), U8(4), U8(9), + B(JumpIfToBooleanTrue), U8(29), + /* 67 E> */ B(LdrNamedProperty), R(1), U8(5), U8(11), R(3), + B(LdaSmi), U8(2), + B(Star), R(2), + B(Ldar), R(3), + B(StaNamedPropertySloppy), R(6), U8(6), U8(13), + /* 62 E> */ B(StackCheck), + /* 88 S> */ B(Nop), + /* 96 E> */ B(LdrNamedProperty), R(6), U8(6), U8(15), R(9), + B(LdaZero), + B(Star), R(8), + B(Jump), U8(48), + B(Jump), U8(34), + B(Star), R(12), + B(Ldar), R(closure), + B(CreateCatchContext), R(12), U8(7), + B(Star), R(11), + B(PushContext), R(7), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfFalse), U8(6), + B(LdaSmi), U8(1), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(4), R(12), + B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), + B(PopContext), R(7), + B(LdaSmi), U8(-1), + B(Star), R(8), + B(Jump), U8(8), + B(Star), R(9), + B(LdaSmi), U8(1), + B(Star), R(8), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(10), + B(LdaZero), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(116), + B(LdaUndefined), + B(TestEqualStrict), R(0), + B(JumpIfTrue), U8(111), + B(LdrNamedProperty), R(0), U8(8), U8(17), R(4), + B(LdaNull), + B(TestEqual), R(4), + B(JumpIfFalse), U8(4), + B(Jump), U8(99), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(2), + B(JumpIfFalse), U8(68), + B(Ldar), R(4), + B(TypeOf), + B(Star), R(11), + B(LdaConstant), U8(9), + B(TestEqualStrict), R(11), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), U16(129), + B(Star), R(11), + B(LdaConstant), U8(10), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(Throw), + B(Mov), R(context), R(11), + B(Mov), R(4), R(12), + B(Mov), R(0), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Jump), U8(22), + B(Star), R(12), + B(Ldar), R(closure), + B(CreateCatchContext), R(12), U8(7), + B(Star), R(11), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(11), + B(PushContext), R(7), + B(PopContext), R(7), + B(Jump), U8(27), + B(Mov), R(4), R(11), + B(Mov), R(0), R(12), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), + B(Star), R(5), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(10), U8(1), + B(LdaZero), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(10), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(7), + B(Jump), U8(8), + B(Ldar), R(9), + /* 105 S> */ B(Return), + B(Ldar), R(9), + B(ReThrow), + B(LdaUndefined), + /* 105 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -751,11 +570,10 @@ constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - kInstanceTypeDontCare, ] handlers: [ - [18, 174, 180], - [21, 127, 129], - [273, 286, 288], + [15, 128, 134], + [18, 94, 96], + [207, 217, 219], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden index fe7176ce15..fd04c713a4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 5 bytecodes: [ - B(StackCheck), - B(CreateClosure), U8(0), U8(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateClosure), U8(0), U8(2), + /* 55 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -31,15 +31,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(1), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(Call), R(0), R(1), U8(1), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdrUndefined), R(1), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 56 E> */ B(Call), R(0), R(1), U8(1), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -53,17 +52,16 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 19 +bytecode array length: 18 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Star), R(1), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Star), R(2), - B(Call), R(0), R(1), U8(2), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdrUndefined), R(1), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + B(LdaSmi), U8(1), + B(Star), R(2), + /* 67 E> */ B(Call), R(0), R(1), U8(2), U8(1), + /* 71 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden new file mode 100644 index 0000000000..57dbfd153d --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -0,0 +1,604 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +pool type: mixed +execute: yes +wrap: no +test function name: f + +--- +snippet: " + function* f() { } + f(); +" +frame size: 11 +parameter count: 1 +bytecode array length: 201 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(20), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), + B(JumpIfTrue), U8(57), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CreateFunctionContext), U8(2), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + /* 11 E> */ B(StackCheck), + B(Mov), R(context), R(4), + /* 11 E> */ B(LdrContextSlot), R(context), U8(4), R(6), + B(Ldar), R(6), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaContextSlot), R(context), U8(5), + B(Star), R(5), + B(LdrContextSlot), R(context), U8(5), R(6), + B(LdaZero), + B(SuspendGenerator), R(6), + B(Ldar), R(5), + /* 16 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(6), U8(1), + B(Star), R(7), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), + B(Star), R(8), + B(LdaZero), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(31), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(22), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(10), + B(Mov), R(7), R(9), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(9), U8(2), + B(Star), R(3), + B(LdaZero), + B(Star), R(2), + B(Jump), U8(35), + B(Ldar), R(7), + /* 11 E> */ B(Throw), + B(LdrUndefined), R(5), + B(LdaTrue), + B(Star), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), + B(Star), R(3), + B(LdaSmi), U8(1), + B(Star), R(2), + B(Jump), U8(14), + B(LdaSmi), U8(-1), + B(Star), R(2), + B(Jump), U8(8), + B(Star), R(3), + B(LdaSmi), U8(2), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(4), + B(LdrContextSlot), R(context), U8(5), R(5), + B(CallRuntime), U16(Runtime::k_GeneratorClose), R(5), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), + B(LdaZero), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(16), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(13), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(10), + B(Jump), U8(11), + B(Ldar), R(3), + /* 16 S> */ B(Return), + B(Ldar), R(3), + /* 16 S> */ B(Return), + B(Ldar), R(3), + B(ReThrow), + B(LdaUndefined), + /* 16 S> */ B(Return), +] +constant pool: [ +] +handlers: [ + [39, 138, 144], +] + +--- +snippet: " + function* f() { yield 42 } + f(); +" +frame size: 11 +parameter count: 1 +bytecode array length: 294 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(26), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(1), + B(JumpIfTrueConstant), U8(0), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CreateFunctionContext), U8(2), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + /* 11 E> */ B(StackCheck), + B(Mov), R(context), R(4), + /* 11 E> */ B(LdrContextSlot), R(context), U8(4), R(6), + B(Ldar), R(6), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaContextSlot), R(context), U8(5), + B(Star), R(5), + B(LdrContextSlot), R(context), U8(5), R(6), + B(LdaZero), + B(SuspendGenerator), R(6), + B(Ldar), R(5), + /* 25 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(6), U8(1), + B(Star), R(7), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), + B(Star), R(8), + B(LdaZero), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(31), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(22), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(10), + B(Mov), R(7), R(9), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(9), U8(2), + B(Star), R(3), + B(LdaZero), + B(Star), R(2), + B(Jump), U8(113), + B(Ldar), R(7), + /* 11 E> */ B(Throw), + /* 16 S> */ B(LdaSmi), U8(42), + B(Star), R(5), + B(LdaFalse), + B(Star), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), + B(Star), R(7), + B(LdrContextSlot), R(context), U8(5), R(5), + B(LdaSmi), U8(1), + B(SuspendGenerator), R(5), + B(Ldar), R(7), + /* 25 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(5), U8(1), + B(Star), R(6), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(5), U8(1), + B(Star), R(8), + B(LdaZero), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(32), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(23), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(10), + B(Mov), R(6), R(9), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(9), U8(2), + B(Star), R(3), + B(LdaSmi), U8(1), + B(Star), R(2), + B(Jump), U8(35), + B(Ldar), R(6), + /* 16 E> */ B(Throw), + B(LdrUndefined), R(5), + B(LdaTrue), + B(Star), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), + B(Star), R(3), + B(LdaSmi), U8(2), + B(Star), R(2), + B(Jump), U8(14), + B(LdaSmi), U8(-1), + B(Star), R(2), + B(Jump), U8(8), + B(Star), R(3), + B(LdaSmi), U8(3), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(4), + B(LdrContextSlot), R(context), U8(5), R(5), + B(CallRuntime), U16(Runtime::k_GeneratorClose), R(5), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), + B(LdaZero), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(22), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(19), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(16), + B(LdaSmi), U8(3), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(13), + B(Jump), U8(14), + B(Ldar), R(3), + /* 25 S> */ B(Return), + B(Ldar), R(3), + /* 25 S> */ B(Return), + B(Ldar), R(3), + /* 25 S> */ B(Return), + B(Ldar), R(3), + B(ReThrow), + B(LdaUndefined), + /* 25 S> */ B(Return), +] +constant pool: [ + kInstanceTypeDontCare, +] +handlers: [ + [45, 222, 228], +] + +--- +snippet: " + function* f() { for (let x of [42]) yield x } + f(); +" +frame size: 18 +parameter count: 1 +bytecode array length: 742 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(26), + B(ResumeGenerator), R(new_target), + B(Star), R(4), + B(LdaZero), + B(TestEqualStrict), R(4), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(4), + B(JumpIfTrueConstant), U8(3), + B(LdaSmi), U8(76), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(4), + B(CreateFunctionContext), U8(9), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + /* 11 E> */ B(StackCheck), + B(Mov), R(context), R(7), + /* 11 E> */ B(LdrContextSlot), R(context), U8(4), R(9), + B(Ldar), R(9), + B(Mov), R(closure), R(8), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(8), U8(2), + B(StaContextSlot), R(context), U8(5), + B(Star), R(8), + B(LdrContextSlot), R(context), U8(5), R(9), + B(LdaZero), + B(SuspendGenerator), R(9), + B(Ldar), R(8), + /* 44 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1), + B(Star), R(10), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1), + B(Star), R(11), + B(LdaZero), + B(TestEqualStrict), R(11), + B(JumpIfTrue), U8(31), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(11), + B(JumpIfTrue), U8(22), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(13), + B(Mov), R(10), R(12), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(12), U8(2), + B(Star), R(6), + B(LdaZero), + B(Star), R(5), + B(JumpConstant), U8(17), + B(Ldar), R(10), + /* 11 E> */ B(Throw), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), + B(Mov), R(context), R(10), + B(Mov), R(context), R(11), + /* 30 S> */ B(CreateArrayLiteral), U8(1), U8(0), U8(3), + B(Star), R(13), + B(LdaConstant), U8(2), + /* 30 E> */ B(LdrKeyedProperty), R(13), U8(3), R(12), + /* 30 E> */ B(Call), R(12), R(13), U8(1), U8(1), + /* 30 E> */ B(StaContextSlot), R(1), U8(7), + B(LdaSmi), U8(-2), + B(TestEqual), R(4), + B(JumpIfTrue), U8(17), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(4), + B(JumpIfTrueConstant), U8(9), + B(LdaSmi), U8(76), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), + /* 27 S> */ B(LdrContextSlot), R(1), U8(7), R(14), + B(LdrNamedProperty), R(14), U8(4), U8(7), R(13), + /* 27 E> */ B(Call), R(13), R(14), U8(1), U8(5), + /* 27 E> */ B(StaContextSlot), R(1), U8(8), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(ToBooleanLogicalNot), + B(JumpIfFalse), U8(11), + B(LdrContextSlot), R(1), U8(8), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), + B(LdrContextSlot), R(1), U8(8), R(12), + B(LdaNamedProperty), R(12), U8(5), U8(9), + B(JumpIfToBooleanTrueConstant), U8(10), + B(LdrContextSlot), R(1), U8(8), R(12), + B(LdaNamedProperty), R(12), U8(6), U8(11), + B(StaContextSlot), R(1), U8(10), + B(LdaSmi), U8(2), + B(StaContextSlot), R(1), U8(9), + B(LdaContextSlot), R(1), U8(10), + B(StaContextSlot), R(1), U8(6), + /* 16 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(7), + B(PushContext), R(2), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(LdaContextSlot), R(1), U8(6), + B(StaContextSlot), R(context), U8(4), + /* 36 S> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(8), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(13), U8(1), + B(Star), R(12), + B(LdaFalse), + B(Star), R(13), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(12), U8(2), + B(Star), R(14), + B(LdrContextSlot), R(1), U8(5), R(12), + B(LdaSmi), U8(1), + B(SuspendGenerator), R(12), + B(Ldar), R(14), + /* 44 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(12), U8(1), + B(Star), R(13), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(12), U8(1), + B(Star), R(15), + B(LdaZero), + B(TestEqualStrict), R(15), + B(JumpIfTrue), U8(43), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(15), + B(JumpIfTrue), U8(34), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(17), + B(Mov), R(13), R(16), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(16), U8(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(PopContext), R(2), + B(Star), R(9), + B(LdaZero), + B(Star), R(8), + B(Jump), U8(68), + B(Ldar), R(13), + /* 36 E> */ B(Throw), + B(Ldar), R(13), + B(PopContext), R(2), + B(LdaZero), + B(StaContextSlot), R(1), U8(9), + B(Wide), B(Jump), U16(-215), + B(Jump), U8(39), + B(Star), R(12), + B(Ldar), R(closure), + B(CreateCatchContext), R(12), U8(11), + B(Star), R(11), + B(PushContext), R(2), + B(LdrContextSlot), R(0), U8(9), R(12), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(12), + B(JumpIfFalse), U8(7), + B(LdaSmi), U8(1), + B(StaContextSlot), R(0), U8(9), + B(LdrContextSlot), R(context), U8(4), R(12), + B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), + B(PopContext), R(2), + B(LdaSmi), U8(-1), + B(Star), R(8), + B(Jump), U8(8), + B(Star), R(9), + B(LdaSmi), U8(1), + B(Star), R(8), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(10), + B(LdrContextSlot), R(1), U8(9), R(11), + B(LdaZero), + B(TestEqualStrict), R(11), + B(JumpIfTrueConstant), U8(15), + B(LdrContextSlot), R(1), U8(7), R(11), + B(LdaUndefined), + B(TestEqualStrict), R(11), + B(JumpIfTrueConstant), U8(16), + B(LdrContextSlot), R(1), U8(7), R(11), + B(LdaNamedProperty), R(11), U8(12), U8(13), + B(StaContextSlot), R(1), U8(11), + B(LdrContextSlot), R(1), U8(11), R(11), + B(LdaNull), + B(TestEqual), R(11), + B(JumpIfFalse), U8(4), + B(Jump), U8(117), + B(LdrContextSlot), R(1), U8(9), R(11), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(11), + B(JumpIfFalse), U8(71), + B(LdaContextSlot), R(1), U8(11), + B(TypeOf), + B(Star), R(11), + B(LdaConstant), U8(13), + B(TestEqualStrict), R(11), + B(JumpIfFalse), U8(4), + B(Jump), U8(18), + B(Wide), B(LdaSmi), U16(129), + B(Star), R(11), + B(LdaConstant), U8(14), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(Throw), + B(Mov), R(context), R(11), + B(LdrContextSlot), R(1), U8(11), R(12), + B(LdrContextSlot), R(1), U8(7), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Jump), U8(22), + B(Star), R(12), + B(Ldar), R(closure), + B(CreateCatchContext), R(12), U8(11), + B(Star), R(11), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(11), + B(PushContext), R(2), + B(PopContext), R(2), + B(Jump), U8(38), + B(LdrContextSlot), R(1), U8(11), R(11), + B(LdrContextSlot), R(1), U8(7), R(12), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), + B(StaContextSlot), R(1), U8(12), + B(LdrContextSlot), R(1), U8(12), R(11), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1), + B(JumpIfToBooleanFalse), U8(4), + B(Jump), U8(11), + B(LdrContextSlot), R(1), U8(12), R(11), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(10), U8(1), + B(LdaZero), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(10), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(8), + B(JumpIfTrue), U8(17), + B(Jump), U8(28), + B(PopContext), R(1), + B(PopContext), R(1), + B(LdaSmi), U8(1), + B(Star), R(5), + B(Mov), R(9), R(6), + B(Jump), U8(47), + B(PopContext), R(1), + B(PopContext), R(1), + B(LdaSmi), U8(2), + B(Star), R(5), + B(Mov), R(9), R(6), + B(Jump), U8(34), + B(PopContext), R(1), + B(LdrUndefined), R(8), + B(LdaTrue), + B(Star), R(9), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(8), U8(2), + B(Star), R(6), + B(LdaSmi), U8(3), + B(Star), R(5), + B(Jump), U8(14), + B(LdaSmi), U8(-1), + B(Star), R(5), + B(Jump), U8(8), + B(Star), R(6), + B(LdaSmi), U8(4), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(7), + B(LdrContextSlot), R(context), U8(5), R(8), + B(CallRuntime), U16(Runtime::k_GeneratorClose), R(8), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(7), U8(1), + B(LdaZero), + B(TestEqualStrict), R(5), + B(JumpIfTrue), U8(28), + B(LdaSmi), U8(1), + B(TestEqualStrict), R(5), + B(JumpIfTrue), U8(25), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), + B(JumpIfTrue), U8(22), + B(LdaSmi), U8(3), + B(TestEqualStrict), R(5), + B(JumpIfTrue), U8(19), + B(LdaSmi), U8(4), + B(TestEqualStrict), R(5), + B(JumpIfTrue), U8(16), + B(Jump), U8(17), + B(Ldar), R(6), + /* 44 S> */ B(Return), + B(Ldar), R(6), + /* 44 S> */ B(Return), + B(Ldar), R(6), + B(ReThrow), + B(Ldar), R(6), + /* 44 S> */ B(Return), + B(Ldar), R(6), + B(ReThrow), + B(LdaUndefined), + /* 44 S> */ B(Return), +] +constant pool: [ + InstanceType::FIXED_ARRAY_TYPE, + InstanceType::FIXED_ARRAY_TYPE, + InstanceType::SYMBOL_TYPE, + kInstanceTypeDontCare, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + InstanceType::FIXED_ARRAY_TYPE, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + kInstanceTypeDontCare, + kInstanceTypeDontCare, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + kInstanceTypeDontCare, + kInstanceTypeDontCare, + kInstanceTypeDontCare, +] +handlers: [ + [45, 661, 667], + [143, 423, 429], + [146, 384, 386], + [525, 537, 539], +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden index 42a2c5b15b..166f7f0351 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden @@ -16,15 +16,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Star), R(0), - B(LdaSmi), U8(1), - B(BitwiseAnd), R(0), - B(StaGlobalSloppy), U8(0), U8(3), - B(Return), + /* 26 E> */ B(StackCheck), + /* 31 S> */ B(LdrGlobal), U8(1), R(0), + B(BitwiseAndSmi), U8(1), R(0), U8(3), + /* 45 E> */ B(StaGlobalSloppy), U8(0), U8(4), + /* 51 S> */ B(Return), ] constant pool: [ "global", @@ -40,15 +38,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Star), R(0), - B(LdaSmi), U8(1), - B(Add), R(0), - B(StaGlobalSloppy), U8(0), U8(3), - B(Return), + /* 27 E> */ B(StackCheck), + /* 32 S> */ B(LdrGlobal), U8(1), R(0), + B(AddSmi), U8(1), R(0), U8(3), + /* 51 E> */ B(StaGlobalSloppy), U8(0), U8(4), + /* 57 S> */ B(Return), ] constant pool: [ "unallocated", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden index 7d64503a0c..6a2406ad12 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden @@ -16,14 +16,13 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(ToNumber), - B(Inc), - B(StaGlobalSloppy), U8(0), U8(3), - B(Return), + /* 26 E> */ B(StackCheck), + /* 31 S> */ B(LdaGlobal), U8(1), + B(Inc), U8(5), + /* 40 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 48 S> */ B(Return), ] constant pool: [ "global", @@ -39,16 +38,15 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(ToNumber), - B(Star), R(0), - B(Dec), - B(StaGlobalSloppy), U8(0), U8(3), - B(Ldar), R(0), - B(Return), + /* 26 E> */ B(StackCheck), + /* 31 S> */ B(LdaGlobal), U8(1), + B(ToNumber), R(0), + B(Dec), U8(5), + /* 44 E> */ B(StaGlobalSloppy), U8(0), U8(3), + B(Ldar), R(0), + /* 48 S> */ B(Return), ] constant pool: [ "global", @@ -64,14 +62,13 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(ToNumber), - B(Dec), - B(StaGlobalStrict), U8(0), U8(3), - B(Return), + /* 27 E> */ B(StackCheck), + /* 46 S> */ B(LdaGlobal), U8(1), + B(Dec), U8(5), + /* 55 E> */ B(StaGlobalStrict), U8(0), U8(3), + /* 68 S> */ B(Return), ] constant pool: [ "unallocated", @@ -87,16 +84,15 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(ToNumber), - B(Star), R(0), - B(Inc), - B(StaGlobalSloppy), U8(0), U8(3), - B(Ldar), R(0), - B(Return), + /* 27 E> */ B(StackCheck), + /* 32 S> */ B(LdaGlobal), U8(1), + B(ToNumber), R(0), + B(Inc), U8(5), + /* 50 E> */ B(StaGlobalSloppy), U8(0), U8(3), + B(Ldar), R(0), + /* 54 S> */ B(Return), ] constant pool: [ "unallocated", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden index ffed12e79c..adead06c5c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden @@ -18,18 +18,16 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Star), R(0), - B(LdaConstant), U8(1), - B(DeletePropertySloppy), R(0), - B(Return), + /* 32 E> */ B(StackCheck), + /* 39 S> */ B(LdrGlobal), U8(1), R(0), + B(LdaConstant), U8(0), + B(DeletePropertySloppy), R(0), + /* 58 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -45,17 +43,15 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Star), R(0), - B(LdaSmi), U8(1), - B(DeletePropertyStrict), R(0), - B(Return), + /* 28 E> */ B(StackCheck), + /* 51 S> */ B(LdrGlobal), U8(1), R(0), + B(LdaSmi), U8(1), + B(DeletePropertyStrict), R(0), + /* 71 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -70,16 +66,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaContextSlot), R(context), U8(3), - B(Star), R(0), - B(LdaContextSlot), R(0), U8(2), - B(Star), R(1), - B(LdaConstant), U8(0), - B(DeletePropertySloppy), R(1), - B(Return), + /* 32 E> */ B(StackCheck), + /* 39 S> */ B(LdrContextSlot), R(context), U8(3), R(0), + B(LdrContextSlot), R(0), U8(2), R(1), + B(LdaConstant), U8(0), + B(DeletePropertySloppy), R(1), + /* 56 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -97,16 +91,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaContextSlot), R(context), U8(3), - B(Star), R(0), - B(LdaContextSlot), R(0), U8(2), - B(Star), R(1), - B(LdaConstant), U8(0), - B(DeletePropertySloppy), R(1), - B(Return), + /* 18 E> */ B(StackCheck), + /* 25 S> */ B(LdrContextSlot), R(context), U8(3), R(0), + B(LdrContextSlot), R(0), U8(2), R(1), + B(LdaConstant), U8(0), + B(DeletePropertySloppy), R(1), + /* 42 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden index 2ff2485210..f70321aa99 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaConstant), U8(0), + /* 46 S> */ B(Return), ] constant pool: [ 1.2, @@ -33,11 +33,11 @@ frame size: 1 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 47 S> */ B(LdaConstant), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ 1.2, @@ -54,11 +54,11 @@ frame size: 1 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 48 S> */ B(LdaConstant), U8(1), + /* 61 S> */ B(Return), ] constant pool: [ 3.14, @@ -331,523 +331,523 @@ frame size: 1 parameter count: 1 bytecode array length: 1033 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(256), - B(Star), R(0), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 41 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 52 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 63 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 74 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 85 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 96 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 107 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 118 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 129 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 140 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 151 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 162 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 173 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 184 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 195 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 206 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 217 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 228 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 239 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 250 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 261 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 272 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 283 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 294 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 305 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 316 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 327 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 338 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 349 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 360 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 371 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 382 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 393 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 404 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 415 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 426 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 437 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 448 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 459 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 470 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 481 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 492 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 503 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 514 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 525 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 536 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 547 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 558 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 569 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 580 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 591 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 602 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 613 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 624 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 635 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 646 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 657 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 668 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 679 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 690 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 701 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 712 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 723 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 734 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 745 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 756 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 767 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 778 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 789 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 800 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 811 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 822 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 833 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 844 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 855 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 866 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 877 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 888 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 899 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 910 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 921 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 932 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 943 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 954 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 965 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 976 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 987 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 998 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 1009 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 1020 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 1031 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 1042 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 1053 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 1064 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 1075 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 1086 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1097 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1108 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1119 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1130 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1141 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1152 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1163 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1174 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1185 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1196 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1207 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1218 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1229 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1240 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1251 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1262 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1273 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1284 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1295 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1306 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1317 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1328 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1339 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1350 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1361 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1372 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1383 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1394 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1405 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1416 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1427 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1438 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1449 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1460 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1471 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1482 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1493 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1504 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1515 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1526 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1537 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1548 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1559 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1570 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1581 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1592 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1603 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1614 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1625 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1636 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1647 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1658 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1669 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1680 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1691 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1702 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1713 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1724 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1735 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1746 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1757 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1768 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1779 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1790 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1801 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1812 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1823 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1834 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1845 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 1856 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 1867 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 1878 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 1889 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 1900 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 1911 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 1922 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 1933 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 1944 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 1955 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 1966 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 1977 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 1988 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 1999 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 2010 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 2021 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 2032 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 2043 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 2054 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 2065 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 2076 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 2087 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 2098 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 2109 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 2120 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 2131 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 2142 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 2153 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 2164 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 2175 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 2186 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2197 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2208 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2219 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2230 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2241 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2252 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2263 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2274 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2285 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2296 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2307 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2318 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2329 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2340 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2351 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2362 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2373 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2384 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2395 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2406 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2417 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2428 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2439 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2450 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2461 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2472 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2483 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2494 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2505 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2516 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2527 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2538 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2549 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2560 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2571 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2582 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2593 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2604 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2615 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2626 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2637 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2648 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2659 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2670 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2681 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2692 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2703 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2714 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2725 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2736 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2747 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2758 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2769 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 2780 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 2791 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 2802 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 2813 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 2824 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 2835 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 2846 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 2857 S> */ B(Wide), B(LdaConstant), U16(256), + B(Star), R(0), + B(LdaUndefined), + /* 2867 S> */ B(Return), ] constant pool: [ 1.414, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden index f450f3f321..c375fb1e1e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden @@ -3,7 +3,7 @@ # --- -pool type: number +pool type: mixed execute: yes wrap: no test function name: f @@ -23,9 +23,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(-1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 55 S> */ B(LdaSmi), U8(-1), + /* 70 S> */ B(Return), ] constant pool: [ ] @@ -47,9 +47,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 36 S> */ B(LdaSmi), U8(1), + /* 76 S> */ B(Return), ] constant pool: [ ] @@ -71,9 +71,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(-1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 59 S> */ B(LdaSmi), U8(-1), + /* 74 S> */ B(Return), ] constant pool: [ ] @@ -93,9 +93,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 17 S> */ B(LdaUndefined), + /* 48 S> */ B(Return), ] constant pool: [ ] @@ -116,22 +116,20 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(14), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(5), - B(LdaSmi), U8(2), - B(Return), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 25 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 30 S> */ B(JumpIfToBooleanFalse), U8(13), + /* 43 S> */ B(AddSmi), U8(1), R(0), U8(1), + B(Mov), R(0), R(1), + B(Star), R(0), + B(Jump), U8(5), + /* 66 S> */ B(LdaSmi), U8(2), + /* 80 S> */ B(Return), + B(LdaUndefined), + /* 80 S> */ B(Return), ] constant pool: [ ] @@ -149,22 +147,20 @@ snippet: " }; f(99); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 22 +bytecode array length: 18 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaZero), - B(TestLessThanOrEqual), R(0), - B(JumpIfFalse), U8(7), - B(Wide), B(LdaSmi), U16(200), - B(Return), - B(Wide), B(LdaSmi), U16(-200), - B(Return), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 18 S> */ B(LdaZero), + /* 24 E> */ B(TestLessThanOrEqual), R(arg0), + B(JumpIfFalse), U8(7), + /* 36 S> */ B(Wide), B(LdaSmi), U16(200), + /* 80 S> */ B(Return), + /* 63 S> */ B(Wide), B(LdaSmi), U16(-200), + /* 80 S> */ B(Return), + B(LdaUndefined), + /* 80 S> */ B(Return), ] constant pool: [ ] @@ -175,20 +171,18 @@ handlers: [ snippet: " function f(a, b) { if (a in b) { return 200; } }f('prop', { prop: 'yes'}); " -frame size: 1 +frame size: 0 parameter count: 3 -bytecode array length: 18 +bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestIn), R(0), - B(JumpIfFalse), U8(7), - B(Wide), B(LdaSmi), U16(200), - B(Return), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(Ldar), R(arg1), + /* 25 E> */ B(TestIn), R(arg0), + B(JumpIfFalse), U8(7), + /* 33 S> */ B(Wide), B(LdaSmi), U16(200), + /* 47 S> */ B(Return), + B(LdaUndefined), + /* 47 S> */ B(Return), ] constant pool: [ ] @@ -264,159 +258,156 @@ snippet: " b = a; a = b; return 200; } else { return -200; } } f(0.001); " -frame size: 3 +frame size: 2 parameter count: 2 -bytecode array length: 287 +bytecode array length: 409 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaConstant), U8(0), - B(TestEqualStrict), R(2), - B(JumpIfFalseConstant), U8(1), - B(Ldar), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Wide), B(LdaSmi), U16(200), - B(Return), - B(Wide), B(LdaSmi), U16(-200), - B(Return), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 24 S> */ B(LdaZero), + B(Star), R(0), + /* 35 S> */ B(LdaZero), + B(Star), R(1), + /* 38 S> */ B(LdaConstant), U8(0), + /* 44 E> */ B(TestEqualStrict), R(0), + B(JumpIfFalseConstant), U8(1), + /* 58 S> */ B(Mov), R(0), R(1), + /* 65 S> */ B(Mov), R(1), R(0), + /* 74 S> */ B(Mov), R(0), R(1), + /* 81 S> */ B(Mov), R(1), R(0), + /* 90 S> */ B(Mov), R(0), R(1), + /* 97 S> */ B(Mov), R(1), R(0), + /* 106 S> */ B(Mov), R(0), R(1), + /* 113 S> */ B(Mov), R(1), R(0), + /* 122 S> */ B(Mov), R(0), R(1), + /* 129 S> */ B(Mov), R(1), R(0), + /* 138 S> */ B(Mov), R(0), R(1), + /* 145 S> */ B(Mov), R(1), R(0), + /* 154 S> */ B(Mov), R(0), R(1), + /* 161 S> */ B(Mov), R(1), R(0), + /* 170 S> */ B(Mov), R(0), R(1), + /* 177 S> */ B(Mov), R(1), R(0), + /* 186 S> */ B(Mov), R(0), R(1), + /* 193 S> */ B(Mov), R(1), R(0), + /* 202 S> */ B(Mov), R(0), R(1), + /* 209 S> */ B(Mov), R(1), R(0), + /* 218 S> */ B(Mov), R(0), R(1), + /* 225 S> */ B(Mov), R(1), R(0), + /* 234 S> */ B(Mov), R(0), R(1), + /* 241 S> */ B(Mov), R(1), R(0), + /* 250 S> */ B(Mov), R(0), R(1), + /* 257 S> */ B(Mov), R(1), R(0), + /* 266 S> */ B(Mov), R(0), R(1), + /* 273 S> */ B(Mov), R(1), R(0), + /* 282 S> */ B(Mov), R(0), R(1), + /* 289 S> */ B(Mov), R(1), R(0), + /* 298 S> */ B(Mov), R(0), R(1), + /* 305 S> */ B(Mov), R(1), R(0), + /* 314 S> */ B(Mov), R(0), R(1), + /* 321 S> */ B(Mov), R(1), R(0), + /* 330 S> */ B(Mov), R(0), R(1), + /* 337 S> */ B(Mov), R(1), R(0), + /* 346 S> */ B(Mov), R(0), R(1), + /* 353 S> */ B(Mov), R(1), R(0), + /* 362 S> */ B(Mov), R(0), R(1), + /* 369 S> */ B(Mov), R(1), R(0), + /* 378 S> */ B(Mov), R(0), R(1), + /* 385 S> */ B(Mov), R(1), R(0), + /* 394 S> */ B(Mov), R(0), R(1), + /* 401 S> */ B(Mov), R(1), R(0), + /* 410 S> */ B(Mov), R(0), R(1), + /* 417 S> */ B(Mov), R(1), R(0), + /* 426 S> */ B(Mov), R(0), R(1), + /* 433 S> */ B(Mov), R(1), R(0), + /* 442 S> */ B(Mov), R(0), R(1), + /* 449 S> */ B(Mov), R(1), R(0), + /* 458 S> */ B(Mov), R(0), R(1), + /* 465 S> */ B(Mov), R(1), R(0), + /* 474 S> */ B(Mov), R(0), R(1), + /* 481 S> */ B(Mov), R(1), R(0), + /* 490 S> */ B(Mov), R(0), R(1), + /* 497 S> */ B(Mov), R(1), R(0), + /* 506 S> */ B(Mov), R(0), R(1), + /* 513 S> */ B(Mov), R(1), R(0), + /* 522 S> */ B(Mov), R(0), R(1), + /* 529 S> */ B(Mov), R(1), R(0), + /* 538 S> */ B(Mov), R(0), R(1), + /* 545 S> */ B(Mov), R(1), R(0), + /* 554 S> */ B(Mov), R(0), R(1), + /* 561 S> */ B(Mov), R(1), R(0), + /* 570 S> */ B(Mov), R(0), R(1), + /* 577 S> */ B(Mov), R(1), R(0), + /* 586 S> */ B(Mov), R(0), R(1), + /* 593 S> */ B(Mov), R(1), R(0), + /* 602 S> */ B(Mov), R(0), R(1), + /* 609 S> */ B(Mov), R(1), R(0), + /* 618 S> */ B(Mov), R(0), R(1), + /* 625 S> */ B(Mov), R(1), R(0), + /* 634 S> */ B(Mov), R(0), R(1), + /* 641 S> */ B(Mov), R(1), R(0), + /* 650 S> */ B(Mov), R(0), R(1), + /* 657 S> */ B(Mov), R(1), R(0), + /* 666 S> */ B(Mov), R(0), R(1), + /* 673 S> */ B(Mov), R(1), R(0), + /* 682 S> */ B(Mov), R(0), R(1), + /* 689 S> */ B(Mov), R(1), R(0), + /* 698 S> */ B(Mov), R(0), R(1), + /* 705 S> */ B(Mov), R(1), R(0), + /* 714 S> */ B(Mov), R(0), R(1), + /* 721 S> */ B(Mov), R(1), R(0), + /* 730 S> */ B(Mov), R(0), R(1), + /* 737 S> */ B(Mov), R(1), R(0), + /* 746 S> */ B(Mov), R(0), R(1), + /* 753 S> */ B(Mov), R(1), R(0), + /* 762 S> */ B(Mov), R(0), R(1), + /* 769 S> */ B(Mov), R(1), R(0), + /* 778 S> */ B(Mov), R(0), R(1), + /* 785 S> */ B(Mov), R(1), R(0), + /* 794 S> */ B(Mov), R(0), R(1), + /* 801 S> */ B(Mov), R(1), R(0), + /* 810 S> */ B(Mov), R(0), R(1), + /* 817 S> */ B(Mov), R(1), R(0), + /* 826 S> */ B(Mov), R(0), R(1), + /* 833 S> */ B(Mov), R(1), R(0), + /* 842 S> */ B(Mov), R(0), R(1), + /* 849 S> */ B(Mov), R(1), R(0), + /* 858 S> */ B(Mov), R(0), R(1), + /* 865 S> */ B(Mov), R(1), R(0), + /* 874 S> */ B(Mov), R(0), R(1), + /* 881 S> */ B(Mov), R(1), R(0), + /* 890 S> */ B(Mov), R(0), R(1), + /* 897 S> */ B(Mov), R(1), R(0), + /* 906 S> */ B(Mov), R(0), R(1), + /* 913 S> */ B(Mov), R(1), R(0), + /* 922 S> */ B(Mov), R(0), R(1), + /* 929 S> */ B(Mov), R(1), R(0), + /* 938 S> */ B(Mov), R(0), R(1), + /* 945 S> */ B(Mov), R(1), R(0), + /* 954 S> */ B(Mov), R(0), R(1), + /* 961 S> */ B(Mov), R(1), R(0), + /* 970 S> */ B(Mov), R(0), R(1), + /* 977 S> */ B(Mov), R(1), R(0), + /* 986 S> */ B(Mov), R(0), R(1), + /* 993 S> */ B(Mov), R(1), R(0), + /* 1002 S> */ B(Mov), R(0), R(1), + /* 1009 S> */ B(Mov), R(1), R(0), + /* 1018 S> */ B(Mov), R(0), R(1), + /* 1025 S> */ B(Mov), R(1), R(0), + /* 1034 S> */ B(Mov), R(0), R(1), + /* 1041 S> */ B(Mov), R(1), R(0), + /* 1050 S> */ B(Mov), R(0), R(1), + /* 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), + /* 1117 S> */ B(Return), + /* 1102 S> */ B(Wide), B(LdaSmi), U16(-200), + /* 1117 S> */ B(Return), + B(LdaUndefined), + /* 1117 S> */ B(Return), ] constant pool: [ - 0.01, - 265, + InstanceType::HEAP_NUMBER_TYPE, + kInstanceTypeDontCare, ] handlers: [ ] @@ -496,153 +487,152 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 281 +bytecode array length: 407 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfToBooleanFalseConstant), U8(0), - B(Ldar), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Star), R(1), - B(Star), R(0), - B(Wide), B(LdaSmi), U16(200), - B(Return), - B(Wide), B(LdaSmi), U16(-200), - B(Return), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 25 S> */ B(LdaZero), + B(Star), R(0), + /* 36 S> */ B(LdaZero), + B(Star), R(1), + /* 41 S> */ B(Ldar), R(0), + B(JumpIfToBooleanFalseConstant), U8(0), + /* 52 S> */ B(Mov), R(0), R(1), + /* 59 S> */ B(Mov), R(1), R(0), + /* 68 S> */ B(Mov), R(0), R(1), + /* 75 S> */ B(Mov), R(1), R(0), + /* 84 S> */ B(Mov), R(0), R(1), + /* 91 S> */ B(Mov), R(1), R(0), + /* 100 S> */ B(Mov), R(0), R(1), + /* 107 S> */ B(Mov), R(1), R(0), + /* 116 S> */ B(Mov), R(0), R(1), + /* 123 S> */ B(Mov), R(1), R(0), + /* 132 S> */ B(Mov), R(0), R(1), + /* 139 S> */ B(Mov), R(1), R(0), + /* 148 S> */ B(Mov), R(0), R(1), + /* 155 S> */ B(Mov), R(1), R(0), + /* 164 S> */ B(Mov), R(0), R(1), + /* 171 S> */ B(Mov), R(1), R(0), + /* 180 S> */ B(Mov), R(0), R(1), + /* 187 S> */ B(Mov), R(1), R(0), + /* 196 S> */ B(Mov), R(0), R(1), + /* 203 S> */ B(Mov), R(1), R(0), + /* 212 S> */ B(Mov), R(0), R(1), + /* 219 S> */ B(Mov), R(1), R(0), + /* 228 S> */ B(Mov), R(0), R(1), + /* 235 S> */ B(Mov), R(1), R(0), + /* 244 S> */ B(Mov), R(0), R(1), + /* 251 S> */ B(Mov), R(1), R(0), + /* 260 S> */ B(Mov), R(0), R(1), + /* 267 S> */ B(Mov), R(1), R(0), + /* 276 S> */ B(Mov), R(0), R(1), + /* 283 S> */ B(Mov), R(1), R(0), + /* 292 S> */ B(Mov), R(0), R(1), + /* 299 S> */ B(Mov), R(1), R(0), + /* 308 S> */ B(Mov), R(0), R(1), + /* 315 S> */ B(Mov), R(1), R(0), + /* 324 S> */ B(Mov), R(0), R(1), + /* 331 S> */ B(Mov), R(1), R(0), + /* 340 S> */ B(Mov), R(0), R(1), + /* 347 S> */ B(Mov), R(1), R(0), + /* 356 S> */ B(Mov), R(0), R(1), + /* 363 S> */ B(Mov), R(1), R(0), + /* 372 S> */ B(Mov), R(0), R(1), + /* 379 S> */ B(Mov), R(1), R(0), + /* 388 S> */ B(Mov), R(0), R(1), + /* 395 S> */ B(Mov), R(1), R(0), + /* 404 S> */ B(Mov), R(0), R(1), + /* 411 S> */ B(Mov), R(1), R(0), + /* 420 S> */ B(Mov), R(0), R(1), + /* 427 S> */ B(Mov), R(1), R(0), + /* 436 S> */ B(Mov), R(0), R(1), + /* 443 S> */ B(Mov), R(1), R(0), + /* 452 S> */ B(Mov), R(0), R(1), + /* 459 S> */ B(Mov), R(1), R(0), + /* 468 S> */ B(Mov), R(0), R(1), + /* 475 S> */ B(Mov), R(1), R(0), + /* 484 S> */ B(Mov), R(0), R(1), + /* 491 S> */ B(Mov), R(1), R(0), + /* 500 S> */ B(Mov), R(0), R(1), + /* 507 S> */ B(Mov), R(1), R(0), + /* 516 S> */ B(Mov), R(0), R(1), + /* 523 S> */ B(Mov), R(1), R(0), + /* 532 S> */ B(Mov), R(0), R(1), + /* 539 S> */ B(Mov), R(1), R(0), + /* 548 S> */ B(Mov), R(0), R(1), + /* 555 S> */ B(Mov), R(1), R(0), + /* 564 S> */ B(Mov), R(0), R(1), + /* 571 S> */ B(Mov), R(1), R(0), + /* 580 S> */ B(Mov), R(0), R(1), + /* 587 S> */ B(Mov), R(1), R(0), + /* 596 S> */ B(Mov), R(0), R(1), + /* 603 S> */ B(Mov), R(1), R(0), + /* 612 S> */ B(Mov), R(0), R(1), + /* 619 S> */ B(Mov), R(1), R(0), + /* 628 S> */ B(Mov), R(0), R(1), + /* 635 S> */ B(Mov), R(1), R(0), + /* 644 S> */ B(Mov), R(0), R(1), + /* 651 S> */ B(Mov), R(1), R(0), + /* 660 S> */ B(Mov), R(0), R(1), + /* 667 S> */ B(Mov), R(1), R(0), + /* 676 S> */ B(Mov), R(0), R(1), + /* 683 S> */ B(Mov), R(1), R(0), + /* 692 S> */ B(Mov), R(0), R(1), + /* 699 S> */ B(Mov), R(1), R(0), + /* 708 S> */ B(Mov), R(0), R(1), + /* 715 S> */ B(Mov), R(1), R(0), + /* 724 S> */ B(Mov), R(0), R(1), + /* 731 S> */ B(Mov), R(1), R(0), + /* 740 S> */ B(Mov), R(0), R(1), + /* 747 S> */ B(Mov), R(1), R(0), + /* 756 S> */ B(Mov), R(0), R(1), + /* 763 S> */ B(Mov), R(1), R(0), + /* 772 S> */ B(Mov), R(0), R(1), + /* 779 S> */ B(Mov), R(1), R(0), + /* 788 S> */ B(Mov), R(0), R(1), + /* 795 S> */ B(Mov), R(1), R(0), + /* 804 S> */ B(Mov), R(0), R(1), + /* 811 S> */ B(Mov), R(1), R(0), + /* 820 S> */ B(Mov), R(0), R(1), + /* 827 S> */ B(Mov), R(1), R(0), + /* 836 S> */ B(Mov), R(0), R(1), + /* 843 S> */ B(Mov), R(1), R(0), + /* 852 S> */ B(Mov), R(0), R(1), + /* 859 S> */ B(Mov), R(1), R(0), + /* 868 S> */ B(Mov), R(0), R(1), + /* 875 S> */ B(Mov), R(1), R(0), + /* 884 S> */ B(Mov), R(0), R(1), + /* 891 S> */ B(Mov), R(1), R(0), + /* 900 S> */ B(Mov), R(0), R(1), + /* 907 S> */ B(Mov), R(1), R(0), + /* 916 S> */ B(Mov), R(0), R(1), + /* 923 S> */ B(Mov), R(1), R(0), + /* 932 S> */ B(Mov), R(0), R(1), + /* 939 S> */ B(Mov), R(1), R(0), + /* 948 S> */ B(Mov), R(0), R(1), + /* 955 S> */ B(Mov), R(1), R(0), + /* 964 S> */ B(Mov), R(0), R(1), + /* 971 S> */ B(Mov), R(1), R(0), + /* 980 S> */ B(Mov), R(0), R(1), + /* 987 S> */ B(Mov), R(1), R(0), + /* 996 S> */ B(Mov), R(0), R(1), + /* 1003 S> */ B(Mov), R(1), R(0), + /* 1012 S> */ B(Mov), R(0), R(1), + /* 1019 S> */ B(Mov), R(1), R(0), + /* 1028 S> */ B(Mov), R(0), R(1), + /* 1035 S> */ B(Mov), R(1), R(0), + /* 1044 S> */ B(Mov), R(0), R(1), + /* 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), + /* 1112 S> */ B(Return), + /* 1097 S> */ B(Wide), B(LdaSmi), U16(-200), + /* 1112 S> */ B(Return), + B(LdaUndefined), + /* 1112 S> */ B(Return), ] constant pool: [ - 265, + kInstanceTypeDontCare, ] handlers: [ ] @@ -662,69 +652,53 @@ snippet: " } f(1, 1); " -frame size: 1 +frame size: 0 parameter count: 3 -bytecode array length: 107 +bytecode array length: 75 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestEqual), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestEqualStrict), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestLessThan), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestGreaterThan), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestLessThanOrEqual), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestGreaterThanOrEqual), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestIn), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(TestInstanceOf), R(0), - B(JumpIfFalse), U8(5), - B(LdaSmi), U8(1), - B(Return), - B(LdaZero), - B(Return), + /* 10 E> */ B(StackCheck), + /* 21 S> */ B(Ldar), R(arg1), + /* 27 E> */ B(TestEqual), R(arg0), + B(JumpIfFalse), U8(5), + /* 35 S> */ B(LdaSmi), U8(1), + /* 262 S> */ B(Return), + /* 49 S> */ B(Ldar), R(arg1), + /* 55 E> */ B(TestEqualStrict), R(arg0), + B(JumpIfFalse), U8(5), + /* 64 S> */ B(LdaSmi), U8(1), + /* 262 S> */ B(Return), + /* 78 S> */ B(Ldar), R(arg1), + /* 84 E> */ B(TestLessThan), R(arg0), + B(JumpIfFalse), U8(5), + /* 91 S> */ B(LdaSmi), U8(1), + /* 262 S> */ B(Return), + /* 105 S> */ B(Ldar), R(arg1), + /* 111 E> */ B(TestGreaterThan), R(arg0), + B(JumpIfFalse), U8(5), + /* 118 S> */ B(LdaSmi), U8(1), + /* 262 S> */ B(Return), + /* 132 S> */ B(Ldar), R(arg1), + /* 138 E> */ B(TestLessThanOrEqual), R(arg0), + B(JumpIfFalse), U8(5), + /* 146 S> */ B(LdaSmi), U8(1), + /* 262 S> */ B(Return), + /* 160 S> */ B(Ldar), R(arg1), + /* 166 E> */ B(TestGreaterThanOrEqual), R(arg0), + B(JumpIfFalse), U8(5), + /* 174 S> */ B(LdaSmi), U8(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), + /* 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), + /* 262 S> */ B(Return), + /* 252 S> */ B(LdaZero), + /* 262 S> */ B(Return), ] constant pool: [ ] @@ -747,16 +721,60 @@ frame size: 1 parameter count: 1 bytecode array length: 14 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(5), - B(LdaSmi), U8(20), - B(Return), - B(LdaSmi), U8(-20), - B(Return), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 25 S> */ B(LdaZero), + B(Star), R(0), + /* 30 S> */ B(JumpIfToBooleanFalse), U8(5), + /* 43 S> */ B(LdaSmi), U8(20), + /* 85 S> */ B(Return), + /* 69 S> */ B(LdaSmi), U8(-20), + /* 85 S> */ B(Return), + B(LdaUndefined), + /* 85 S> */ B(Return), +] +constant pool: [ +] +handlers: [ +] + +--- +snippet: " + function f(a, b) { + if (a == b || a < 0) { + return 1; + } else if (a > 0 && b > 0) { + return 0; + } else { + return -1; + } + }; + f(-1, 1); +" +frame size: 0 +parameter count: 3 +bytecode array length: 32 +bytecodes: [ + /* 10 E> */ B(StackCheck), + /* 21 S> */ B(Ldar), R(arg1), + /* 27 E> */ B(TestEqual), R(arg0), + B(JumpIfTrue), U8(7), + B(LdaZero), + /* 37 E> */ B(TestLessThan), R(arg0), + B(JumpIfFalse), U8(5), + /* 48 S> */ B(LdaSmi), U8(1), + /* 133 S> */ B(Return), + /* 67 S> */ B(LdaZero), + /* 73 E> */ B(TestGreaterThan), R(arg0), + B(JumpIfFalse), U8(9), + B(LdaZero), + /* 82 E> */ B(TestGreaterThan), R(arg1), + B(JumpIfFalse), U8(4), + /* 93 S> */ B(LdaZero), + /* 133 S> */ B(Return), + /* 118 S> */ B(LdaSmi), U8(-1), + /* 133 S> */ B(Return), + B(LdaUndefined), + /* 133 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden index 1c37c124e8..6ac81a606b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(ExtraWide), B(LdaSmi), U32(12345678), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(ExtraWide), B(LdaSmi), U32(12345678), + /* 51 S> */ B(Return), ] constant pool: [ ] @@ -32,11 +32,11 @@ frame size: 1 parameter count: 1 bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(Wide), B(LdaSmi), U16(1234), - B(Star), R(0), - B(Wide), B(LdaSmi), U16(5678), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), + B(Star), R(0), + /* 48 S> */ B(Wide), B(LdaSmi), U16(5678), + /* 61 S> */ B(Return), ] constant pool: [ ] @@ -51,11 +51,11 @@ frame size: 1 parameter count: 1 bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(Wide), B(LdaSmi), U16(1234), - B(Star), R(0), - B(Wide), B(LdaSmi), U16(1234), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), + B(Star), R(0), + /* 48 S> */ B(Wide), B(LdaSmi), U16(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 3f0b49df82..a5efe58049 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden @@ -327,663 +327,655 @@ snippet: " } return 3; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 1422 +bytecode array length: 1408 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(256), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(257), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(258), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(259), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(260), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(261), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(262), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(263), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(264), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(265), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(266), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(267), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(268), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(269), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(270), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(271), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(272), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(273), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(274), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(275), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(276), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(277), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(278), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(279), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(280), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(281), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(282), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(283), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(284), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(285), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(286), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(287), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(288), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(289), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(290), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(291), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(292), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(293), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(294), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(295), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(296), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(297), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(298), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(299), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(300), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(301), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(302), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(303), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(304), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(305), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(306), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(307), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(308), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(309), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(310), - B(Star), R(0), - B(Wide), B(LdaConstant), U16(311), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(3), - B(TestLessThan), R(2), - B(Wide), B(JumpIfFalse), U16(46), - B(StackCheck), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(1), - B(TestEqual), R(2), - B(Wide), B(JumpIfFalse), U16(7), - B(Wide), B(Jump), U16(19), - B(Ldar), R(1), - B(Star), R(2), - B(LdaSmi), U8(2), - B(TestEqual), R(2), - B(Wide), B(JumpIfFalse), U16(7), - B(Wide), B(Jump), U16(13), - B(Ldar), R(1), - B(ToNumber), - B(Star), R(2), - B(Inc), - B(Star), R(1), - B(Jump), U8(-53), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 55 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 68 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 81 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 94 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 107 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 120 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 133 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 146 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 159 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 172 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 185 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 198 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 211 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 224 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 237 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 250 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 263 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 276 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 289 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 302 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 315 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 328 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 341 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 354 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 367 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 380 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 393 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 406 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 419 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 432 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 445 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 458 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 471 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 484 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 497 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 510 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 523 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 536 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 549 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 562 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 575 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 588 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 601 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 614 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 627 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 640 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 653 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 666 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 679 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 692 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 705 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 718 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 731 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 744 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 757 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 770 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 783 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 796 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 809 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 822 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 835 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 848 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 861 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 874 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 887 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 900 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 913 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 926 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 939 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 952 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 965 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 978 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 991 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 1004 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 1017 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 1030 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 1043 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 1056 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 1069 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 1082 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 1095 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 1108 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 1121 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 1134 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 1147 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 1160 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 1173 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 1186 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 1199 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 1212 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 1225 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 1238 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 1251 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 1264 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 1277 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1290 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1303 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1316 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1329 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1342 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1355 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1368 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1381 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1394 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1407 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1420 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1433 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1446 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1459 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1472 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1485 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1498 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1511 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1524 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1537 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1550 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1563 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1576 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1589 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1602 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1615 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1628 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1641 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1654 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1667 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1680 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1693 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1706 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1719 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1732 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1745 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1758 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1771 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1784 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1797 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1810 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1823 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1836 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1849 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1862 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1875 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1888 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1901 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1914 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1927 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1940 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1953 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1966 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1979 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1992 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 2005 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 2018 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 2031 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 2044 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 2057 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 2070 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 2083 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 2096 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 2109 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 2122 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 2135 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 2148 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 2161 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 2174 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 2187 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 2200 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 2213 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 2226 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 2239 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 2252 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 2265 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 2278 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 2291 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 2304 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 2317 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 2330 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 2343 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 2356 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 2369 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 2382 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 2395 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 2408 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 2421 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 2434 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 2447 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 2460 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 2473 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 2486 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 2499 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 2512 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 2525 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 2538 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 2551 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 2564 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 2577 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2590 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2603 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2616 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2629 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2642 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2655 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2668 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2681 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2694 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2707 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2720 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2733 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2746 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2759 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2772 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2785 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2798 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2811 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2824 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2837 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2850 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2863 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2876 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2889 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2902 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2915 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2928 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2941 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2954 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2967 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2980 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2993 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 3006 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 3019 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 3032 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 3045 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 3058 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 3071 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 3084 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 3097 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 3110 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 3123 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 3136 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 3149 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 3162 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 3175 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 3188 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 3201 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 3214 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 3227 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 3240 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 3253 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 3266 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 3279 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 3292 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 3305 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 3318 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 3331 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 3344 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 3357 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 3370 S> */ B(Wide), B(LdaConstant), U16(256), + B(Star), R(0), + /* 3383 S> */ B(Wide), B(LdaConstant), U16(257), + B(Star), R(0), + /* 3396 S> */ B(Wide), B(LdaConstant), U16(258), + B(Star), R(0), + /* 3409 S> */ B(Wide), B(LdaConstant), U16(259), + B(Star), R(0), + /* 3422 S> */ B(Wide), B(LdaConstant), U16(260), + B(Star), R(0), + /* 3435 S> */ B(Wide), B(LdaConstant), U16(261), + B(Star), R(0), + /* 3448 S> */ B(Wide), B(LdaConstant), U16(262), + B(Star), R(0), + /* 3461 S> */ B(Wide), B(LdaConstant), U16(263), + B(Star), R(0), + /* 3474 S> */ B(Wide), B(LdaConstant), U16(264), + B(Star), R(0), + /* 3487 S> */ B(Wide), B(LdaConstant), U16(265), + B(Star), R(0), + /* 3500 S> */ B(Wide), B(LdaConstant), U16(266), + B(Star), R(0), + /* 3513 S> */ B(Wide), B(LdaConstant), U16(267), + B(Star), R(0), + /* 3526 S> */ B(Wide), B(LdaConstant), U16(268), + B(Star), R(0), + /* 3539 S> */ B(Wide), B(LdaConstant), U16(269), + B(Star), R(0), + /* 3552 S> */ B(Wide), B(LdaConstant), U16(270), + B(Star), R(0), + /* 3565 S> */ B(Wide), B(LdaConstant), U16(271), + B(Star), R(0), + /* 3578 S> */ B(Wide), B(LdaConstant), U16(272), + B(Star), R(0), + /* 3591 S> */ B(Wide), B(LdaConstant), U16(273), + B(Star), R(0), + /* 3604 S> */ B(Wide), B(LdaConstant), U16(274), + B(Star), R(0), + /* 3617 S> */ B(Wide), B(LdaConstant), U16(275), + B(Star), R(0), + /* 3630 S> */ B(Wide), B(LdaConstant), U16(276), + B(Star), R(0), + /* 3643 S> */ B(Wide), B(LdaConstant), U16(277), + B(Star), R(0), + /* 3656 S> */ B(Wide), B(LdaConstant), U16(278), + B(Star), R(0), + /* 3669 S> */ B(Wide), B(LdaConstant), U16(279), + B(Star), R(0), + /* 3682 S> */ B(Wide), B(LdaConstant), U16(280), + B(Star), R(0), + /* 3695 S> */ B(Wide), B(LdaConstant), U16(281), + B(Star), R(0), + /* 3708 S> */ B(Wide), B(LdaConstant), U16(282), + B(Star), R(0), + /* 3721 S> */ B(Wide), B(LdaConstant), U16(283), + B(Star), R(0), + /* 3734 S> */ B(Wide), B(LdaConstant), U16(284), + B(Star), R(0), + /* 3747 S> */ B(Wide), B(LdaConstant), U16(285), + B(Star), R(0), + /* 3760 S> */ B(Wide), B(LdaConstant), U16(286), + B(Star), R(0), + /* 3773 S> */ B(Wide), B(LdaConstant), U16(287), + B(Star), R(0), + /* 3786 S> */ B(Wide), B(LdaConstant), U16(288), + B(Star), R(0), + /* 3799 S> */ B(Wide), B(LdaConstant), U16(289), + B(Star), R(0), + /* 3812 S> */ B(Wide), B(LdaConstant), U16(290), + B(Star), R(0), + /* 3825 S> */ B(Wide), B(LdaConstant), U16(291), + B(Star), R(0), + /* 3838 S> */ B(Wide), B(LdaConstant), U16(292), + B(Star), R(0), + /* 3851 S> */ B(Wide), B(LdaConstant), U16(293), + B(Star), R(0), + /* 3864 S> */ B(Wide), B(LdaConstant), U16(294), + B(Star), R(0), + /* 3877 S> */ B(Wide), B(LdaConstant), U16(295), + B(Star), R(0), + /* 3890 S> */ B(Wide), B(LdaConstant), U16(296), + B(Star), R(0), + /* 3903 S> */ B(Wide), B(LdaConstant), U16(297), + B(Star), R(0), + /* 3916 S> */ B(Wide), B(LdaConstant), U16(298), + B(Star), R(0), + /* 3929 S> */ B(Wide), B(LdaConstant), U16(299), + B(Star), R(0), + /* 3942 S> */ B(Wide), B(LdaConstant), U16(300), + B(Star), R(0), + /* 3955 S> */ B(Wide), B(LdaConstant), U16(301), + B(Star), R(0), + /* 3968 S> */ B(Wide), B(LdaConstant), U16(302), + B(Star), R(0), + /* 3981 S> */ B(Wide), B(LdaConstant), U16(303), + B(Star), R(0), + /* 3994 S> */ B(Wide), B(LdaConstant), U16(304), + B(Star), R(0), + /* 4007 S> */ B(Wide), B(LdaConstant), U16(305), + B(Star), R(0), + /* 4020 S> */ B(Wide), B(LdaConstant), U16(306), + B(Star), R(0), + /* 4033 S> */ B(Wide), B(LdaConstant), U16(307), + B(Star), R(0), + /* 4046 S> */ B(Wide), B(LdaConstant), U16(308), + B(Star), R(0), + /* 4059 S> */ B(Wide), B(LdaConstant), U16(309), + B(Star), R(0), + /* 4072 S> */ B(Wide), B(LdaConstant), U16(310), + B(Star), R(0), + /* 4085 S> */ B(Wide), B(LdaConstant), U16(311), + B(Star), R(0), + /* 4103 S> */ B(LdaZero), + B(Star), R(1), + /* 4108 S> */ B(LdaSmi), U8(3), + /* 4108 E> */ B(TestLessThan), R(1), + B(Wide), B(JumpIfFalse), U16(36), + /* 4090 E> */ B(StackCheck), + /* 4122 S> */ B(LdaSmi), U8(1), + /* 4128 E> */ B(TestEqual), R(1), + B(Wide), B(JumpIfFalse), U16(7), + /* 4134 S> */ B(Wide), B(Jump), U16(15), + /* 4146 S> */ B(LdaSmi), U8(2), + /* 4152 E> */ B(TestEqual), R(1), + B(Wide), B(JumpIfFalse), U16(7), + /* 4158 S> */ B(Wide), B(Jump), U16(11), + /* 4114 S> */ B(Ldar), R(1), + B(Inc), U8(1), + B(Star), R(1), + B(Jump), U8(-39), + /* 4167 S> */ B(LdaSmi), U8(3), + /* 4177 S> */ B(Return), ] constant pool: [ 0.1, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden index 5ceda85dbc..4dbbdafd5e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden @@ -15,13 +15,13 @@ frame size: 1 parameter count: 1 bytecode array length: 10 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + B(LdaUndefined), + /* 46 S> */ B(Return), ] constant pool: [ ] @@ -36,16 +36,16 @@ frame size: 2 parameter count: 1 bytecode array length: 20 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 46 S> */ B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), + /* 56 S> */ B(Return), ] constant pool: [ "x", @@ -59,22 +59,21 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Ldar), R(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 45 S> */ B(LdaSmi), U8(20), + B(Star), R(1), + B(Ldar), R(0), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + /* 45 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + B(Mov), R(1), R(0), + B(LdaUndefined), + /* 52 S> */ B(Return), ] constant pool: [ "x", @@ -88,24 +87,23 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 31 +bytecode array length: 30 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Ldar), R(1), - B(Star), R(0), - B(LdaUndefined), - B(Return), + B(LdaTheHole), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(20), + B(Star), R(1), + B(Ldar), R(0), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(0), + B(Star), R(2), + /* 48 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + B(Mov), R(1), R(0), + B(LdaUndefined), + /* 54 S> */ B(Return), ] constant pool: [ "x", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden index 4fc5c4ff99..0b25fbf329 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden @@ -13,19 +13,19 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 24 +bytecode array length: 21 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 72 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -39,23 +39,23 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 37 +bytecode array length: 34 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 72 S> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + /* 82 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -70,27 +70,27 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 45 +bytecode array length: 42 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(20), - B(Star), R(2), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 45 S> */ B(LdaSmi), U8(20), + B(Star), R(2), + /* 45 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + B(Ldar), R(2), + B(StaContextSlot), R(context), U8(4), + /* 45 E> */ B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 78 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, @@ -105,28 +105,28 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 47 +bytecode array length: 44 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(1), - B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(CreateClosure), U8(0), U8(0), - B(Star), R(0), - B(StackCheck), - B(LdaSmi), U8(10), - B(StaContextSlot), R(context), U8(4), - B(LdaSmi), U8(20), - B(Star), R(2), - B(LdaContextSlot), R(context), U8(4), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), - B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), - B(LdaUndefined), - B(Return), + B(CreateFunctionContext), U8(1), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), + B(CreateClosure), U8(0), U8(2), + B(Star), R(0), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 46 S> */ B(LdaSmi), U8(20), + B(Star), R(2), + /* 48 E> */ B(LdaContextSlot), R(context), U8(4), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + B(Ldar), R(2), + B(StaContextSlot), R(context), U8(4), + B(LdaUndefined), + /* 80 S> */ B(Return), ] constant pool: [ InstanceType::SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden index 0a96caeee2..dd9f714394 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden @@ -16,14 +16,13 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Return), + /* 21 E> */ B(StackCheck), + /* 26 S> */ B(LdaGlobal), U8(1), + /* 36 S> */ B(Return), ] constant pool: [ - "a", ] handlers: [ ] @@ -36,14 +35,13 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Return), + /* 27 E> */ B(StackCheck), + /* 32 S> */ B(LdaGlobal), U8(1), + /* 42 S> */ B(Return), ] constant pool: [ - "t", ] handlers: [ ] @@ -56,14 +54,13 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaGlobal), U8(0), U8(1), - B(Return), + /* 17 E> */ B(StackCheck), + /* 22 S> */ B(LdaGlobal), U8(1), + /* 32 S> */ B(Return), ] constant pool: [ - "a", ] handlers: [ ] @@ -204,401 +201,272 @@ snippet: " } f({name: 1}); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 1032 +bytecode array length: 646 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(255), - B(Wide), B(LdaGlobal), U16(1), U16(257), - B(Return), + /* 17 E> */ B(StackCheck), + /* 25 S> */ B(Nop), + /* 26 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 35 S> */ B(Nop), + /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 45 S> */ B(Nop), + /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 55 S> */ B(Nop), + /* 56 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 65 S> */ B(Nop), + /* 66 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 75 S> */ B(Nop), + /* 76 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 85 S> */ B(Nop), + /* 86 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 95 S> */ B(Nop), + /* 96 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 105 S> */ B(Nop), + /* 106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 115 S> */ B(Nop), + /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 125 S> */ B(Nop), + /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 135 S> */ B(Nop), + /* 136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 145 S> */ B(Nop), + /* 146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 155 S> */ B(Nop), + /* 156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 165 S> */ B(Nop), + /* 166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 175 S> */ B(Nop), + /* 176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 185 S> */ B(Nop), + /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 195 S> */ B(Nop), + /* 196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 205 S> */ B(Nop), + /* 206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 215 S> */ B(Nop), + /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 225 S> */ B(Nop), + /* 226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 235 S> */ B(Nop), + /* 236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 245 S> */ B(Nop), + /* 246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 255 S> */ B(Nop), + /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 265 S> */ B(Nop), + /* 266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 275 S> */ B(Nop), + /* 276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 285 S> */ B(Nop), + /* 286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 295 S> */ B(Nop), + /* 296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 305 S> */ B(Nop), + /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 315 S> */ B(Nop), + /* 316 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 325 S> */ B(Nop), + /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 335 S> */ B(Nop), + /* 336 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 345 S> */ B(Nop), + /* 346 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 355 S> */ B(Nop), + /* 356 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 365 S> */ B(Nop), + /* 366 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 375 S> */ B(Nop), + /* 376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 385 S> */ B(Nop), + /* 386 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 395 S> */ B(Nop), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 405 S> */ B(Nop), + /* 406 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 415 S> */ B(Nop), + /* 416 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 425 S> */ B(Nop), + /* 426 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 435 S> */ B(Nop), + /* 436 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 445 S> */ B(Nop), + /* 446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 455 S> */ B(Nop), + /* 456 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 465 S> */ B(Nop), + /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 475 S> */ B(Nop), + /* 476 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 485 S> */ B(Nop), + /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 495 S> */ B(Nop), + /* 496 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 505 S> */ B(Nop), + /* 506 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 515 S> */ B(Nop), + /* 516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 525 S> */ B(Nop), + /* 526 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 535 S> */ B(Nop), + /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 545 S> */ B(Nop), + /* 546 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 555 S> */ B(Nop), + /* 556 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 565 S> */ B(Nop), + /* 566 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 575 S> */ B(Nop), + /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 585 S> */ B(Nop), + /* 586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 595 S> */ B(Nop), + /* 596 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 605 S> */ B(Nop), + /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 615 S> */ B(Nop), + /* 616 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 625 S> */ B(Nop), + /* 626 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 635 S> */ B(Nop), + /* 636 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 645 S> */ B(Nop), + /* 646 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 655 S> */ B(Nop), + /* 656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 665 S> */ B(Nop), + /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 675 S> */ B(Nop), + /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 685 S> */ B(Nop), + /* 686 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 695 S> */ B(Nop), + /* 696 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 705 S> */ B(Nop), + /* 706 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 715 S> */ B(Nop), + /* 716 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 725 S> */ B(Nop), + /* 726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 735 S> */ B(Nop), + /* 736 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 745 S> */ B(Nop), + /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 755 S> */ B(Nop), + /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 765 S> */ B(Nop), + /* 766 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 775 S> */ B(Nop), + /* 776 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 785 S> */ B(Nop), + /* 786 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 795 S> */ B(Nop), + /* 796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 805 S> */ B(Nop), + /* 806 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 815 S> */ B(Nop), + /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 825 S> */ B(Nop), + /* 826 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 835 S> */ B(Nop), + /* 836 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 845 S> */ B(Nop), + /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 855 S> */ B(Nop), + /* 856 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 865 S> */ B(Nop), + /* 866 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 875 S> */ B(Nop), + /* 876 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 885 S> */ B(Nop), + /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 895 S> */ B(Nop), + /* 896 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 905 S> */ B(Nop), + /* 906 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 915 S> */ B(Nop), + /* 916 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 925 S> */ B(Nop), + /* 926 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 935 S> */ B(Nop), + /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 945 S> */ B(Nop), + /* 946 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 955 S> */ B(Nop), + /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 965 S> */ B(Nop), + /* 966 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 975 S> */ B(Nop), + /* 976 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 985 S> */ B(Nop), + /* 986 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 995 S> */ B(Nop), + /* 996 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 1005 S> */ B(Nop), + /* 1006 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 1015 S> */ B(Nop), + /* 1016 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 1025 S> */ B(Nop), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 1035 S> */ B(Nop), + /* 1036 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 1045 S> */ B(Nop), + /* 1046 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 1055 S> */ B(Nop), + /* 1056 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 1065 S> */ B(Nop), + /* 1066 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 1075 S> */ B(Nop), + /* 1076 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 1085 S> */ B(Nop), + /* 1086 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 1095 S> */ B(Nop), + /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 1105 S> */ B(Nop), + /* 1106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 1115 S> */ B(Nop), + /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1125 S> */ B(Nop), + /* 1126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1135 S> */ B(Nop), + /* 1136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1145 S> */ B(Nop), + /* 1146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1155 S> */ B(Nop), + /* 1156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1165 S> */ B(Nop), + /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1175 S> */ B(Nop), + /* 1176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1185 S> */ B(Nop), + /* 1186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1195 S> */ B(Nop), + /* 1196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1205 S> */ B(Nop), + /* 1206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1215 S> */ B(Nop), + /* 1216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1225 S> */ B(Nop), + /* 1226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1235 S> */ B(Nop), + /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1245 S> */ B(Nop), + /* 1246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1255 S> */ B(Nop), + /* 1256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1265 S> */ B(Nop), + /* 1266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1275 S> */ B(Nop), + /* 1276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1285 S> */ B(Nop), + /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1295 S> */ B(Nop), + /* 1296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1305 S> */ B(Wide), B(LdaGlobal), U16(257), + /* 1315 S> */ B(Return), ] constant pool: [ "name", - "a", ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden index cddb9a1429..b8c8c5fa72 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden @@ -15,12 +15,12 @@ frame size: 1 parameter count: 1 bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(JumpIfToBooleanTrue), U8(4), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanTrue), U8(4), + B(LdaSmi), U8(3), + /* 60 S> */ B(Return), ] constant pool: [ ] @@ -31,19 +31,18 @@ handlers: [ snippet: " var x = 0; return (x == 1) || 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(TestEqual), R(1), - B(JumpIfTrue), U8(4), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(1), + /* 55 E> */ B(TestEqual), R(0), + B(JumpIfTrue), U8(4), + B(LdaSmi), U8(3), + /* 67 S> */ B(Return), ] constant pool: [ ] @@ -58,12 +57,12 @@ frame size: 1 parameter count: 1 bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(4), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(4), + B(LdaSmi), U8(3), + /* 60 S> */ B(Return), ] constant pool: [ ] @@ -74,19 +73,18 @@ handlers: [ snippet: " var x = 0; return (x == 0) && 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Star), R(1), - B(LdaZero), - B(TestEqual), R(1), - B(JumpIfFalse), U8(4), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(LdaZero), + /* 55 E> */ B(TestEqual), R(0), + B(JumpIfFalse), U8(4), + B(LdaSmi), U8(3), + /* 67 S> */ B(Return), ] constant pool: [ ] @@ -101,12 +99,12 @@ frame size: 1 parameter count: 1 bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(JumpIfToBooleanTrue), U8(4), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanTrue), U8(4), + B(LdaSmi), U8(3), + /* 68 S> */ B(Return), ] constant pool: [ ] @@ -119,25 +117,21 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 24 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(2), - B(Star), R(0), - B(LdaSmi), U8(3), - B(Star), R(1), - B(LdaSmi), U8(4), - B(Star), R(2), - B(Ldar), R(0), - B(JumpIfToBooleanTrue), U8(16), - B(Ldar), R(0), - B(Ldar), R(1), - B(Ldar), R(0), - B(Ldar), R(1), - B(LdaSmi), U8(5), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(2), + B(Star), R(0), + /* 49 S> */ B(LdaSmi), U8(3), + B(Star), R(1), + /* 56 S> */ B(LdaSmi), U8(4), + B(Star), R(2), + /* 59 S> */ B(Ldar), R(0), + B(JumpIfToBooleanTrue), U8(8), + B(LdaSmi), U8(5), + B(Star), R(2), + B(LdaSmi), U8(3), + /* 95 S> */ B(Return), ] constant pool: [ ] @@ -184,145 +178,145 @@ frame size: 3 parameter count: 1 bytecode array length: 276 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Star), R(2), - B(Ldar), R(0), - B(JumpIfToBooleanTrueConstant), U8(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 60 S> */ B(LdaSmi), U8(3), + B(Star), R(2), + /* 63 S> */ B(Ldar), R(0), + B(JumpIfToBooleanTrueConstant), U8(0), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(3), + /* 624 S> */ B(Return), ] constant pool: [ 260, @@ -370,145 +364,145 @@ frame size: 3 parameter count: 1 bytecode array length: 275 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Star), R(2), - B(Ldar), R(0), - B(JumpIfToBooleanFalseConstant), U8(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 60 S> */ B(LdaSmi), U8(3), + B(Star), R(2), + /* 63 S> */ B(Ldar), R(0), + B(JumpIfToBooleanFalseConstant), U8(0), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(3), + /* 624 S> */ B(Return), ] constant pool: [ 260, @@ -552,152 +546,150 @@ snippet: " a = 1, b = 2, a = 1, b = 2, 3); " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 282 +bytecode array length: 278 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Star), R(2), - B(Ldar), R(0), - B(Star), R(3), - B(LdaSmi), U8(3), - B(TestGreaterThan), R(3), - B(JumpIfTrueConstant), U8(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 60 S> */ B(LdaSmi), U8(3), + B(Star), R(2), + /* 63 S> */ B(LdaSmi), U8(3), + /* 73 E> */ B(TestGreaterThan), R(0), + B(JumpIfTrueConstant), U8(0), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(3), + /* 630 S> */ B(Return), ] constant pool: [ 260, @@ -741,152 +733,150 @@ snippet: " a = 1, b = 2, a = 1, b = 2, 3); " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 281 +bytecode array length: 277 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Star), R(2), - B(Ldar), R(0), - B(Star), R(3), - B(LdaSmi), U8(5), - B(TestLessThan), R(3), - B(JumpIfFalseConstant), U8(0), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(2), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 53 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 60 S> */ B(LdaSmi), U8(3), + B(Star), R(2), + /* 63 S> */ B(LdaSmi), U8(5), + /* 73 E> */ B(TestLessThan), R(0), + B(JumpIfFalseConstant), U8(0), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(2), + B(LdaSmi), U8(3), + /* 630 S> */ B(Return), ] constant pool: [ 260, @@ -902,9 +892,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaZero), + /* 49 S> */ B(Return), ] constant pool: [ ] @@ -919,9 +909,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(1), + /* 49 S> */ B(Return), ] constant pool: [ ] @@ -936,15 +926,15 @@ frame size: 1 parameter count: 1 bytecode array length: 15 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(4), - B(LdaSmi), U8(3), - B(JumpIfToBooleanTrue), U8(3), - B(LdaZero), - B(LdaSmi), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(4), + B(LdaSmi), U8(3), + B(JumpIfToBooleanTrue), U8(3), + B(LdaZero), + B(LdaSmi), U8(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 acec42f2e0..ed13d254ac 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden @@ -11,36 +11,38 @@ wrap: yes snippet: " eval('var x = 10;'); return x; " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 67 +bytecode array length: 68 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(1), R(4), - B(Mov), R(3), R(5), - B(Mov), R(closure), R(6), - B(LdaZero), - B(Star), R(7), - B(LdaSmi), U8(30), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5), - B(Star), R(1), - B(Call), R(1), R(2), U8(2), U8(0), - B(LdaLookupSlot), U8(2), - B(Return), + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(6), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaConstant), U8(0), + B(Star), R(3), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(LdaConstant), U8(1), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(30), + B(Star), R(8), + B(LdaSmi), U8(34), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 34 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 55 S> */ B(LdaLookupSlot), U8(2), + /* 65 S> */ B(Return), ] constant pool: [ "eval", @@ -54,37 +56,39 @@ handlers: [ snippet: " eval('var x = 10;'); return typeof x; " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 68 +bytecode array length: 69 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(1), R(4), - B(Mov), R(3), R(5), - B(Mov), R(closure), R(6), - B(LdaZero), - B(Star), R(7), - B(LdaSmi), U8(30), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5), - B(Star), R(1), - B(Call), R(1), R(2), U8(2), U8(0), - B(LdaLookupSlotInsideTypeof), U8(2), - B(TypeOf), - B(Return), + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(6), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaConstant), U8(0), + B(Star), R(3), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(LdaConstant), U8(1), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(30), + B(Star), R(8), + B(LdaSmi), U8(34), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 34 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 55 S> */ B(LdaLookupSlotInsideTypeof), U8(2), + B(TypeOf), + /* 72 S> */ B(Return), ] constant pool: [ "eval", @@ -98,37 +102,39 @@ handlers: [ snippet: " x = 20; return eval(''); " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 69 +bytecode array length: 70 bytecodes: [ - B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), - B(PushContext), R(0), - B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), - B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), - B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - B(StackCheck), - B(LdaSmi), U8(20), - B(StaLookupSlotSloppy), U8(0), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(1), R(4), - B(Mov), R(3), R(5), - B(Mov), R(closure), R(6), - B(LdaZero), - B(Star), R(7), - B(LdaSmi), U8(30), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5), - B(Star), R(1), - B(Call), R(1), R(2), U8(2), U8(0), - B(Return), + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(5), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(6), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(20), + /* 36 E> */ B(StaLookupSlotSloppy), U8(0), + /* 42 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(LdaConstant), U8(2), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(30), + B(Star), R(8), + B(LdaSmi), U8(49), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 49 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 59 S> */ B(Return), ] constant pool: [ "x", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden index 26e11e3b18..41476311e8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden @@ -21,9 +21,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaLookupSlot), U8(0), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaLookupSlot), U8(0), + /* 25 S> */ B(Return), ] constant pool: [ "x", @@ -44,11 +44,11 @@ frame size: 0 parameter count: 1 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(StaLookupSlotSloppy), U8(0), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaSmi), U8(10), + /* 17 E> */ B(StaLookupSlotSloppy), U8(0), + B(LdaUndefined), + /* 23 S> */ B(Return), ] constant pool: [ "x", @@ -69,11 +69,11 @@ frame size: 0 parameter count: 1 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(StaLookupSlotStrict), U8(0), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 29 S> */ B(LdaSmi), U8(10), + /* 31 E> */ B(StaLookupSlotStrict), U8(0), + B(LdaUndefined), + /* 37 S> */ B(Return), ] constant pool: [ "x", @@ -94,10 +94,10 @@ frame size: 0 parameter count: 1 bytecode array length: 5 bytecodes: [ - B(StackCheck), - B(LdaLookupSlotInsideTypeof), U8(0), - B(TypeOf), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(LdaLookupSlotInsideTypeof), U8(0), + B(TypeOf), + /* 32 S> */ B(Return), ] constant pool: [ "x", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden index 2fdc3e9f54..a668d62452 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden @@ -281,521 +281,521 @@ frame size: 1 parameter count: 1 bytecode array length: 1030 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(LdaLookupSlot), U16(256), - B(Return), + /* 10 E> */ B(StackCheck), + /* 22 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 34 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 46 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 58 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 70 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 82 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 94 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 106 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 118 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 130 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 142 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 154 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 166 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 178 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 190 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 202 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 214 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 226 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 238 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 250 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 262 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 274 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 286 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 298 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 310 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 322 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 334 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 346 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 358 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 370 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 382 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 394 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 406 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 418 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 430 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 442 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 454 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 466 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 478 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 490 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 502 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 514 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 526 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 538 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 550 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 562 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 574 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 586 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 598 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 610 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 622 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 634 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 646 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 658 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 670 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 682 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 694 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 706 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 718 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 730 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 742 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 754 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 766 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 778 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 790 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 802 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 814 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 826 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 838 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 850 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 862 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 874 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 886 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 898 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 910 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 922 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 934 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 946 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 958 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 970 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 982 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 994 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 1006 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 1018 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 1030 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 1042 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 1054 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 1066 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 1078 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 1090 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 1102 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 1114 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 1126 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 1138 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 1150 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 1162 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1174 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1186 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1198 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1210 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1222 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1234 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1246 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1258 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1270 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1282 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1294 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1306 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1318 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1330 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1342 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1354 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1366 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1378 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1390 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1402 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1414 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1426 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1438 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1450 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1462 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1474 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1486 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1498 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1510 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1522 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1534 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1546 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1558 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1570 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1582 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1594 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1606 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1618 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1630 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1642 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1654 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1666 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1678 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1690 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1702 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1714 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1726 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1738 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1750 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1762 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1774 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1786 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1798 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1810 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1822 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1834 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1846 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1858 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1870 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1882 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1894 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1906 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1918 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1930 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1942 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1954 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1966 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1978 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1990 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 2002 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 2014 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 2026 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 2038 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 2050 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 2062 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 2074 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 2086 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 2098 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 2110 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 2122 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 2134 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 2146 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 2158 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 2170 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 2182 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 2194 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 2206 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 2218 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 2230 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 2242 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 2254 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 2266 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 2278 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 2290 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 2302 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 2314 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 2326 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 2338 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 2350 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 2362 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2374 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2386 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2398 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2410 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2422 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2434 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2446 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2458 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2470 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2482 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2494 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2506 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2518 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2530 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2542 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2554 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2566 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2578 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2590 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2602 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2614 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2626 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2638 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2650 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2662 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2674 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2686 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2698 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2710 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2722 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2734 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2746 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2758 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2770 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2782 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2794 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2806 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2818 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2830 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2842 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2854 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2866 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2878 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2890 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2902 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2914 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2926 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2938 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2950 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2962 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2974 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2986 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2998 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 3010 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 3022 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 3034 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 3046 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 3058 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 3070 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 3082 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 3086 S> */ B(Wide), B(LdaLookupSlot), U16(256), + /* 3095 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, @@ -1332,522 +1332,522 @@ frame size: 1 parameter count: 1 bytecode array length: 1031 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(LdaLookupSlotInsideTypeof), U16(256), - B(TypeOf), - B(Return), + /* 10 E> */ B(StackCheck), + /* 22 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 34 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 46 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 58 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 70 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 82 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 94 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 106 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 118 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 130 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 142 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 154 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 166 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 178 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 190 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 202 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 214 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 226 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 238 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 250 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 262 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 274 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 286 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 298 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 310 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 322 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 334 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 346 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 358 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 370 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 382 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 394 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 406 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 418 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 430 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 442 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 454 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 466 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 478 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 490 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 502 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 514 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 526 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 538 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 550 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 562 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 574 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 586 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 598 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 610 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 622 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 634 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 646 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 658 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 670 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 682 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 694 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 706 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 718 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 730 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 742 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 754 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 766 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 778 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 790 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 802 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 814 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 826 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 838 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 850 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 862 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 874 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 886 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 898 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 910 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 922 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 934 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 946 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 958 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 970 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 982 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 994 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 1006 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 1018 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 1030 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 1042 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 1054 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 1066 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 1078 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 1090 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 1102 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 1114 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 1126 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 1138 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 1150 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 1162 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1174 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1186 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1198 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1210 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1222 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1234 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1246 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1258 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1270 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1282 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1294 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1306 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1318 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1330 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1342 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1354 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1366 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1378 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1390 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1402 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1414 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1426 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1438 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1450 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1462 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1474 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1486 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1498 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1510 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1522 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1534 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1546 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1558 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1570 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1582 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1594 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1606 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1618 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1630 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1642 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1654 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1666 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1678 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1690 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1702 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1714 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1726 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1738 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1750 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1762 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1774 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1786 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1798 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1810 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1822 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1834 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1846 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1858 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1870 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1882 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1894 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1906 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1918 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1930 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1942 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1954 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1966 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1978 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1990 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 2002 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 2014 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 2026 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 2038 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 2050 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 2062 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 2074 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 2086 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 2098 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 2110 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 2122 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 2134 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 2146 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 2158 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 2170 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 2182 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 2194 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 2206 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 2218 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 2230 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 2242 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 2254 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 2266 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 2278 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 2290 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 2302 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 2314 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 2326 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 2338 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 2350 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 2362 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2374 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2386 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2398 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2410 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2422 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2434 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2446 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2458 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2470 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2482 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2494 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2506 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2518 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2530 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2542 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2554 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2566 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2578 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2590 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2602 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2614 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2626 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2638 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2650 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2662 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2674 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2686 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2698 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2710 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2722 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2734 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2746 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2758 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2770 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2782 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2794 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2806 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2818 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2830 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2842 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2854 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2866 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2878 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2890 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2902 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2914 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2926 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2938 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2950 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2962 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2974 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2986 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2998 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 3010 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 3022 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 3034 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 3046 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 3058 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 3070 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 3082 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 3086 S> */ B(Wide), B(LdaLookupSlotInsideTypeof), U16(256), + B(TypeOf), + /* 3102 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, @@ -2384,523 +2384,523 @@ frame size: 1 parameter count: 1 bytecode array length: 1033 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(LdaSmi), U8(10), - B(Wide), B(StaLookupSlotSloppy), U16(256), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 22 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 34 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 46 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 58 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 70 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 82 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 94 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 106 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 118 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 130 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 142 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 154 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 166 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 178 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 190 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 202 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 214 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 226 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 238 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 250 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 262 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 274 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 286 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 298 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 310 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 322 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 334 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 346 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 358 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 370 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 382 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 394 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 406 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 418 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 430 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 442 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 454 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 466 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 478 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 490 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 502 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 514 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 526 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 538 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 550 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 562 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 574 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 586 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 598 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 610 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 622 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 634 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 646 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 658 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 670 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 682 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 694 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 706 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 718 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 730 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 742 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 754 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 766 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 778 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 790 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 802 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 814 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 826 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 838 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 850 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 862 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 874 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 886 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 898 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 910 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 922 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 934 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 946 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 958 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 970 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 982 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 994 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 1006 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 1018 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 1030 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 1042 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 1054 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 1066 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 1078 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 1090 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 1102 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 1114 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 1126 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 1138 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 1150 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 1162 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1174 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1186 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1198 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1210 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1222 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1234 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1246 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1258 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1270 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1282 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1294 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1306 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1318 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1330 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1342 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1354 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1366 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1378 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1390 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1402 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1414 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1426 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1438 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1450 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1462 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1474 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1486 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1498 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1510 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1522 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1534 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1546 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1558 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1570 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1582 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1594 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1606 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1618 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1630 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1642 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1654 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1666 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1678 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1690 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1702 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1714 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1726 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1738 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1750 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1762 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1774 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1786 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1798 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1810 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1822 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1834 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1846 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1858 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1870 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1882 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1894 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1906 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1918 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1930 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1942 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1954 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1966 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1978 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1990 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 2002 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 2014 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 2026 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 2038 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 2050 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 2062 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 2074 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 2086 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 2098 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 2110 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 2122 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 2134 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 2146 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 2158 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 2170 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 2182 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 2194 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 2206 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 2218 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 2230 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 2242 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 2254 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 2266 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 2278 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 2290 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 2302 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 2314 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 2326 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 2338 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 2350 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 2362 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2374 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2386 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2398 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2410 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2422 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2434 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2446 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2458 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2470 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2482 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2494 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2506 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2518 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2530 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2542 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2554 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2566 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2578 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2590 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2602 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2614 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2626 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2638 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2650 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2662 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2674 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2686 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2698 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2710 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2722 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2734 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2746 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2758 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2770 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2782 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2794 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2806 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2818 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2830 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2842 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2854 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2866 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2878 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2890 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2902 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2914 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2926 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2938 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2950 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2962 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2974 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2986 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2998 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 3010 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 3022 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 3034 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 3046 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 3058 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 3070 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 3082 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 3086 S> */ B(LdaSmi), U8(10), + /* 3088 E> */ B(Wide), B(StaLookupSlotSloppy), U16(256), + B(LdaUndefined), + /* 3093 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, @@ -3438,523 +3438,523 @@ frame size: 1 parameter count: 1 bytecode array length: 1033 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(LdaSmi), U8(10), - B(Wide), B(StaLookupSlotStrict), U16(256), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 35 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 47 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 59 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 71 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 83 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 95 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 107 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 119 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 131 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 143 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 155 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 167 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 179 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 191 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 203 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 215 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 227 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 239 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 251 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 263 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 275 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 287 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 299 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 311 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 323 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 335 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 347 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 359 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 371 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 383 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 395 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 407 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 419 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 431 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 443 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 455 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 467 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 479 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 491 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 503 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 515 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 527 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 539 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 551 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 563 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 575 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 587 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 599 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 611 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 623 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 635 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 647 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 659 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 671 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 683 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 695 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 707 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 719 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 731 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 743 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 755 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 767 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 779 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 791 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 803 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 815 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 827 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 839 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 851 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 863 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 875 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 887 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 899 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 911 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 923 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 935 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 947 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 959 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 971 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 983 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 995 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 1007 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 1019 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 1031 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 1043 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 1055 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 1067 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 1079 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 1091 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 1103 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 1115 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 1127 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 1139 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 1151 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 1163 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 1175 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1187 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1199 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1211 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1223 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1235 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1247 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1259 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1271 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1283 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1295 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1307 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1319 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1331 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1343 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1355 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1367 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1379 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1391 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1403 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1415 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1427 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1439 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1451 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1463 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1475 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1487 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1499 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1511 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1523 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1535 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1547 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1559 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1571 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1583 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1595 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1607 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1619 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1631 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1643 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1655 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1667 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1679 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1691 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1703 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1715 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1727 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1739 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1751 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1763 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1775 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1787 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1799 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1811 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1823 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1835 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1847 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1859 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1871 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1883 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1895 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1907 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1919 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1931 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1943 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1955 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1967 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1979 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1991 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 2003 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 2015 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 2027 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 2039 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 2051 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 2063 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 2075 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 2087 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 2099 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 2111 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 2123 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 2135 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 2147 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 2159 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 2171 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 2183 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 2195 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 2207 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 2219 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 2231 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 2243 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 2255 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 2267 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 2279 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 2291 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 2303 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 2315 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 2327 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 2339 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 2351 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 2363 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 2375 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2387 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2399 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2411 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2423 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2435 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2447 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2459 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2471 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2483 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2495 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2507 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2519 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2531 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2543 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2555 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2567 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2579 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2591 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2603 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2615 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2627 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2639 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2651 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2663 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2675 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2687 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2699 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2711 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2723 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2735 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2747 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2759 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2771 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2783 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2795 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2807 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2819 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2831 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2843 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2855 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2867 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2879 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2891 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2903 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2915 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2927 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2939 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2951 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2963 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2975 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2987 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2999 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 3011 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 3023 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 3035 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 3047 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 3059 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 3071 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 3083 S> */ B(LdaConstant), U8(254), + B(Star), R(0), + /* 3095 S> */ B(LdaConstant), U8(255), + B(Star), R(0), + /* 3099 S> */ B(LdaSmi), U8(10), + /* 3101 E> */ B(Wide), B(StaLookupSlotStrict), U16(256), + B(LdaUndefined), + /* 3106 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden index da2d35e56b..090fb0bb7a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden @@ -11,22 +11,16 @@ wrap: yes snippet: " return new.target; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 19 +bytecode array length: 7 bytecodes: [ - B(Ldar), R(new_target), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), - B(Return), + B(Mov), R(new_target), R(0), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(Ldar), R(0), + /* 53 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, ] handlers: [ ] @@ -35,23 +29,16 @@ handlers: [ snippet: " new.target; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 20 +bytecode array length: 6 bytecodes: [ - B(Ldar), R(new_target), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), - B(LdaUndefined), - B(Return), + B(Mov), R(new_target), R(0), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaUndefined), + /* 46 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_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 063ebbf759..b9c7d0ca4d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden @@ -13,12 +13,12 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(7), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(35), R(0), + B(Ldar), R(0), + /* 46 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -32,12 +32,12 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + B(Ldar), R(0), + /* 71 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -51,17 +51,15 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 20 +bytecode array length: 17 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Ldar), R(0), - B(StoreICSloppy), R(1), U8(1), U8(1), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 75 E> */ B(StaNamedPropertySloppy), R(1), U8(1), U8(1), + B(Ldar), R(1), + /* 80 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -74,22 +72,18 @@ handlers: [ snippet: " var a = 1; return { val: a, val: a + 1 }; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 26 +bytecode array length: 21 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Ldar), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(Add), R(2), - B(StoreICSloppy), R(1), U8(1), U8(1), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + /* 67 E> */ B(AddSmi), U8(1), R(0), U8(1), + B(StaNamedPropertySloppy), R(1), U8(1), U8(2), + B(Ldar), R(1), + /* 76 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -104,15 +98,14 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(0), - B(CreateClosure), U8(1), U8(0), - B(StoreICSloppy), R(0), U8(2), U8(1), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + B(CreateClosure), U8(1), U8(2), + B(StaNamedPropertySloppy), R(0), U8(2), U8(1), + B(Ldar), R(0), + /* 67 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -128,15 +121,14 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(0), - B(CreateClosure), U8(1), U8(0), - B(StoreICSloppy), R(0), U8(2), U8(1), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + B(CreateClosure), U8(1), U8(2), + B(StaNamedPropertySloppy), R(0), U8(2), U8(1), + B(Ldar), R(0), + /* 68 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -152,23 +144,22 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 33 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(0), - B(Mov), R(0), R(1), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CreateClosure), U8(2), U8(0), - B(Star), R(3), - B(LdaNull), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CreateClosure), U8(2), U8(2), + B(Star), R(3), + B(LdaNull), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(Mov), R(0), R(1), + B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), + B(Ldar), R(0), + /* 68 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -184,23 +175,22 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 35 +bytecode array length: 34 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(0), - B(Mov), R(0), R(1), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CreateClosure), U8(2), U8(0), - B(Star), R(3), - B(CreateClosure), U8(3), U8(0), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CreateClosure), U8(2), U8(2), + B(Star), R(3), + B(CreateClosure), U8(3), U8(2), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(Mov), R(0), R(1), + B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), + B(Ldar), R(0), + /* 102 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -217,23 +207,22 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 33 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(0), - B(Mov), R(0), R(1), - B(LdaConstant), U8(1), - B(Star), R(2), - B(LdaNull), - B(Star), R(3), - B(CreateClosure), U8(2), U8(0), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), + B(LdaConstant), U8(1), + B(Star), R(2), + B(LdaNull), + B(Star), R(3), + B(CreateClosure), U8(2), U8(2), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(Mov), R(0), R(1), + B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), + B(Ldar), R(0), + /* 74 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -249,23 +238,21 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 33 +bytecode array length: 31 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(Mov), R(1), R(2), - B(LdaSmi), U8(1), - B(Star), R(3), - B(Ldar), R(0), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(LdaSmi), U8(1), + B(Star), R(3), + B(LdaZero), + B(Star), R(5), + B(Mov), R(1), R(2), + B(Mov), R(0), R(4), + /* 57 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), + B(Ldar), R(1), + /* 62 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -279,17 +266,16 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 21 +bytecode array length: 20 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(7), - B(Star), R(0), - B(Mov), R(0), R(1), - B(LdaNull), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(1), U8(2), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(35), R(0), + B(LdaNull), + B(Star), R(2), + B(Mov), R(0), R(1), + B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(1), U8(2), + B(Ldar), R(0), + /* 62 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, @@ -303,26 +289,23 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 37 +bytecode array length: 33 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CreateObjectLiteral), U8(1), U8(0), U8(7), - B(Star), R(1), - B(Mov), R(1), R(2), - B(Ldar), R(0), - B(ToName), - B(Star), R(3), - B(LdaSmi), U8(1), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(LdaZero), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), - B(Ldar), R(1), - B(Return), + /* 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), + /* 60 E> */ B(ToName), R(3), + B(LdaSmi), U8(1), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(LdaZero), + B(Star), R(6), + B(Mov), R(1), R(2), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), + B(Ldar), R(1), + /* 69 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -337,28 +320,24 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 43 +bytecode array length: 37 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CreateObjectLiteral), U8(1), U8(0), U8(5), - B(Star), R(1), - B(Ldar), R(0), - B(StoreICSloppy), R(1), U8(2), U8(1), - B(Mov), R(1), R(2), - B(Ldar), R(0), - B(ToName), - B(Star), R(3), - B(LdaSmi), U8(1), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(LdaZero), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), - B(Ldar), R(1), - B(Return), + /* 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(1), + /* 68 E> */ B(ToName), R(3), + B(LdaSmi), U8(1), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(LdaZero), + B(Star), R(6), + B(Mov), R(1), R(2), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), + B(Ldar), R(1), + /* 77 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -374,31 +353,27 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 53 +bytecode array length: 49 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CreateObjectLiteral), U8(1), U8(1), U8(7), - B(Star), R(1), - B(Mov), R(1), R(2), - B(Ldar), R(0), - B(ToName), - B(Star), R(3), - B(LdaSmi), U8(1), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(LdaZero), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), - B(Mov), R(1), R(2), - B(CreateObjectLiteral), U8(1), U8(0), U8(7), - B(Star), R(4), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(2), U8(2), - B(Ldar), R(1), - B(Return), + /* 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), + /* 60 E> */ B(ToName), R(3), + B(LdaSmi), U8(1), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(LdaZero), + B(Star), R(6), + B(Mov), R(1), R(2), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), + B(CreateObjectLiteral), U8(1), U8(0), U8(35), R(4), + B(Mov), R(1), R(2), + B(Mov), R(4), R(3), + B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(2), U8(2), + B(Ldar), R(1), + /* 84 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, @@ -413,42 +388,39 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 77 +bytecode array length: 73 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(CreateObjectLiteral), U8(1), U8(0), U8(7), - B(Star), R(1), - B(Mov), R(1), R(2), - B(Ldar), R(0), - B(ToName), - B(Star), R(3), - B(LdaConstant), U8(2), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(LdaZero), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), - B(Mov), R(1), R(2), - B(LdaConstant), U8(3), - B(Star), R(3), - B(CreateClosure), U8(4), U8(0), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineGetterPropertyUnchecked), R(2), U8(4), - B(Mov), R(1), R(2), - B(LdaConstant), U8(3), - B(Star), R(3), - B(CreateClosure), U8(5), U8(0), - B(Star), R(4), - B(LdaZero), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kDefineSetterPropertyUnchecked), R(2), U8(4), - B(Ldar), R(1), - B(Return), + /* 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), + /* 60 E> */ B(ToName), R(3), + B(LdaConstant), U8(2), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(LdaZero), + B(Star), R(6), + B(Mov), R(1), R(2), + B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), + B(LdaConstant), U8(3), + B(ToName), R(3), + B(CreateClosure), U8(4), U8(2), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(Mov), R(1), R(2), + B(CallRuntime), U16(Runtime::kDefineGetterPropertyUnchecked), R(2), U8(4), + B(LdaConstant), U8(3), + B(ToName), R(3), + B(CreateClosure), U8(5), U8(2), + B(Star), R(4), + B(LdaZero), + B(Star), R(5), + B(Mov), R(1), R(2), + B(CallRuntime), U16(Runtime::kDefineSetterPropertyUnchecked), R(2), U8(4), + B(Ldar), R(1), + /* 99 S> */ B(Return), ] constant pool: [ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden index 83c6fe9658..62b1ace69d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden @@ -270,524 +270,524 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 1035 +bytecode array length: 1037 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(CreateObjectLiteral), U16(256), U16(0), U8(5), - B(Star), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 41 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 51 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 61 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 71 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 81 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 91 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 101 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 111 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 121 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 131 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 141 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 151 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 161 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 171 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 181 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 191 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 201 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 211 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 221 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 231 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 241 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 251 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 261 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 271 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 281 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 291 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 301 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 311 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 321 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 331 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 341 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 351 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 361 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 371 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 381 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 391 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 401 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 411 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 421 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 431 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 441 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 451 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 461 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 471 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 481 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 491 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 501 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 511 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 521 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 531 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 541 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 551 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 561 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 571 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 581 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 591 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 601 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 611 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 621 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 631 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 641 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 651 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 661 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 671 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 681 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 691 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 701 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 711 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 721 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 731 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 741 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 751 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 761 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 771 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 781 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 791 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 801 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 811 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 821 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 831 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 841 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 851 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 861 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 871 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 881 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 891 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 901 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 911 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 921 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 931 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 941 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 951 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 961 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 971 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 981 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 991 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1001 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1011 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1021 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1031 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1041 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1051 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1061 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1071 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1081 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1091 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1101 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1111 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1121 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1131 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1141 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1151 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1161 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1171 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1181 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1191 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1201 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1211 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1221 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1231 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1241 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1251 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1261 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1271 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1281 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1291 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1301 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1311 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1321 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1331 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1341 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1351 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1361 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1371 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1381 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1391 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1401 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1411 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1421 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1431 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1441 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1451 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1461 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1471 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1481 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1491 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1501 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1511 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1521 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1531 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1541 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1551 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1561 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1571 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1581 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1591 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1601 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1611 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1621 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1631 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1641 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1651 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1661 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1671 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1681 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 1691 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 1701 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 1711 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 1721 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 1731 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 1741 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 1751 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 1761 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 1771 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 1781 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 1791 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 1801 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 1811 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 1821 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 1831 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 1841 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 1851 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 1861 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 1871 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 1881 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 1891 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 1901 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 1911 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 1921 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 1931 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 1941 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 1951 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 1961 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 1971 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 1981 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 1991 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2001 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2011 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2021 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2031 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2041 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2051 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2061 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2071 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2081 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2091 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2101 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2111 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2121 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2131 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2141 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2151 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2161 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2171 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2181 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2191 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2201 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2211 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2221 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2231 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2241 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2251 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2261 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2271 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2281 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2291 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2301 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2311 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2321 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2331 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2341 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2351 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2361 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2371 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2381 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2391 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2401 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2411 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2421 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2431 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2441 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2451 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2461 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2471 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2481 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2491 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2501 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2511 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2521 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 2531 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 2541 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 2551 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 2561 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 2571 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 2581 S> */ B(LdaConstant), U8(254), + 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), + B(Ldar), R(1), + /* 2638 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden index 378a5b7471..e58694f982 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden @@ -22,18 +22,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 21 +bytecode array length: 16 bytecodes: [ - B(StackCheck), - B(Ldar), R(context), - B(Star), R(0), - B(LdaContextSlot), R(0), U8(1), - B(Star), R(0), - B(LdaContextSlot), R(0), U8(4), - B(Star), R(1), - B(LdaContextSlot), R(context), U8(4), - B(Mul), R(1), - B(Return), + /* 97 E> */ B(StackCheck), + /* 102 S> */ B(LdrContextSlot), R(context), U8(1), R(0), + B(LdrContextSlot), R(0), U8(4), R(1), + /* 120 E> */ B(LdaContextSlot), R(context), U8(4), + B(Mul), R(1), U8(1), + /* 130 S> */ B(Return), ] constant pool: [ ] @@ -54,19 +50,15 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 22 +bytecode array length: 16 bytecodes: [ - B(StackCheck), - B(LdaContextSlot), R(context), U8(4), - B(Star), R(0), - B(Ldar), R(context), - B(Star), R(1), - B(LdaContextSlot), R(1), U8(1), - B(Star), R(1), - B(Ldar), R(0), - B(StaContextSlot), R(1), U8(4), - B(LdaUndefined), - B(Return), + /* 97 E> */ B(StackCheck), + /* 102 S> */ B(LdrContextSlot), R(context), U8(4), R(0), + /* 111 E> */ B(LdrContextSlot), R(context), U8(1), R(1), + B(Ldar), R(0), + B(StaContextSlot), R(1), U8(4), + B(LdaUndefined), + /* 123 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden index e124788baf..71b6df7687 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden @@ -17,9 +17,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(Ldar), R(this), - B(Return), + /* 10 E> */ B(StackCheck), + /* 15 S> */ B(Ldar), R(this), + /* 28 S> */ B(Return), ] constant pool: [ ] @@ -35,9 +35,9 @@ frame size: 0 parameter count: 2 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(Ldar), R(arg0), + /* 32 S> */ B(Return), ] constant pool: [ ] @@ -53,9 +53,9 @@ frame size: 0 parameter count: 2 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(Ldar), R(this), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(Ldar), R(this), + /* 32 S> */ B(Return), ] constant pool: [ ] @@ -71,9 +71,9 @@ frame size: 0 parameter count: 8 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg3), - B(Return), + /* 10 E> */ B(StackCheck), + /* 55 S> */ B(Ldar), R(arg3), + /* 68 S> */ B(Return), ] constant pool: [ ] @@ -89,9 +89,9 @@ frame size: 0 parameter count: 8 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(Ldar), R(this), - B(Return), + /* 10 E> */ B(StackCheck), + /* 55 S> */ B(Ldar), R(this), + /* 68 S> */ B(Return), ] constant pool: [ ] @@ -107,11 +107,11 @@ frame size: 0 parameter count: 2 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(arg0), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(LdaSmi), U8(1), + B(Star), R(arg0), + B(LdaUndefined), + /* 29 S> */ B(Return), ] constant pool: [ ] @@ -127,11 +127,11 @@ frame size: 0 parameter count: 5 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(arg1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 37 S> */ B(LdaSmi), U8(1), + B(Star), R(arg1), + B(LdaUndefined), + /* 47 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden index 08b20dd426..aadf2dec01 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden @@ -13,12 +13,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(Nop), + /* 55 S> */ B(Return), ] constant pool: [ ] @@ -29,17 +30,15 @@ handlers: [ snippet: " var x = 0; return x + 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Add), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(AddSmi), U8(3), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -50,17 +49,15 @@ handlers: [ snippet: " var x = 0; return x - 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Sub), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(SubSmi), U8(3), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -71,17 +68,16 @@ handlers: [ snippet: " var x = 4; return x * 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(4), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Mul), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(4), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(3), + B(Mul), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -92,17 +88,16 @@ handlers: [ snippet: " var x = 4; return x / 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(4), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Div), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(4), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(3), + B(Div), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -113,17 +108,16 @@ handlers: [ snippet: " var x = 4; return x % 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(4), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Mod), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(4), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(3), + B(Mod), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -134,17 +128,15 @@ handlers: [ snippet: " var x = 1; return x | 2; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(BitwiseOr), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(BitwiseOrSmi), U8(2), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -155,17 +147,16 @@ handlers: [ snippet: " var x = 1; return x ^ 2; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(BitwiseXor), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(2), + B(BitwiseXor), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -176,17 +167,15 @@ handlers: [ snippet: " var x = 1; return x & 2; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(2), - B(BitwiseAnd), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(BitwiseAndSmi), U8(2), R(0), U8(1), + /* 59 S> */ B(Return), ] constant pool: [ ] @@ -197,17 +186,15 @@ handlers: [ snippet: " var x = 10; return x << 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(ShiftLeft), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 46 S> */ B(ShiftLeftSmi), U8(3), R(0), U8(1), + /* 61 S> */ B(Return), ] constant pool: [ ] @@ -218,17 +205,15 @@ handlers: [ snippet: " var x = 10; return x >> 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(ShiftRight), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 46 S> */ B(ShiftRightSmi), U8(3), R(0), U8(1), + /* 61 S> */ B(Return), ] constant pool: [ ] @@ -239,17 +224,16 @@ handlers: [ snippet: " var x = 10; return x >>> 3; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(10), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(ShiftRightLogical), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(10), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(3), + B(ShiftRightLogical), R(0), U8(1), + /* 62 S> */ B(Return), ] constant pool: [ ] @@ -264,11 +248,11 @@ frame size: 1 parameter count: 1 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaSmi), U8(3), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(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 0a23f2b7e1..7eaaa88d05 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden @@ -14,9 +14,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(LdaUndefined), + /* 34 S> */ B(Return), ] constant pool: [ ] @@ -31,9 +31,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaUndefined), + /* 42 S> */ B(Return), ] constant pool: [ ] @@ -48,9 +48,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaNull), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaNull), + /* 47 S> */ B(Return), ] constant pool: [ ] @@ -65,9 +65,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaTrue), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaTrue), + /* 47 S> */ B(Return), ] constant pool: [ ] @@ -82,9 +82,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaFalse), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaFalse), + /* 48 S> */ B(Return), ] constant pool: [ ] @@ -99,9 +99,9 @@ frame size: 0 parameter count: 1 bytecode array length: 3 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaZero), + /* 44 S> */ B(Return), ] constant pool: [ ] @@ -116,9 +116,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(1), + /* 45 S> */ B(Return), ] constant pool: [ ] @@ -133,9 +133,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(-1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(-1), + /* 45 S> */ B(Return), ] constant pool: [ ] @@ -150,9 +150,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(127), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(127), + /* 47 S> */ B(Return), ] constant pool: [ ] @@ -167,9 +167,26 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(-128), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(-128), + /* 47 S> */ B(Return), +] +constant pool: [ +] +handlers: [ +] + +--- +snippet: " + return 2.0; +" +frame size: 0 +parameter count: 1 +bytecode array length: 4 +bytecodes: [ + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(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 d6108f12d6..23501bd4b9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden @@ -13,17 +13,15 @@ snippet: " function f(a) { return a.func(); } f(new (function Obj() { this.func = function() { return; }})()) " -frame size: 2 +frame size: 1 parameter count: 2 -bytecode array length: 17 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(3), - B(Star), R(0), - B(Call), R(0), R(1), U8(1), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(Nop), + /* 24 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + /* 25 E> */ B(Call), R(0), R(arg0), U8(1), U8(1), + /* 33 S> */ B(Return), ] constant pool: [ "func", @@ -38,19 +36,17 @@ snippet: " " frame size: 4 parameter count: 4 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(3), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(2), - B(Ldar), R(arg2), - B(Star), R(3), - B(Call), R(0), R(1), U8(3), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 22 S> */ B(Nop), + /* 30 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + B(Ldar), R(0), + B(Mov), R(arg0), R(1), + B(Mov), R(arg1), R(2), + B(Mov), R(arg2), R(3), + /* 31 E> */ B(Call), R(0), R(1), U8(3), U8(1), + /* 43 S> */ B(Return), ] constant pool: [ "func", @@ -65,22 +61,18 @@ snippet: " " frame size: 4 parameter count: 3 -bytecode array length: 31 +bytecode array length: 26 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(3), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(3), - B(Ldar), R(arg1), - B(Add), R(3), - B(Star), R(2), - B(Ldar), R(arg1), - B(Star), R(3), - B(Call), R(0), R(1), U8(3), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(Nop), + /* 27 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + B(Ldar), R(arg1), + /* 37 E> */ B(Add), R(arg1), U8(5), + B(Star), R(2), + B(Mov), R(arg0), R(1), + B(Mov), R(arg1), R(3), + /* 28 E> */ B(Call), R(0), R(1), U8(3), U8(1), + /* 44 S> */ B(Return), ] constant pool: [ "func", @@ -222,401 +214,271 @@ snippet: " return a.func(); } f(new (function Obj() { this.func = function() { return; }})()) " -frame size: 2 +frame size: 1 parameter count: 2 -bytecode array length: 1050 +bytecode array length: 663 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(255), - B(Ldar), R(arg0), - B(Star), R(1), - B(Wide), B(LoadIC), R16(1), U16(0), U16(259), - B(Star), R(0), - B(Wide), B(Call), R16(0), R16(1), U16(1), U16(257), - B(Return), + /* 10 E> */ B(StackCheck), + /* 17 S> */ B(Nop), + /* 18 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 26 S> */ B(Nop), + /* 27 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 35 S> */ B(Nop), + /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 44 S> */ B(Nop), + /* 45 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 53 S> */ B(Nop), + /* 54 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 62 S> */ B(Nop), + /* 63 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 71 S> */ B(Nop), + /* 72 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 80 S> */ B(Nop), + /* 81 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 89 S> */ B(Nop), + /* 90 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 98 S> */ B(Nop), + /* 99 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 107 S> */ B(Nop), + /* 108 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 116 S> */ B(Nop), + /* 117 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 125 S> */ B(Nop), + /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 134 S> */ B(Nop), + /* 135 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 143 S> */ B(Nop), + /* 144 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 152 S> */ B(Nop), + /* 153 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 161 S> */ B(Nop), + /* 162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 170 S> */ B(Nop), + /* 171 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 179 S> */ B(Nop), + /* 180 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 188 S> */ B(Nop), + /* 189 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 197 S> */ B(Nop), + /* 198 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 206 S> */ B(Nop), + /* 207 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 215 S> */ B(Nop), + /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 224 S> */ B(Nop), + /* 225 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 233 S> */ B(Nop), + /* 234 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 242 S> */ B(Nop), + /* 243 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 251 S> */ B(Nop), + /* 252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 260 S> */ B(Nop), + /* 261 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 269 S> */ B(Nop), + /* 270 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 278 S> */ B(Nop), + /* 279 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 287 S> */ B(Nop), + /* 288 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 296 S> */ B(Nop), + /* 297 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 305 S> */ B(Nop), + /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 314 S> */ B(Nop), + /* 315 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 323 S> */ B(Nop), + /* 324 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 332 S> */ B(Nop), + /* 333 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 341 S> */ B(Nop), + /* 342 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 350 S> */ B(Nop), + /* 351 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 359 S> */ B(Nop), + /* 360 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 368 S> */ B(Nop), + /* 369 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 377 S> */ B(Nop), + /* 378 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 386 S> */ B(Nop), + /* 387 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 395 S> */ B(Nop), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 404 S> */ B(Nop), + /* 405 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 413 S> */ B(Nop), + /* 414 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 422 S> */ B(Nop), + /* 423 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 431 S> */ B(Nop), + /* 432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 440 S> */ B(Nop), + /* 441 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 449 S> */ B(Nop), + /* 450 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 458 S> */ B(Nop), + /* 459 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 467 S> */ B(Nop), + /* 468 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 476 S> */ B(Nop), + /* 477 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 485 S> */ B(Nop), + /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 494 S> */ B(Nop), + /* 495 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 503 S> */ B(Nop), + /* 504 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 512 S> */ B(Nop), + /* 513 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 521 S> */ B(Nop), + /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 530 S> */ B(Nop), + /* 531 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 539 S> */ B(Nop), + /* 540 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 548 S> */ B(Nop), + /* 549 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 557 S> */ B(Nop), + /* 558 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 566 S> */ B(Nop), + /* 567 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 575 S> */ B(Nop), + /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 584 S> */ B(Nop), + /* 585 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 593 S> */ B(Nop), + /* 594 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 602 S> */ B(Nop), + /* 603 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 611 S> */ B(Nop), + /* 612 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 620 S> */ B(Nop), + /* 621 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 629 S> */ B(Nop), + /* 630 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 638 S> */ B(Nop), + /* 639 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 647 S> */ B(Nop), + /* 648 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 656 S> */ B(Nop), + /* 657 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 665 S> */ B(Nop), + /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 674 S> */ B(Nop), + /* 675 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 683 S> */ B(Nop), + /* 684 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 692 S> */ B(Nop), + /* 693 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 701 S> */ B(Nop), + /* 702 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 710 S> */ B(Nop), + /* 711 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 719 S> */ B(Nop), + /* 720 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 728 S> */ B(Nop), + /* 729 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 737 S> */ B(Nop), + /* 738 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 746 S> */ B(Nop), + /* 747 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 755 S> */ B(Nop), + /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 764 S> */ B(Nop), + /* 765 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 773 S> */ B(Nop), + /* 774 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 782 S> */ B(Nop), + /* 783 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 791 S> */ B(Nop), + /* 792 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 800 S> */ B(Nop), + /* 801 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 809 S> */ B(Nop), + /* 810 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 818 S> */ B(Nop), + /* 819 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 827 S> */ B(Nop), + /* 828 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 836 S> */ B(Nop), + /* 837 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 845 S> */ B(Nop), + /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 854 S> */ B(Nop), + /* 855 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 863 S> */ B(Nop), + /* 864 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 872 S> */ B(Nop), + /* 873 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 881 S> */ B(Nop), + /* 882 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 890 S> */ B(Nop), + /* 891 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 899 S> */ B(Nop), + /* 900 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 908 S> */ B(Nop), + /* 909 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 917 S> */ B(Nop), + /* 918 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 926 S> */ B(Nop), + /* 927 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 935 S> */ B(Nop), + /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 944 S> */ B(Nop), + /* 945 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 953 S> */ B(Nop), + /* 954 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 962 S> */ B(Nop), + /* 963 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 971 S> */ B(Nop), + /* 972 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 980 S> */ B(Nop), + /* 981 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 989 S> */ B(Nop), + /* 990 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 998 S> */ B(Nop), + /* 999 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1007 S> */ B(Nop), + /* 1008 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1016 S> */ B(Nop), + /* 1017 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1025 S> */ B(Nop), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1034 S> */ B(Nop), + /* 1035 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1043 S> */ B(Nop), + /* 1044 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1052 S> */ B(Nop), + /* 1053 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1061 S> */ B(Nop), + /* 1062 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1070 S> */ B(Nop), + /* 1071 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1079 S> */ B(Nop), + /* 1080 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1088 S> */ B(Nop), + /* 1089 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1097 S> */ B(Nop), + /* 1098 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1106 S> */ B(Nop), + /* 1107 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1115 S> */ B(Nop), + /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1124 S> */ B(Nop), + /* 1125 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1133 S> */ B(Nop), + /* 1134 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1142 S> */ B(Nop), + /* 1143 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1151 S> */ B(Nop), + /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1160 S> */ B(Nop), + /* 1161 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1169 S> */ B(Nop), + /* 1177 E> */ B(Wide), B(LdrNamedProperty), R16(arg0), U16(0), U16(259), R16(0), + /* 1178 E> */ B(Wide), B(Call), R16(0), R16(arg0), U16(1), U16(257), + /* 1186 S> */ B(Return), ] constant pool: [ "func", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden index 7d5a58e623..cee0357ab8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden @@ -13,15 +13,14 @@ snippet: " function f(a) { return a.name; } f({name : \"test\"}); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 10 +bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(Nop), + /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 31 S> */ B(Return), ] constant pool: [ "name", @@ -34,15 +33,14 @@ snippet: " function f(a) { return a[\"key\"]; } f({key : \"test\"}); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 10 +bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(Nop), + /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 33 S> */ B(Return), ] constant pool: [ "key", @@ -55,16 +53,14 @@ snippet: " function f(a) { return a[100]; } f({100 : \"test\"}); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 11 +bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(100), - B(KeyedLoadIC), R(0), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(LdaSmi), U8(100), + /* 24 E> */ B(LdaKeyedProperty), R(arg0), U8(1), + /* 31 S> */ B(Return), ] constant pool: [ ] @@ -76,16 +72,14 @@ snippet: " function f(a, b) { return a[b]; } f({arg : \"test\"}, \"arg\"); " -frame size: 1 +frame size: 0 parameter count: 3 -bytecode array length: 11 +bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(0), U8(1), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(Ldar), R(arg1), + /* 28 E> */ B(LdaKeyedProperty), R(arg0), U8(1), + /* 32 S> */ B(Return), ] constant pool: [ ] @@ -97,20 +91,17 @@ snippet: " function f(a) { var b = a.name; return a[-124]; } f({\"-124\" : \"test\", name : 123 }) " -frame size: 2 +frame size: 1 parameter count: 2 -bytecode array length: 21 +bytecode array length: 15 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(1), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LdaSmi), U8(-124), - B(KeyedLoadIC), R(1), U8(3), - B(Return), + /* 10 E> */ B(StackCheck), + /* 25 S> */ B(Nop), + /* 25 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(1), R(0), + B(Ldar), R(0), + /* 32 S> */ B(LdaSmi), U8(-124), + /* 40 E> */ B(LdaKeyedProperty), R(arg0), U8(3), + /* 48 S> */ B(Return), ] constant pool: [ "name", @@ -254,527 +245,398 @@ snippet: " } f({name : \"test\"}) " -frame size: 2 +frame size: 1 parameter count: 2 -bytecode array length: 1294 +bytecode array length: 1035 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(1), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(3), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(5), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(7), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(9), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(11), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(13), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(15), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(17), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(19), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(21), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(23), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(25), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(27), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(29), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(31), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(33), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(35), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(37), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(39), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(41), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(43), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(45), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(47), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(49), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(51), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(53), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(55), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(57), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(59), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(61), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(63), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(65), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(67), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(69), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(71), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(73), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(75), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(77), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(79), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(81), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(83), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(85), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(87), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(89), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(91), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(93), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(95), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(97), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(99), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(101), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(103), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(105), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(107), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(109), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(111), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(113), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(115), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(117), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(119), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(121), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(123), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(125), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(127), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(129), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(131), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(133), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(135), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(137), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(139), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(141), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(143), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(145), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(147), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(149), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(151), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(153), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(155), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(157), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(159), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(161), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(163), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(165), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(167), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(169), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(171), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(173), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(175), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(177), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(179), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(181), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(183), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(185), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(187), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(189), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(191), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(193), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(195), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(197), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(199), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(201), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(203), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(205), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(207), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(209), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(211), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(213), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(215), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(217), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(219), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(221), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(223), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(225), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(227), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(229), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(231), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(233), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(235), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(237), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(239), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(241), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(243), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(245), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(247), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(249), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(251), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(253), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LoadIC), R(1), U8(0), U8(255), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Wide), B(LoadIC), R16(1), U16(0), U16(257), - B(Return), + /* 10 E> */ B(StackCheck), + /* 27 S> */ B(Nop), + /* 32 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(1), R(0), + B(Ldar), R(0), + /* 41 S> */ B(Nop), + /* 46 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + B(Ldar), R(0), + /* 55 S> */ B(Nop), + /* 60 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(5), R(0), + B(Ldar), R(0), + /* 69 S> */ B(Nop), + /* 74 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(7), R(0), + B(Ldar), R(0), + /* 83 S> */ B(Nop), + /* 88 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(9), R(0), + B(Ldar), R(0), + /* 97 S> */ B(Nop), + /* 102 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(11), R(0), + B(Ldar), R(0), + /* 111 S> */ B(Nop), + /* 116 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(13), R(0), + B(Ldar), R(0), + /* 125 S> */ B(Nop), + /* 130 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(15), R(0), + B(Ldar), R(0), + /* 139 S> */ B(Nop), + /* 144 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(17), R(0), + B(Ldar), R(0), + /* 153 S> */ B(Nop), + /* 158 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(19), R(0), + B(Ldar), R(0), + /* 167 S> */ B(Nop), + /* 172 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(21), R(0), + B(Ldar), R(0), + /* 181 S> */ B(Nop), + /* 186 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(23), R(0), + B(Ldar), R(0), + /* 195 S> */ B(Nop), + /* 200 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(25), R(0), + B(Ldar), R(0), + /* 209 S> */ B(Nop), + /* 214 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(27), R(0), + B(Ldar), R(0), + /* 223 S> */ B(Nop), + /* 228 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(29), R(0), + B(Ldar), R(0), + /* 237 S> */ B(Nop), + /* 242 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(31), R(0), + B(Ldar), R(0), + /* 251 S> */ B(Nop), + /* 256 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(33), R(0), + B(Ldar), R(0), + /* 265 S> */ B(Nop), + /* 270 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(35), R(0), + B(Ldar), R(0), + /* 279 S> */ B(Nop), + /* 284 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(37), R(0), + B(Ldar), R(0), + /* 293 S> */ B(Nop), + /* 298 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(39), R(0), + B(Ldar), R(0), + /* 307 S> */ B(Nop), + /* 312 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(41), R(0), + B(Ldar), R(0), + /* 321 S> */ B(Nop), + /* 326 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(43), R(0), + B(Ldar), R(0), + /* 335 S> */ B(Nop), + /* 340 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(45), R(0), + B(Ldar), R(0), + /* 349 S> */ B(Nop), + /* 354 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(47), R(0), + B(Ldar), R(0), + /* 363 S> */ B(Nop), + /* 368 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(49), R(0), + B(Ldar), R(0), + /* 377 S> */ B(Nop), + /* 382 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(51), R(0), + B(Ldar), R(0), + /* 391 S> */ B(Nop), + /* 396 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(53), R(0), + B(Ldar), R(0), + /* 405 S> */ B(Nop), + /* 410 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(55), R(0), + B(Ldar), R(0), + /* 419 S> */ B(Nop), + /* 424 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(57), R(0), + B(Ldar), R(0), + /* 433 S> */ B(Nop), + /* 438 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(59), R(0), + B(Ldar), R(0), + /* 447 S> */ B(Nop), + /* 452 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(61), R(0), + B(Ldar), R(0), + /* 461 S> */ B(Nop), + /* 466 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(63), R(0), + B(Ldar), R(0), + /* 475 S> */ B(Nop), + /* 480 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(65), R(0), + B(Ldar), R(0), + /* 489 S> */ B(Nop), + /* 494 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(67), R(0), + B(Ldar), R(0), + /* 503 S> */ B(Nop), + /* 508 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(69), R(0), + B(Ldar), R(0), + /* 517 S> */ B(Nop), + /* 522 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(71), R(0), + B(Ldar), R(0), + /* 531 S> */ B(Nop), + /* 536 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(73), R(0), + B(Ldar), R(0), + /* 545 S> */ B(Nop), + /* 550 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(75), R(0), + B(Ldar), R(0), + /* 559 S> */ B(Nop), + /* 564 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(77), R(0), + B(Ldar), R(0), + /* 573 S> */ B(Nop), + /* 578 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(79), R(0), + B(Ldar), R(0), + /* 587 S> */ B(Nop), + /* 592 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(81), R(0), + B(Ldar), R(0), + /* 601 S> */ B(Nop), + /* 606 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(83), R(0), + B(Ldar), R(0), + /* 615 S> */ B(Nop), + /* 620 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(85), R(0), + B(Ldar), R(0), + /* 629 S> */ B(Nop), + /* 634 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(87), R(0), + B(Ldar), R(0), + /* 643 S> */ B(Nop), + /* 648 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(89), R(0), + B(Ldar), R(0), + /* 657 S> */ B(Nop), + /* 662 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(91), R(0), + B(Ldar), R(0), + /* 671 S> */ B(Nop), + /* 676 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(93), R(0), + B(Ldar), R(0), + /* 685 S> */ B(Nop), + /* 690 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(95), R(0), + B(Ldar), R(0), + /* 699 S> */ B(Nop), + /* 704 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(97), R(0), + B(Ldar), R(0), + /* 713 S> */ B(Nop), + /* 718 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(99), R(0), + B(Ldar), R(0), + /* 727 S> */ B(Nop), + /* 732 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(101), R(0), + B(Ldar), R(0), + /* 741 S> */ B(Nop), + /* 746 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(103), R(0), + B(Ldar), R(0), + /* 755 S> */ B(Nop), + /* 760 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(105), R(0), + B(Ldar), R(0), + /* 769 S> */ B(Nop), + /* 774 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(107), R(0), + B(Ldar), R(0), + /* 783 S> */ B(Nop), + /* 788 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(109), R(0), + B(Ldar), R(0), + /* 797 S> */ B(Nop), + /* 802 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(111), R(0), + B(Ldar), R(0), + /* 811 S> */ B(Nop), + /* 816 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(113), R(0), + B(Ldar), R(0), + /* 825 S> */ B(Nop), + /* 830 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(115), R(0), + B(Ldar), R(0), + /* 839 S> */ B(Nop), + /* 844 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(117), R(0), + B(Ldar), R(0), + /* 853 S> */ B(Nop), + /* 858 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(119), R(0), + B(Ldar), R(0), + /* 867 S> */ B(Nop), + /* 872 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(121), R(0), + B(Ldar), R(0), + /* 881 S> */ B(Nop), + /* 886 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(123), R(0), + B(Ldar), R(0), + /* 895 S> */ B(Nop), + /* 900 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(125), R(0), + B(Ldar), R(0), + /* 909 S> */ B(Nop), + /* 914 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(127), R(0), + B(Ldar), R(0), + /* 923 S> */ B(Nop), + /* 928 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(129), R(0), + B(Ldar), R(0), + /* 937 S> */ B(Nop), + /* 942 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(131), R(0), + B(Ldar), R(0), + /* 951 S> */ B(Nop), + /* 956 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(133), R(0), + B(Ldar), R(0), + /* 965 S> */ B(Nop), + /* 970 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(135), R(0), + B(Ldar), R(0), + /* 979 S> */ B(Nop), + /* 984 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(137), R(0), + B(Ldar), R(0), + /* 993 S> */ B(Nop), + /* 998 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(139), R(0), + B(Ldar), R(0), + /* 1007 S> */ B(Nop), + /* 1012 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(141), R(0), + B(Ldar), R(0), + /* 1021 S> */ B(Nop), + /* 1026 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(143), R(0), + B(Ldar), R(0), + /* 1035 S> */ B(Nop), + /* 1040 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(145), R(0), + B(Ldar), R(0), + /* 1049 S> */ B(Nop), + /* 1054 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(147), R(0), + B(Ldar), R(0), + /* 1063 S> */ B(Nop), + /* 1068 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(149), R(0), + B(Ldar), R(0), + /* 1077 S> */ B(Nop), + /* 1082 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(151), R(0), + B(Ldar), R(0), + /* 1091 S> */ B(Nop), + /* 1096 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(153), R(0), + B(Ldar), R(0), + /* 1105 S> */ B(Nop), + /* 1110 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(155), R(0), + B(Ldar), R(0), + /* 1119 S> */ B(Nop), + /* 1124 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(157), R(0), + B(Ldar), R(0), + /* 1133 S> */ B(Nop), + /* 1138 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(159), R(0), + B(Ldar), R(0), + /* 1147 S> */ B(Nop), + /* 1152 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(161), R(0), + B(Ldar), R(0), + /* 1161 S> */ B(Nop), + /* 1166 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(163), R(0), + B(Ldar), R(0), + /* 1175 S> */ B(Nop), + /* 1180 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(165), R(0), + B(Ldar), R(0), + /* 1189 S> */ B(Nop), + /* 1194 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(167), R(0), + B(Ldar), R(0), + /* 1203 S> */ B(Nop), + /* 1208 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(169), R(0), + B(Ldar), R(0), + /* 1217 S> */ B(Nop), + /* 1222 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(171), R(0), + B(Ldar), R(0), + /* 1231 S> */ B(Nop), + /* 1236 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(173), R(0), + B(Ldar), R(0), + /* 1245 S> */ B(Nop), + /* 1250 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(175), R(0), + B(Ldar), R(0), + /* 1259 S> */ B(Nop), + /* 1264 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(177), R(0), + B(Ldar), R(0), + /* 1273 S> */ B(Nop), + /* 1278 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(179), R(0), + B(Ldar), R(0), + /* 1287 S> */ B(Nop), + /* 1292 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(181), R(0), + B(Ldar), R(0), + /* 1301 S> */ B(Nop), + /* 1306 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(183), R(0), + B(Ldar), R(0), + /* 1315 S> */ B(Nop), + /* 1320 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(185), R(0), + B(Ldar), R(0), + /* 1329 S> */ B(Nop), + /* 1334 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(187), R(0), + B(Ldar), R(0), + /* 1343 S> */ B(Nop), + /* 1348 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(189), R(0), + B(Ldar), R(0), + /* 1357 S> */ B(Nop), + /* 1362 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(191), R(0), + B(Ldar), R(0), + /* 1371 S> */ B(Nop), + /* 1376 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(193), R(0), + B(Ldar), R(0), + /* 1385 S> */ B(Nop), + /* 1390 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(195), R(0), + B(Ldar), R(0), + /* 1399 S> */ B(Nop), + /* 1404 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(197), R(0), + B(Ldar), R(0), + /* 1413 S> */ B(Nop), + /* 1418 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(199), R(0), + B(Ldar), R(0), + /* 1427 S> */ B(Nop), + /* 1432 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(201), R(0), + B(Ldar), R(0), + /* 1441 S> */ B(Nop), + /* 1446 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(203), R(0), + B(Ldar), R(0), + /* 1455 S> */ B(Nop), + /* 1460 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(205), R(0), + B(Ldar), R(0), + /* 1469 S> */ B(Nop), + /* 1474 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(207), R(0), + B(Ldar), R(0), + /* 1483 S> */ B(Nop), + /* 1488 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(209), R(0), + B(Ldar), R(0), + /* 1497 S> */ B(Nop), + /* 1502 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(211), R(0), + B(Ldar), R(0), + /* 1511 S> */ B(Nop), + /* 1516 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(213), R(0), + B(Ldar), R(0), + /* 1525 S> */ B(Nop), + /* 1530 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(215), R(0), + B(Ldar), R(0), + /* 1539 S> */ B(Nop), + /* 1544 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(217), R(0), + B(Ldar), R(0), + /* 1553 S> */ B(Nop), + /* 1558 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(219), R(0), + B(Ldar), R(0), + /* 1567 S> */ B(Nop), + /* 1572 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(221), R(0), + B(Ldar), R(0), + /* 1581 S> */ B(Nop), + /* 1586 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(223), R(0), + B(Ldar), R(0), + /* 1595 S> */ B(Nop), + /* 1600 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(225), R(0), + B(Ldar), R(0), + /* 1609 S> */ B(Nop), + /* 1614 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(227), R(0), + B(Ldar), R(0), + /* 1623 S> */ B(Nop), + /* 1628 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(229), R(0), + B(Ldar), R(0), + /* 1637 S> */ B(Nop), + /* 1642 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(231), R(0), + B(Ldar), R(0), + /* 1651 S> */ B(Nop), + /* 1656 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(233), R(0), + B(Ldar), R(0), + /* 1665 S> */ B(Nop), + /* 1670 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(235), R(0), + B(Ldar), R(0), + /* 1679 S> */ B(Nop), + /* 1684 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(237), R(0), + B(Ldar), R(0), + /* 1693 S> */ B(Nop), + /* 1698 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(239), R(0), + B(Ldar), R(0), + /* 1707 S> */ B(Nop), + /* 1712 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(241), R(0), + B(Ldar), R(0), + /* 1721 S> */ B(Nop), + /* 1726 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(243), R(0), + B(Ldar), R(0), + /* 1735 S> */ B(Nop), + /* 1740 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(245), R(0), + B(Ldar), R(0), + /* 1749 S> */ B(Nop), + /* 1754 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(247), R(0), + B(Ldar), R(0), + /* 1763 S> */ B(Nop), + /* 1768 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(249), R(0), + B(Ldar), R(0), + /* 1777 S> */ B(Nop), + /* 1782 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(251), R(0), + B(Ldar), R(0), + /* 1791 S> */ B(Nop), + /* 1796 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(253), R(0), + B(Ldar), R(0), + /* 1805 S> */ B(Nop), + /* 1810 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(255), R(0), + B(Ldar), R(0), + /* 1819 S> */ B(Nop), + /* 1827 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(257), + /* 1834 S> */ B(Return), ] constant pool: [ "name", @@ -918,656 +780,398 @@ snippet: " } f({name : \"test\"}, \"name\") " -frame size: 2 +frame size: 1 parameter count: 3 -bytecode array length: 1422 +bytecode array length: 1034 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(1), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(3), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(5), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(7), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(9), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(11), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(13), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(15), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(17), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(19), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(21), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(23), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(25), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(27), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(29), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(31), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(33), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(35), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(37), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(39), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(41), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(43), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(45), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(47), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(49), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(51), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(53), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(55), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(57), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(59), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(61), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(63), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(65), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(67), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(69), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(71), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(73), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(75), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(77), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(79), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(81), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(83), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(85), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(87), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(89), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(91), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(93), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(95), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(97), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(99), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(101), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(103), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(105), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(107), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(109), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(111), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(113), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(115), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(117), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(119), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(121), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(123), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(125), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(127), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(129), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(131), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(133), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(135), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(137), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(139), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(141), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(143), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(145), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(147), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(149), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(151), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(153), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(155), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(157), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(159), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(161), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(163), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(165), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(167), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(169), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(171), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(173), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(175), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(177), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(179), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(181), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(183), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(185), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(187), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(189), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(191), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(193), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(195), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(197), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(199), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(201), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(203), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(205), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(207), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(209), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(211), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(213), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(215), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(217), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(219), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(221), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(223), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(225), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(227), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(229), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(231), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(233), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(235), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(237), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(239), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(241), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(243), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(245), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(247), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(249), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(251), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(253), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(KeyedLoadIC), R(1), U8(255), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(Ldar), R(arg1), - B(Wide), B(KeyedLoadIC), R16(1), U16(257), - B(Return), + /* 10 E> */ B(StackCheck), + /* 30 S> */ B(Ldar), R(arg1), + /* 36 E> */ B(LdrKeyedProperty), R(arg0), U8(1), R(0), + B(Ldar), R(0), + /* 42 S> */ B(Ldar), R(arg1), + /* 48 E> */ B(LdrKeyedProperty), R(arg0), U8(3), R(0), + B(Ldar), R(0), + /* 54 S> */ B(Ldar), R(arg1), + /* 60 E> */ B(LdrKeyedProperty), R(arg0), U8(5), R(0), + B(Ldar), R(0), + /* 66 S> */ B(Ldar), R(arg1), + /* 72 E> */ B(LdrKeyedProperty), R(arg0), U8(7), R(0), + B(Ldar), R(0), + /* 78 S> */ B(Ldar), R(arg1), + /* 84 E> */ B(LdrKeyedProperty), R(arg0), U8(9), R(0), + B(Ldar), R(0), + /* 90 S> */ B(Ldar), R(arg1), + /* 96 E> */ B(LdrKeyedProperty), R(arg0), U8(11), R(0), + B(Ldar), R(0), + /* 102 S> */ B(Ldar), R(arg1), + /* 108 E> */ B(LdrKeyedProperty), R(arg0), U8(13), R(0), + B(Ldar), R(0), + /* 114 S> */ B(Ldar), R(arg1), + /* 120 E> */ B(LdrKeyedProperty), R(arg0), U8(15), R(0), + B(Ldar), R(0), + /* 126 S> */ B(Ldar), R(arg1), + /* 132 E> */ B(LdrKeyedProperty), R(arg0), U8(17), R(0), + B(Ldar), R(0), + /* 138 S> */ B(Ldar), R(arg1), + /* 144 E> */ B(LdrKeyedProperty), R(arg0), U8(19), R(0), + B(Ldar), R(0), + /* 150 S> */ B(Ldar), R(arg1), + /* 156 E> */ B(LdrKeyedProperty), R(arg0), U8(21), R(0), + B(Ldar), R(0), + /* 162 S> */ B(Ldar), R(arg1), + /* 168 E> */ B(LdrKeyedProperty), R(arg0), U8(23), R(0), + B(Ldar), R(0), + /* 174 S> */ B(Ldar), R(arg1), + /* 180 E> */ B(LdrKeyedProperty), R(arg0), U8(25), R(0), + B(Ldar), R(0), + /* 186 S> */ B(Ldar), R(arg1), + /* 192 E> */ B(LdrKeyedProperty), R(arg0), U8(27), R(0), + B(Ldar), R(0), + /* 198 S> */ B(Ldar), R(arg1), + /* 204 E> */ B(LdrKeyedProperty), R(arg0), U8(29), R(0), + B(Ldar), R(0), + /* 210 S> */ B(Ldar), R(arg1), + /* 216 E> */ B(LdrKeyedProperty), R(arg0), U8(31), R(0), + B(Ldar), R(0), + /* 222 S> */ B(Ldar), R(arg1), + /* 228 E> */ B(LdrKeyedProperty), R(arg0), U8(33), R(0), + B(Ldar), R(0), + /* 234 S> */ B(Ldar), R(arg1), + /* 240 E> */ B(LdrKeyedProperty), R(arg0), U8(35), R(0), + B(Ldar), R(0), + /* 246 S> */ B(Ldar), R(arg1), + /* 252 E> */ B(LdrKeyedProperty), R(arg0), U8(37), R(0), + B(Ldar), R(0), + /* 258 S> */ B(Ldar), R(arg1), + /* 264 E> */ B(LdrKeyedProperty), R(arg0), U8(39), R(0), + B(Ldar), R(0), + /* 270 S> */ B(Ldar), R(arg1), + /* 276 E> */ B(LdrKeyedProperty), R(arg0), U8(41), R(0), + B(Ldar), R(0), + /* 282 S> */ B(Ldar), R(arg1), + /* 288 E> */ B(LdrKeyedProperty), R(arg0), U8(43), R(0), + B(Ldar), R(0), + /* 294 S> */ B(Ldar), R(arg1), + /* 300 E> */ B(LdrKeyedProperty), R(arg0), U8(45), R(0), + B(Ldar), R(0), + /* 306 S> */ B(Ldar), R(arg1), + /* 312 E> */ B(LdrKeyedProperty), R(arg0), U8(47), R(0), + B(Ldar), R(0), + /* 318 S> */ B(Ldar), R(arg1), + /* 324 E> */ B(LdrKeyedProperty), R(arg0), U8(49), R(0), + B(Ldar), R(0), + /* 330 S> */ B(Ldar), R(arg1), + /* 336 E> */ B(LdrKeyedProperty), R(arg0), U8(51), R(0), + B(Ldar), R(0), + /* 342 S> */ B(Ldar), R(arg1), + /* 348 E> */ B(LdrKeyedProperty), R(arg0), U8(53), R(0), + B(Ldar), R(0), + /* 354 S> */ B(Ldar), R(arg1), + /* 360 E> */ B(LdrKeyedProperty), R(arg0), U8(55), R(0), + B(Ldar), R(0), + /* 366 S> */ B(Ldar), R(arg1), + /* 372 E> */ B(LdrKeyedProperty), R(arg0), U8(57), R(0), + B(Ldar), R(0), + /* 378 S> */ B(Ldar), R(arg1), + /* 384 E> */ B(LdrKeyedProperty), R(arg0), U8(59), R(0), + B(Ldar), R(0), + /* 390 S> */ B(Ldar), R(arg1), + /* 396 E> */ B(LdrKeyedProperty), R(arg0), U8(61), R(0), + B(Ldar), R(0), + /* 402 S> */ B(Ldar), R(arg1), + /* 408 E> */ B(LdrKeyedProperty), R(arg0), U8(63), R(0), + B(Ldar), R(0), + /* 414 S> */ B(Ldar), R(arg1), + /* 420 E> */ B(LdrKeyedProperty), R(arg0), U8(65), R(0), + B(Ldar), R(0), + /* 426 S> */ B(Ldar), R(arg1), + /* 432 E> */ B(LdrKeyedProperty), R(arg0), U8(67), R(0), + B(Ldar), R(0), + /* 438 S> */ B(Ldar), R(arg1), + /* 444 E> */ B(LdrKeyedProperty), R(arg0), U8(69), R(0), + B(Ldar), R(0), + /* 450 S> */ B(Ldar), R(arg1), + /* 456 E> */ B(LdrKeyedProperty), R(arg0), U8(71), R(0), + B(Ldar), R(0), + /* 462 S> */ B(Ldar), R(arg1), + /* 468 E> */ B(LdrKeyedProperty), R(arg0), U8(73), R(0), + B(Ldar), R(0), + /* 474 S> */ B(Ldar), R(arg1), + /* 480 E> */ B(LdrKeyedProperty), R(arg0), U8(75), R(0), + B(Ldar), R(0), + /* 486 S> */ B(Ldar), R(arg1), + /* 492 E> */ B(LdrKeyedProperty), R(arg0), U8(77), R(0), + B(Ldar), R(0), + /* 498 S> */ B(Ldar), R(arg1), + /* 504 E> */ B(LdrKeyedProperty), R(arg0), U8(79), R(0), + B(Ldar), R(0), + /* 510 S> */ B(Ldar), R(arg1), + /* 516 E> */ B(LdrKeyedProperty), R(arg0), U8(81), R(0), + B(Ldar), R(0), + /* 522 S> */ B(Ldar), R(arg1), + /* 528 E> */ B(LdrKeyedProperty), R(arg0), U8(83), R(0), + B(Ldar), R(0), + /* 534 S> */ B(Ldar), R(arg1), + /* 540 E> */ B(LdrKeyedProperty), R(arg0), U8(85), R(0), + B(Ldar), R(0), + /* 546 S> */ B(Ldar), R(arg1), + /* 552 E> */ B(LdrKeyedProperty), R(arg0), U8(87), R(0), + B(Ldar), R(0), + /* 558 S> */ B(Ldar), R(arg1), + /* 564 E> */ B(LdrKeyedProperty), R(arg0), U8(89), R(0), + B(Ldar), R(0), + /* 570 S> */ B(Ldar), R(arg1), + /* 576 E> */ B(LdrKeyedProperty), R(arg0), U8(91), R(0), + B(Ldar), R(0), + /* 582 S> */ B(Ldar), R(arg1), + /* 588 E> */ B(LdrKeyedProperty), R(arg0), U8(93), R(0), + B(Ldar), R(0), + /* 594 S> */ B(Ldar), R(arg1), + /* 600 E> */ B(LdrKeyedProperty), R(arg0), U8(95), R(0), + B(Ldar), R(0), + /* 606 S> */ B(Ldar), R(arg1), + /* 612 E> */ B(LdrKeyedProperty), R(arg0), U8(97), R(0), + B(Ldar), R(0), + /* 618 S> */ B(Ldar), R(arg1), + /* 624 E> */ B(LdrKeyedProperty), R(arg0), U8(99), R(0), + B(Ldar), R(0), + /* 630 S> */ B(Ldar), R(arg1), + /* 636 E> */ B(LdrKeyedProperty), R(arg0), U8(101), R(0), + B(Ldar), R(0), + /* 642 S> */ B(Ldar), R(arg1), + /* 648 E> */ B(LdrKeyedProperty), R(arg0), U8(103), R(0), + B(Ldar), R(0), + /* 654 S> */ B(Ldar), R(arg1), + /* 660 E> */ B(LdrKeyedProperty), R(arg0), U8(105), R(0), + B(Ldar), R(0), + /* 666 S> */ B(Ldar), R(arg1), + /* 672 E> */ B(LdrKeyedProperty), R(arg0), U8(107), R(0), + B(Ldar), R(0), + /* 678 S> */ B(Ldar), R(arg1), + /* 684 E> */ B(LdrKeyedProperty), R(arg0), U8(109), R(0), + B(Ldar), R(0), + /* 690 S> */ B(Ldar), R(arg1), + /* 696 E> */ B(LdrKeyedProperty), R(arg0), U8(111), R(0), + B(Ldar), R(0), + /* 702 S> */ B(Ldar), R(arg1), + /* 708 E> */ B(LdrKeyedProperty), R(arg0), U8(113), R(0), + B(Ldar), R(0), + /* 714 S> */ B(Ldar), R(arg1), + /* 720 E> */ B(LdrKeyedProperty), R(arg0), U8(115), R(0), + B(Ldar), R(0), + /* 726 S> */ B(Ldar), R(arg1), + /* 732 E> */ B(LdrKeyedProperty), R(arg0), U8(117), R(0), + B(Ldar), R(0), + /* 738 S> */ B(Ldar), R(arg1), + /* 744 E> */ B(LdrKeyedProperty), R(arg0), U8(119), R(0), + B(Ldar), R(0), + /* 750 S> */ B(Ldar), R(arg1), + /* 756 E> */ B(LdrKeyedProperty), R(arg0), U8(121), R(0), + B(Ldar), R(0), + /* 762 S> */ B(Ldar), R(arg1), + /* 768 E> */ B(LdrKeyedProperty), R(arg0), U8(123), R(0), + B(Ldar), R(0), + /* 774 S> */ B(Ldar), R(arg1), + /* 780 E> */ B(LdrKeyedProperty), R(arg0), U8(125), R(0), + B(Ldar), R(0), + /* 786 S> */ B(Ldar), R(arg1), + /* 792 E> */ B(LdrKeyedProperty), R(arg0), U8(127), R(0), + B(Ldar), R(0), + /* 798 S> */ B(Ldar), R(arg1), + /* 804 E> */ B(LdrKeyedProperty), R(arg0), U8(129), R(0), + B(Ldar), R(0), + /* 810 S> */ B(Ldar), R(arg1), + /* 816 E> */ B(LdrKeyedProperty), R(arg0), U8(131), R(0), + B(Ldar), R(0), + /* 822 S> */ B(Ldar), R(arg1), + /* 828 E> */ B(LdrKeyedProperty), R(arg0), U8(133), R(0), + B(Ldar), R(0), + /* 834 S> */ B(Ldar), R(arg1), + /* 840 E> */ B(LdrKeyedProperty), R(arg0), U8(135), R(0), + B(Ldar), R(0), + /* 846 S> */ B(Ldar), R(arg1), + /* 852 E> */ B(LdrKeyedProperty), R(arg0), U8(137), R(0), + B(Ldar), R(0), + /* 858 S> */ B(Ldar), R(arg1), + /* 864 E> */ B(LdrKeyedProperty), R(arg0), U8(139), R(0), + B(Ldar), R(0), + /* 870 S> */ B(Ldar), R(arg1), + /* 876 E> */ B(LdrKeyedProperty), R(arg0), U8(141), R(0), + B(Ldar), R(0), + /* 882 S> */ B(Ldar), R(arg1), + /* 888 E> */ B(LdrKeyedProperty), R(arg0), U8(143), R(0), + B(Ldar), R(0), + /* 894 S> */ B(Ldar), R(arg1), + /* 900 E> */ B(LdrKeyedProperty), R(arg0), U8(145), R(0), + B(Ldar), R(0), + /* 906 S> */ B(Ldar), R(arg1), + /* 912 E> */ B(LdrKeyedProperty), R(arg0), U8(147), R(0), + B(Ldar), R(0), + /* 918 S> */ B(Ldar), R(arg1), + /* 924 E> */ B(LdrKeyedProperty), R(arg0), U8(149), R(0), + B(Ldar), R(0), + /* 930 S> */ B(Ldar), R(arg1), + /* 936 E> */ B(LdrKeyedProperty), R(arg0), U8(151), R(0), + B(Ldar), R(0), + /* 942 S> */ B(Ldar), R(arg1), + /* 948 E> */ B(LdrKeyedProperty), R(arg0), U8(153), R(0), + B(Ldar), R(0), + /* 954 S> */ B(Ldar), R(arg1), + /* 960 E> */ B(LdrKeyedProperty), R(arg0), U8(155), R(0), + B(Ldar), R(0), + /* 966 S> */ B(Ldar), R(arg1), + /* 972 E> */ B(LdrKeyedProperty), R(arg0), U8(157), R(0), + B(Ldar), R(0), + /* 978 S> */ B(Ldar), R(arg1), + /* 984 E> */ B(LdrKeyedProperty), R(arg0), U8(159), R(0), + B(Ldar), R(0), + /* 990 S> */ B(Ldar), R(arg1), + /* 996 E> */ B(LdrKeyedProperty), R(arg0), U8(161), R(0), + B(Ldar), R(0), + /* 1002 S> */ B(Ldar), R(arg1), + /* 1008 E> */ B(LdrKeyedProperty), R(arg0), U8(163), R(0), + B(Ldar), R(0), + /* 1014 S> */ B(Ldar), R(arg1), + /* 1020 E> */ B(LdrKeyedProperty), R(arg0), U8(165), R(0), + B(Ldar), R(0), + /* 1026 S> */ B(Ldar), R(arg1), + /* 1032 E> */ B(LdrKeyedProperty), R(arg0), U8(167), R(0), + B(Ldar), R(0), + /* 1038 S> */ B(Ldar), R(arg1), + /* 1044 E> */ B(LdrKeyedProperty), R(arg0), U8(169), R(0), + B(Ldar), R(0), + /* 1050 S> */ B(Ldar), R(arg1), + /* 1056 E> */ B(LdrKeyedProperty), R(arg0), U8(171), R(0), + B(Ldar), R(0), + /* 1062 S> */ B(Ldar), R(arg1), + /* 1068 E> */ B(LdrKeyedProperty), R(arg0), U8(173), R(0), + B(Ldar), R(0), + /* 1074 S> */ B(Ldar), R(arg1), + /* 1080 E> */ B(LdrKeyedProperty), R(arg0), U8(175), R(0), + B(Ldar), R(0), + /* 1086 S> */ B(Ldar), R(arg1), + /* 1092 E> */ B(LdrKeyedProperty), R(arg0), U8(177), R(0), + B(Ldar), R(0), + /* 1098 S> */ B(Ldar), R(arg1), + /* 1104 E> */ B(LdrKeyedProperty), R(arg0), U8(179), R(0), + B(Ldar), R(0), + /* 1110 S> */ B(Ldar), R(arg1), + /* 1116 E> */ B(LdrKeyedProperty), R(arg0), U8(181), R(0), + B(Ldar), R(0), + /* 1122 S> */ B(Ldar), R(arg1), + /* 1128 E> */ B(LdrKeyedProperty), R(arg0), U8(183), R(0), + B(Ldar), R(0), + /* 1134 S> */ B(Ldar), R(arg1), + /* 1140 E> */ B(LdrKeyedProperty), R(arg0), U8(185), R(0), + B(Ldar), R(0), + /* 1146 S> */ B(Ldar), R(arg1), + /* 1152 E> */ B(LdrKeyedProperty), R(arg0), U8(187), R(0), + B(Ldar), R(0), + /* 1158 S> */ B(Ldar), R(arg1), + /* 1164 E> */ B(LdrKeyedProperty), R(arg0), U8(189), R(0), + B(Ldar), R(0), + /* 1170 S> */ B(Ldar), R(arg1), + /* 1176 E> */ B(LdrKeyedProperty), R(arg0), U8(191), R(0), + B(Ldar), R(0), + /* 1182 S> */ B(Ldar), R(arg1), + /* 1188 E> */ B(LdrKeyedProperty), R(arg0), U8(193), R(0), + B(Ldar), R(0), + /* 1194 S> */ B(Ldar), R(arg1), + /* 1200 E> */ B(LdrKeyedProperty), R(arg0), U8(195), R(0), + B(Ldar), R(0), + /* 1206 S> */ B(Ldar), R(arg1), + /* 1212 E> */ B(LdrKeyedProperty), R(arg0), U8(197), R(0), + B(Ldar), R(0), + /* 1218 S> */ B(Ldar), R(arg1), + /* 1224 E> */ B(LdrKeyedProperty), R(arg0), U8(199), R(0), + B(Ldar), R(0), + /* 1230 S> */ B(Ldar), R(arg1), + /* 1236 E> */ B(LdrKeyedProperty), R(arg0), U8(201), R(0), + B(Ldar), R(0), + /* 1242 S> */ B(Ldar), R(arg1), + /* 1248 E> */ B(LdrKeyedProperty), R(arg0), U8(203), R(0), + B(Ldar), R(0), + /* 1254 S> */ B(Ldar), R(arg1), + /* 1260 E> */ B(LdrKeyedProperty), R(arg0), U8(205), R(0), + B(Ldar), R(0), + /* 1266 S> */ B(Ldar), R(arg1), + /* 1272 E> */ B(LdrKeyedProperty), R(arg0), U8(207), R(0), + B(Ldar), R(0), + /* 1278 S> */ B(Ldar), R(arg1), + /* 1284 E> */ B(LdrKeyedProperty), R(arg0), U8(209), R(0), + B(Ldar), R(0), + /* 1290 S> */ B(Ldar), R(arg1), + /* 1296 E> */ B(LdrKeyedProperty), R(arg0), U8(211), R(0), + B(Ldar), R(0), + /* 1302 S> */ B(Ldar), R(arg1), + /* 1308 E> */ B(LdrKeyedProperty), R(arg0), U8(213), R(0), + B(Ldar), R(0), + /* 1314 S> */ B(Ldar), R(arg1), + /* 1320 E> */ B(LdrKeyedProperty), R(arg0), U8(215), R(0), + B(Ldar), R(0), + /* 1326 S> */ B(Ldar), R(arg1), + /* 1332 E> */ B(LdrKeyedProperty), R(arg0), U8(217), R(0), + B(Ldar), R(0), + /* 1338 S> */ B(Ldar), R(arg1), + /* 1344 E> */ B(LdrKeyedProperty), R(arg0), U8(219), R(0), + B(Ldar), R(0), + /* 1350 S> */ B(Ldar), R(arg1), + /* 1356 E> */ B(LdrKeyedProperty), R(arg0), U8(221), R(0), + B(Ldar), R(0), + /* 1362 S> */ B(Ldar), R(arg1), + /* 1368 E> */ B(LdrKeyedProperty), R(arg0), U8(223), R(0), + B(Ldar), R(0), + /* 1374 S> */ B(Ldar), R(arg1), + /* 1380 E> */ B(LdrKeyedProperty), R(arg0), U8(225), R(0), + B(Ldar), R(0), + /* 1386 S> */ B(Ldar), R(arg1), + /* 1392 E> */ B(LdrKeyedProperty), R(arg0), U8(227), R(0), + B(Ldar), R(0), + /* 1398 S> */ B(Ldar), R(arg1), + /* 1404 E> */ B(LdrKeyedProperty), R(arg0), U8(229), R(0), + B(Ldar), R(0), + /* 1410 S> */ B(Ldar), R(arg1), + /* 1416 E> */ B(LdrKeyedProperty), R(arg0), U8(231), R(0), + B(Ldar), R(0), + /* 1422 S> */ B(Ldar), R(arg1), + /* 1428 E> */ B(LdrKeyedProperty), R(arg0), U8(233), R(0), + B(Ldar), R(0), + /* 1434 S> */ B(Ldar), R(arg1), + /* 1440 E> */ B(LdrKeyedProperty), R(arg0), U8(235), R(0), + B(Ldar), R(0), + /* 1446 S> */ B(Ldar), R(arg1), + /* 1452 E> */ B(LdrKeyedProperty), R(arg0), U8(237), R(0), + B(Ldar), R(0), + /* 1458 S> */ B(Ldar), R(arg1), + /* 1464 E> */ B(LdrKeyedProperty), R(arg0), U8(239), R(0), + B(Ldar), R(0), + /* 1470 S> */ B(Ldar), R(arg1), + /* 1476 E> */ B(LdrKeyedProperty), R(arg0), U8(241), R(0), + B(Ldar), R(0), + /* 1482 S> */ B(Ldar), R(arg1), + /* 1488 E> */ B(LdrKeyedProperty), R(arg0), U8(243), R(0), + B(Ldar), R(0), + /* 1494 S> */ B(Ldar), R(arg1), + /* 1500 E> */ B(LdrKeyedProperty), R(arg0), U8(245), R(0), + B(Ldar), R(0), + /* 1506 S> */ B(Ldar), R(arg1), + /* 1512 E> */ B(LdrKeyedProperty), R(arg0), U8(247), R(0), + B(Ldar), R(0), + /* 1518 S> */ B(Ldar), R(arg1), + /* 1524 E> */ B(LdrKeyedProperty), R(arg0), U8(249), R(0), + B(Ldar), R(0), + /* 1530 S> */ B(Ldar), R(arg1), + /* 1536 E> */ B(LdrKeyedProperty), R(arg0), U8(251), R(0), + B(Ldar), R(0), + /* 1542 S> */ B(Ldar), R(arg1), + /* 1548 E> */ B(LdrKeyedProperty), R(arg0), U8(253), R(0), + B(Ldar), R(0), + /* 1554 S> */ B(Ldar), R(arg1), + /* 1560 E> */ B(LdrKeyedProperty), R(arg0), U8(255), R(0), + B(Ldar), R(0), + /* 1566 S> */ B(Ldar), R(arg1), + /* 1575 E> */ B(Wide), B(LdaKeyedProperty), R16(arg0), U16(257), + /* 1579 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden index 9e67a90c7b..7f456cf4fc 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden @@ -13,17 +13,15 @@ snippet: " function f(a) { a.name = \"val\"; } f({name : \"test\"}) " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 13 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaConstant), U8(0), - B(StoreICSloppy), R(0), U8(1), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(LdaConstant), U8(0), + /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(1), U8(1), + B(LdaUndefined), + /* 32 S> */ B(Return), ] constant pool: [ "val", @@ -37,17 +35,15 @@ snippet: " function f(a) { a[\"key\"] = \"val\"; } f({key : \"test\"}) " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 13 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaConstant), U8(0), - B(StoreICSloppy), R(0), U8(1), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(LdaConstant), U8(0), + /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(1), U8(1), + B(LdaUndefined), + /* 34 S> */ B(Return), ] constant pool: [ "val", @@ -63,17 +59,15 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 17 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(100), - B(Star), R(1), - B(LdaConstant), U8(0), - B(KeyedStoreICSloppy), R(0), R(1), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(LdaSmi), U8(100), + B(Star), R(1), + B(LdaConstant), U8(0), + /* 23 E> */ B(StaKeyedPropertySloppy), R(arg0), R(1), U8(1), + B(LdaUndefined), + /* 32 S> */ B(Return), ] constant pool: [ "val", @@ -86,19 +80,15 @@ snippet: " function f(a, b) { a[b] = \"val\"; } f({arg : \"test\"}, \"arg\") " -frame size: 2 +frame size: 0 parameter count: 3 -bytecode array length: 17 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaConstant), U8(0), - B(KeyedStoreICSloppy), R(0), R(1), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 19 S> */ B(LdaConstant), U8(0), + /* 24 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(1), + B(LdaUndefined), + /* 33 S> */ B(Return), ] constant pool: [ "val", @@ -111,20 +101,16 @@ snippet: " function f(a) { a.name = a[-124]; } f({\"-124\" : \"test\", name : 123 }) " -frame size: 2 +frame size: 0 parameter count: 2 -bytecode array length: 20 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg0), - B(Star), R(1), - B(LdaSmi), U8(-124), - B(KeyedLoadIC), R(1), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(3), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(LdaSmi), U8(-124), + /* 26 E> */ B(LdaKeyedProperty), R(arg0), U8(1), + /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(3), + B(LdaUndefined), + /* 34 S> */ B(Return), ] constant pool: [ "name", @@ -137,17 +123,15 @@ snippet: " function f(a) { \"use strict\"; a.name = \"val\"; } f({name : \"test\"}) " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 13 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaConstant), U8(0), - B(StoreICStrict), R(0), U8(1), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 30 S> */ B(LdaConstant), U8(0), + /* 37 E> */ B(StaNamedPropertyStrict), R(arg0), U8(1), U8(1), + B(LdaUndefined), + /* 46 S> */ B(Return), ] constant pool: [ "val", @@ -161,19 +145,15 @@ snippet: " function f(a, b) { \"use strict\"; a[b] = \"val\"; } f({arg : \"test\"}, \"arg\") " -frame size: 2 +frame size: 0 parameter count: 3 -bytecode array length: 17 +bytecode array length: 9 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaConstant), U8(0), - B(KeyedStoreICStrict), R(0), R(1), U8(1), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 33 S> */ B(LdaConstant), U8(0), + /* 38 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(1), + B(LdaUndefined), + /* 47 S> */ B(Return), ] constant pool: [ "val", @@ -316,529 +296,271 @@ snippet: " } f({name : \"test\"}) " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 1297 +bytecode array length: 781 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICSloppy), R(0), U8(0), U8(255), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Wide), B(StoreICSloppy), R16(0), U16(0), U16(257), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 18 S> */ B(LdaSmi), U8(1), + /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(1), + /* 32 S> */ B(LdaSmi), U8(1), + /* 39 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(3), + /* 46 S> */ B(LdaSmi), U8(1), + /* 53 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(5), + /* 60 S> */ B(LdaSmi), U8(1), + /* 67 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(7), + /* 74 S> */ B(LdaSmi), U8(1), + /* 81 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(9), + /* 88 S> */ B(LdaSmi), U8(1), + /* 95 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(11), + /* 102 S> */ B(LdaSmi), U8(1), + /* 109 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(13), + /* 116 S> */ B(LdaSmi), U8(1), + /* 123 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(15), + /* 130 S> */ B(LdaSmi), U8(1), + /* 137 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(17), + /* 144 S> */ B(LdaSmi), U8(1), + /* 151 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(19), + /* 158 S> */ B(LdaSmi), U8(1), + /* 165 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(21), + /* 172 S> */ B(LdaSmi), U8(1), + /* 179 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(23), + /* 186 S> */ B(LdaSmi), U8(1), + /* 193 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(25), + /* 200 S> */ B(LdaSmi), U8(1), + /* 207 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(27), + /* 214 S> */ B(LdaSmi), U8(1), + /* 221 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(29), + /* 228 S> */ B(LdaSmi), U8(1), + /* 235 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(31), + /* 242 S> */ B(LdaSmi), U8(1), + /* 249 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(33), + /* 256 S> */ B(LdaSmi), U8(1), + /* 263 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(35), + /* 270 S> */ B(LdaSmi), U8(1), + /* 277 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(37), + /* 284 S> */ B(LdaSmi), U8(1), + /* 291 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(39), + /* 298 S> */ B(LdaSmi), U8(1), + /* 305 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(41), + /* 312 S> */ B(LdaSmi), U8(1), + /* 319 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(43), + /* 326 S> */ B(LdaSmi), U8(1), + /* 333 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(45), + /* 340 S> */ B(LdaSmi), U8(1), + /* 347 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(47), + /* 354 S> */ B(LdaSmi), U8(1), + /* 361 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(49), + /* 368 S> */ B(LdaSmi), U8(1), + /* 375 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(51), + /* 382 S> */ B(LdaSmi), U8(1), + /* 389 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(53), + /* 396 S> */ B(LdaSmi), U8(1), + /* 403 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(55), + /* 410 S> */ B(LdaSmi), U8(1), + /* 417 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(57), + /* 424 S> */ B(LdaSmi), U8(1), + /* 431 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(59), + /* 438 S> */ B(LdaSmi), U8(1), + /* 445 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(61), + /* 452 S> */ B(LdaSmi), U8(1), + /* 459 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(63), + /* 466 S> */ B(LdaSmi), U8(1), + /* 473 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(65), + /* 480 S> */ B(LdaSmi), U8(1), + /* 487 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(67), + /* 494 S> */ B(LdaSmi), U8(1), + /* 501 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(69), + /* 508 S> */ B(LdaSmi), U8(1), + /* 515 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(71), + /* 522 S> */ B(LdaSmi), U8(1), + /* 529 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(73), + /* 536 S> */ B(LdaSmi), U8(1), + /* 543 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(75), + /* 550 S> */ B(LdaSmi), U8(1), + /* 557 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(77), + /* 564 S> */ B(LdaSmi), U8(1), + /* 571 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(79), + /* 578 S> */ B(LdaSmi), U8(1), + /* 585 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(81), + /* 592 S> */ B(LdaSmi), U8(1), + /* 599 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(83), + /* 606 S> */ B(LdaSmi), U8(1), + /* 613 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(85), + /* 620 S> */ B(LdaSmi), U8(1), + /* 627 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(87), + /* 634 S> */ B(LdaSmi), U8(1), + /* 641 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(89), + /* 648 S> */ B(LdaSmi), U8(1), + /* 655 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(91), + /* 662 S> */ B(LdaSmi), U8(1), + /* 669 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(93), + /* 676 S> */ B(LdaSmi), U8(1), + /* 683 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(95), + /* 690 S> */ B(LdaSmi), U8(1), + /* 697 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(97), + /* 704 S> */ B(LdaSmi), U8(1), + /* 711 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(99), + /* 718 S> */ B(LdaSmi), U8(1), + /* 725 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(101), + /* 732 S> */ B(LdaSmi), U8(1), + /* 739 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(103), + /* 746 S> */ B(LdaSmi), U8(1), + /* 753 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(105), + /* 760 S> */ B(LdaSmi), U8(1), + /* 767 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(107), + /* 774 S> */ B(LdaSmi), U8(1), + /* 781 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(109), + /* 788 S> */ B(LdaSmi), U8(1), + /* 795 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(111), + /* 802 S> */ B(LdaSmi), U8(1), + /* 809 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(113), + /* 816 S> */ B(LdaSmi), U8(1), + /* 823 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(115), + /* 830 S> */ B(LdaSmi), U8(1), + /* 837 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(117), + /* 844 S> */ B(LdaSmi), U8(1), + /* 851 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(119), + /* 858 S> */ B(LdaSmi), U8(1), + /* 865 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(121), + /* 872 S> */ B(LdaSmi), U8(1), + /* 879 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(123), + /* 886 S> */ B(LdaSmi), U8(1), + /* 893 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(125), + /* 900 S> */ B(LdaSmi), U8(1), + /* 907 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(127), + /* 914 S> */ B(LdaSmi), U8(1), + /* 921 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(129), + /* 928 S> */ B(LdaSmi), U8(1), + /* 935 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(131), + /* 942 S> */ B(LdaSmi), U8(1), + /* 949 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(133), + /* 956 S> */ B(LdaSmi), U8(1), + /* 963 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(135), + /* 970 S> */ B(LdaSmi), U8(1), + /* 977 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(137), + /* 984 S> */ B(LdaSmi), U8(1), + /* 991 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(139), + /* 998 S> */ B(LdaSmi), U8(1), + /* 1005 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(141), + /* 1012 S> */ B(LdaSmi), U8(1), + /* 1019 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(143), + /* 1026 S> */ B(LdaSmi), U8(1), + /* 1033 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(145), + /* 1040 S> */ B(LdaSmi), U8(1), + /* 1047 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(147), + /* 1054 S> */ B(LdaSmi), U8(1), + /* 1061 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(149), + /* 1068 S> */ B(LdaSmi), U8(1), + /* 1075 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(151), + /* 1082 S> */ B(LdaSmi), U8(1), + /* 1089 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(153), + /* 1096 S> */ B(LdaSmi), U8(1), + /* 1103 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(155), + /* 1110 S> */ B(LdaSmi), U8(1), + /* 1117 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(157), + /* 1124 S> */ B(LdaSmi), U8(1), + /* 1131 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(159), + /* 1138 S> */ B(LdaSmi), U8(1), + /* 1145 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(161), + /* 1152 S> */ B(LdaSmi), U8(1), + /* 1159 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(163), + /* 1166 S> */ B(LdaSmi), U8(1), + /* 1173 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(165), + /* 1180 S> */ B(LdaSmi), U8(1), + /* 1187 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(167), + /* 1194 S> */ B(LdaSmi), U8(1), + /* 1201 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(169), + /* 1208 S> */ B(LdaSmi), U8(1), + /* 1215 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(171), + /* 1222 S> */ B(LdaSmi), U8(1), + /* 1229 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(173), + /* 1236 S> */ B(LdaSmi), U8(1), + /* 1243 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(175), + /* 1250 S> */ B(LdaSmi), U8(1), + /* 1257 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(177), + /* 1264 S> */ B(LdaSmi), U8(1), + /* 1271 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(179), + /* 1278 S> */ B(LdaSmi), U8(1), + /* 1285 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(181), + /* 1292 S> */ B(LdaSmi), U8(1), + /* 1299 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(183), + /* 1306 S> */ B(LdaSmi), U8(1), + /* 1313 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(185), + /* 1320 S> */ B(LdaSmi), U8(1), + /* 1327 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(187), + /* 1334 S> */ B(LdaSmi), U8(1), + /* 1341 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(189), + /* 1348 S> */ B(LdaSmi), U8(1), + /* 1355 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(191), + /* 1362 S> */ B(LdaSmi), U8(1), + /* 1369 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(193), + /* 1376 S> */ B(LdaSmi), U8(1), + /* 1383 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(195), + /* 1390 S> */ B(LdaSmi), U8(1), + /* 1397 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(197), + /* 1404 S> */ B(LdaSmi), U8(1), + /* 1411 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(199), + /* 1418 S> */ B(LdaSmi), U8(1), + /* 1425 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(201), + /* 1432 S> */ B(LdaSmi), U8(1), + /* 1439 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(203), + /* 1446 S> */ B(LdaSmi), U8(1), + /* 1453 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(205), + /* 1460 S> */ B(LdaSmi), U8(1), + /* 1467 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(207), + /* 1474 S> */ B(LdaSmi), U8(1), + /* 1481 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(209), + /* 1488 S> */ B(LdaSmi), U8(1), + /* 1495 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(211), + /* 1502 S> */ B(LdaSmi), U8(1), + /* 1509 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(213), + /* 1516 S> */ B(LdaSmi), U8(1), + /* 1523 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(215), + /* 1530 S> */ B(LdaSmi), U8(1), + /* 1537 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(217), + /* 1544 S> */ B(LdaSmi), U8(1), + /* 1551 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(219), + /* 1558 S> */ B(LdaSmi), U8(1), + /* 1565 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(221), + /* 1572 S> */ B(LdaSmi), U8(1), + /* 1579 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(223), + /* 1586 S> */ B(LdaSmi), U8(1), + /* 1593 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(225), + /* 1600 S> */ B(LdaSmi), U8(1), + /* 1607 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(227), + /* 1614 S> */ B(LdaSmi), U8(1), + /* 1621 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(229), + /* 1628 S> */ B(LdaSmi), U8(1), + /* 1635 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(231), + /* 1642 S> */ B(LdaSmi), U8(1), + /* 1649 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(233), + /* 1656 S> */ B(LdaSmi), U8(1), + /* 1663 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(235), + /* 1670 S> */ B(LdaSmi), U8(1), + /* 1677 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(237), + /* 1684 S> */ B(LdaSmi), U8(1), + /* 1691 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(239), + /* 1698 S> */ B(LdaSmi), U8(1), + /* 1705 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(241), + /* 1712 S> */ B(LdaSmi), U8(1), + /* 1719 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(243), + /* 1726 S> */ B(LdaSmi), U8(1), + /* 1733 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(245), + /* 1740 S> */ B(LdaSmi), U8(1), + /* 1747 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(247), + /* 1754 S> */ B(LdaSmi), U8(1), + /* 1761 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(249), + /* 1768 S> */ B(LdaSmi), U8(1), + /* 1775 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(251), + /* 1782 S> */ B(LdaSmi), U8(1), + /* 1789 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(253), + /* 1796 S> */ B(LdaSmi), U8(1), + /* 1803 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(255), + /* 1810 S> */ B(LdaSmi), U8(2), + /* 1817 E> */ B(Wide), B(StaNamedPropertySloppy), R16(arg0), U16(0), U16(257), + B(LdaUndefined), + /* 1822 S> */ B(Return), ] constant pool: [ "name", @@ -982,529 +704,271 @@ snippet: " } f({name : \"test\"}) " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 1297 +bytecode array length: 781 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(1), - B(StoreICStrict), R(0), U8(0), U8(255), - B(Ldar), R(arg0), - B(Star), R(0), - B(LdaSmi), U8(2), - B(Wide), B(StoreICStrict), R16(0), U16(0), U16(257), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 33 S> */ B(LdaSmi), U8(1), + /* 40 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(1), + /* 47 S> */ B(LdaSmi), U8(1), + /* 54 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(3), + /* 61 S> */ B(LdaSmi), U8(1), + /* 68 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(5), + /* 75 S> */ B(LdaSmi), U8(1), + /* 82 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(7), + /* 89 S> */ B(LdaSmi), U8(1), + /* 96 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(9), + /* 103 S> */ B(LdaSmi), U8(1), + /* 110 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(11), + /* 117 S> */ B(LdaSmi), U8(1), + /* 124 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(13), + /* 131 S> */ B(LdaSmi), U8(1), + /* 138 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(15), + /* 145 S> */ B(LdaSmi), U8(1), + /* 152 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(17), + /* 159 S> */ B(LdaSmi), U8(1), + /* 166 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(19), + /* 173 S> */ B(LdaSmi), U8(1), + /* 180 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(21), + /* 187 S> */ B(LdaSmi), U8(1), + /* 194 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(23), + /* 201 S> */ B(LdaSmi), U8(1), + /* 208 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(25), + /* 215 S> */ B(LdaSmi), U8(1), + /* 222 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(27), + /* 229 S> */ B(LdaSmi), U8(1), + /* 236 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(29), + /* 243 S> */ B(LdaSmi), U8(1), + /* 250 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(31), + /* 257 S> */ B(LdaSmi), U8(1), + /* 264 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(33), + /* 271 S> */ B(LdaSmi), U8(1), + /* 278 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(35), + /* 285 S> */ B(LdaSmi), U8(1), + /* 292 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(37), + /* 299 S> */ B(LdaSmi), U8(1), + /* 306 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(39), + /* 313 S> */ B(LdaSmi), U8(1), + /* 320 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(41), + /* 327 S> */ B(LdaSmi), U8(1), + /* 334 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(43), + /* 341 S> */ B(LdaSmi), U8(1), + /* 348 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(45), + /* 355 S> */ B(LdaSmi), U8(1), + /* 362 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(47), + /* 369 S> */ B(LdaSmi), U8(1), + /* 376 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(49), + /* 383 S> */ B(LdaSmi), U8(1), + /* 390 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(51), + /* 397 S> */ B(LdaSmi), U8(1), + /* 404 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(53), + /* 411 S> */ B(LdaSmi), U8(1), + /* 418 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(55), + /* 425 S> */ B(LdaSmi), U8(1), + /* 432 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(57), + /* 439 S> */ B(LdaSmi), U8(1), + /* 446 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(59), + /* 453 S> */ B(LdaSmi), U8(1), + /* 460 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(61), + /* 467 S> */ B(LdaSmi), U8(1), + /* 474 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(63), + /* 481 S> */ B(LdaSmi), U8(1), + /* 488 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(65), + /* 495 S> */ B(LdaSmi), U8(1), + /* 502 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(67), + /* 509 S> */ B(LdaSmi), U8(1), + /* 516 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(69), + /* 523 S> */ B(LdaSmi), U8(1), + /* 530 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(71), + /* 537 S> */ B(LdaSmi), U8(1), + /* 544 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(73), + /* 551 S> */ B(LdaSmi), U8(1), + /* 558 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(75), + /* 565 S> */ B(LdaSmi), U8(1), + /* 572 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(77), + /* 579 S> */ B(LdaSmi), U8(1), + /* 586 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(79), + /* 593 S> */ B(LdaSmi), U8(1), + /* 600 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(81), + /* 607 S> */ B(LdaSmi), U8(1), + /* 614 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(83), + /* 621 S> */ B(LdaSmi), U8(1), + /* 628 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(85), + /* 635 S> */ B(LdaSmi), U8(1), + /* 642 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(87), + /* 649 S> */ B(LdaSmi), U8(1), + /* 656 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(89), + /* 663 S> */ B(LdaSmi), U8(1), + /* 670 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(91), + /* 677 S> */ B(LdaSmi), U8(1), + /* 684 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(93), + /* 691 S> */ B(LdaSmi), U8(1), + /* 698 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(95), + /* 705 S> */ B(LdaSmi), U8(1), + /* 712 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(97), + /* 719 S> */ B(LdaSmi), U8(1), + /* 726 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(99), + /* 733 S> */ B(LdaSmi), U8(1), + /* 740 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(101), + /* 747 S> */ B(LdaSmi), U8(1), + /* 754 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(103), + /* 761 S> */ B(LdaSmi), U8(1), + /* 768 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(105), + /* 775 S> */ B(LdaSmi), U8(1), + /* 782 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(107), + /* 789 S> */ B(LdaSmi), U8(1), + /* 796 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(109), + /* 803 S> */ B(LdaSmi), U8(1), + /* 810 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(111), + /* 817 S> */ B(LdaSmi), U8(1), + /* 824 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(113), + /* 831 S> */ B(LdaSmi), U8(1), + /* 838 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(115), + /* 845 S> */ B(LdaSmi), U8(1), + /* 852 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(117), + /* 859 S> */ B(LdaSmi), U8(1), + /* 866 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(119), + /* 873 S> */ B(LdaSmi), U8(1), + /* 880 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(121), + /* 887 S> */ B(LdaSmi), U8(1), + /* 894 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(123), + /* 901 S> */ B(LdaSmi), U8(1), + /* 908 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(125), + /* 915 S> */ B(LdaSmi), U8(1), + /* 922 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(127), + /* 929 S> */ B(LdaSmi), U8(1), + /* 936 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(129), + /* 943 S> */ B(LdaSmi), U8(1), + /* 950 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(131), + /* 957 S> */ B(LdaSmi), U8(1), + /* 964 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(133), + /* 971 S> */ B(LdaSmi), U8(1), + /* 978 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(135), + /* 985 S> */ B(LdaSmi), U8(1), + /* 992 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(137), + /* 999 S> */ B(LdaSmi), U8(1), + /* 1006 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(139), + /* 1013 S> */ B(LdaSmi), U8(1), + /* 1020 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(141), + /* 1027 S> */ B(LdaSmi), U8(1), + /* 1034 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(143), + /* 1041 S> */ B(LdaSmi), U8(1), + /* 1048 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(145), + /* 1055 S> */ B(LdaSmi), U8(1), + /* 1062 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(147), + /* 1069 S> */ B(LdaSmi), U8(1), + /* 1076 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(149), + /* 1083 S> */ B(LdaSmi), U8(1), + /* 1090 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(151), + /* 1097 S> */ B(LdaSmi), U8(1), + /* 1104 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(153), + /* 1111 S> */ B(LdaSmi), U8(1), + /* 1118 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(155), + /* 1125 S> */ B(LdaSmi), U8(1), + /* 1132 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(157), + /* 1139 S> */ B(LdaSmi), U8(1), + /* 1146 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(159), + /* 1153 S> */ B(LdaSmi), U8(1), + /* 1160 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(161), + /* 1167 S> */ B(LdaSmi), U8(1), + /* 1174 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(163), + /* 1181 S> */ B(LdaSmi), U8(1), + /* 1188 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(165), + /* 1195 S> */ B(LdaSmi), U8(1), + /* 1202 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(167), + /* 1209 S> */ B(LdaSmi), U8(1), + /* 1216 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(169), + /* 1223 S> */ B(LdaSmi), U8(1), + /* 1230 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(171), + /* 1237 S> */ B(LdaSmi), U8(1), + /* 1244 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(173), + /* 1251 S> */ B(LdaSmi), U8(1), + /* 1258 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(175), + /* 1265 S> */ B(LdaSmi), U8(1), + /* 1272 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(177), + /* 1279 S> */ B(LdaSmi), U8(1), + /* 1286 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(179), + /* 1293 S> */ B(LdaSmi), U8(1), + /* 1300 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(181), + /* 1307 S> */ B(LdaSmi), U8(1), + /* 1314 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(183), + /* 1321 S> */ B(LdaSmi), U8(1), + /* 1328 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(185), + /* 1335 S> */ B(LdaSmi), U8(1), + /* 1342 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(187), + /* 1349 S> */ B(LdaSmi), U8(1), + /* 1356 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(189), + /* 1363 S> */ B(LdaSmi), U8(1), + /* 1370 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(191), + /* 1377 S> */ B(LdaSmi), U8(1), + /* 1384 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(193), + /* 1391 S> */ B(LdaSmi), U8(1), + /* 1398 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(195), + /* 1405 S> */ B(LdaSmi), U8(1), + /* 1412 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(197), + /* 1419 S> */ B(LdaSmi), U8(1), + /* 1426 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(199), + /* 1433 S> */ B(LdaSmi), U8(1), + /* 1440 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(201), + /* 1447 S> */ B(LdaSmi), U8(1), + /* 1454 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(203), + /* 1461 S> */ B(LdaSmi), U8(1), + /* 1468 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(205), + /* 1475 S> */ B(LdaSmi), U8(1), + /* 1482 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(207), + /* 1489 S> */ B(LdaSmi), U8(1), + /* 1496 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(209), + /* 1503 S> */ B(LdaSmi), U8(1), + /* 1510 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(211), + /* 1517 S> */ B(LdaSmi), U8(1), + /* 1524 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(213), + /* 1531 S> */ B(LdaSmi), U8(1), + /* 1538 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(215), + /* 1545 S> */ B(LdaSmi), U8(1), + /* 1552 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(217), + /* 1559 S> */ B(LdaSmi), U8(1), + /* 1566 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(219), + /* 1573 S> */ B(LdaSmi), U8(1), + /* 1580 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(221), + /* 1587 S> */ B(LdaSmi), U8(1), + /* 1594 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(223), + /* 1601 S> */ B(LdaSmi), U8(1), + /* 1608 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(225), + /* 1615 S> */ B(LdaSmi), U8(1), + /* 1622 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(227), + /* 1629 S> */ B(LdaSmi), U8(1), + /* 1636 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(229), + /* 1643 S> */ B(LdaSmi), U8(1), + /* 1650 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(231), + /* 1657 S> */ B(LdaSmi), U8(1), + /* 1664 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(233), + /* 1671 S> */ B(LdaSmi), U8(1), + /* 1678 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(235), + /* 1685 S> */ B(LdaSmi), U8(1), + /* 1692 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(237), + /* 1699 S> */ B(LdaSmi), U8(1), + /* 1706 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(239), + /* 1713 S> */ B(LdaSmi), U8(1), + /* 1720 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(241), + /* 1727 S> */ B(LdaSmi), U8(1), + /* 1734 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(243), + /* 1741 S> */ B(LdaSmi), U8(1), + /* 1748 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(245), + /* 1755 S> */ B(LdaSmi), U8(1), + /* 1762 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(247), + /* 1769 S> */ B(LdaSmi), U8(1), + /* 1776 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(249), + /* 1783 S> */ B(LdaSmi), U8(1), + /* 1790 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(251), + /* 1797 S> */ B(LdaSmi), U8(1), + /* 1804 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(253), + /* 1811 S> */ B(LdaSmi), U8(1), + /* 1818 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(255), + /* 1825 S> */ B(LdaSmi), U8(2), + /* 1832 E> */ B(Wide), B(StaNamedPropertyStrict), R16(arg0), U16(0), U16(257), + B(LdaUndefined), + /* 1837 S> */ B(Return), ] constant pool: [ "name", @@ -1647,787 +1111,271 @@ snippet: " } f({name : \"test\"}) " -frame size: 2 +frame size: 0 parameter count: 3 -bytecode array length: 1813 +bytecode array length: 781 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICSloppy), R(0), R(1), U8(255), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Wide), B(KeyedStoreICSloppy), R16(0), R16(1), U16(257), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 21 S> */ B(LdaSmi), U8(1), + /* 26 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(1), + /* 33 S> */ B(LdaSmi), U8(1), + /* 38 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(3), + /* 45 S> */ B(LdaSmi), U8(1), + /* 50 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(5), + /* 57 S> */ B(LdaSmi), U8(1), + /* 62 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(7), + /* 69 S> */ B(LdaSmi), U8(1), + /* 74 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(9), + /* 81 S> */ B(LdaSmi), U8(1), + /* 86 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(11), + /* 93 S> */ B(LdaSmi), U8(1), + /* 98 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(13), + /* 105 S> */ B(LdaSmi), U8(1), + /* 110 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(15), + /* 117 S> */ B(LdaSmi), U8(1), + /* 122 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(17), + /* 129 S> */ B(LdaSmi), U8(1), + /* 134 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(19), + /* 141 S> */ B(LdaSmi), U8(1), + /* 146 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(21), + /* 153 S> */ B(LdaSmi), U8(1), + /* 158 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(23), + /* 165 S> */ B(LdaSmi), U8(1), + /* 170 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(25), + /* 177 S> */ B(LdaSmi), U8(1), + /* 182 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(27), + /* 189 S> */ B(LdaSmi), U8(1), + /* 194 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(29), + /* 201 S> */ B(LdaSmi), U8(1), + /* 206 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(31), + /* 213 S> */ B(LdaSmi), U8(1), + /* 218 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(33), + /* 225 S> */ B(LdaSmi), U8(1), + /* 230 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(35), + /* 237 S> */ B(LdaSmi), U8(1), + /* 242 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(37), + /* 249 S> */ B(LdaSmi), U8(1), + /* 254 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(39), + /* 261 S> */ B(LdaSmi), U8(1), + /* 266 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(41), + /* 273 S> */ B(LdaSmi), U8(1), + /* 278 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(43), + /* 285 S> */ B(LdaSmi), U8(1), + /* 290 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(45), + /* 297 S> */ B(LdaSmi), U8(1), + /* 302 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(47), + /* 309 S> */ B(LdaSmi), U8(1), + /* 314 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(49), + /* 321 S> */ B(LdaSmi), U8(1), + /* 326 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(51), + /* 333 S> */ B(LdaSmi), U8(1), + /* 338 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(53), + /* 345 S> */ B(LdaSmi), U8(1), + /* 350 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(55), + /* 357 S> */ B(LdaSmi), U8(1), + /* 362 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(57), + /* 369 S> */ B(LdaSmi), U8(1), + /* 374 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(59), + /* 381 S> */ B(LdaSmi), U8(1), + /* 386 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(61), + /* 393 S> */ B(LdaSmi), U8(1), + /* 398 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(63), + /* 405 S> */ B(LdaSmi), U8(1), + /* 410 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(65), + /* 417 S> */ B(LdaSmi), U8(1), + /* 422 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(67), + /* 429 S> */ B(LdaSmi), U8(1), + /* 434 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(69), + /* 441 S> */ B(LdaSmi), U8(1), + /* 446 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(71), + /* 453 S> */ B(LdaSmi), U8(1), + /* 458 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(73), + /* 465 S> */ B(LdaSmi), U8(1), + /* 470 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(75), + /* 477 S> */ B(LdaSmi), U8(1), + /* 482 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(77), + /* 489 S> */ B(LdaSmi), U8(1), + /* 494 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(79), + /* 501 S> */ B(LdaSmi), U8(1), + /* 506 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(81), + /* 513 S> */ B(LdaSmi), U8(1), + /* 518 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(83), + /* 525 S> */ B(LdaSmi), U8(1), + /* 530 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(85), + /* 537 S> */ B(LdaSmi), U8(1), + /* 542 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(87), + /* 549 S> */ B(LdaSmi), U8(1), + /* 554 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(89), + /* 561 S> */ B(LdaSmi), U8(1), + /* 566 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(91), + /* 573 S> */ B(LdaSmi), U8(1), + /* 578 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(93), + /* 585 S> */ B(LdaSmi), U8(1), + /* 590 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(95), + /* 597 S> */ B(LdaSmi), U8(1), + /* 602 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(97), + /* 609 S> */ B(LdaSmi), U8(1), + /* 614 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(99), + /* 621 S> */ B(LdaSmi), U8(1), + /* 626 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(101), + /* 633 S> */ B(LdaSmi), U8(1), + /* 638 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(103), + /* 645 S> */ B(LdaSmi), U8(1), + /* 650 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(105), + /* 657 S> */ B(LdaSmi), U8(1), + /* 662 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(107), + /* 669 S> */ B(LdaSmi), U8(1), + /* 674 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(109), + /* 681 S> */ B(LdaSmi), U8(1), + /* 686 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(111), + /* 693 S> */ B(LdaSmi), U8(1), + /* 698 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(113), + /* 705 S> */ B(LdaSmi), U8(1), + /* 710 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(115), + /* 717 S> */ B(LdaSmi), U8(1), + /* 722 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(117), + /* 729 S> */ B(LdaSmi), U8(1), + /* 734 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(119), + /* 741 S> */ B(LdaSmi), U8(1), + /* 746 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(121), + /* 753 S> */ B(LdaSmi), U8(1), + /* 758 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(123), + /* 765 S> */ B(LdaSmi), U8(1), + /* 770 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(125), + /* 777 S> */ B(LdaSmi), U8(1), + /* 782 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(127), + /* 789 S> */ B(LdaSmi), U8(1), + /* 794 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(129), + /* 801 S> */ B(LdaSmi), U8(1), + /* 806 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(131), + /* 813 S> */ B(LdaSmi), U8(1), + /* 818 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(133), + /* 825 S> */ B(LdaSmi), U8(1), + /* 830 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(135), + /* 837 S> */ B(LdaSmi), U8(1), + /* 842 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(137), + /* 849 S> */ B(LdaSmi), U8(1), + /* 854 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(139), + /* 861 S> */ B(LdaSmi), U8(1), + /* 866 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(141), + /* 873 S> */ B(LdaSmi), U8(1), + /* 878 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(143), + /* 885 S> */ B(LdaSmi), U8(1), + /* 890 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(145), + /* 897 S> */ B(LdaSmi), U8(1), + /* 902 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(147), + /* 909 S> */ B(LdaSmi), U8(1), + /* 914 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(149), + /* 921 S> */ B(LdaSmi), U8(1), + /* 926 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(151), + /* 933 S> */ B(LdaSmi), U8(1), + /* 938 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(153), + /* 945 S> */ B(LdaSmi), U8(1), + /* 950 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(155), + /* 957 S> */ B(LdaSmi), U8(1), + /* 962 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(157), + /* 969 S> */ B(LdaSmi), U8(1), + /* 974 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(159), + /* 981 S> */ B(LdaSmi), U8(1), + /* 986 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(161), + /* 993 S> */ B(LdaSmi), U8(1), + /* 998 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(163), + /* 1005 S> */ B(LdaSmi), U8(1), + /* 1010 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(165), + /* 1017 S> */ B(LdaSmi), U8(1), + /* 1022 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(167), + /* 1029 S> */ B(LdaSmi), U8(1), + /* 1034 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(169), + /* 1041 S> */ B(LdaSmi), U8(1), + /* 1046 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(171), + /* 1053 S> */ B(LdaSmi), U8(1), + /* 1058 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(173), + /* 1065 S> */ B(LdaSmi), U8(1), + /* 1070 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(175), + /* 1077 S> */ B(LdaSmi), U8(1), + /* 1082 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(177), + /* 1089 S> */ B(LdaSmi), U8(1), + /* 1094 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(179), + /* 1101 S> */ B(LdaSmi), U8(1), + /* 1106 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(181), + /* 1113 S> */ B(LdaSmi), U8(1), + /* 1118 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(183), + /* 1125 S> */ B(LdaSmi), U8(1), + /* 1130 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(185), + /* 1137 S> */ B(LdaSmi), U8(1), + /* 1142 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(187), + /* 1149 S> */ B(LdaSmi), U8(1), + /* 1154 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(189), + /* 1161 S> */ B(LdaSmi), U8(1), + /* 1166 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(191), + /* 1173 S> */ B(LdaSmi), U8(1), + /* 1178 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(193), + /* 1185 S> */ B(LdaSmi), U8(1), + /* 1190 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(195), + /* 1197 S> */ B(LdaSmi), U8(1), + /* 1202 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(197), + /* 1209 S> */ B(LdaSmi), U8(1), + /* 1214 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(199), + /* 1221 S> */ B(LdaSmi), U8(1), + /* 1226 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(201), + /* 1233 S> */ B(LdaSmi), U8(1), + /* 1238 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(203), + /* 1245 S> */ B(LdaSmi), U8(1), + /* 1250 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(205), + /* 1257 S> */ B(LdaSmi), U8(1), + /* 1262 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(207), + /* 1269 S> */ B(LdaSmi), U8(1), + /* 1274 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(209), + /* 1281 S> */ B(LdaSmi), U8(1), + /* 1286 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(211), + /* 1293 S> */ B(LdaSmi), U8(1), + /* 1298 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(213), + /* 1305 S> */ B(LdaSmi), U8(1), + /* 1310 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(215), + /* 1317 S> */ B(LdaSmi), U8(1), + /* 1322 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(217), + /* 1329 S> */ B(LdaSmi), U8(1), + /* 1334 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(219), + /* 1341 S> */ B(LdaSmi), U8(1), + /* 1346 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(221), + /* 1353 S> */ B(LdaSmi), U8(1), + /* 1358 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(223), + /* 1365 S> */ B(LdaSmi), U8(1), + /* 1370 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(225), + /* 1377 S> */ B(LdaSmi), U8(1), + /* 1382 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(227), + /* 1389 S> */ B(LdaSmi), U8(1), + /* 1394 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(229), + /* 1401 S> */ B(LdaSmi), U8(1), + /* 1406 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(231), + /* 1413 S> */ B(LdaSmi), U8(1), + /* 1418 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(233), + /* 1425 S> */ B(LdaSmi), U8(1), + /* 1430 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(235), + /* 1437 S> */ B(LdaSmi), U8(1), + /* 1442 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(237), + /* 1449 S> */ B(LdaSmi), U8(1), + /* 1454 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(239), + /* 1461 S> */ B(LdaSmi), U8(1), + /* 1466 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(241), + /* 1473 S> */ B(LdaSmi), U8(1), + /* 1478 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(243), + /* 1485 S> */ B(LdaSmi), U8(1), + /* 1490 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(245), + /* 1497 S> */ B(LdaSmi), U8(1), + /* 1502 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(247), + /* 1509 S> */ B(LdaSmi), U8(1), + /* 1514 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(249), + /* 1521 S> */ B(LdaSmi), U8(1), + /* 1526 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(251), + /* 1533 S> */ B(LdaSmi), U8(1), + /* 1538 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(253), + /* 1545 S> */ B(LdaSmi), U8(1), + /* 1550 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(255), + /* 1557 S> */ B(LdaSmi), U8(2), + /* 1562 E> */ B(Wide), B(StaKeyedPropertySloppy), R16(arg0), R16(arg1), U16(257), + B(LdaUndefined), + /* 1567 S> */ B(Return), ] constant pool: [ ] @@ -2570,787 +1518,271 @@ snippet: " } f({name : \"test\"}) " -frame size: 2 +frame size: 0 parameter count: 3 -bytecode array length: 1813 +bytecode array length: 781 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(1), - B(KeyedStoreICStrict), R(0), R(1), U8(255), - B(Ldar), R(arg0), - B(Star), R(0), - B(Ldar), R(arg1), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Wide), B(KeyedStoreICStrict), R16(0), R16(1), U16(257), - B(LdaUndefined), - B(Return), + /* 10 E> */ B(StackCheck), + /* 37 S> */ B(LdaSmi), U8(1), + /* 42 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(1), + /* 49 S> */ B(LdaSmi), U8(1), + /* 54 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(3), + /* 61 S> */ B(LdaSmi), U8(1), + /* 66 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(5), + /* 73 S> */ B(LdaSmi), U8(1), + /* 78 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(7), + /* 85 S> */ B(LdaSmi), U8(1), + /* 90 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(9), + /* 97 S> */ B(LdaSmi), U8(1), + /* 102 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(11), + /* 109 S> */ B(LdaSmi), U8(1), + /* 114 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(13), + /* 121 S> */ B(LdaSmi), U8(1), + /* 126 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(15), + /* 133 S> */ B(LdaSmi), U8(1), + /* 138 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(17), + /* 145 S> */ B(LdaSmi), U8(1), + /* 150 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(19), + /* 157 S> */ B(LdaSmi), U8(1), + /* 162 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(21), + /* 169 S> */ B(LdaSmi), U8(1), + /* 174 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(23), + /* 181 S> */ B(LdaSmi), U8(1), + /* 186 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(25), + /* 193 S> */ B(LdaSmi), U8(1), + /* 198 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(27), + /* 205 S> */ B(LdaSmi), U8(1), + /* 210 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(29), + /* 217 S> */ B(LdaSmi), U8(1), + /* 222 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(31), + /* 229 S> */ B(LdaSmi), U8(1), + /* 234 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(33), + /* 241 S> */ B(LdaSmi), U8(1), + /* 246 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(35), + /* 253 S> */ B(LdaSmi), U8(1), + /* 258 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(37), + /* 265 S> */ B(LdaSmi), U8(1), + /* 270 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(39), + /* 277 S> */ B(LdaSmi), U8(1), + /* 282 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(41), + /* 289 S> */ B(LdaSmi), U8(1), + /* 294 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(43), + /* 301 S> */ B(LdaSmi), U8(1), + /* 306 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(45), + /* 313 S> */ B(LdaSmi), U8(1), + /* 318 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(47), + /* 325 S> */ B(LdaSmi), U8(1), + /* 330 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(49), + /* 337 S> */ B(LdaSmi), U8(1), + /* 342 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(51), + /* 349 S> */ B(LdaSmi), U8(1), + /* 354 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(53), + /* 361 S> */ B(LdaSmi), U8(1), + /* 366 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(55), + /* 373 S> */ B(LdaSmi), U8(1), + /* 378 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(57), + /* 385 S> */ B(LdaSmi), U8(1), + /* 390 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(59), + /* 397 S> */ B(LdaSmi), U8(1), + /* 402 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(61), + /* 409 S> */ B(LdaSmi), U8(1), + /* 414 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(63), + /* 421 S> */ B(LdaSmi), U8(1), + /* 426 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(65), + /* 433 S> */ B(LdaSmi), U8(1), + /* 438 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(67), + /* 445 S> */ B(LdaSmi), U8(1), + /* 450 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(69), + /* 457 S> */ B(LdaSmi), U8(1), + /* 462 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(71), + /* 469 S> */ B(LdaSmi), U8(1), + /* 474 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(73), + /* 481 S> */ B(LdaSmi), U8(1), + /* 486 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(75), + /* 493 S> */ B(LdaSmi), U8(1), + /* 498 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(77), + /* 505 S> */ B(LdaSmi), U8(1), + /* 510 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(79), + /* 517 S> */ B(LdaSmi), U8(1), + /* 522 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(81), + /* 529 S> */ B(LdaSmi), U8(1), + /* 534 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(83), + /* 541 S> */ B(LdaSmi), U8(1), + /* 546 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(85), + /* 553 S> */ B(LdaSmi), U8(1), + /* 558 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(87), + /* 565 S> */ B(LdaSmi), U8(1), + /* 570 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(89), + /* 577 S> */ B(LdaSmi), U8(1), + /* 582 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(91), + /* 589 S> */ B(LdaSmi), U8(1), + /* 594 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(93), + /* 601 S> */ B(LdaSmi), U8(1), + /* 606 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(95), + /* 613 S> */ B(LdaSmi), U8(1), + /* 618 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(97), + /* 625 S> */ B(LdaSmi), U8(1), + /* 630 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(99), + /* 637 S> */ B(LdaSmi), U8(1), + /* 642 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(101), + /* 649 S> */ B(LdaSmi), U8(1), + /* 654 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(103), + /* 661 S> */ B(LdaSmi), U8(1), + /* 666 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(105), + /* 673 S> */ B(LdaSmi), U8(1), + /* 678 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(107), + /* 685 S> */ B(LdaSmi), U8(1), + /* 690 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(109), + /* 697 S> */ B(LdaSmi), U8(1), + /* 702 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(111), + /* 709 S> */ B(LdaSmi), U8(1), + /* 714 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(113), + /* 721 S> */ B(LdaSmi), U8(1), + /* 726 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(115), + /* 733 S> */ B(LdaSmi), U8(1), + /* 738 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(117), + /* 745 S> */ B(LdaSmi), U8(1), + /* 750 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(119), + /* 757 S> */ B(LdaSmi), U8(1), + /* 762 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(121), + /* 769 S> */ B(LdaSmi), U8(1), + /* 774 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(123), + /* 781 S> */ B(LdaSmi), U8(1), + /* 786 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(125), + /* 793 S> */ B(LdaSmi), U8(1), + /* 798 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(127), + /* 805 S> */ B(LdaSmi), U8(1), + /* 810 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(129), + /* 817 S> */ B(LdaSmi), U8(1), + /* 822 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(131), + /* 829 S> */ B(LdaSmi), U8(1), + /* 834 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(133), + /* 841 S> */ B(LdaSmi), U8(1), + /* 846 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(135), + /* 853 S> */ B(LdaSmi), U8(1), + /* 858 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(137), + /* 865 S> */ B(LdaSmi), U8(1), + /* 870 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(139), + /* 877 S> */ B(LdaSmi), U8(1), + /* 882 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(141), + /* 889 S> */ B(LdaSmi), U8(1), + /* 894 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(143), + /* 901 S> */ B(LdaSmi), U8(1), + /* 906 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(145), + /* 913 S> */ B(LdaSmi), U8(1), + /* 918 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(147), + /* 925 S> */ B(LdaSmi), U8(1), + /* 930 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(149), + /* 937 S> */ B(LdaSmi), U8(1), + /* 942 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(151), + /* 949 S> */ B(LdaSmi), U8(1), + /* 954 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(153), + /* 961 S> */ B(LdaSmi), U8(1), + /* 966 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(155), + /* 973 S> */ B(LdaSmi), U8(1), + /* 978 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(157), + /* 985 S> */ B(LdaSmi), U8(1), + /* 990 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(159), + /* 997 S> */ B(LdaSmi), U8(1), + /* 1002 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(161), + /* 1009 S> */ B(LdaSmi), U8(1), + /* 1014 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(163), + /* 1021 S> */ B(LdaSmi), U8(1), + /* 1026 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(165), + /* 1033 S> */ B(LdaSmi), U8(1), + /* 1038 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(167), + /* 1045 S> */ B(LdaSmi), U8(1), + /* 1050 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(169), + /* 1057 S> */ B(LdaSmi), U8(1), + /* 1062 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(171), + /* 1069 S> */ B(LdaSmi), U8(1), + /* 1074 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(173), + /* 1081 S> */ B(LdaSmi), U8(1), + /* 1086 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(175), + /* 1093 S> */ B(LdaSmi), U8(1), + /* 1098 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(177), + /* 1105 S> */ B(LdaSmi), U8(1), + /* 1110 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(179), + /* 1117 S> */ B(LdaSmi), U8(1), + /* 1122 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(181), + /* 1129 S> */ B(LdaSmi), U8(1), + /* 1134 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(183), + /* 1141 S> */ B(LdaSmi), U8(1), + /* 1146 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(185), + /* 1153 S> */ B(LdaSmi), U8(1), + /* 1158 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(187), + /* 1165 S> */ B(LdaSmi), U8(1), + /* 1170 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(189), + /* 1177 S> */ B(LdaSmi), U8(1), + /* 1182 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(191), + /* 1189 S> */ B(LdaSmi), U8(1), + /* 1194 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(193), + /* 1201 S> */ B(LdaSmi), U8(1), + /* 1206 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(195), + /* 1213 S> */ B(LdaSmi), U8(1), + /* 1218 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(197), + /* 1225 S> */ B(LdaSmi), U8(1), + /* 1230 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(199), + /* 1237 S> */ B(LdaSmi), U8(1), + /* 1242 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(201), + /* 1249 S> */ B(LdaSmi), U8(1), + /* 1254 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(203), + /* 1261 S> */ B(LdaSmi), U8(1), + /* 1266 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(205), + /* 1273 S> */ B(LdaSmi), U8(1), + /* 1278 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(207), + /* 1285 S> */ B(LdaSmi), U8(1), + /* 1290 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(209), + /* 1297 S> */ B(LdaSmi), U8(1), + /* 1302 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(211), + /* 1309 S> */ B(LdaSmi), U8(1), + /* 1314 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(213), + /* 1321 S> */ B(LdaSmi), U8(1), + /* 1326 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(215), + /* 1333 S> */ B(LdaSmi), U8(1), + /* 1338 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(217), + /* 1345 S> */ B(LdaSmi), U8(1), + /* 1350 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(219), + /* 1357 S> */ B(LdaSmi), U8(1), + /* 1362 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(221), + /* 1369 S> */ B(LdaSmi), U8(1), + /* 1374 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(223), + /* 1381 S> */ B(LdaSmi), U8(1), + /* 1386 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(225), + /* 1393 S> */ B(LdaSmi), U8(1), + /* 1398 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(227), + /* 1405 S> */ B(LdaSmi), U8(1), + /* 1410 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(229), + /* 1417 S> */ B(LdaSmi), U8(1), + /* 1422 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(231), + /* 1429 S> */ B(LdaSmi), U8(1), + /* 1434 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(233), + /* 1441 S> */ B(LdaSmi), U8(1), + /* 1446 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(235), + /* 1453 S> */ B(LdaSmi), U8(1), + /* 1458 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(237), + /* 1465 S> */ B(LdaSmi), U8(1), + /* 1470 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(239), + /* 1477 S> */ B(LdaSmi), U8(1), + /* 1482 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(241), + /* 1489 S> */ B(LdaSmi), U8(1), + /* 1494 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(243), + /* 1501 S> */ B(LdaSmi), U8(1), + /* 1506 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(245), + /* 1513 S> */ B(LdaSmi), U8(1), + /* 1518 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(247), + /* 1525 S> */ B(LdaSmi), U8(1), + /* 1530 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(249), + /* 1537 S> */ B(LdaSmi), U8(1), + /* 1542 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(251), + /* 1549 S> */ B(LdaSmi), U8(1), + /* 1554 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(253), + /* 1561 S> */ B(LdaSmi), U8(1), + /* 1566 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(255), + /* 1573 S> */ B(LdaSmi), U8(2), + /* 1578 E> */ B(Wide), B(StaKeyedPropertyStrict), R16(arg0), R16(arg1), U16(257), + B(LdaUndefined), + /* 1583 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden index adffb750bb..3637f78230 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(CreateRegExpLiteral), U8(0), U8(0), U8(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), + /* 49 S> */ B(Return), ] constant pool: [ "ab+d", @@ -33,12 +33,12 @@ frame size: 0 parameter count: 1 bytecode array length: 6 bytecodes: [ - B(StackCheck), - B(CreateRegExpLiteral), U8(0), U8(0), U8(2), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(2), + /* 58 S> */ B(Return), ] constant pool: [ - "(\x5cw+)\x5cs(\x5cw+)", + "(\u005cw+)\u005cs(\u005cw+)", ] handlers: [ ] @@ -49,17 +49,16 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - B(StackCheck), - B(CreateRegExpLiteral), U8(0), U8(0), U8(0), - B(Star), R(1), - B(LoadIC), R(1), U8(1), U8(3), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(2), - B(Call), R(0), R(1), U8(2), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), + B(Star), R(1), + /* 47 E> */ B(LdrNamedProperty), R(1), U8(1), U8(3), R(0), + B(LdaConstant), U8(2), + B(Star), R(2), + /* 48 E> */ B(Call), R(0), R(1), U8(2), U8(1), + /* 62 S> */ B(Return), ] constant pool: [ "ab+d", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden index d6fb160273..3c5499b4cf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden @@ -272,521 +272,521 @@ frame size: 1 parameter count: 1 bytecode array length: 1033 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Star), R(0), - B(LdaConstant), U8(2), - B(Star), R(0), - B(LdaConstant), U8(3), - B(Star), R(0), - B(LdaConstant), U8(4), - B(Star), R(0), - B(LdaConstant), U8(5), - B(Star), R(0), - B(LdaConstant), U8(6), - B(Star), R(0), - B(LdaConstant), U8(7), - B(Star), R(0), - B(LdaConstant), U8(8), - B(Star), R(0), - B(LdaConstant), U8(9), - B(Star), R(0), - B(LdaConstant), U8(10), - B(Star), R(0), - B(LdaConstant), U8(11), - B(Star), R(0), - B(LdaConstant), U8(12), - B(Star), R(0), - B(LdaConstant), U8(13), - B(Star), R(0), - B(LdaConstant), U8(14), - B(Star), R(0), - B(LdaConstant), U8(15), - B(Star), R(0), - B(LdaConstant), U8(16), - B(Star), R(0), - B(LdaConstant), U8(17), - B(Star), R(0), - B(LdaConstant), U8(18), - B(Star), R(0), - B(LdaConstant), U8(19), - B(Star), R(0), - B(LdaConstant), U8(20), - B(Star), R(0), - B(LdaConstant), U8(21), - B(Star), R(0), - B(LdaConstant), U8(22), - B(Star), R(0), - B(LdaConstant), U8(23), - B(Star), R(0), - B(LdaConstant), U8(24), - B(Star), R(0), - B(LdaConstant), U8(25), - B(Star), R(0), - B(LdaConstant), U8(26), - B(Star), R(0), - B(LdaConstant), U8(27), - B(Star), R(0), - B(LdaConstant), U8(28), - B(Star), R(0), - B(LdaConstant), U8(29), - B(Star), R(0), - B(LdaConstant), U8(30), - B(Star), R(0), - B(LdaConstant), U8(31), - B(Star), R(0), - B(LdaConstant), U8(32), - B(Star), R(0), - B(LdaConstant), U8(33), - B(Star), R(0), - B(LdaConstant), U8(34), - B(Star), R(0), - B(LdaConstant), U8(35), - B(Star), R(0), - B(LdaConstant), U8(36), - B(Star), R(0), - B(LdaConstant), U8(37), - B(Star), R(0), - B(LdaConstant), U8(38), - B(Star), R(0), - B(LdaConstant), U8(39), - B(Star), R(0), - B(LdaConstant), U8(40), - B(Star), R(0), - B(LdaConstant), U8(41), - B(Star), R(0), - B(LdaConstant), U8(42), - B(Star), R(0), - B(LdaConstant), U8(43), - B(Star), R(0), - B(LdaConstant), U8(44), - B(Star), R(0), - B(LdaConstant), U8(45), - B(Star), R(0), - B(LdaConstant), U8(46), - B(Star), R(0), - B(LdaConstant), U8(47), - B(Star), R(0), - B(LdaConstant), U8(48), - B(Star), R(0), - B(LdaConstant), U8(49), - B(Star), R(0), - B(LdaConstant), U8(50), - B(Star), R(0), - B(LdaConstant), U8(51), - B(Star), R(0), - B(LdaConstant), U8(52), - B(Star), R(0), - B(LdaConstant), U8(53), - B(Star), R(0), - B(LdaConstant), U8(54), - B(Star), R(0), - B(LdaConstant), U8(55), - B(Star), R(0), - B(LdaConstant), U8(56), - B(Star), R(0), - B(LdaConstant), U8(57), - B(Star), R(0), - B(LdaConstant), U8(58), - B(Star), R(0), - B(LdaConstant), U8(59), - B(Star), R(0), - B(LdaConstant), U8(60), - B(Star), R(0), - B(LdaConstant), U8(61), - B(Star), R(0), - B(LdaConstant), U8(62), - B(Star), R(0), - B(LdaConstant), U8(63), - B(Star), R(0), - B(LdaConstant), U8(64), - B(Star), R(0), - B(LdaConstant), U8(65), - B(Star), R(0), - B(LdaConstant), U8(66), - B(Star), R(0), - B(LdaConstant), U8(67), - B(Star), R(0), - B(LdaConstant), U8(68), - B(Star), R(0), - B(LdaConstant), U8(69), - B(Star), R(0), - B(LdaConstant), U8(70), - B(Star), R(0), - B(LdaConstant), U8(71), - B(Star), R(0), - B(LdaConstant), U8(72), - B(Star), R(0), - B(LdaConstant), U8(73), - B(Star), R(0), - B(LdaConstant), U8(74), - B(Star), R(0), - B(LdaConstant), U8(75), - B(Star), R(0), - B(LdaConstant), U8(76), - B(Star), R(0), - B(LdaConstant), U8(77), - B(Star), R(0), - B(LdaConstant), U8(78), - B(Star), R(0), - B(LdaConstant), U8(79), - B(Star), R(0), - B(LdaConstant), U8(80), - B(Star), R(0), - B(LdaConstant), U8(81), - B(Star), R(0), - B(LdaConstant), U8(82), - B(Star), R(0), - B(LdaConstant), U8(83), - B(Star), R(0), - B(LdaConstant), U8(84), - B(Star), R(0), - B(LdaConstant), U8(85), - B(Star), R(0), - B(LdaConstant), U8(86), - B(Star), R(0), - B(LdaConstant), U8(87), - B(Star), R(0), - B(LdaConstant), U8(88), - B(Star), R(0), - B(LdaConstant), U8(89), - B(Star), R(0), - B(LdaConstant), U8(90), - B(Star), R(0), - B(LdaConstant), U8(91), - B(Star), R(0), - B(LdaConstant), U8(92), - B(Star), R(0), - B(LdaConstant), U8(93), - B(Star), R(0), - B(LdaConstant), U8(94), - B(Star), R(0), - B(LdaConstant), U8(95), - B(Star), R(0), - B(LdaConstant), U8(96), - B(Star), R(0), - B(LdaConstant), U8(97), - B(Star), R(0), - B(LdaConstant), U8(98), - B(Star), R(0), - B(LdaConstant), U8(99), - B(Star), R(0), - B(LdaConstant), U8(100), - B(Star), R(0), - B(LdaConstant), U8(101), - B(Star), R(0), - B(LdaConstant), U8(102), - B(Star), R(0), - B(LdaConstant), U8(103), - B(Star), R(0), - B(LdaConstant), U8(104), - B(Star), R(0), - B(LdaConstant), U8(105), - B(Star), R(0), - B(LdaConstant), U8(106), - B(Star), R(0), - B(LdaConstant), U8(107), - B(Star), R(0), - B(LdaConstant), U8(108), - B(Star), R(0), - B(LdaConstant), U8(109), - B(Star), R(0), - B(LdaConstant), U8(110), - B(Star), R(0), - B(LdaConstant), U8(111), - B(Star), R(0), - B(LdaConstant), U8(112), - B(Star), R(0), - B(LdaConstant), U8(113), - B(Star), R(0), - B(LdaConstant), U8(114), - B(Star), R(0), - B(LdaConstant), U8(115), - B(Star), R(0), - B(LdaConstant), U8(116), - B(Star), R(0), - B(LdaConstant), U8(117), - B(Star), R(0), - B(LdaConstant), U8(118), - B(Star), R(0), - B(LdaConstant), U8(119), - B(Star), R(0), - B(LdaConstant), U8(120), - B(Star), R(0), - B(LdaConstant), U8(121), - B(Star), R(0), - B(LdaConstant), U8(122), - B(Star), R(0), - B(LdaConstant), U8(123), - B(Star), R(0), - B(LdaConstant), U8(124), - B(Star), R(0), - B(LdaConstant), U8(125), - B(Star), R(0), - B(LdaConstant), U8(126), - B(Star), R(0), - B(LdaConstant), U8(127), - B(Star), R(0), - B(LdaConstant), U8(128), - B(Star), R(0), - B(LdaConstant), U8(129), - B(Star), R(0), - B(LdaConstant), U8(130), - B(Star), R(0), - B(LdaConstant), U8(131), - B(Star), R(0), - B(LdaConstant), U8(132), - B(Star), R(0), - B(LdaConstant), U8(133), - B(Star), R(0), - B(LdaConstant), U8(134), - B(Star), R(0), - B(LdaConstant), U8(135), - B(Star), R(0), - B(LdaConstant), U8(136), - B(Star), R(0), - B(LdaConstant), U8(137), - B(Star), R(0), - B(LdaConstant), U8(138), - B(Star), R(0), - B(LdaConstant), U8(139), - B(Star), R(0), - B(LdaConstant), U8(140), - B(Star), R(0), - B(LdaConstant), U8(141), - B(Star), R(0), - B(LdaConstant), U8(142), - B(Star), R(0), - B(LdaConstant), U8(143), - B(Star), R(0), - B(LdaConstant), U8(144), - B(Star), R(0), - B(LdaConstant), U8(145), - B(Star), R(0), - B(LdaConstant), U8(146), - B(Star), R(0), - B(LdaConstant), U8(147), - B(Star), R(0), - B(LdaConstant), U8(148), - B(Star), R(0), - B(LdaConstant), U8(149), - B(Star), R(0), - B(LdaConstant), U8(150), - B(Star), R(0), - B(LdaConstant), U8(151), - B(Star), R(0), - B(LdaConstant), U8(152), - B(Star), R(0), - B(LdaConstant), U8(153), - B(Star), R(0), - B(LdaConstant), U8(154), - B(Star), R(0), - B(LdaConstant), U8(155), - B(Star), R(0), - B(LdaConstant), U8(156), - B(Star), R(0), - B(LdaConstant), U8(157), - B(Star), R(0), - B(LdaConstant), U8(158), - B(Star), R(0), - B(LdaConstant), U8(159), - B(Star), R(0), - B(LdaConstant), U8(160), - B(Star), R(0), - B(LdaConstant), U8(161), - B(Star), R(0), - B(LdaConstant), U8(162), - B(Star), R(0), - B(LdaConstant), U8(163), - B(Star), R(0), - B(LdaConstant), U8(164), - B(Star), R(0), - B(LdaConstant), U8(165), - B(Star), R(0), - B(LdaConstant), U8(166), - B(Star), R(0), - B(LdaConstant), U8(167), - B(Star), R(0), - B(LdaConstant), U8(168), - B(Star), R(0), - B(LdaConstant), U8(169), - B(Star), R(0), - B(LdaConstant), U8(170), - B(Star), R(0), - B(LdaConstant), U8(171), - B(Star), R(0), - B(LdaConstant), U8(172), - B(Star), R(0), - B(LdaConstant), U8(173), - B(Star), R(0), - B(LdaConstant), U8(174), - B(Star), R(0), - B(LdaConstant), U8(175), - B(Star), R(0), - B(LdaConstant), U8(176), - B(Star), R(0), - B(LdaConstant), U8(177), - B(Star), R(0), - B(LdaConstant), U8(178), - B(Star), R(0), - B(LdaConstant), U8(179), - B(Star), R(0), - B(LdaConstant), U8(180), - B(Star), R(0), - B(LdaConstant), U8(181), - B(Star), R(0), - B(LdaConstant), U8(182), - B(Star), R(0), - B(LdaConstant), U8(183), - B(Star), R(0), - B(LdaConstant), U8(184), - B(Star), R(0), - B(LdaConstant), U8(185), - B(Star), R(0), - B(LdaConstant), U8(186), - B(Star), R(0), - B(LdaConstant), U8(187), - B(Star), R(0), - B(LdaConstant), U8(188), - B(Star), R(0), - B(LdaConstant), U8(189), - B(Star), R(0), - B(LdaConstant), U8(190), - B(Star), R(0), - B(LdaConstant), U8(191), - B(Star), R(0), - B(LdaConstant), U8(192), - B(Star), R(0), - B(LdaConstant), U8(193), - B(Star), R(0), - B(LdaConstant), U8(194), - B(Star), R(0), - B(LdaConstant), U8(195), - B(Star), R(0), - B(LdaConstant), U8(196), - B(Star), R(0), - B(LdaConstant), U8(197), - B(Star), R(0), - B(LdaConstant), U8(198), - B(Star), R(0), - B(LdaConstant), U8(199), - B(Star), R(0), - B(LdaConstant), U8(200), - B(Star), R(0), - B(LdaConstant), U8(201), - B(Star), R(0), - B(LdaConstant), U8(202), - B(Star), R(0), - B(LdaConstant), U8(203), - B(Star), R(0), - B(LdaConstant), U8(204), - B(Star), R(0), - B(LdaConstant), U8(205), - B(Star), R(0), - B(LdaConstant), U8(206), - B(Star), R(0), - B(LdaConstant), U8(207), - B(Star), R(0), - B(LdaConstant), U8(208), - B(Star), R(0), - B(LdaConstant), U8(209), - B(Star), R(0), - B(LdaConstant), U8(210), - B(Star), R(0), - B(LdaConstant), U8(211), - B(Star), R(0), - B(LdaConstant), U8(212), - B(Star), R(0), - B(LdaConstant), U8(213), - B(Star), R(0), - B(LdaConstant), U8(214), - B(Star), R(0), - B(LdaConstant), U8(215), - B(Star), R(0), - B(LdaConstant), U8(216), - B(Star), R(0), - B(LdaConstant), U8(217), - B(Star), R(0), - B(LdaConstant), U8(218), - B(Star), R(0), - B(LdaConstant), U8(219), - B(Star), R(0), - B(LdaConstant), U8(220), - B(Star), R(0), - B(LdaConstant), U8(221), - B(Star), R(0), - B(LdaConstant), U8(222), - B(Star), R(0), - B(LdaConstant), U8(223), - B(Star), R(0), - B(LdaConstant), U8(224), - B(Star), R(0), - B(LdaConstant), U8(225), - B(Star), R(0), - B(LdaConstant), U8(226), - B(Star), R(0), - B(LdaConstant), U8(227), - B(Star), R(0), - B(LdaConstant), U8(228), - B(Star), R(0), - B(LdaConstant), U8(229), - B(Star), R(0), - B(LdaConstant), U8(230), - B(Star), R(0), - B(LdaConstant), U8(231), - B(Star), R(0), - B(LdaConstant), U8(232), - B(Star), R(0), - B(LdaConstant), U8(233), - B(Star), R(0), - B(LdaConstant), U8(234), - B(Star), R(0), - B(LdaConstant), U8(235), - B(Star), R(0), - B(LdaConstant), U8(236), - B(Star), R(0), - B(LdaConstant), U8(237), - B(Star), R(0), - B(LdaConstant), U8(238), - B(Star), R(0), - B(LdaConstant), U8(239), - B(Star), R(0), - B(LdaConstant), U8(240), - B(Star), R(0), - B(LdaConstant), U8(241), - B(Star), R(0), - B(LdaConstant), U8(242), - B(Star), R(0), - B(LdaConstant), U8(243), - B(Star), R(0), - B(LdaConstant), U8(244), - B(Star), R(0), - B(LdaConstant), U8(245), - B(Star), R(0), - B(LdaConstant), U8(246), - B(Star), R(0), - B(LdaConstant), U8(247), - B(Star), R(0), - B(LdaConstant), U8(248), - B(Star), R(0), - B(LdaConstant), U8(249), - B(Star), R(0), - B(LdaConstant), U8(250), - B(Star), R(0), - B(LdaConstant), U8(251), - B(Star), R(0), - B(LdaConstant), U8(252), - B(Star), R(0), - B(LdaConstant), U8(253), - B(Star), R(0), - B(LdaConstant), U8(254), - B(Star), R(0), - B(LdaConstant), U8(255), - B(Star), R(0), - B(Wide), B(CreateRegExpLiteral), U16(256), U16(0), U8(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 41 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 51 S> */ B(LdaConstant), U8(1), + B(Star), R(0), + /* 61 S> */ B(LdaConstant), U8(2), + B(Star), R(0), + /* 71 S> */ B(LdaConstant), U8(3), + B(Star), R(0), + /* 81 S> */ B(LdaConstant), U8(4), + B(Star), R(0), + /* 91 S> */ B(LdaConstant), U8(5), + B(Star), R(0), + /* 101 S> */ B(LdaConstant), U8(6), + B(Star), R(0), + /* 111 S> */ B(LdaConstant), U8(7), + B(Star), R(0), + /* 121 S> */ B(LdaConstant), U8(8), + B(Star), R(0), + /* 131 S> */ B(LdaConstant), U8(9), + B(Star), R(0), + /* 141 S> */ B(LdaConstant), U8(10), + B(Star), R(0), + /* 151 S> */ B(LdaConstant), U8(11), + B(Star), R(0), + /* 161 S> */ B(LdaConstant), U8(12), + B(Star), R(0), + /* 171 S> */ B(LdaConstant), U8(13), + B(Star), R(0), + /* 181 S> */ B(LdaConstant), U8(14), + B(Star), R(0), + /* 191 S> */ B(LdaConstant), U8(15), + B(Star), R(0), + /* 201 S> */ B(LdaConstant), U8(16), + B(Star), R(0), + /* 211 S> */ B(LdaConstant), U8(17), + B(Star), R(0), + /* 221 S> */ B(LdaConstant), U8(18), + B(Star), R(0), + /* 231 S> */ B(LdaConstant), U8(19), + B(Star), R(0), + /* 241 S> */ B(LdaConstant), U8(20), + B(Star), R(0), + /* 251 S> */ B(LdaConstant), U8(21), + B(Star), R(0), + /* 261 S> */ B(LdaConstant), U8(22), + B(Star), R(0), + /* 271 S> */ B(LdaConstant), U8(23), + B(Star), R(0), + /* 281 S> */ B(LdaConstant), U8(24), + B(Star), R(0), + /* 291 S> */ B(LdaConstant), U8(25), + B(Star), R(0), + /* 301 S> */ B(LdaConstant), U8(26), + B(Star), R(0), + /* 311 S> */ B(LdaConstant), U8(27), + B(Star), R(0), + /* 321 S> */ B(LdaConstant), U8(28), + B(Star), R(0), + /* 331 S> */ B(LdaConstant), U8(29), + B(Star), R(0), + /* 341 S> */ B(LdaConstant), U8(30), + B(Star), R(0), + /* 351 S> */ B(LdaConstant), U8(31), + B(Star), R(0), + /* 361 S> */ B(LdaConstant), U8(32), + B(Star), R(0), + /* 371 S> */ B(LdaConstant), U8(33), + B(Star), R(0), + /* 381 S> */ B(LdaConstant), U8(34), + B(Star), R(0), + /* 391 S> */ B(LdaConstant), U8(35), + B(Star), R(0), + /* 401 S> */ B(LdaConstant), U8(36), + B(Star), R(0), + /* 411 S> */ B(LdaConstant), U8(37), + B(Star), R(0), + /* 421 S> */ B(LdaConstant), U8(38), + B(Star), R(0), + /* 431 S> */ B(LdaConstant), U8(39), + B(Star), R(0), + /* 441 S> */ B(LdaConstant), U8(40), + B(Star), R(0), + /* 451 S> */ B(LdaConstant), U8(41), + B(Star), R(0), + /* 461 S> */ B(LdaConstant), U8(42), + B(Star), R(0), + /* 471 S> */ B(LdaConstant), U8(43), + B(Star), R(0), + /* 481 S> */ B(LdaConstant), U8(44), + B(Star), R(0), + /* 491 S> */ B(LdaConstant), U8(45), + B(Star), R(0), + /* 501 S> */ B(LdaConstant), U8(46), + B(Star), R(0), + /* 511 S> */ B(LdaConstant), U8(47), + B(Star), R(0), + /* 521 S> */ B(LdaConstant), U8(48), + B(Star), R(0), + /* 531 S> */ B(LdaConstant), U8(49), + B(Star), R(0), + /* 541 S> */ B(LdaConstant), U8(50), + B(Star), R(0), + /* 551 S> */ B(LdaConstant), U8(51), + B(Star), R(0), + /* 561 S> */ B(LdaConstant), U8(52), + B(Star), R(0), + /* 571 S> */ B(LdaConstant), U8(53), + B(Star), R(0), + /* 581 S> */ B(LdaConstant), U8(54), + B(Star), R(0), + /* 591 S> */ B(LdaConstant), U8(55), + B(Star), R(0), + /* 601 S> */ B(LdaConstant), U8(56), + B(Star), R(0), + /* 611 S> */ B(LdaConstant), U8(57), + B(Star), R(0), + /* 621 S> */ B(LdaConstant), U8(58), + B(Star), R(0), + /* 631 S> */ B(LdaConstant), U8(59), + B(Star), R(0), + /* 641 S> */ B(LdaConstant), U8(60), + B(Star), R(0), + /* 651 S> */ B(LdaConstant), U8(61), + B(Star), R(0), + /* 661 S> */ B(LdaConstant), U8(62), + B(Star), R(0), + /* 671 S> */ B(LdaConstant), U8(63), + B(Star), R(0), + /* 681 S> */ B(LdaConstant), U8(64), + B(Star), R(0), + /* 691 S> */ B(LdaConstant), U8(65), + B(Star), R(0), + /* 701 S> */ B(LdaConstant), U8(66), + B(Star), R(0), + /* 711 S> */ B(LdaConstant), U8(67), + B(Star), R(0), + /* 721 S> */ B(LdaConstant), U8(68), + B(Star), R(0), + /* 731 S> */ B(LdaConstant), U8(69), + B(Star), R(0), + /* 741 S> */ B(LdaConstant), U8(70), + B(Star), R(0), + /* 751 S> */ B(LdaConstant), U8(71), + B(Star), R(0), + /* 761 S> */ B(LdaConstant), U8(72), + B(Star), R(0), + /* 771 S> */ B(LdaConstant), U8(73), + B(Star), R(0), + /* 781 S> */ B(LdaConstant), U8(74), + B(Star), R(0), + /* 791 S> */ B(LdaConstant), U8(75), + B(Star), R(0), + /* 801 S> */ B(LdaConstant), U8(76), + B(Star), R(0), + /* 811 S> */ B(LdaConstant), U8(77), + B(Star), R(0), + /* 821 S> */ B(LdaConstant), U8(78), + B(Star), R(0), + /* 831 S> */ B(LdaConstant), U8(79), + B(Star), R(0), + /* 841 S> */ B(LdaConstant), U8(80), + B(Star), R(0), + /* 851 S> */ B(LdaConstant), U8(81), + B(Star), R(0), + /* 861 S> */ B(LdaConstant), U8(82), + B(Star), R(0), + /* 871 S> */ B(LdaConstant), U8(83), + B(Star), R(0), + /* 881 S> */ B(LdaConstant), U8(84), + B(Star), R(0), + /* 891 S> */ B(LdaConstant), U8(85), + B(Star), R(0), + /* 901 S> */ B(LdaConstant), U8(86), + B(Star), R(0), + /* 911 S> */ B(LdaConstant), U8(87), + B(Star), R(0), + /* 921 S> */ B(LdaConstant), U8(88), + B(Star), R(0), + /* 931 S> */ B(LdaConstant), U8(89), + B(Star), R(0), + /* 941 S> */ B(LdaConstant), U8(90), + B(Star), R(0), + /* 951 S> */ B(LdaConstant), U8(91), + B(Star), R(0), + /* 961 S> */ B(LdaConstant), U8(92), + B(Star), R(0), + /* 971 S> */ B(LdaConstant), U8(93), + B(Star), R(0), + /* 981 S> */ B(LdaConstant), U8(94), + B(Star), R(0), + /* 991 S> */ B(LdaConstant), U8(95), + B(Star), R(0), + /* 1001 S> */ B(LdaConstant), U8(96), + B(Star), R(0), + /* 1011 S> */ B(LdaConstant), U8(97), + B(Star), R(0), + /* 1021 S> */ B(LdaConstant), U8(98), + B(Star), R(0), + /* 1031 S> */ B(LdaConstant), U8(99), + B(Star), R(0), + /* 1041 S> */ B(LdaConstant), U8(100), + B(Star), R(0), + /* 1051 S> */ B(LdaConstant), U8(101), + B(Star), R(0), + /* 1061 S> */ B(LdaConstant), U8(102), + B(Star), R(0), + /* 1071 S> */ B(LdaConstant), U8(103), + B(Star), R(0), + /* 1081 S> */ B(LdaConstant), U8(104), + B(Star), R(0), + /* 1091 S> */ B(LdaConstant), U8(105), + B(Star), R(0), + /* 1101 S> */ B(LdaConstant), U8(106), + B(Star), R(0), + /* 1111 S> */ B(LdaConstant), U8(107), + B(Star), R(0), + /* 1121 S> */ B(LdaConstant), U8(108), + B(Star), R(0), + /* 1131 S> */ B(LdaConstant), U8(109), + B(Star), R(0), + /* 1141 S> */ B(LdaConstant), U8(110), + B(Star), R(0), + /* 1151 S> */ B(LdaConstant), U8(111), + B(Star), R(0), + /* 1161 S> */ B(LdaConstant), U8(112), + B(Star), R(0), + /* 1171 S> */ B(LdaConstant), U8(113), + B(Star), R(0), + /* 1181 S> */ B(LdaConstant), U8(114), + B(Star), R(0), + /* 1191 S> */ B(LdaConstant), U8(115), + B(Star), R(0), + /* 1201 S> */ B(LdaConstant), U8(116), + B(Star), R(0), + /* 1211 S> */ B(LdaConstant), U8(117), + B(Star), R(0), + /* 1221 S> */ B(LdaConstant), U8(118), + B(Star), R(0), + /* 1231 S> */ B(LdaConstant), U8(119), + B(Star), R(0), + /* 1241 S> */ B(LdaConstant), U8(120), + B(Star), R(0), + /* 1251 S> */ B(LdaConstant), U8(121), + B(Star), R(0), + /* 1261 S> */ B(LdaConstant), U8(122), + B(Star), R(0), + /* 1271 S> */ B(LdaConstant), U8(123), + B(Star), R(0), + /* 1281 S> */ B(LdaConstant), U8(124), + B(Star), R(0), + /* 1291 S> */ B(LdaConstant), U8(125), + B(Star), R(0), + /* 1301 S> */ B(LdaConstant), U8(126), + B(Star), R(0), + /* 1311 S> */ B(LdaConstant), U8(127), + B(Star), R(0), + /* 1321 S> */ B(LdaConstant), U8(128), + B(Star), R(0), + /* 1331 S> */ B(LdaConstant), U8(129), + B(Star), R(0), + /* 1341 S> */ B(LdaConstant), U8(130), + B(Star), R(0), + /* 1351 S> */ B(LdaConstant), U8(131), + B(Star), R(0), + /* 1361 S> */ B(LdaConstant), U8(132), + B(Star), R(0), + /* 1371 S> */ B(LdaConstant), U8(133), + B(Star), R(0), + /* 1381 S> */ B(LdaConstant), U8(134), + B(Star), R(0), + /* 1391 S> */ B(LdaConstant), U8(135), + B(Star), R(0), + /* 1401 S> */ B(LdaConstant), U8(136), + B(Star), R(0), + /* 1411 S> */ B(LdaConstant), U8(137), + B(Star), R(0), + /* 1421 S> */ B(LdaConstant), U8(138), + B(Star), R(0), + /* 1431 S> */ B(LdaConstant), U8(139), + B(Star), R(0), + /* 1441 S> */ B(LdaConstant), U8(140), + B(Star), R(0), + /* 1451 S> */ B(LdaConstant), U8(141), + B(Star), R(0), + /* 1461 S> */ B(LdaConstant), U8(142), + B(Star), R(0), + /* 1471 S> */ B(LdaConstant), U8(143), + B(Star), R(0), + /* 1481 S> */ B(LdaConstant), U8(144), + B(Star), R(0), + /* 1491 S> */ B(LdaConstant), U8(145), + B(Star), R(0), + /* 1501 S> */ B(LdaConstant), U8(146), + B(Star), R(0), + /* 1511 S> */ B(LdaConstant), U8(147), + B(Star), R(0), + /* 1521 S> */ B(LdaConstant), U8(148), + B(Star), R(0), + /* 1531 S> */ B(LdaConstant), U8(149), + B(Star), R(0), + /* 1541 S> */ B(LdaConstant), U8(150), + B(Star), R(0), + /* 1551 S> */ B(LdaConstant), U8(151), + B(Star), R(0), + /* 1561 S> */ B(LdaConstant), U8(152), + B(Star), R(0), + /* 1571 S> */ B(LdaConstant), U8(153), + B(Star), R(0), + /* 1581 S> */ B(LdaConstant), U8(154), + B(Star), R(0), + /* 1591 S> */ B(LdaConstant), U8(155), + B(Star), R(0), + /* 1601 S> */ B(LdaConstant), U8(156), + B(Star), R(0), + /* 1611 S> */ B(LdaConstant), U8(157), + B(Star), R(0), + /* 1621 S> */ B(LdaConstant), U8(158), + B(Star), R(0), + /* 1631 S> */ B(LdaConstant), U8(159), + B(Star), R(0), + /* 1641 S> */ B(LdaConstant), U8(160), + B(Star), R(0), + /* 1651 S> */ B(LdaConstant), U8(161), + B(Star), R(0), + /* 1661 S> */ B(LdaConstant), U8(162), + B(Star), R(0), + /* 1671 S> */ B(LdaConstant), U8(163), + B(Star), R(0), + /* 1681 S> */ B(LdaConstant), U8(164), + B(Star), R(0), + /* 1691 S> */ B(LdaConstant), U8(165), + B(Star), R(0), + /* 1701 S> */ B(LdaConstant), U8(166), + B(Star), R(0), + /* 1711 S> */ B(LdaConstant), U8(167), + B(Star), R(0), + /* 1721 S> */ B(LdaConstant), U8(168), + B(Star), R(0), + /* 1731 S> */ B(LdaConstant), U8(169), + B(Star), R(0), + /* 1741 S> */ B(LdaConstant), U8(170), + B(Star), R(0), + /* 1751 S> */ B(LdaConstant), U8(171), + B(Star), R(0), + /* 1761 S> */ B(LdaConstant), U8(172), + B(Star), R(0), + /* 1771 S> */ B(LdaConstant), U8(173), + B(Star), R(0), + /* 1781 S> */ B(LdaConstant), U8(174), + B(Star), R(0), + /* 1791 S> */ B(LdaConstant), U8(175), + B(Star), R(0), + /* 1801 S> */ B(LdaConstant), U8(176), + B(Star), R(0), + /* 1811 S> */ B(LdaConstant), U8(177), + B(Star), R(0), + /* 1821 S> */ B(LdaConstant), U8(178), + B(Star), R(0), + /* 1831 S> */ B(LdaConstant), U8(179), + B(Star), R(0), + /* 1841 S> */ B(LdaConstant), U8(180), + B(Star), R(0), + /* 1851 S> */ B(LdaConstant), U8(181), + B(Star), R(0), + /* 1861 S> */ B(LdaConstant), U8(182), + B(Star), R(0), + /* 1871 S> */ B(LdaConstant), U8(183), + B(Star), R(0), + /* 1881 S> */ B(LdaConstant), U8(184), + B(Star), R(0), + /* 1891 S> */ B(LdaConstant), U8(185), + B(Star), R(0), + /* 1901 S> */ B(LdaConstant), U8(186), + B(Star), R(0), + /* 1911 S> */ B(LdaConstant), U8(187), + B(Star), R(0), + /* 1921 S> */ B(LdaConstant), U8(188), + B(Star), R(0), + /* 1931 S> */ B(LdaConstant), U8(189), + B(Star), R(0), + /* 1941 S> */ B(LdaConstant), U8(190), + B(Star), R(0), + /* 1951 S> */ B(LdaConstant), U8(191), + B(Star), R(0), + /* 1961 S> */ B(LdaConstant), U8(192), + B(Star), R(0), + /* 1971 S> */ B(LdaConstant), U8(193), + B(Star), R(0), + /* 1981 S> */ B(LdaConstant), U8(194), + B(Star), R(0), + /* 1991 S> */ B(LdaConstant), U8(195), + B(Star), R(0), + /* 2001 S> */ B(LdaConstant), U8(196), + B(Star), R(0), + /* 2011 S> */ B(LdaConstant), U8(197), + B(Star), R(0), + /* 2021 S> */ B(LdaConstant), U8(198), + B(Star), R(0), + /* 2031 S> */ B(LdaConstant), U8(199), + B(Star), R(0), + /* 2041 S> */ B(LdaConstant), U8(200), + B(Star), R(0), + /* 2051 S> */ B(LdaConstant), U8(201), + B(Star), R(0), + /* 2061 S> */ B(LdaConstant), U8(202), + B(Star), R(0), + /* 2071 S> */ B(LdaConstant), U8(203), + B(Star), R(0), + /* 2081 S> */ B(LdaConstant), U8(204), + B(Star), R(0), + /* 2091 S> */ B(LdaConstant), U8(205), + B(Star), R(0), + /* 2101 S> */ B(LdaConstant), U8(206), + B(Star), R(0), + /* 2111 S> */ B(LdaConstant), U8(207), + B(Star), R(0), + /* 2121 S> */ B(LdaConstant), U8(208), + B(Star), R(0), + /* 2131 S> */ B(LdaConstant), U8(209), + B(Star), R(0), + /* 2141 S> */ B(LdaConstant), U8(210), + B(Star), R(0), + /* 2151 S> */ B(LdaConstant), U8(211), + B(Star), R(0), + /* 2161 S> */ B(LdaConstant), U8(212), + B(Star), R(0), + /* 2171 S> */ B(LdaConstant), U8(213), + B(Star), R(0), + /* 2181 S> */ B(LdaConstant), U8(214), + B(Star), R(0), + /* 2191 S> */ B(LdaConstant), U8(215), + B(Star), R(0), + /* 2201 S> */ B(LdaConstant), U8(216), + B(Star), R(0), + /* 2211 S> */ B(LdaConstant), U8(217), + B(Star), R(0), + /* 2221 S> */ B(LdaConstant), U8(218), + B(Star), R(0), + /* 2231 S> */ B(LdaConstant), U8(219), + B(Star), R(0), + /* 2241 S> */ B(LdaConstant), U8(220), + B(Star), R(0), + /* 2251 S> */ B(LdaConstant), U8(221), + B(Star), R(0), + /* 2261 S> */ B(LdaConstant), U8(222), + B(Star), R(0), + /* 2271 S> */ B(LdaConstant), U8(223), + B(Star), R(0), + /* 2281 S> */ B(LdaConstant), U8(224), + B(Star), R(0), + /* 2291 S> */ B(LdaConstant), U8(225), + B(Star), R(0), + /* 2301 S> */ B(LdaConstant), U8(226), + B(Star), R(0), + /* 2311 S> */ B(LdaConstant), U8(227), + B(Star), R(0), + /* 2321 S> */ B(LdaConstant), U8(228), + B(Star), R(0), + /* 2331 S> */ B(LdaConstant), U8(229), + B(Star), R(0), + /* 2341 S> */ B(LdaConstant), U8(230), + B(Star), R(0), + /* 2351 S> */ B(LdaConstant), U8(231), + B(Star), R(0), + /* 2361 S> */ B(LdaConstant), U8(232), + B(Star), R(0), + /* 2371 S> */ B(LdaConstant), U8(233), + B(Star), R(0), + /* 2381 S> */ B(LdaConstant), U8(234), + B(Star), R(0), + /* 2391 S> */ B(LdaConstant), U8(235), + B(Star), R(0), + /* 2401 S> */ B(LdaConstant), U8(236), + B(Star), R(0), + /* 2411 S> */ B(LdaConstant), U8(237), + B(Star), R(0), + /* 2421 S> */ B(LdaConstant), U8(238), + B(Star), R(0), + /* 2431 S> */ B(LdaConstant), U8(239), + B(Star), R(0), + /* 2441 S> */ B(LdaConstant), U8(240), + B(Star), R(0), + /* 2451 S> */ B(LdaConstant), U8(241), + B(Star), R(0), + /* 2461 S> */ B(LdaConstant), U8(242), + B(Star), R(0), + /* 2471 S> */ B(LdaConstant), U8(243), + B(Star), R(0), + /* 2481 S> */ B(LdaConstant), U8(244), + B(Star), R(0), + /* 2491 S> */ B(LdaConstant), U8(245), + B(Star), R(0), + /* 2501 S> */ B(LdaConstant), U8(246), + B(Star), R(0), + /* 2511 S> */ B(LdaConstant), U8(247), + B(Star), R(0), + /* 2521 S> */ B(LdaConstant), U8(248), + B(Star), R(0), + /* 2531 S> */ B(LdaConstant), U8(249), + B(Star), R(0), + /* 2541 S> */ B(LdaConstant), U8(250), + B(Star), R(0), + /* 2551 S> */ B(LdaConstant), U8(251), + B(Star), R(0), + /* 2561 S> */ B(LdaConstant), U8(252), + B(Star), R(0), + /* 2571 S> */ B(LdaConstant), U8(253), + B(Star), R(0), + /* 2581 S> */ B(LdaConstant), U8(254), + 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), + /* 2616 S> */ B(Return), ] constant pool: [ InstanceType::HEAP_NUMBER_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden index e9283cdf51..c632a76e69 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden @@ -16,27 +16,24 @@ snippet: " } return ld_a; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 31 +bytecode array length: 26 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(Ldar), R(0), - B(Add), R(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(10), - B(TestGreaterThan), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(4), - B(Jump), U8(-21), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 45 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 48 E> */ B(StackCheck), + /* 64 S> */ B(Ldar), R(0), + /* 78 E> */ B(Add), R(0), U8(1), + B(Star), R(0), + /* 86 S> */ B(LdaSmi), U8(10), + /* 95 E> */ B(TestGreaterThan), R(0), + B(JumpIfFalse), U8(4), + /* 101 S> */ B(Jump), U8(4), + B(Jump), U8(-16), + /* 110 S> */ B(Ldar), R(0), + /* 123 S> */ B(Return), ] constant pool: [ ] @@ -52,26 +49,23 @@ snippet: " } while(false); return ld_a; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 29 +bytecode array length: 23 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(Ldar), R(0), - B(Add), R(1), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(10), - B(TestGreaterThan), R(1), - B(JumpIfFalse), U8(4), - B(Jump), U8(2), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 45 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 48 E> */ B(StackCheck), + /* 55 S> */ B(Nop), + /* 69 E> */ B(Add), R(0), U8(1), + B(Star), R(0), + /* 77 S> */ B(LdaSmi), U8(10), + /* 86 E> */ B(TestGreaterThan), R(0), + B(JumpIfFalse), U8(4), + /* 92 S> */ B(Jump), U8(2), + /* 118 S> */ B(Ldar), R(0), + /* 131 S> */ B(Return), ] constant pool: [ ] @@ -84,18 +78,18 @@ snippet: " ld_a = ld_a + ld_a; return ld_a; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Star), R(1), - B(Ldar), R(0), - B(Add), R(1), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 45 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 50 S> */ B(Nop), + /* 64 E> */ B(Add), R(0), U8(1), + B(Star), R(0), + /* 72 S> */ B(Nop), + /* 85 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden index 151c334221..5cc49b2035 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden @@ -18,11 +18,11 @@ frame size: 0 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(2), - B(StaGlobalSloppy), U8(0), U8(1), - B(LdaUndefined), - B(Return), + /* 21 E> */ B(StackCheck), + /* 26 S> */ B(LdaSmi), U8(2), + /* 28 E> */ B(StaGlobalSloppy), U8(0), U8(1), + B(LdaUndefined), + /* 33 S> */ B(Return), ] constant pool: [ "a", @@ -39,11 +39,11 @@ frame size: 0 parameter count: 2 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(StaGlobalSloppy), U8(0), U8(1), - B(LdaUndefined), - B(Return), + /* 26 E> */ B(StackCheck), + /* 32 S> */ B(Ldar), R(arg0), + /* 34 E> */ B(StaGlobalSloppy), U8(0), U8(1), + B(LdaUndefined), + /* 39 S> */ B(Return), ] constant pool: [ "a", @@ -61,11 +61,11 @@ frame size: 0 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(2), - B(StaGlobalStrict), U8(0), U8(1), - B(LdaUndefined), - B(Return), + /* 35 E> */ B(StackCheck), + /* 40 S> */ B(LdaSmi), U8(2), + /* 42 E> */ B(StaGlobalStrict), U8(0), U8(1), + B(LdaUndefined), + /* 47 S> */ B(Return), ] constant pool: [ "a", @@ -83,11 +83,11 @@ frame size: 0 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(2), - B(StaGlobalSloppy), U8(0), U8(1), - B(LdaUndefined), - B(Return), + /* 17 E> */ B(StackCheck), + /* 22 S> */ B(LdaSmi), U8(2), + /* 24 E> */ B(StaGlobalSloppy), U8(0), U8(1), + B(LdaUndefined), + /* 29 S> */ B(Return), ] constant pool: [ "a", @@ -231,399 +231,271 @@ snippet: " } f({name: 1}); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 1035 +bytecode array length: 651 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(255), - B(LdaSmi), U8(2), - B(Wide), B(StaGlobalSloppy), U16(1), U16(257), - B(LdaUndefined), - B(Return), + /* 17 E> */ B(StackCheck), + /* 25 S> */ B(Nop), + /* 26 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 35 S> */ B(Nop), + /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 45 S> */ B(Nop), + /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 55 S> */ B(Nop), + /* 56 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 65 S> */ B(Nop), + /* 66 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 75 S> */ B(Nop), + /* 76 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 85 S> */ B(Nop), + /* 86 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 95 S> */ B(Nop), + /* 96 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 105 S> */ B(Nop), + /* 106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 115 S> */ B(Nop), + /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 125 S> */ B(Nop), + /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 135 S> */ B(Nop), + /* 136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 145 S> */ B(Nop), + /* 146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 155 S> */ B(Nop), + /* 156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 165 S> */ B(Nop), + /* 166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 175 S> */ B(Nop), + /* 176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 185 S> */ B(Nop), + /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 195 S> */ B(Nop), + /* 196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 205 S> */ B(Nop), + /* 206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 215 S> */ B(Nop), + /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 225 S> */ B(Nop), + /* 226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 235 S> */ B(Nop), + /* 236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 245 S> */ B(Nop), + /* 246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 255 S> */ B(Nop), + /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 265 S> */ B(Nop), + /* 266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 275 S> */ B(Nop), + /* 276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 285 S> */ B(Nop), + /* 286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 295 S> */ B(Nop), + /* 296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 305 S> */ B(Nop), + /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 315 S> */ B(Nop), + /* 316 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 325 S> */ B(Nop), + /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 335 S> */ B(Nop), + /* 336 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 345 S> */ B(Nop), + /* 346 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 355 S> */ B(Nop), + /* 356 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 365 S> */ B(Nop), + /* 366 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 375 S> */ B(Nop), + /* 376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 385 S> */ B(Nop), + /* 386 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 395 S> */ B(Nop), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 405 S> */ B(Nop), + /* 406 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 415 S> */ B(Nop), + /* 416 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 425 S> */ B(Nop), + /* 426 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 435 S> */ B(Nop), + /* 436 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 445 S> */ B(Nop), + /* 446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 455 S> */ B(Nop), + /* 456 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 465 S> */ B(Nop), + /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 475 S> */ B(Nop), + /* 476 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 485 S> */ B(Nop), + /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 495 S> */ B(Nop), + /* 496 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 505 S> */ B(Nop), + /* 506 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 515 S> */ B(Nop), + /* 516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 525 S> */ B(Nop), + /* 526 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 535 S> */ B(Nop), + /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 545 S> */ B(Nop), + /* 546 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 555 S> */ B(Nop), + /* 556 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 565 S> */ B(Nop), + /* 566 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 575 S> */ B(Nop), + /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 585 S> */ B(Nop), + /* 586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 595 S> */ B(Nop), + /* 596 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 605 S> */ B(Nop), + /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 615 S> */ B(Nop), + /* 616 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 625 S> */ B(Nop), + /* 626 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 635 S> */ B(Nop), + /* 636 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 645 S> */ B(Nop), + /* 646 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 655 S> */ B(Nop), + /* 656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 665 S> */ B(Nop), + /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 675 S> */ B(Nop), + /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 685 S> */ B(Nop), + /* 686 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 695 S> */ B(Nop), + /* 696 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 705 S> */ B(Nop), + /* 706 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 715 S> */ B(Nop), + /* 716 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 725 S> */ B(Nop), + /* 726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 735 S> */ B(Nop), + /* 736 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 745 S> */ B(Nop), + /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 755 S> */ B(Nop), + /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 765 S> */ B(Nop), + /* 766 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 775 S> */ B(Nop), + /* 776 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 785 S> */ B(Nop), + /* 786 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 795 S> */ B(Nop), + /* 796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 805 S> */ B(Nop), + /* 806 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 815 S> */ B(Nop), + /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 825 S> */ B(Nop), + /* 826 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 835 S> */ B(Nop), + /* 836 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 845 S> */ B(Nop), + /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 855 S> */ B(Nop), + /* 856 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 865 S> */ B(Nop), + /* 866 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 875 S> */ B(Nop), + /* 876 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 885 S> */ B(Nop), + /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 895 S> */ B(Nop), + /* 896 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 905 S> */ B(Nop), + /* 906 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 915 S> */ B(Nop), + /* 916 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 925 S> */ B(Nop), + /* 926 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 935 S> */ B(Nop), + /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 945 S> */ B(Nop), + /* 946 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 955 S> */ B(Nop), + /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 965 S> */ B(Nop), + /* 966 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 975 S> */ B(Nop), + /* 976 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 985 S> */ B(Nop), + /* 986 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 995 S> */ B(Nop), + /* 996 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 1005 S> */ B(Nop), + /* 1006 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 1015 S> */ B(Nop), + /* 1016 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 1025 S> */ B(Nop), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 1035 S> */ B(Nop), + /* 1036 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 1045 S> */ B(Nop), + /* 1046 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 1055 S> */ B(Nop), + /* 1056 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 1065 S> */ B(Nop), + /* 1066 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 1075 S> */ B(Nop), + /* 1076 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 1085 S> */ B(Nop), + /* 1086 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 1095 S> */ B(Nop), + /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 1105 S> */ B(Nop), + /* 1106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 1115 S> */ B(Nop), + /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1125 S> */ B(Nop), + /* 1126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1135 S> */ B(Nop), + /* 1136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1145 S> */ B(Nop), + /* 1146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1155 S> */ B(Nop), + /* 1156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1165 S> */ B(Nop), + /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1175 S> */ B(Nop), + /* 1176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1185 S> */ B(Nop), + /* 1186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1195 S> */ B(Nop), + /* 1196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1205 S> */ B(Nop), + /* 1206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1215 S> */ B(Nop), + /* 1216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1225 S> */ B(Nop), + /* 1226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1235 S> */ B(Nop), + /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1245 S> */ B(Nop), + /* 1246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1255 S> */ B(Nop), + /* 1256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1265 S> */ B(Nop), + /* 1266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1275 S> */ B(Nop), + /* 1276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1285 S> */ B(Nop), + /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1295 S> */ B(Nop), + /* 1296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1305 S> */ B(LdaSmi), U8(2), + /* 1307 E> */ B(Wide), B(StaGlobalSloppy), U16(1), U16(257), + B(LdaUndefined), + /* 1312 S> */ B(Return), ] constant pool: [ "name", @@ -769,399 +641,271 @@ snippet: " } f({name: 1}); " -frame size: 1 +frame size: 0 parameter count: 2 -bytecode array length: 1035 +bytecode array length: 651 bytecodes: [ - B(StackCheck), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(1), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(3), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(5), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(7), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(9), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(11), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(13), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(15), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(17), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(19), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(21), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(23), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(25), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(27), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(29), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(31), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(33), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(35), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(37), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(39), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(41), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(43), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(45), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(47), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(49), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(51), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(53), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(55), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(57), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(59), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(61), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(63), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(65), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(67), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(69), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(71), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(73), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(75), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(77), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(79), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(81), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(83), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(85), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(87), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(89), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(91), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(93), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(95), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(97), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(99), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(101), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(103), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(105), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(107), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(109), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(111), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(113), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(115), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(117), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(119), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(121), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(123), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(125), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(127), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(129), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(131), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(133), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(135), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(137), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(139), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(141), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(143), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(145), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(147), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(149), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(151), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(153), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(155), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(157), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(159), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(161), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(163), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(165), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(167), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(169), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(171), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(173), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(175), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(177), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(179), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(181), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(183), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(185), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(187), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(189), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(191), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(193), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(195), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(197), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(199), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(201), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(203), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(205), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(207), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(209), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(211), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(213), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(215), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(217), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(219), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(221), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(223), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(225), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(227), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(229), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(231), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(233), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(235), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(237), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(239), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(241), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(243), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(245), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(247), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(249), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(251), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(253), - B(Ldar), R(arg0), - B(Star), R(0), - B(LoadIC), R(0), U8(0), U8(255), - B(LdaSmi), U8(2), - B(Wide), B(StaGlobalStrict), U16(1), U16(257), - B(LdaUndefined), - B(Return), + /* 17 E> */ B(StackCheck), + /* 41 S> */ B(Nop), + /* 42 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 51 S> */ B(Nop), + /* 52 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 61 S> */ B(Nop), + /* 62 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 71 S> */ B(Nop), + /* 72 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 81 S> */ B(Nop), + /* 82 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 91 S> */ B(Nop), + /* 92 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 101 S> */ B(Nop), + /* 102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 111 S> */ B(Nop), + /* 112 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 121 S> */ B(Nop), + /* 122 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 131 S> */ B(Nop), + /* 132 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 141 S> */ B(Nop), + /* 142 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 151 S> */ B(Nop), + /* 152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 161 S> */ B(Nop), + /* 162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 171 S> */ B(Nop), + /* 172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 181 S> */ B(Nop), + /* 182 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 191 S> */ B(Nop), + /* 192 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 201 S> */ B(Nop), + /* 202 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 211 S> */ B(Nop), + /* 212 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 221 S> */ B(Nop), + /* 222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 231 S> */ B(Nop), + /* 232 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 241 S> */ B(Nop), + /* 242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 251 S> */ B(Nop), + /* 252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 261 S> */ B(Nop), + /* 262 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 271 S> */ B(Nop), + /* 272 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 281 S> */ B(Nop), + /* 282 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 291 S> */ B(Nop), + /* 292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 301 S> */ B(Nop), + /* 302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 311 S> */ B(Nop), + /* 312 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 321 S> */ B(Nop), + /* 322 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 331 S> */ B(Nop), + /* 332 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 341 S> */ B(Nop), + /* 342 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 351 S> */ B(Nop), + /* 352 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 361 S> */ B(Nop), + /* 362 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 371 S> */ B(Nop), + /* 372 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 381 S> */ B(Nop), + /* 382 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 391 S> */ B(Nop), + /* 392 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 401 S> */ B(Nop), + /* 402 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 411 S> */ B(Nop), + /* 412 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 421 S> */ B(Nop), + /* 422 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 431 S> */ B(Nop), + /* 432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 441 S> */ B(Nop), + /* 442 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 451 S> */ B(Nop), + /* 452 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 461 S> */ B(Nop), + /* 462 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 471 S> */ B(Nop), + /* 472 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 481 S> */ B(Nop), + /* 482 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 491 S> */ B(Nop), + /* 492 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 501 S> */ B(Nop), + /* 502 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 511 S> */ B(Nop), + /* 512 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 521 S> */ B(Nop), + /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 531 S> */ B(Nop), + /* 532 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 541 S> */ B(Nop), + /* 542 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 551 S> */ B(Nop), + /* 552 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 561 S> */ B(Nop), + /* 562 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 571 S> */ B(Nop), + /* 572 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 581 S> */ B(Nop), + /* 582 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 591 S> */ B(Nop), + /* 592 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 601 S> */ B(Nop), + /* 602 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 611 S> */ B(Nop), + /* 612 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 621 S> */ B(Nop), + /* 622 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 631 S> */ B(Nop), + /* 632 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 641 S> */ B(Nop), + /* 642 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 651 S> */ B(Nop), + /* 652 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 661 S> */ B(Nop), + /* 662 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 671 S> */ B(Nop), + /* 672 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 681 S> */ B(Nop), + /* 682 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 691 S> */ B(Nop), + /* 692 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 701 S> */ B(Nop), + /* 702 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 711 S> */ B(Nop), + /* 712 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 721 S> */ B(Nop), + /* 722 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 731 S> */ B(Nop), + /* 732 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 741 S> */ B(Nop), + /* 742 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 751 S> */ B(Nop), + /* 752 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 761 S> */ B(Nop), + /* 762 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 771 S> */ B(Nop), + /* 772 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 781 S> */ B(Nop), + /* 782 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 791 S> */ B(Nop), + /* 792 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 801 S> */ B(Nop), + /* 802 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 811 S> */ B(Nop), + /* 812 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 821 S> */ B(Nop), + /* 822 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 831 S> */ B(Nop), + /* 832 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 841 S> */ B(Nop), + /* 842 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 851 S> */ B(Nop), + /* 852 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 861 S> */ B(Nop), + /* 862 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 871 S> */ B(Nop), + /* 872 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 881 S> */ B(Nop), + /* 882 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 891 S> */ B(Nop), + /* 892 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 901 S> */ B(Nop), + /* 902 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 911 S> */ B(Nop), + /* 912 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 921 S> */ B(Nop), + /* 922 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 931 S> */ B(Nop), + /* 932 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 941 S> */ B(Nop), + /* 942 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 951 S> */ B(Nop), + /* 952 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 961 S> */ B(Nop), + /* 962 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 971 S> */ B(Nop), + /* 972 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 981 S> */ B(Nop), + /* 982 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 991 S> */ B(Nop), + /* 992 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 1001 S> */ B(Nop), + /* 1002 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 1011 S> */ B(Nop), + /* 1012 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 1021 S> */ B(Nop), + /* 1022 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 1031 S> */ B(Nop), + /* 1032 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 1041 S> */ B(Nop), + /* 1042 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 1051 S> */ B(Nop), + /* 1052 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 1061 S> */ B(Nop), + /* 1062 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 1071 S> */ B(Nop), + /* 1072 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 1081 S> */ B(Nop), + /* 1082 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 1091 S> */ B(Nop), + /* 1092 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 1101 S> */ B(Nop), + /* 1102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 1111 S> */ B(Nop), + /* 1112 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 1121 S> */ B(Nop), + /* 1122 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 1131 S> */ B(Nop), + /* 1132 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1141 S> */ B(Nop), + /* 1142 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1151 S> */ B(Nop), + /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1161 S> */ B(Nop), + /* 1162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1171 S> */ B(Nop), + /* 1172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1181 S> */ B(Nop), + /* 1182 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1191 S> */ B(Nop), + /* 1192 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1201 S> */ B(Nop), + /* 1202 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1211 S> */ B(Nop), + /* 1212 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1221 S> */ B(Nop), + /* 1222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1231 S> */ B(Nop), + /* 1232 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1241 S> */ B(Nop), + /* 1242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1251 S> */ B(Nop), + /* 1252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1261 S> */ B(Nop), + /* 1262 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1271 S> */ B(Nop), + /* 1272 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1281 S> */ B(Nop), + /* 1282 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1291 S> */ B(Nop), + /* 1292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1301 S> */ B(Nop), + /* 1302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1311 S> */ B(Nop), + /* 1312 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1321 S> */ B(LdaSmi), U8(2), + /* 1323 E> */ B(Wide), B(StaGlobalStrict), U16(1), U16(257), + B(LdaUndefined), + /* 1328 S> */ B(Return), ] constant pool: [ "name", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden index 9cf212c932..c28ac2a8c9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaConstant), U8(0), + /* 61 S> */ B(Return), ] constant pool: [ "This is a string", @@ -33,11 +33,11 @@ frame size: 1 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 58 S> */ B(LdaConstant), U8(1), + /* 82 S> */ B(Return), ] constant pool: [ "First string", @@ -54,11 +54,11 @@ frame size: 1 parameter count: 1 bytecode array length: 8 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Star), R(0), - B(LdaConstant), U8(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaConstant), U8(0), + B(Star), R(0), + /* 57 S> */ B(LdaConstant), U8(0), + /* 79 S> */ B(Return), ] constant pool: [ "Same string", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden index c908959257..bc16a7b964 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden @@ -17,26 +17,26 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 31 +bytecode array length: 32 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(7), - B(Jump), U8(8), - B(LdaSmi), U8(2), - B(Return), - B(LdaSmi), U8(3), - B(Return), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(1), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(7), + B(Jump), U8(8), + /* 66 S> */ B(LdaSmi), U8(2), + /* 97 S> */ B(Return), + /* 85 S> */ B(LdaSmi), U8(3), + /* 97 S> */ B(Return), + B(LdaUndefined), + /* 97 S> */ B(Return), ] constant pool: [ ] @@ -53,28 +53,28 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 37 +bytecode array length: 38 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(Jump), U8(14), - B(LdaSmi), U8(2), - B(Star), R(1), - B(Jump), U8(8), - B(LdaSmi), U8(3), - B(Star), R(1), - B(Jump), U8(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(1), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(10), + B(Jump), U8(14), + /* 66 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 73 S> */ B(Jump), U8(8), + /* 89 S> */ B(LdaSmi), U8(3), + B(Star), R(1), + /* 96 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 105 S> */ B(Return), ] constant pool: [ ] @@ -91,27 +91,27 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 35 +bytecode array length: 36 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(8), - B(Jump), U8(12), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Star), R(1), - B(Jump), U8(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(1), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(8), + B(Jump), U8(12), + /* 66 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 98 S> */ B(LdaSmi), U8(3), + B(Star), R(1), + /* 105 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 114 S> */ B(Return), ] constant pool: [ ] @@ -129,27 +129,27 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 35 +bytecode array length: 36 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(3), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(6), - B(Jump), U8(6), - B(Jump), U8(10), - B(Jump), U8(8), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Jump), U8(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(2), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(3), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(6), + B(Jump), U8(6), + /* 66 S> */ B(Jump), U8(10), + /* 82 S> */ B(Jump), U8(8), + /* 99 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 106 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 115 S> */ B(Return), ] constant pool: [ ] @@ -167,32 +167,32 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 44 +bytecode array length: 45 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(TypeOf), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(3), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(Jump), U8(14), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Jump), U8(14), - B(LdaSmi), U8(2), - B(Star), R(1), - B(Jump), U8(8), - B(LdaSmi), U8(3), - B(Star), R(1), - B(Jump), U8(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 42 E> */ B(TypeOf), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(2), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(3), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(10), + B(Jump), U8(14), + /* 74 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 81 S> */ B(Jump), U8(14), + /* 97 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 104 S> */ B(Jump), U8(8), + /* 121 S> */ B(LdaSmi), U8(3), + B(Star), R(1), + /* 128 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 137 S> */ B(Return), ] constant pool: [ ] @@ -209,26 +209,25 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Star), R(0), - B(Star), R(2), - B(Ldar), R(1), - B(TypeOf), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(4), - B(Jump), U8(8), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Jump), U8(8), - B(LdaSmi), U8(2), - B(Star), R(1), - B(Jump), U8(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 45 S> */ B(TypeOf), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(4), + B(Jump), U8(8), + /* 74 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + /* 81 S> */ B(Jump), U8(8), + /* 98 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 105 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 114 S> */ B(Return), ] constant pool: [ ] @@ -312,154 +311,154 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 289 +bytecode array length: 290 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(1), - B(Star), R(0), - B(Star), R(2), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrueConstant), U8(0), - B(JumpConstant), U8(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(LdaSmi), U8(2), - B(Star), R(1), - B(Jump), U8(8), - B(LdaSmi), U8(3), - B(Star), R(1), - B(Jump), U8(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(1), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(1), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(2), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(2), + B(JumpIfTrueConstant), U8(0), + B(JumpConstant), U8(1), + /* 68 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 77 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 86 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 95 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 104 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 113 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 122 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 131 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 140 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 149 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 158 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 167 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 176 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 185 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 194 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 203 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 212 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 221 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 230 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 239 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 248 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 257 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 266 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 275 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 284 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 293 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 302 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 311 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 320 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 329 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 338 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 347 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 356 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 365 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 374 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 383 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 392 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 401 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 410 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 419 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 428 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 437 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 446 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 455 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 464 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 473 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 482 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 491 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 500 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 509 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 518 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 527 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 536 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 545 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 554 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 563 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 572 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 581 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 590 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 599 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 608 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 617 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 626 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 635 S> */ B(LdaSmi), U8(2), + B(Star), R(1), + /* 644 S> */ B(Jump), U8(8), + /* 662 S> */ B(LdaSmi), U8(3), + B(Star), R(1), + /* 671 S> */ B(Jump), U8(2), + B(LdaUndefined), + /* 680 S> */ B(Return), ] constant pool: [ 262, @@ -482,40 +481,37 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 61 +bytecode array length: 59 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(2), - B(Star), R(0), - B(Star), R(3), - B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(10), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(36), - B(Jump), U8(38), - B(Ldar), R(2), - B(Star), R(4), - B(LdaSmi), U8(1), - B(Add), R(4), - B(Star), R(1), - B(Star), R(4), - B(LdaSmi), U8(2), - B(TestEqualStrict), R(4), - B(JumpIfTrue), U8(4), - B(Jump), U8(8), - B(LdaSmi), U8(1), - B(Star), R(2), - B(Jump), U8(8), - B(LdaSmi), U8(2), - B(Star), R(2), - B(Jump), U8(2), - B(LdaSmi), U8(3), - B(Star), R(2), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(2), + B(Star), R(0), + /* 45 S> */ B(LdaSmi), U8(1), + B(TestEqualStrict), R(0), + B(Mov), R(0), R(3), + B(JumpIfToBooleanTrue), U8(10), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(3), + B(JumpIfTrue), U8(33), + B(Jump), U8(35), + /* 77 E> */ B(AddSmi), U8(1), R(2), U8(1), + B(Star), R(1), + /* 70 S> */ B(LdaSmi), U8(2), + B(TestEqualStrict), R(1), + B(Mov), R(1), R(4), + B(JumpIfToBooleanTrue), U8(4), + B(Jump), U8(8), + /* 101 S> */ B(LdaSmi), U8(1), + B(Star), R(2), + /* 108 S> */ B(Jump), U8(8), + /* 131 S> */ B(LdaSmi), U8(2), + B(Star), R(2), + /* 138 S> */ B(Jump), U8(2), + /* 176 S> */ B(LdaSmi), U8(3), + B(Star), R(2), + B(LdaUndefined), + /* 185 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden index da84a493e1..582c087341 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden @@ -14,21 +14,14 @@ snippet: " f = function f() {}; f(); " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 19 +bytecode array length: 6 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(closure), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(5), - B(Mov), R(1), R(0), - B(Ldar), R(1), - B(LdaUndefined), - B(Return), + /* 21 E> */ B(StackCheck), + B(Mov), R(closure), R(0), + B(LdaUndefined), + /* 25 S> */ B(Return), ] constant pool: [ ] @@ -41,23 +34,14 @@ snippet: " f = function f() { return f; }; f(); " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 23 +bytecode array length: 7 bytecodes: [ - B(LdaTheHole), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(closure), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(5), - B(Mov), R(1), R(0), - B(Ldar), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(3), - B(LdaUndefined), - B(Return), + /* 21 E> */ B(StackCheck), + B(Mov), R(closure), R(0), + /* 26 S> */ B(Ldar), R(0), + /* 36 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden index 99e17fc1ea..4e7a0bc225 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden @@ -15,9 +15,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Throw), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaSmi), U8(1), + /* 34 E> */ B(Throw), ] constant pool: [ ] @@ -32,9 +32,9 @@ frame size: 0 parameter count: 1 bytecode array length: 4 bytecodes: [ - B(StackCheck), - B(LdaConstant), U8(0), - B(Throw), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(LdaConstant), U8(0), + /* 34 E> */ B(Throw), ] constant pool: [ "Error", @@ -50,14 +50,14 @@ frame size: 1 parameter count: 1 bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(JumpIfToBooleanFalse), U8(5), - B(LdaConstant), U8(0), - B(Throw), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(5), + /* 54 S> */ B(LdaConstant), U8(0), + /* 54 E> */ B(Throw), + B(LdaUndefined), + /* 72 S> */ B(Return), ] constant pool: [ "Error", diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden index 23d3609885..03f8b5496d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden @@ -14,27 +14,26 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 44 +bytecode array length: 45 bytecodes: [ - B(LdaConstant), U8(0), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), - B(StackCheck), - B(LdaConstant), U8(1), - B(Star), R(1), - B(LdaZero), - B(Star), R(2), - B(CreateObjectLiteral), U8(2), U8(0), U8(5), - B(Star), R(4), - B(CreateClosure), U8(3), U8(0), - B(StoreICSloppy), R(4), U8(4), U8(3), - B(Ldar), R(4), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), - B(LdaUndefined), - B(Return), + B(LdaConstant), U8(0), + B(Star), R(1), + B(LdaZero), + B(Star), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), + /* 0 E> */ B(StackCheck), + /* 8 S> */ B(LdaConstant), U8(1), + B(Star), R(1), + B(LdaZero), + B(CreateObjectLiteral), U8(2), U8(0), U8(1), R(4), + B(Star), R(2), + B(CreateClosure), U8(3), U8(0), + B(StaNamedPropertySloppy), R(4), U8(4), U8(3), + B(Mov), R(4), R(3), + B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), + B(LdaUndefined), + /* 33 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden index 20abd3ecb7..17d4ef0fd4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden @@ -11,35 +11,33 @@ wrap: yes snippet: " try { return 1; } catch(e) { return 2; } " -frame size: 5 +frame size: 3 parameter count: 1 -bytecode array length: 40 +bytecode array length: 34 bytecodes: [ - B(StackCheck), - B(Mov), R(context), R(1), - B(LdaSmi), U8(1), - B(Return), - B(Star), R(3), - B(LdaConstant), U8(0), - B(Star), R(2), - B(Ldar), R(closure), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(2), U8(3), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(1), - B(PushContext), R(0), - B(LdaSmi), U8(2), - B(PopContext), R(0), - B(Return), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(Mov), R(context), R(1), + /* 40 S> */ B(LdaSmi), U8(1), + /* 75 S> */ B(Return), + B(Jump), U8(25), + B(Star), R(2), + B(Ldar), R(closure), + B(CreateCatchContext), R(2), U8(0), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(1), + B(PushContext), R(0), + /* 63 S> */ B(LdaSmi), U8(2), + B(PopContext), R(0), + /* 75 S> */ B(Return), + B(LdaUndefined), + /* 75 S> */ B(Return), ] constant pool: [ "e", ] handlers: [ - [4, 7, 7], + [4, 7, 9], ] --- @@ -48,45 +46,39 @@ snippet: " try { a = 1 } catch(e1) {}; try { a = 2 } catch(e2) { a = 3 } " -frame size: 6 +frame size: 4 parameter count: 1 -bytecode array length: 81 +bytecode array length: 65 bytecodes: [ - B(StackCheck), - B(Mov), R(context), R(2), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Jump), U8(30), - B(Star), R(4), - B(LdaConstant), U8(0), - B(Star), R(3), - B(Ldar), R(closure), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(3), U8(3), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(2), - B(PushContext), R(1), - B(PopContext), R(1), - B(Mov), R(context), R(2), - B(LdaSmi), U8(2), - B(Star), R(0), - B(Jump), U8(34), - B(Star), R(4), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Ldar), R(closure), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(3), U8(3), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(2), - B(PushContext), R(1), - B(LdaSmi), U8(3), - B(Star), R(0), - B(PopContext), R(1), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(Mov), R(context), R(2), + /* 47 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + B(Jump), U8(22), + B(Star), R(3), + B(Ldar), R(closure), + /* 49 E> */ B(CreateCatchContext), R(3), U8(0), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(2), + B(PushContext), R(1), + B(PopContext), R(1), + B(Mov), R(context), R(2), + /* 75 S> */ B(LdaSmi), U8(2), + B(Star), R(0), + B(Jump), U8(26), + B(Star), R(3), + B(Ldar), R(closure), + /* 77 E> */ B(CreateCatchContext), R(3), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(2), + B(PushContext), R(1), + /* 95 S> */ B(LdaSmi), U8(3), + B(Star), R(0), + B(PopContext), R(1), + B(LdaUndefined), + /* 103 S> */ B(Return), ] constant pool: [ "e1", @@ -94,6 +86,6 @@ constant pool: [ ] handlers: [ [4, 8, 10], - [41, 45, 47], + [33, 37, 39], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden index e14a709840..a42f90c844 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden @@ -16,31 +16,31 @@ frame size: 4 parameter count: 1 bytecode array length: 51 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Mov), R(context), R(3), - B(LdaSmi), U8(2), - B(Star), R(0), - B(LdaSmi), U8(-1), - B(Star), R(1), - B(Jump), U8(7), - B(Star), R(2), - B(LdaZero), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(3), - B(LdaSmi), U8(3), - B(Star), R(0), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(3), U8(1), - B(LdaZero), - B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(4), - B(Jump), U8(5), - B(Ldar), R(2), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + B(Mov), R(context), R(3), + /* 51 S> */ B(LdaSmi), U8(2), + B(Star), R(0), + B(LdaSmi), U8(-1), + B(Star), R(1), + B(Jump), U8(7), + B(Star), R(2), + B(LdaZero), + B(Star), R(1), + /* 53 E> */ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(3), + /* 70 S> */ B(LdaSmi), U8(3), + B(Star), R(0), + /* 72 E> */ B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(3), U8(1), + B(LdaZero), + B(TestEqualStrict), R(1), + B(JumpIfTrue), U8(4), + B(Jump), U8(5), + B(Ldar), R(2), + B(ReThrow), + B(LdaUndefined), + /* 79 S> */ B(Return), ] constant pool: [ ] @@ -53,56 +53,53 @@ snippet: " var a = 1; try { a = 2; } catch(e) { a = 20 } finally { a = 3; } " -frame size: 9 +frame size: 7 parameter count: 1 -bytecode array length: 88 +bytecode array length: 80 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Mov), R(context), R(4), - B(Mov), R(context), R(5), - B(LdaSmi), U8(2), - B(Star), R(0), - B(Jump), U8(34), - B(Star), R(7), - B(LdaConstant), U8(0), - B(Star), R(6), - B(Ldar), R(closure), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(6), U8(3), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(5), - B(PushContext), R(1), - B(LdaSmi), U8(20), - B(Star), R(0), - B(PopContext), R(1), - B(LdaSmi), U8(-1), - B(Star), R(2), - B(Jump), U8(7), - B(Star), R(3), - B(LdaZero), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(4), - B(LdaSmi), U8(3), - B(Star), R(0), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), - B(LdaZero), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(4), - B(Jump), U8(5), - B(Ldar), R(3), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + B(Mov), R(context), R(4), + B(Mov), R(context), R(5), + /* 51 S> */ B(LdaSmi), U8(2), + B(Star), R(0), + B(Jump), U8(26), + B(Star), R(6), + B(Ldar), R(closure), + /* 53 E> */ B(CreateCatchContext), R(6), U8(0), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(5), + B(PushContext), R(1), + /* 71 S> */ B(LdaSmi), U8(20), + B(Star), R(0), + B(PopContext), R(1), + B(LdaSmi), U8(-1), + B(Star), R(2), + B(Jump), U8(7), + B(Star), R(3), + B(LdaZero), + B(Star), R(2), + /* 73 E> */ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(4), + /* 90 S> */ B(LdaSmi), U8(3), + B(Star), R(0), + /* 92 E> */ B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), + B(LdaZero), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(4), + B(Jump), U8(5), + B(Ldar), R(3), + B(ReThrow), + B(LdaUndefined), + /* 99 S> */ B(Return), ] constant pool: [ "e", ] handlers: [ - [8, 49, 55], + [8, 41, 47], [11, 15, 17], ] @@ -112,70 +109,64 @@ snippet: " try { a = 1 } catch(e) { a = 2 } } catch(e) { a = 20 } finally { a = 3; } " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 121 +bytecode array length: 105 bytecodes: [ - B(StackCheck), - B(Mov), R(context), R(4), - B(Mov), R(context), R(5), - B(Mov), R(context), R(6), - B(LdaSmi), U8(1), - B(Star), R(0), - B(Jump), U8(34), - B(Star), R(8), - B(LdaConstant), U8(0), - B(Star), R(7), - B(Ldar), R(closure), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(7), U8(3), - B(Star), R(6), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(6), - B(PushContext), R(1), - B(LdaSmi), U8(2), - B(Star), R(0), - B(PopContext), R(1), - B(Jump), U8(34), - B(Star), R(7), - B(LdaConstant), U8(0), - B(Star), R(6), - B(Ldar), R(closure), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kPushCatchContext), R(6), U8(3), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(5), - B(PushContext), R(1), - B(LdaSmi), U8(20), - B(Star), R(0), - B(PopContext), R(1), - B(LdaSmi), U8(-1), - B(Star), R(2), - B(Jump), U8(7), - B(Star), R(3), - B(LdaZero), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(4), - B(LdaSmi), U8(3), - B(Star), R(0), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), - B(LdaZero), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(4), - B(Jump), U8(5), - B(Ldar), R(3), - B(ReThrow), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + B(Mov), R(context), R(4), + B(Mov), R(context), R(5), + B(Mov), R(context), R(6), + /* 55 S> */ B(LdaSmi), U8(1), + B(Star), R(0), + B(Jump), U8(26), + B(Star), R(7), + B(Ldar), R(closure), + /* 57 E> */ B(CreateCatchContext), R(7), U8(0), + B(Star), R(6), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(6), + B(PushContext), R(1), + /* 74 S> */ B(LdaSmi), U8(2), + B(Star), R(0), + B(PopContext), R(1), + B(Jump), U8(26), + B(Star), R(6), + B(Ldar), R(closure), + /* 76 E> */ B(CreateCatchContext), R(6), U8(0), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Ldar), R(5), + B(PushContext), R(1), + /* 95 S> */ B(LdaSmi), U8(20), + B(Star), R(0), + B(PopContext), R(1), + B(LdaSmi), U8(-1), + B(Star), R(2), + B(Jump), U8(7), + B(Star), R(3), + B(LdaZero), + B(Star), R(2), + /* 97 E> */ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), + B(Star), R(4), + /* 114 S> */ B(LdaSmi), U8(3), + B(Star), R(0), + /* 116 E> */ B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), + B(LdaZero), + B(TestEqualStrict), R(2), + B(JumpIfTrue), U8(4), + B(Jump), U8(5), + B(Ldar), R(3), + B(ReThrow), + B(LdaUndefined), + /* 123 S> */ B(Return), ] constant pool: [ "e", ] handlers: [ - [4, 82, 88], - [7, 48, 50], + [4, 66, 72], + [7, 40, 42], [10, 14, 16], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden index e5db7a7ed9..1fe9354b6f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden @@ -20,11 +20,11 @@ frame size: 1 parameter count: 1 bytecode array length: 7 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(13), - B(Star), R(0), - B(TypeOf), - B(Return), + /* 10 E> */ B(StackCheck), + /* 24 S> */ B(LdaSmi), U8(13), + B(Star), R(0), + /* 29 S> */ B(TypeOf), + /* 47 S> */ B(Return), ] constant pool: [ ] @@ -41,15 +41,14 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - B(StackCheck), - B(LdaGlobalInsideTypeof), U8(0), U8(1), - B(TypeOf), - B(Return), + /* 22 E> */ B(StackCheck), + /* 28 S> */ B(LdaGlobalInsideTypeof), U8(1), + B(TypeOf), + /* 46 S> */ B(Return), ] constant pool: [ - "x", ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden index 0a3ca760c7..0e2c767256 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden @@ -15,28 +15,22 @@ snippet: " } return x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 31 +bytecode array length: 22 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(10), - B(TestEqual), R(1), - B(LogicalNot), - B(JumpIfFalse), U8(15), - B(StackCheck), - B(Ldar), R(0), - B(Star), R(1), - B(LdaSmi), U8(10), - B(Add), R(1), - B(Star), R(0), - B(Jump), U8(-22), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaZero), + B(Star), R(0), + /* 54 S> */ B(LdaSmi), U8(10), + /* 54 E> */ B(TestEqual), R(0), + B(JumpIfTrue), U8(11), + /* 45 E> */ B(StackCheck), + /* 65 S> */ B(AddSmi), U8(10), R(0), U8(1), + B(Star), R(0), + B(Jump), U8(-13), + /* 79 S> */ B(Ldar), R(0), + /* 89 S> */ B(Return), ] constant pool: [ ] @@ -51,24 +45,22 @@ snippet: " } while(x == false); return x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 22 +bytecode array length: 18 bytecodes: [ - B(StackCheck), - B(LdaFalse), - B(Star), R(0), - B(StackCheck), - B(Ldar), R(0), - B(LogicalNot), - B(Star), R(0), - B(Ldar), R(0), - B(Star), R(1), - B(LdaFalse), - B(TestEqual), R(1), - B(JumpIfTrue), U8(-13), - B(Ldar), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaFalse), + B(Star), R(0), + /* 49 E> */ B(StackCheck), + /* 56 S> */ B(Ldar), R(0), + B(ToBooleanLogicalNot), + B(Star), R(0), + /* 74 S> */ B(LdaFalse), + /* 74 E> */ B(TestEqual), R(0), + B(JumpIfTrue), U8(-9), + /* 85 S> */ B(Ldar), R(0), + /* 95 S> */ B(Return), ] constant pool: [ ] @@ -80,18 +72,17 @@ snippet: " var x = 101; return void(x * 3); " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(101), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(3), - B(Mul), R(1), - B(LdaUndefined), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(101), + B(Star), R(0), + /* 47 S> */ B(LdaSmi), U8(3), + B(Mul), R(0), U8(1), + B(LdaUndefined), + /* 67 S> */ B(Return), ] constant pool: [ ] @@ -108,18 +99,17 @@ frame size: 4 parameter count: 1 bytecode array length: 23 bytecodes: [ - B(StackCheck), - B(Wide), B(LdaSmi), U16(1234), - B(Star), R(0), - B(Star), R(2), - B(Ldar), R(0), - B(Mul), R(2), - B(Star), R(3), - B(LdaSmi), U8(1), - B(Sub), R(3), - B(LdaUndefined), - B(Star), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), + B(Star), R(0), + /* 56 S> */ B(Nop), + /* 66 E> */ B(Mul), R(0), U8(1), + B(Star), R(3), + B(SubSmi), U8(1), R(3), U8(2), + B(LdrUndefined), R(1), + B(Ldar), R(1), + /* 74 S> */ B(Nop), + /* 84 S> */ B(Return), ] constant pool: [ ] @@ -131,17 +121,16 @@ snippet: " var x = 13; return ~x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(13), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(-1), - B(BitwiseXor), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(13), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(-1), + B(BitwiseXor), R(0), U8(1), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -153,17 +142,16 @@ snippet: " var x = 13; return +x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(13), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(1), - B(Mul), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(13), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(1), + B(Mul), R(0), U8(1), + /* 57 S> */ B(Return), ] constant pool: [ ] @@ -175,17 +163,16 @@ snippet: " var x = 13; return -x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - B(StackCheck), - B(LdaSmi), U8(13), - B(Star), R(0), - B(Star), R(1), - B(LdaSmi), U8(-1), - B(Mul), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 42 S> */ B(LdaSmi), U8(13), + B(Star), R(0), + /* 46 S> */ B(LdaSmi), U8(-1), + B(Mul), R(0), U8(1), + /* 57 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden index 930077503f..a39a1cf6aa 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden @@ -171,12 +171,12 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 6 +bytecode array length: 10 bytecodes: [ - B(StackCheck), - B(Ldar), R(127), - B(Star), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1494 S> */ B(Wide), B(Mov), R16(127), R16(0), + /* 1505 S> */ B(Ldar), R(0), + /* 1516 S> */ B(Return), ] constant pool: [ ] @@ -347,12 +347,12 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 6 +bytecode array length: 12 bytecodes: [ - B(StackCheck), - B(Ldar), R(126), - B(Star), R(127), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1494 S> */ B(Wide), B(Mov), R16(126), R16(127), + /* 1507 S> */ B(Wide), B(Ldar), R16(127), + /* 1520 S> */ B(Return), ] constant pool: [ ] @@ -521,20 +521,18 @@ snippet: " if (x2 > 3) { return x129; } return x128; " -frame size: 158 +frame size: 157 parameter count: 1 -bytecode array length: 23 +bytecode array length: 17 bytecodes: [ - B(StackCheck), - B(Ldar), R(2), - B(Wide), B(Star), R16(157), - B(LdaSmi), U8(3), - B(Wide), B(TestGreaterThan), R16(157), - B(JumpIfFalse), U8(7), - B(Wide), B(Ldar), R16(129), - B(Return), - B(Ldar), R(128), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1494 S> */ B(LdaSmi), U8(3), + /* 1501 E> */ B(TestGreaterThan), R(2), + B(JumpIfFalse), U8(7), + /* 1508 S> */ B(Wide), B(Ldar), R16(129), + /* 1536 S> */ B(Return), + /* 1523 S> */ B(Wide), B(Ldar), R16(128), + /* 1536 S> */ B(Return), ] constant pool: [ ] @@ -705,29 +703,25 @@ snippet: " if (x2 > 3) { return x0; } return x129; " -frame size: 158 +frame size: 157 parameter count: 1 -bytecode array length: 48 +bytecode array length: 34 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(Wide), B(Ldar), R16(129), - B(Wide), B(Star), R16(157), - B(LdaSmi), U8(3), - B(Wide), B(TestEqual), R16(157), - B(JumpIfFalse), U8(8), - B(Ldar), R(0), - B(Wide), B(Star), R16(129), - B(Ldar), R(2), - B(Wide), B(Star), R16(157), - B(LdaSmi), U8(3), - B(Wide), B(TestGreaterThan), R16(157), - B(JumpIfFalse), U8(5), - B(Ldar), R(0), - B(Return), - B(Wide), B(Ldar), R16(129), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1503 S> */ B(LdaZero), + B(Star), R(0), + /* 1506 S> */ B(LdaSmi), U8(3), + /* 1515 E> */ B(Wide), B(TestEqual), R16(129), + B(JumpIfFalse), U8(10), + /* 1534 S> */ B(Wide), B(Mov), R16(0), R16(129), + B(Ldar), R(0), + /* 1540 S> */ B(LdaSmi), U8(3), + /* 1547 E> */ B(TestGreaterThan), R(2), + B(JumpIfFalse), U8(5), + /* 1554 S> */ B(Ldar), R(0), + /* 1580 S> */ B(Return), + /* 1567 S> */ B(Wide), B(Ldar), R16(129), + /* 1580 S> */ B(Return), ] constant pool: [ ] @@ -899,34 +893,29 @@ snippet: " " frame size: 158 parameter count: 1 -bytecode array length: 54 +bytecode array length: 53 bytecodes: [ - B(StackCheck), - B(LdaZero), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(LdaZero), - B(Star), R(128), - B(Ldar), R(128), - B(Wide), B(Star), R16(157), - B(LdaSmi), U8(64), - B(Wide), B(TestLessThan), R16(157), - B(JumpIfFalse), U8(29), - B(StackCheck), - B(Ldar), R(1), - B(Wide), B(Star), R16(157), - B(Ldar), R(128), - B(Wide), B(Add), R16(157), - B(Star), R(1), - B(Ldar), R(128), - B(ToNumber), - B(Wide), B(Star), R16(157), - B(Inc), - B(Star), R(128), - B(Jump), U8(-39), - B(Ldar), R(128), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1503 S> */ B(LdaZero), + B(Star), R(0), + /* 1515 S> */ B(LdaZero), + B(Star), R(1), + /* 1523 S> */ B(LdaZero), + B(Wide), B(Star), R16(128), + /* 1538 S> */ B(LdaSmi), U8(64), + /* 1538 E> */ B(Wide), B(TestLessThan), R16(128), + B(JumpIfFalse), U8(30), + /* 1518 E> */ B(StackCheck), + /* 1555 S> */ B(Wide), B(Ldar), R16(128), + /* 1561 E> */ B(Add), R(1), U8(2), + B(Wide), B(Mov), R16(1), R16(157), + B(Star), R(1), + /* 1548 S> */ B(Wide), B(Ldar), R16(128), + B(Inc), U8(1), + B(Wide), B(Star), R16(128), + B(Jump), U8(-34), + /* 1567 S> */ B(Wide), B(Ldar), R16(128), + /* 1580 S> */ B(Return), ] constant pool: [ ] @@ -1098,37 +1087,35 @@ snippet: " " frame size: 163 parameter count: 1 -bytecode array length: 80 +bytecode array length: 84 bytecodes: [ - B(StackCheck), - B(Wide), B(LdaSmi), U16(1234), - B(Star), R(0), - B(LdaZero), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfUndefined), U8(65), - B(JumpIfNull), U8(63), - B(ToObject), - B(Wide), B(Star), R16(157), - B(Wide), B(ForInPrepare), R16(158), - B(LdaZero), - B(Wide), B(Star), R16(161), - B(Wide), B(ForInDone), R16(161), R16(160), - B(JumpIfTrue), U8(41), - B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(1), - B(JumpIfUndefined), U8(19), - B(Star), R(128), - B(StackCheck), - B(Ldar), R(1), - B(Wide), B(Star), R16(162), - B(Ldar), R(128), - B(Wide), B(Add), R16(162), - B(Star), R(1), - B(Wide), B(ForInStep), R16(161), - B(Wide), B(Star), R16(161), - B(Jump), U8(-45), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1503 S> */ B(Wide), B(LdaSmi), U16(1234), + B(Star), R(0), + /* 1518 S> */ B(LdaZero), + B(Star), R(1), + /* 1534 S> */ B(Ldar), R(0), + B(JumpIfUndefined), U8(69), + B(JumpIfNull), U8(67), + B(Wide), B(ToObject), R16(157), + B(Wide), B(ForInPrepare), R16(157), R16(158), + B(LdaZero), + B(Wide), B(Star), R16(161), + /* 1526 S> */ B(Wide), B(ForInDone), R16(161), R16(160), + B(JumpIfTrue), U8(44), + B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(2), + B(JumpIfUndefined), U8(22), + B(Wide), B(Star), R16(128), + /* 1521 E> */ B(StackCheck), + /* 1541 S> */ B(Wide), B(Ldar), R16(128), + /* 1547 E> */ B(Add), R(1), U8(1), + B(Wide), B(Mov), R16(1), R16(162), + B(Star), R(1), + /* 1544 E> */ B(Wide), B(ForInStep), R16(161), + B(Wide), B(Star), R16(161), + B(Jump), U8(-48), + /* 1553 S> */ B(Ldar), R(1), + /* 1564 S> */ B(Return), ] constant pool: [ ] @@ -1301,24 +1288,20 @@ snippet: " " frame size: 159 parameter count: 1 -bytecode array length: 55 +bytecode array length: 53 bytecodes: [ - B(StackCheck), - B(Ldar), R(64), - B(Wide), B(Star), R16(157), - B(Ldar), R(63), - B(Wide), B(Star), R16(158), - B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2), - B(Star), R(0), - B(Ldar), R(27), - B(Wide), B(Star), R16(157), - B(Wide), B(Ldar), R16(143), - B(Wide), B(Star), R16(158), - B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), - B(Ldar), R(1), - B(Return), + /* 30 E> */ B(StackCheck), + /* 1494 S> */ B(Wide), B(Mov), R16(64), R16(157), + B(Wide), B(Mov), R16(63), R16(158), + /* 1509 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2), + B(Star), R(0), + /* 1515 S> */ B(Wide), B(Mov), R16(27), R16(157), + B(Wide), B(Mov), R16(143), R16(158), + /* 1530 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2), + B(Star), R(1), + /* 1537 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), + /* 1549 S> */ B(Ldar), R(1), + /* 1560 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden index 350a0a5d7f..b5a0df5da2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden @@ -11,22 +11,20 @@ wrap: yes snippet: " with ({x:42}) { return x; } " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 26 +bytecode array length: 21 bytecodes: [ - B(StackCheck), - B(CreateObjectLiteral), U8(0), U8(0), U8(5), - B(Star), R(1), - B(ToObject), - B(Star), R(2), - B(Ldar), R(closure), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kPushWithContext), R(2), U8(2), - B(PushContext), R(0), - B(LdaLookupSlot), U8(1), - B(PopContext), R(0), - B(Return), + /* 30 E> */ B(StackCheck), + /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), + B(Ldar), R(1), + B(ToObject), R(2), + B(Ldar), R(closure), + B(CreateWithContext), R(2), + B(PushContext), R(0), + /* 50 S> */ B(LdaLookupSlot), U8(1), + B(PopContext), R(0), + /* 62 S> */ B(Return), ] constant pool: [ InstanceType::FIXED_ARRAY_TYPE, diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc index 92ba9ba0bd..dd03c24b3c 100644 --- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc +++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc @@ -4,6 +4,7 @@ #include <cstring> #include <fstream> +#include <memory> #include <vector> #include "test/cctest/interpreter/bytecode-expectations-printer.h" @@ -12,7 +13,6 @@ #include "include/v8.h" #include "src/base/logging.h" -#include "src/base/smart-pointers.h" #include "src/compiler.h" #include "src/interpreter/interpreter.h" @@ -90,17 +90,6 @@ class ProgramOptions final { std::string test_function_name_; }; -class ArrayBufferAllocator final : public v8::ArrayBuffer::Allocator { - public: - void* Allocate(size_t length) override { - void* data = AllocateUninitialized(length); - if (data != nullptr) memset(data, 0, length); - return data; - } - void* AllocateUninitialized(size_t length) override { return malloc(length); } - void Free(void* data, size_t) override { free(data); } -}; - class V8InitializationScope final { public: explicit V8InitializationScope(const char* exec_path); @@ -110,7 +99,8 @@ class V8InitializationScope final { v8::Isolate* isolate() const { return isolate_; } private: - v8::base::SmartPointer<v8::Platform> platform_; + std::unique_ptr<v8::Platform> platform_; + std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_; v8::Isolate* isolate_; DISALLOW_COPY_AND_ASSIGN(V8InitializationScope); @@ -350,14 +340,14 @@ V8InitializationScope::V8InitializationScope(const char* exec_path) i::FLAG_always_opt = false; i::FLAG_allow_natives_syntax = true; - v8::V8::InitializeICU(); + v8::V8::InitializeICUDefaultLocation(exec_path); v8::V8::InitializeExternalStartupData(exec_path); v8::V8::InitializePlatform(platform_.get()); v8::V8::Initialize(); - ArrayBufferAllocator allocator; v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = &allocator; + allocator_.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator()); + create_params.array_buffer_allocator = allocator_.get(); isolate_ = v8::Isolate::New(create_params); } diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.h b/deps/v8/test/cctest/interpreter/interpreter-tester.h index f8a0a8a67a..4e202eada5 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.h +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.h @@ -114,7 +114,7 @@ class InterpreterTester { function->shared()->set_function_data(*bytecode_.ToHandleChecked()); } if (!feedback_vector_.is_null()) { - function->shared()->set_feedback_vector( + function->literals()->set_feedback_vector( *feedback_vector_.ToHandleChecked()); } return function; diff --git a/deps/v8/test/cctest/interpreter/source-position-matcher.cc b/deps/v8/test/cctest/interpreter/source-position-matcher.cc new file mode 100644 index 0000000000..30d545abc3 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/source-position-matcher.cc @@ -0,0 +1,224 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/cctest/interpreter/source-position-matcher.h" + +#include "src/objects-inl.h" +#include "src/objects.h" + +namespace v8 { +namespace internal { +namespace interpreter { + +// Comparer for PositionTableEntry instances. +struct PositionTableEntryComparer { + bool operator()(const PositionTableEntry& lhs, + const PositionTableEntry& rhs) const { + int lhs_type_score = type_score(lhs); + int rhs_type_score = type_score(rhs); + if (lhs_type_score == rhs_type_score) { + return lhs.source_position < rhs.source_position; + } else { + return lhs_type_score < rhs_type_score; + } + } + + int type_score(const PositionTableEntry& entry) const { + return entry.is_statement ? 1 : 0; + } +}; + +// +// The principles for comparing source positions in bytecode arrays +// are: +// +// 1. The number of statement positions must be the same in both. +// +// 2. Statement positions may be moved provide they do not affect the +// debuggers causal view of the v8 heap and local state. This means +// statement positions may be moved when their initial position is +// on bytecodes that manipulate the accumulator and temporary +// registers. +// +// 3. When duplicate expression positions are present, either may +// be dropped. +// +// 4. Expression positions may be applied to later bytecodes in the +// bytecode array if the current bytecode does not throw. +// +// 5. Expression positions may be dropped when they are applied to +// bytecodes that manipulate local frame state and immediately +// proceeded by another source position. +// +// 6. The relative ordering of source positions must be preserved. +// +bool SourcePositionMatcher::Match(Handle<BytecodeArray> original_bytecode, + Handle<BytecodeArray> optimized_bytecode) { + SourcePositionTableIterator original( + original_bytecode->source_position_table()); + SourcePositionTableIterator optimized( + optimized_bytecode->source_position_table()); + + int last_original_bytecode_offset = 0; + int last_optimized_bytecode_offset = 0; + + // Ordered lists of expression positions immediately before the + // latest statements in each bytecode array. + std::vector<PositionTableEntry> original_expression_entries; + std::vector<PositionTableEntry> optimized_expression_entries; + + while (true) { + MoveToNextStatement(&original, &original_expression_entries); + MoveToNextStatement(&optimized, &optimized_expression_entries); + + if (original.done() && optimized.done()) { + return true; + } else if (original.done()) { + return false; + } else if (optimized.done()) { + return false; + } + + if (HasNewExpressionPositionsInOptimized(&original_expression_entries, + &optimized_expression_entries)) { + return false; + } + + StripUnneededExpressionPositions(original_bytecode, + &original_expression_entries, + original.code_offset()); + StripUnneededExpressionPositions(optimized_bytecode, + &optimized_expression_entries, + optimized.code_offset()); + + if (!CompareExpressionPositions(&original_expression_entries, + &optimized_expression_entries)) { + // Message logged in CompareExpressionPositions(). + return false; + } + + // Check original and optimized have matching source positions. + if (original.source_position() != optimized.source_position()) { + return false; + } + + if (original.code_offset() < last_original_bytecode_offset) { + return false; + } + last_original_bytecode_offset = original.code_offset(); + + if (optimized.code_offset() < last_optimized_bytecode_offset) { + return false; + } + last_optimized_bytecode_offset = optimized.code_offset(); + + // TODO(oth): Can we compare statement positions are semantically + // equivalent? e.g. before a bytecode that has debugger observable + // effects. This is likely non-trivial. + } + + return true; +} + +bool SourcePositionMatcher::HasNewExpressionPositionsInOptimized( + const std::vector<PositionTableEntry>* const original_positions, + const std::vector<PositionTableEntry>* const optimized_positions) { + std::set<PositionTableEntry, PositionTableEntryComparer> original_set( + original_positions->begin(), original_positions->end()); + + bool retval = false; + for (auto optimized_position : *optimized_positions) { + if (original_set.find(optimized_position) == original_set.end()) { + retval = true; + } + } + return retval; +} + +bool SourcePositionMatcher::CompareExpressionPositions( + const std::vector<PositionTableEntry>* const original_positions, + const std::vector<PositionTableEntry>* const optimized_positions) { + if (original_positions->size() != optimized_positions->size()) { + return false; + } + + if (original_positions->size() == 0) { + return true; + } + + for (size_t i = 0; i < original_positions->size(); ++i) { + PositionTableEntry original = original_positions->at(i); + PositionTableEntry optimized = original_positions->at(i); + CHECK(original.source_position > 0); + if ((original.is_statement || optimized.is_statement) || + (original.source_position != optimized.source_position) || + (original.source_position < 0)) { + return false; + } + } + return true; +} + +void SourcePositionMatcher::StripUnneededExpressionPositions( + Handle<BytecodeArray> bytecode_array, + std::vector<PositionTableEntry>* expression_positions, + int next_statement_bytecode_offset) { + size_t j = 0; + for (size_t i = 0; i < expression_positions->size(); ++i) { + CHECK(expression_positions->at(i).source_position > 0 && + !expression_positions->at(i).is_statement); + int bytecode_end = (i == expression_positions->size() - 1) + ? next_statement_bytecode_offset + : expression_positions->at(i + 1).code_offset; + if (ExpressionPositionIsNeeded(bytecode_array, + expression_positions->at(i).code_offset, + bytecode_end)) { + expression_positions->at(j++) = expression_positions->at(i); + } + } + expression_positions->resize(j); +} + +void SourcePositionMatcher::AdvanceBytecodeIterator( + BytecodeArrayIterator* iterator, int bytecode_offset) { + while (iterator->current_offset() != bytecode_offset) { + iterator->Advance(); + } +} + +bool SourcePositionMatcher::ExpressionPositionIsNeeded( + Handle<BytecodeArray> bytecode_array, int start_offset, int end_offset) { + CHECK_GT(end_offset, start_offset); + BytecodeArrayIterator iterator(bytecode_array); + AdvanceBytecodeIterator(&iterator, start_offset); + + while (iterator.current_offset() != end_offset) { + if (Bytecodes::IsWithoutExternalSideEffects(iterator.current_bytecode())) { + iterator.Advance(); + } else { + // Bytecode could throw so need an expression position. + return true; + } + } + return false; +} + +void SourcePositionMatcher::MoveToNextStatement( + SourcePositionTableIterator* iterator, + std::vector<PositionTableEntry>* positions) { + iterator->Advance(); + positions->clear(); + while (!iterator->done()) { + if (iterator->is_statement()) { + break; + } + positions->push_back({iterator->code_offset(), iterator->source_position(), + iterator->is_statement()}); + iterator->Advance(); + } +} + +} // namespace interpreter +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/source-position-matcher.h b/deps/v8/test/cctest/interpreter/source-position-matcher.h new file mode 100644 index 0000000000..7cc49cc20c --- /dev/null +++ b/deps/v8/test/cctest/interpreter/source-position-matcher.h @@ -0,0 +1,50 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_ +#define TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_ + +#include "src/interpreter/bytecode-array-iterator.h" +#include "src/objects.h" +#include "src/source-position-table.h" +#include "src/v8.h" + +namespace v8 { +namespace internal { +namespace interpreter { + +class SourcePositionMatcher final { + public: + bool Match(Handle<BytecodeArray> original, Handle<BytecodeArray> optimized); + + private: + bool HasNewExpressionPositionsInOptimized( + const std::vector<PositionTableEntry>* const original_positions, + const std::vector<PositionTableEntry>* const optimized_positions); + + bool CompareExpressionPositions( + const std::vector<PositionTableEntry>* const original_positions, + const std::vector<PositionTableEntry>* const optimized_positions); + + void StripUnneededExpressionPositions( + Handle<BytecodeArray> bytecode_array, + std::vector<PositionTableEntry>* positions, + int next_statement_bytecode_offset); + + bool ExpressionPositionIsNeeded(Handle<BytecodeArray> bytecode_array, + int start_offset, int end_offset); + + void MoveToNextStatement( + SourcePositionTableIterator* iterator, + std::vector<PositionTableEntry>* expression_positions); + + void AdvanceBytecodeIterator(BytecodeArrayIterator* iterator, + int bytecode_offset); +}; + +} // namespace interpreter +} // namespace internal +} // namespace v8 + +#endif // TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_ diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index 2519f25142..d82bad228b 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -72,6 +72,7 @@ class InitializedIgnitionHandleScope : public InitializedHandleScope { public: InitializedIgnitionHandleScope() { i::FLAG_ignition = true; + i::FLAG_ignition_osr = false; // TODO(4764): Disabled for now. i::FLAG_always_opt = false; i::FLAG_allow_natives_syntax = true; CcTest::i_isolate()->interpreter()->Initialize(); @@ -113,6 +114,44 @@ std::string BuildActual(const BytecodeExpectationsPrinter& printer, return actual_stream.str(); } +bool CompareTexts(const std::string& generated, const std::string& expected) { + std::istringstream generated_stream(generated); + std::istringstream expected_stream(expected); + std::string generated_line; + std::string expected_line; + // Line number does not include golden file header. + int line_number = 0; + + do { + std::getline(generated_stream, generated_line); + std::getline(expected_stream, expected_line); + + if (!generated_stream.good() && !expected_stream.good()) { + return true; + } + + if (!generated_stream.good()) { + std::cerr << "Expected has extra lines after line " << line_number + << "\n"; + std::cerr << " Expected: '" << expected_line << "'\n"; + return false; + } else if (!expected_stream.good()) { + std::cerr << "Generated has extra lines after line " << line_number + << "\n"; + std::cerr << " Generated: '" << generated_line << "'\n"; + return false; + } + + if (generated_line != expected_line) { + std::cerr << "Inputs differ at line " << line_number << "\n"; + std::cerr << " Generated: '" << generated_line << "'\n"; + std::cerr << " Expected: '" << expected_line << "'\n"; + return false; + } + line_number++; + } while (true); +} + using ConstantPoolType = BytecodeExpectationsPrinter::ConstantPoolType; TEST(PrimitiveReturnStatements) { @@ -122,27 +161,29 @@ TEST(PrimitiveReturnStatements) { const char* snippets[] = { "", - "return;", + "return;\n", - "return null;", + "return null;\n", - "return true;", + "return true;\n", - "return false;", + "return false;\n", - "return 0;", + "return 0;\n", - "return +1;", + "return +1;\n", - "return -1;", + "return -1;\n", - "return +127;", + "return +127;\n", - "return -128;", + "return -128;\n", + + "return 2.0;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("PrimitiveReturnStatements.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("PrimitiveReturnStatements.golden"))); } TEST(PrimitiveExpressions) { @@ -150,35 +191,35 @@ TEST(PrimitiveExpressions) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "var x = 0; return x;", + "var x = 0; return x;\n", - "var x = 0; return x + 3;", + "var x = 0; return x + 3;\n", - "var x = 0; return x - 3;", + "var x = 0; return x - 3;\n", - "var x = 4; return x * 3;", + "var x = 4; return x * 3;\n", - "var x = 4; return x / 3;", + "var x = 4; return x / 3;\n", - "var x = 4; return x % 3;", + "var x = 4; return x % 3;\n", - "var x = 1; return x | 2;", + "var x = 1; return x | 2;\n", - "var x = 1; return x ^ 2;", + "var x = 1; return x ^ 2;\n", - "var x = 1; return x & 2;", + "var x = 1; return x & 2;\n", - "var x = 10; return x << 3;", + "var x = 10; return x << 3;\n", - "var x = 10; return x >> 3;", + "var x = 10; return x >> 3;\n", - "var x = 10; return x >>> 3;", + "var x = 10; return x >>> 3;\n", - "var x = 0; return (x, 3);", + "var x = 0; return (x, 3);\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("PrimitiveExpressions.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("PrimitiveExpressions.golden"))); } TEST(LogicalExpressions) { @@ -186,43 +227,43 @@ TEST(LogicalExpressions) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "var x = 0; return x || 3;", + "var x = 0; return x || 3;\n", - "var x = 0; return (x == 1) || 3;", + "var x = 0; return (x == 1) || 3;\n", - "var x = 0; return x && 3;", + "var x = 0; return x && 3;\n", - "var x = 0; return (x == 0) && 3;", + "var x = 0; return (x == 0) && 3;\n", - "var x = 0; return x || (1, 2, 3);", + "var x = 0; return x || (1, 2, 3);\n", - "var a = 2, b = 3, c = 4; return a || (a, b, a, b, c = 5, 3);", + "var a = 2, b = 3, c = 4; return a || (a, b, a, b, c = 5, 3);\n", "var x = 1; var a = 2, b = 3; return x || (" // REPEAT_32("\n a = 1, b = 2, ") // - "3);", + "3);\n", "var x = 0; var a = 2, b = 3; return x && (" // REPEAT_32("\n a = 1, b = 2, ") // - "3);", + "3);\n", "var x = 1; var a = 2, b = 3; return (x > 3) || (" // REPEAT_32("\n a = 1, b = 2, ") // - "3);", + "3);\n", "var x = 0; var a = 2, b = 3; return (x < 5) && (" // REPEAT_32("\n a = 1, b = 2, ") // - "3);", + "3);\n", - "return 0 && 3;", + "return 0 && 3;\n", - "return 1 || 3;", + "return 1 || 3;\n", - "var x = 1; return x && 3 || 0, 1;", + "var x = 1; return x && 3 || 0, 1;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("LogicalExpressions.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("LogicalExpressions.golden"))); } TEST(Parameters) { @@ -248,8 +289,8 @@ TEST(Parameters) { "function f(arg1, arg2, arg3, arg4) { arg2 = 1; }", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("Parameters.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("Parameters.golden"))); } TEST(IntegerConstants) { @@ -257,15 +298,15 @@ TEST(IntegerConstants) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "return 12345678;", + "return 12345678;\n", - "var a = 1234; return 5678;", + "var a = 1234; return 5678;\n", - "var a = 1234; return 1234;", + "var a = 1234; return 1234;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("IntegerConstants.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("IntegerConstants.golden"))); } TEST(HeapNumberConstants) { @@ -273,19 +314,19 @@ TEST(HeapNumberConstants) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "return 1.2;", + "return 1.2;\n", - "var a = 1.2; return 2.6;", + "var a = 1.2; return 2.6;\n", - "var a = 3.14; return 3.14;", + "var a = 3.14; return 3.14;\n", "var a;" // REPEAT_256("\na = 1.414;") // - " a = 3.14;", + " a = 3.14;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("HeapNumberConstants.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("HeapNumberConstants.golden"))); } TEST(StringConstants) { @@ -293,15 +334,15 @@ TEST(StringConstants) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "return \"This is a string\";", + "return \"This is a string\";\n", - "var a = \"First string\"; return \"Second string\";", + "var a = \"First string\"; return \"Second string\";\n", - "var a = \"Same string\"; return \"Same string\";", + "var a = \"Same string\"; return \"Same string\";\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("StringConstants.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("StringConstants.golden"))); } TEST(PropertyLoads) { @@ -313,16 +354,16 @@ TEST(PropertyLoads) { const char* snippets[] = { "function f(a) { return a.name; }\n" - "f({name : \"test\"});", + "f({name : \"test\"});\n", "function f(a) { return a[\"key\"]; }\n" - "f({key : \"test\"});", + "f({key : \"test\"});\n", "function f(a) { return a[100]; }\n" - "f({100 : \"test\"});", + "f({100 : \"test\"});\n", "function f(a, b) { return a[b]; }\n" - "f({arg : \"test\"}, \"arg\");", + "f({arg : \"test\"}, \"arg\");\n", "function f(a) { var b = a.name; return a[-124]; }\n" "f({\"-124\" : \"test\", name : 123 })", @@ -344,7 +385,8 @@ TEST(PropertyLoads) { "f({name : \"test\"}, \"name\")\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("PropertyLoads.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("PropertyLoads.golden"))); } TEST(PropertyStores) { @@ -407,7 +449,8 @@ TEST(PropertyStores) { "f({name : \"test\"})\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("PropertyStores.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("PropertyStores.golden"))); } #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" @@ -436,7 +479,8 @@ TEST(PropertyCall) { "f(" FUNC_ARG ")", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("PropertyCall.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("PropertyCall.golden"))); } TEST(LoadGlobal) { @@ -465,10 +509,11 @@ TEST(LoadGlobal) { REPEAT_127(" b.name;\n") " return a;\n" "}\n" - "f({name: 1});", + "f({name: 1});\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("LoadGlobal.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("LoadGlobal.golden"))); } TEST(StoreGlobal) { @@ -481,18 +526,18 @@ TEST(StoreGlobal) { const char* snippets[] = { "var a = 1;\n" "function f() { a = 2; }\n" - "f();", + "f();\n", "var a = \"test\"; function f(b) { a = b; }\n" - "f(\"global\");", + "f(\"global\");\n", "'use strict'; var a = 1;\n" "function f() { a = 2; }\n" - "f();", + "f();\n", "a = 1;\n" "function f() { a = 2; }\n" - "f();", + "f();\n", "a = 1;\n" "function f(b) {\n" @@ -500,7 +545,7 @@ TEST(StoreGlobal) { REPEAT_127(" b.name;\n") " a = 2;\n" "}\n" - "f({name: 1});", + "f({name: 1});\n", "a = 1;\n" "function f(b) {\n" @@ -509,10 +554,11 @@ TEST(StoreGlobal) { REPEAT_127(" b.name;\n") " a = 2;\n" "}\n" - "f({name: 1});", + "f({name: 1});\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("StoreGlobal.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("StoreGlobal.golden"))); } TEST(CallGlobal) { @@ -525,14 +571,15 @@ TEST(CallGlobal) { const char* snippets[] = { "function t() { }\n" "function f() { return t(); }\n" - "f();", + "f();\n", "function t(a, b, c) { }\n" "function f() { return t(1, 2, 3); }\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("CallGlobal.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CallGlobal.golden"))); } TEST(CallRuntime) { @@ -544,30 +591,26 @@ TEST(CallRuntime) { const char* snippets[] = { "function f() { %TheHole() }\n" - "f();", + "f();\n", "function f(a) { return %IsArray(a) }\n" - "f(undefined);", + "f(undefined);\n", "function f() { return %Add(1, 2) }\n" - "f();", + "f();\n", "function f() { return %spread_iterable([1]) }\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("CallRuntime.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CallRuntime.golden"))); } TEST(IfConditions) { - if (FLAG_harmony_instanceof) { - // TODO(mvstanton): when ES6 instanceof ships, regenerate the bytecode - // expectations and remove this flag check. - return; - } InitializedIgnitionHandleScope scope; BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + ConstantPoolType::kMixed); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -579,7 +622,7 @@ TEST(IfConditions) { " return -1;\n" " }\n" "};\n" - "f();", + "f();\n", "function f() {\n" " if ('lucky') {\n" @@ -588,7 +631,7 @@ TEST(IfConditions) { " return -1;\n" " }\n" "};\n" - "f();", + "f();\n", "function f() {\n" " if (false) {\n" @@ -597,14 +640,14 @@ TEST(IfConditions) { " return -1;\n" " }\n" "};\n" - "f();", + "f();\n", "function f() {\n" " if (false) {\n" " return 1;\n" " }\n" "};\n" - "f();", + "f();\n", "function f() {\n" " var a = 1;\n" @@ -614,7 +657,7 @@ TEST(IfConditions) { " return 2;\n" " }\n" "};\n" - "f();", + "f();\n", "function f(a) {\n" " if (a <= 0) {\n" @@ -623,14 +666,14 @@ TEST(IfConditions) { " return -200;\n" " }\n" "};\n" - "f(99);", + "f(99);\n", "function f(a, b) { if (a in b) { return 200; } }" - "f('prop', { prop: 'yes'});", + "f('prop', { prop: 'yes'});\n", "function f(z) { var a = 0; var b = 0; if (a === 0.01) {\n" REPEAT_64(" b = a; a = b;\n") - " return 200; } else { return -200; } } f(0.001);", + " return 200; } else { return -200; } } f(0.001);\n", "function f() {\n" " var a = 0; var b = 0;\n" @@ -638,7 +681,7 @@ TEST(IfConditions) { REPEAT_64(" b = a; a = b;\n") " return 200; } else { return -200; }\n" "};\n" - "f();", + "f();\n", "function f(a, b) {\n" " if (a == b) { return 1; }\n" @@ -651,7 +694,7 @@ TEST(IfConditions) { " if (a instanceof b) { return 1; }\n" " return 0;\n" "}\n" - "f(1, 1);", + "f(1, 1);\n", "function f() {\n" " var a = 0;\n" @@ -661,10 +704,22 @@ TEST(IfConditions) { " return -20;\n" " }\n" "};\n" - "f();", + "f();\n", + + "function f(a, b) {\n" + " if (a == b || a < 0) {\n" + " return 1;\n" + " } else if (a > 0 && b > 0) {\n" + " return 0;\n" + " } else {\n" + " return -1;\n" + " }\n" + "};\n" + "f(-1, 1);\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("IfConditions.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("IfConditions.golden"))); } TEST(DeclareGlobals) { @@ -677,18 +732,19 @@ TEST(DeclareGlobals) { printer.set_top_level(true); const char* snippets[] = { - "var a = 1;", + "var a = 1;\n", - "function f() {}", + "function f() {}\n", "var a = 1;\n" - "a=2;", + "a=2;\n", "function f() {}\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("DeclareGlobals.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("DeclareGlobals.golden"))); } TEST(BreakableBlocks) { @@ -703,7 +759,7 @@ TEST(BreakableBlocks) { " break label;\n" " x = x + 1;\n" "}\n" - "return x;", + "return x;\n", "var sum = 0;\n" "outer: {\n" @@ -714,7 +770,7 @@ TEST(BreakableBlocks) { " }\n" " }\n" "}\n" - "return sum;", + "return sum;\n", "outer: {\n" " let y = 10;\n" @@ -731,11 +787,11 @@ TEST(BreakableBlocks) { " y = 3;\n" " }\n" "}\n" - "x = 4;", + "x = 4;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("BreakableBlocks.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("BreakableBlocks.golden"))); } TEST(BasicLoops) { @@ -745,13 +801,13 @@ TEST(BasicLoops) { const char* snippets[] = { "var x = 0;\n" "while (false) { x = 99; break; continue; }\n" - "return x;", + "return x;\n", "var x = 0;\n" "while (false) {\n" " x = x + 1;\n" "};\n" - "return x;", + "return x;\n", "var x = 0;\n" "var y = 1;\n" @@ -761,7 +817,7 @@ TEST(BasicLoops) { " if (x == 3) continue;\n" " if (x == 4) break;\n" "}\n" - "return y;", + "return y;\n", "var i = 0;\n" "while (true) {\n" @@ -772,7 +828,7 @@ TEST(BasicLoops) { " if (i == 5) break;\n" " i = i + 1;\n" "}\n" - "return i;", + "return i;\n", "var i = 0;\n" "while (true) {\n" @@ -783,7 +839,7 @@ TEST(BasicLoops) { " i = i + 1;\n" " break;\n" "}\n" - "return i;", + "return i;\n", "var x = 10;\n" "var y = 1;\n" @@ -791,7 +847,7 @@ TEST(BasicLoops) { " y = y * 12;\n" " x = x - 1;\n" "}\n" - "return y;", + "return y;\n", "var x = 0; var y = 1;\n" "do {\n" @@ -800,7 +856,7 @@ TEST(BasicLoops) { " if (x == 6) continue;\n" " x = x + 1;\n" "} while (x < 10);\n" - "return y;", + "return y;\n", "var x = 10;\n" "var y = 1;\n" @@ -808,7 +864,7 @@ TEST(BasicLoops) { " y = y * 12;\n" " x = x - 1;\n" "} while (x);\n" - "return y;", + "return y;\n", "var x = 0; var y = 1;\n" "do {\n" @@ -817,7 +873,7 @@ TEST(BasicLoops) { " x = x + 1;\n" " if (x == 6) continue;\n" "} while (false);\n" - "return y;", + "return y;\n", "var x = 0; var y = 1;\n" "do {\n" @@ -826,56 +882,56 @@ TEST(BasicLoops) { " x = x + 1;\n" " if (x == 6) continue;\n" "} while (true);\n" - "return y;", + "return y;\n", "var x = 0;\n" "for (;;) {\n" " if (x == 1) break;\n" " if (x == 2) continue;\n" " x = x + 1;\n" - "}", + "}\n", "for (var x = 0;;) {\n" " if (x == 1) break;\n" " if (x == 2) continue;\n" " x = x + 1;\n" - "}", + "}\n", "var x = 0;\n" "for (;; x = x + 1) {\n" " if (x == 1) break;\n" " if (x == 2) continue;\n" - "}", + "}\n", "for (var x = 0;; x = x + 1) {\n" " if (x == 1) break;\n" " if (x == 2) continue;\n" - "}", + "}\n", "var u = 0;\n" "for (var i = 0; i < 100; i = i + 1) {\n" " u = u + 1;\n" " continue;\n" - "}", + "}\n", "var y = 1;\n" "for (var x = 10; x; --x) {\n" " y = y * 12;\n" "}\n" - "return y;", + "return y;\n", "var x = 0;\n" "for (var i = 0; false; i++) {\n" " x = x + 1;\n" "};\n" - "return x;", + "return x;\n", "var x = 0;\n" "for (var i = 0; true; ++i) {\n" " x = x + 1;\n" " if (x == 20) break;\n" "};\n" - "return x;", + "return x;\n", "var a = 0;\n" "while (a) {\n" @@ -885,10 +941,11 @@ TEST(BasicLoops) { " if (z) continue;\n" " z++;\n" " }\n" - "}", + "}\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("BasicLoops.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("BasicLoops.golden"))); } TEST(JumpsRequiringConstantWideOperands) { @@ -904,11 +961,11 @@ TEST(JumpsRequiringConstantWideOperands) { " if (i == 1) continue;\n" " if (i == 2) break;\n" "}\n" - "return 3;", + "return 3;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("JumpsRequiringConstantWideOperands.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("JumpsRequiringConstantWideOperands.golden"))); } TEST(UnaryOperators) { @@ -920,32 +977,33 @@ TEST(UnaryOperators) { "while (x != 10) {\n" " x = x + 10;\n" "}\n" - "return x;", + "return x;\n", "var x = false;\n" "do {\n" " x = !x;\n" "} while(x == false);\n" - "return x;", + "return x;\n", "var x = 101;\n" - "return void(x * 3);", + "return void(x * 3);\n", "var x = 1234;\n" "var y = void (x * x - 1);\n" - "return y;", + "return y;\n", "var x = 13;\n" - "return ~x;", + "return ~x;\n", "var x = 13;\n" - "return +x;", + "return +x;\n", "var x = 13;\n" - "return -x;", + "return -x;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("UnaryOperators.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("UnaryOperators.golden"))); } TEST(Typeof) { @@ -967,8 +1025,8 @@ TEST(Typeof) { "};", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("Typeof.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("Typeof.golden"))); } TEST(Delete) { @@ -977,23 +1035,24 @@ TEST(Delete) { ConstantPoolType::kMixed); const char* snippets[] = { - "var a = {x:13, y:14}; return delete a.x;", + "var a = {x:13, y:14}; return delete a.x;\n", - "'use strict'; var a = {x:13, y:14}; return delete a.x;", + "'use strict'; var a = {x:13, y:14}; return delete a.x;\n", - "var a = {1:13, 2:14}; return delete a[2];", + "var a = {1:13, 2:14}; return delete a[2];\n", - "var a = 10; return delete a;", + "var a = 10; return delete a;\n", "'use strict';\n" "var a = {1:10};\n" "(function f1() {return a;});\n" - "return delete a[1];", + "return delete a[1];\n", - "return delete 'test';", + "return delete 'test';\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Delete.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("Delete.golden"))); } TEST(GlobalDelete) { @@ -1008,29 +1067,30 @@ TEST(GlobalDelete) { "function f() {\n" " return delete a.x;\n" "};\n" - "f();", + "f();\n", "a = {1:13, 2:14};\n" "function f() {\n" " 'use strict';\n" " return delete a[1];\n" "};\n" - "f();", + "f();\n", "var a = {x:13, y:14};\n" "function f() {\n" " return delete a;\n" "};\n" - "f();", + "f();\n", "b = 30;\n" "function f() {\n" " return delete b;\n" "};\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("GlobalDelete.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("GlobalDelete.golden"))); } TEST(FunctionLiterals) { @@ -1039,15 +1099,15 @@ TEST(FunctionLiterals) { ConstantPoolType::kMixed); const char* snippets[] = { - "return function(){ }", + "return function(){ }\n", - "return (function(){ })()", + "return (function(){ })()\n", - "return (function(x){ return x; })(1)", + "return (function(x){ return x; })(1)\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("FunctionLiterals.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("FunctionLiterals.golden"))); } TEST(RegExpLiterals) { @@ -1056,14 +1116,15 @@ TEST(RegExpLiterals) { ConstantPoolType::kString); const char* snippets[] = { - "return /ab+d/;", + "return /ab+d/;\n", - "return /(\\w+)\\s(\\w+)/i;", + "return /(\\w+)\\s(\\w+)/i;\n", - "return /ab+d/.exec('abdd');", + "return /ab+d/.exec('abdd');\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("RegExpLiterals.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("RegExpLiterals.golden"))); } TEST(RegExpLiteralsWide) { @@ -1074,11 +1135,11 @@ TEST(RegExpLiteralsWide) { const char* snippets[] = { "var a;" // REPEAT_256("\na = 1.23;") // - "\nreturn /ab+d/;", + "\nreturn /ab+d/;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("RegExpLiteralsWide.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("RegExpLiteralsWide.golden"))); } TEST(ArrayLiterals) { @@ -1087,16 +1148,17 @@ TEST(ArrayLiterals) { ConstantPoolType::kMixed); const char* snippets[] = { - "return [ 1, 2 ];", + "return [ 1, 2 ];\n", - "var a = 1; return [ a, a + 1 ];", + "var a = 1; return [ a, a + 1 ];\n", - "return [ [ 1, 2 ], [ 3 ] ];", + "return [ [ 1, 2 ], [ 3 ] ];\n", - "var a = 1; return [ [ a, 2 ], [ a + 2 ] ];", + "var a = 1; return [ [ a, 2 ], [ a + 2 ] ];\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("ArrayLiterals.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ArrayLiterals.golden"))); } TEST(ArrayLiteralsWide) { @@ -1107,11 +1169,11 @@ TEST(ArrayLiteralsWide) { const char* snippets[] = { "var a;" // REPEAT_256("\na = 1.23;") // - "\nreturn [ 1 , 2 ];", + "\nreturn [ 1 , 2 ];\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("ArrayLiteralsWide.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ArrayLiteralsWide.golden"))); } TEST(ObjectLiterals) { @@ -1120,38 +1182,39 @@ TEST(ObjectLiterals) { ConstantPoolType::kMixed); const char* snippets[] = { - "return { };", + "return { };\n", - "return { name: 'string', val: 9.2 };", + "return { name: 'string', val: 9.2 };\n", - "var a = 1; return { name: 'string', val: a };", + "var a = 1; return { name: 'string', val: a };\n", - "var a = 1; return { val: a, val: a + 1 };", + "var a = 1; return { val: a, val: a + 1 };\n", - "return { func: function() { } };", + "return { func: function() { } };\n", - "return { func(a) { return a; } };", + "return { func(a) { return a; } };\n", - "return { get a() { return 2; } };", + "return { get a() { return 2; } };\n", - "return { get a() { return this.x; }, set a(val) { this.x = val } };", + "return { get a() { return this.x; }, set a(val) { this.x = val } };\n", - "return { set b(val) { this.y = val } };", + "return { set b(val) { this.y = val } };\n", - "var a = 1; return { 1: a };", + "var a = 1; return { 1: a };\n", - "return { __proto__: null };", + "return { __proto__: null };\n", - "var a = 'test'; return { [a]: 1 };", + "var a = 'test'; return { [a]: 1 };\n", - "var a = 'test'; return { val: a, [a]: 1 };", + "var a = 'test'; return { val: a, [a]: 1 };\n", - "var a = 'test'; return { [a]: 1, __proto__: {} };", + "var a = 'test'; return { [a]: 1, __proto__: {} };\n", - "var n = 'name'; return { [n]: 'val', get a() { }, set a(b) {} };", + "var n = 'name'; return { [n]: 'val', get a() { }, set a(b) {} };\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("ObjectLiterals.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ObjectLiterals.golden"))); } TEST(ObjectLiteralsWide) { @@ -1161,11 +1224,11 @@ TEST(ObjectLiteralsWide) { const char* snippets[] = { "var a;" // REPEAT_256("\na = 1.23;") // - "\nreturn { name: 'string', val: 9.2 };", + "\nreturn { name: 'string', val: 9.2 };\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("ObjectLiteralsWide.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ObjectLiteralsWide.golden"))); } TEST(TopLevelObjectLiterals) { @@ -1178,11 +1241,11 @@ TEST(TopLevelObjectLiterals) { printer.set_top_level(true); const char* snippets[] = { - "var a = { func: function() { } };", + "var a = { func: function() { } };\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("TopLevelObjectLiterals.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("TopLevelObjectLiterals.golden"))); } TEST(TryCatch) { @@ -1191,14 +1254,15 @@ TEST(TryCatch) { ConstantPoolType::kString); const char* snippets[] = { - "try { return 1; } catch(e) { return 2; }", + "try { return 1; } catch(e) { return 2; }\n", "var a;\n" "try { a = 1 } catch(e1) {};\n" - "try { a = 2 } catch(e2) { a = 3 }", + "try { a = 2 } catch(e2) { a = 3 }\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("TryCatch.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("TryCatch.golden"))); } TEST(TryFinally) { @@ -1207,17 +1271,18 @@ TEST(TryFinally) { ConstantPoolType::kString); const char* snippets[] = { "var a = 1;\n" - "try { a = 2; } finally { a = 3; }", + "try { a = 2; } finally { a = 3; }\n", "var a = 1;\n" - "try { a = 2; } catch(e) { a = 20 } finally { a = 3; }", + "try { a = 2; } catch(e) { a = 20 } finally { a = 3; }\n", "var a; try {\n" " try { a = 1 } catch(e) { a = 2 }\n" - "} catch(e) { a = 20 } finally { a = 3; }", + "} catch(e) { a = 20 } finally { a = 3; }\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("TryFinally.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("TryFinally.golden"))); } TEST(Throw) { @@ -1225,14 +1290,15 @@ TEST(Throw) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "throw 1;", + "throw 1;\n", - "throw 'Error';", + "throw 'Error';\n", - "var a = 1; if (a) { throw 'Error'; };", + "var a = 1; if (a) { throw 'Error'; };\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Throw.golden")); + CHECK( + CompareTexts(BuildActual(printer, snippets), LoadGolden("Throw.golden"))); } TEST(CallNew) { @@ -1245,11 +1311,11 @@ TEST(CallNew) { const char* snippets[] = { "function bar() { this.value = 0; }\n" "function f() { return new bar(); }\n" - "f();", + "f();\n", "function bar(x) { this.value = 18; this.x = x;}\n" "function f() { return new bar(3); }\n" - "f();", + "f();\n", "function bar(w, x, y, z) {\n" " this.value = 18;\n" @@ -1258,10 +1324,11 @@ TEST(CallNew) { " this.z = z;\n" "}\n" "function f() { return new bar(3, 4, 5); }\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("CallNew.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CallNew.golden"))); } TEST(ContextVariables) { @@ -1274,27 +1341,27 @@ TEST(ContextVariables) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "var a; return function() { a = 1; };", + "var a; return function() { a = 1; };\n", - "var a = 1; return function() { a = 2; };", + "var a = 1; return function() { a = 2; };\n", - "var a = 1; var b = 2; return function() { a = 2; b = 3 };", + "var a = 1; var b = 2; return function() { a = 2; b = 3 };\n", - "var a; (function() { a = 2; })(); return a;", + "var a; (function() { a = 2; })(); return a;\n", "'use strict';\n" "let a = 1;\n" - "{ let b = 2; return function() { a + b; }; }", + "{ let b = 2; return function() { a + b; }; }\n", "'use strict';\n" REPEAT_249_UNIQUE_VARS() "eval();\n" "var b = 100;\n" - "return b", + "return b\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("ContextVariables.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ContextVariables.golden"))); } TEST(ContextParameters) { @@ -1314,8 +1381,8 @@ TEST(ContextParameters) { "function f() { var self = this; return function() { self = 2; }; }", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("ContextParameters.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("ContextParameters.golden"))); } TEST(OuterContextVariables) { @@ -1345,8 +1412,8 @@ TEST(OuterContextVariables) { "var f = new Outer().getInnerFunc();", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("OuterContextVariables.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("OuterContextVariables.golden"))); } TEST(CountOperators) { @@ -1354,30 +1421,31 @@ TEST(CountOperators) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "var a = 1; return ++a;", + "var a = 1; return ++a;\n", - "var a = 1; return a++;", + "var a = 1; return a++;\n", - "var a = 1; return --a;", + "var a = 1; return --a;\n", - "var a = 1; return a--;", + "var a = 1; return a--;\n", - "var a = { val: 1 }; return a.val++;", + "var a = { val: 1 }; return a.val++;\n", - "var a = { val: 1 }; return --a.val;", + "var a = { val: 1 }; return --a.val;\n", - "var name = 'var'; var a = { val: 1 }; return a[name]--;", + "var name = 'var'; var a = { val: 1 }; return a[name]--;\n", - "var name = 'var'; var a = { val: 1 }; return ++a[name];", + "var name = 'var'; var a = { val: 1 }; return ++a[name];\n", - "var a = 1; var b = function() { return a }; return ++a;", + "var a = 1; var b = function() { return a }; return ++a;\n", - "var a = 1; var b = function() { return a }; return a--;", + "var a = 1; var b = function() { return a }; return a--;\n", - "var idx = 1; var a = [1, 2]; return a[idx++] = 2;", + "var idx = 1; var a = [1, 2]; return a[idx++] = 2;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("CountOperators.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CountOperators.golden"))); } TEST(GlobalCountOperators) { @@ -1390,23 +1458,23 @@ TEST(GlobalCountOperators) { const char* snippets[] = { "var global = 1;\n" "function f() { return ++global; }\n" - "f();", + "f();\n", "var global = 1;\n" "function f() { return global--; }\n" - "f();", + "f();\n", "unallocated = 1;\n" "function f() { 'use strict'; return --unallocated; }\n" - "f();", + "f();\n", "unallocated = 1;\n" "function f() { return unallocated++; }\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("GlobalCountOperators.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("GlobalCountOperators.golden"))); } TEST(CompoundExpressions) { @@ -1414,19 +1482,19 @@ TEST(CompoundExpressions) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "var a = 1; a += 2;", + "var a = 1; a += 2;\n", - "var a = 1; a /= 2;", + "var a = 1; a /= 2;\n", - "var a = { val: 2 }; a.name *= 2;", + "var a = { val: 2 }; a.name *= 2;\n", - "var a = { 1: 2 }; a[1] ^= 2;", + "var a = { 1: 2 }; a[1] ^= 2;\n", - "var a = 1; (function f() { return a; }); a |= 24;", + "var a = 1; (function f() { return a; }); a |= 24;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("CompoundExpressions.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CompoundExpressions.golden"))); } TEST(GlobalCompoundExpressions) { @@ -1439,15 +1507,15 @@ TEST(GlobalCompoundExpressions) { const char* snippets[] = { "var global = 1;\n" "function f() { return global &= 1; }\n" - "f();", + "f();\n", "unallocated = 1;\n" "function f() { return unallocated += 1; }\n" - "f();", + "f();\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("GlobalCompoundExpressions.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("GlobalCompoundExpressions.golden"))); } TEST(CreateArguments) { @@ -1471,8 +1539,8 @@ TEST(CreateArguments) { "function f(a, b, c) { 'use strict'; return arguments; }", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("CreateArguments.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("CreateArguments.golden"))); } TEST(CreateRestParameter) { @@ -1492,8 +1560,8 @@ TEST(CreateRestParameter) { "function f(a, ...restArgs) { return restArgs[0] + arguments[0]; }", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("CreateRestParameter.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("CreateRestParameter.golden"))); } TEST(ForIn) { @@ -1501,29 +1569,30 @@ TEST(ForIn) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "for (var p in null) {}", + "for (var p in null) {}\n", - "for (var p in undefined) {}", + "for (var p in undefined) {}\n", - "for (var p in undefined) {}", + "for (var p in undefined) {}\n", "var x = 'potatoes';\n" - "for (var p in x) { return p; }", + "for (var p in x) { return p; }\n", "var x = 0;\n" - "for (var p in [1,2,3]) { x += p; }", + "for (var p in [1,2,3]) { x += p; }\n", "var x = { 'a': 1, 'b': 2 };\n" "for (x['a'] in [10, 20, 30]) {\n" " if (x['a'] == 10) continue;\n" " if (x['a'] == 20) break;\n" - "}", + "}\n", "var x = [ 10, 11, 12 ] ;\n" - "for (x[0] in [1,2,3]) { return x[3]; }", + "for (x[0] in [1,2,3]) { return x[3]; }\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("ForIn.golden")); + CHECK( + CompareTexts(BuildActual(printer, snippets), LoadGolden("ForIn.golden"))); } TEST(ForOf) { @@ -1531,21 +1600,22 @@ TEST(ForOf) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "for (var p of [0, 1, 2]) {}", + "for (var p of [0, 1, 2]) {}\n", "var x = 'potatoes';\n" - "for (var p of x) { return p; }", + "for (var p of x) { return p; }\n", "for (var x of [10, 20, 30]) {\n" " if (x == 10) continue;\n" " if (x == 20) break;\n" - "}", + "}\n", "var x = { 'a': 1, 'b': 2 };\n" - "for (x['a'] of [1,2,3]) { return x['a']; }", + "for (x['a'] of [1,2,3]) { return x['a']; }\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("ForOf.golden")); + CHECK( + CompareTexts(BuildActual(printer, snippets), LoadGolden("ForOf.golden"))); } TEST(Conditional) { @@ -1553,12 +1623,18 @@ TEST(Conditional) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "return 1 ? 2 : 3;", + "return 1 ? 2 : 3;\n", + + "return 1 ? 2 ? 3 : 4 : 5;\n", - "return 1 ? 2 ? 3 : 4 : 5;", + "return 0 < 1 ? 2 : 3;\n", + + "var x = 0;\n" + "return x ? 2 : 3;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Conditional.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("Conditional.golden"))); } TEST(Switch) { @@ -1570,39 +1646,39 @@ TEST(Switch) { "switch(a) {\n" " case 1: return 2;\n" " case 2: return 3;\n" - "}", + "}\n", "var a = 1;\n" "switch(a) {\n" " case 1: a = 2; break;\n" " case 2: a = 3; break;\n" - "}", + "}\n", "var a = 1;\n" "switch(a) {\n" " case 1: a = 2; // fall-through\n" " case 2: a = 3; break;\n" - "}", + "}\n", "var a = 1;\n" "switch(a) {\n" " case 2: break;\n" " case 3: break;\n" " default: a = 1; break;\n" - "}", + "}\n", "var a = 1;\n" "switch(typeof(a)) {\n" " case 2: a = 1; break;\n" " case 3: a = 2; break;\n" " default: a = 3; break;\n" - "}", + "}\n", "var a = 1;\n" "switch(a) {\n" " case typeof(a): a = 1; break;\n" " default: a = 2; break;\n" - "}", + "}\n", "var a = 1;\n" "switch(a) {\n" @@ -1612,7 +1688,7 @@ TEST(Switch) { " case 2:\n" " a = 3;\n" " break;\n" - "}", + "}\n", "var a = 1;\n" "switch(a) {\n" @@ -1622,10 +1698,11 @@ TEST(Switch) { " default : a = 2; break;\n" " } // fall-through\n" " case 2: a = 3;\n" - "}", + "}\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Switch.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("Switch.golden"))); } TEST(BasicBlockToBoolean) { @@ -1633,15 +1710,15 @@ TEST(BasicBlockToBoolean) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "var a = 1; if (a || a < 0) { return 1; }", + "var a = 1; if (a || a < 0) { return 1; }\n", - "var a = 1; if (a && a < 0) { return 1; }", + "var a = 1; if (a && a < 0) { return 1; }\n", - "var a = 1; a = (a || a < 0) ? 2 : 3;", + "var a = 1; a = (a || a < 0) ? 2 : 3;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("BasicBlockToBoolean.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("BasicBlockToBoolean.golden"))); } TEST(DeadCodeRemoval) { @@ -1649,17 +1726,17 @@ TEST(DeadCodeRemoval) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kNumber); const char* snippets[] = { - "return; var a = 1; a();", + "return; var a = 1; a();\n", - "if (false) { return; }; var a = 1;", + "if (false) { return; }; var a = 1;\n", - "if (true) { return 1; } else { return 2; };", + "if (true) { return 1; } else { return 2; };\n", - "var a = 1; if (a) { return 1; }; return 2;", + "var a = 1; if (a) { return 1; }; return 2;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("DeadCodeRemoval.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("DeadCodeRemoval.golden"))); } TEST(ThisFunction) { @@ -1677,8 +1754,8 @@ TEST(ThisFunction) { "f = function f() { return f; };", }; - CHECK_EQ(BuildActual(printer, snippets, "", "\nf();"), - LoadGolden("ThisFunction.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, "", "\nf();"), + LoadGolden("ThisFunction.golden"))); } TEST(NewTarget) { @@ -1687,12 +1764,13 @@ TEST(NewTarget) { ConstantPoolType::kMixed); const char* snippets[] = { - "return new.target;", + "return new.target;\n", - "new.target;", + "new.target;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("NewTarget.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("NewTarget.golden"))); } TEST(RemoveRedundantLdar) { @@ -1705,22 +1783,22 @@ TEST(RemoveRedundantLdar) { " ld_a = ld_a + ld_a;\n" // in a different basicblock. " if (ld_a > 10) break;\n" "}\n" - "return ld_a;", + "return ld_a;\n", "var ld_a = 1;\n" "do {\n" " ld_a = ld_a + ld_a;\n" " if (ld_a > 10) continue;\n" "} while(false);\n" - "return ld_a;", + "return ld_a;\n", "var ld_a = 1;\n" " ld_a = ld_a + ld_a;\n" - " return ld_a;", + " return ld_a;\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("RemoveRedundantLdar.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("RemoveRedundantLdar.golden"))); } TEST(AssignmentsInBinaryExpression) { @@ -1729,28 +1807,28 @@ TEST(AssignmentsInBinaryExpression) { ConstantPoolType::kString); const char* snippets[] = { "var x = 0, y = 1;\n" - "return (x = 2, y = 3, x = 4, y = 5);", + "return (x = 2, y = 3, x = 4, y = 5);\n", "var x = 55;\n" "var y = (x = 100);\n" - "return y;", + "return y;\n", "var x = 55;\n" "x = x + (x = 100) + (x = 101);\n" - "return x;", + "return x;\n", "var x = 55;\n" "x = (x = 56) - x + (x = 57);\n" "x++;\n" - "return x;", + "return x;\n", "var x = 55;\n" "var y = x + (x = 1) + (x = 2) + (x = 3);\n" - "return y;", + "return y;\n", "var x = 55;\n" "var x = x + (x = 1) + (x = 2) + (x = 3);\n" - "return x;", + "return x;\n", "var x = 10, y = 20;\n" "return x + (x = 1) + (x + 1) * (y = 2) + (y = 3) + (x = 4) + (y = 5) + " @@ -1760,8 +1838,8 @@ TEST(AssignmentsInBinaryExpression) { "return 1 + x + (x++) + (++x);\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("AssignmentsInBinaryExpression.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("AssignmentsInBinaryExpression.golden"))); } TEST(Eval) { @@ -1769,10 +1847,11 @@ TEST(Eval) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "return eval('1;');", + "return eval('1;');\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Eval.golden")); + CHECK( + CompareTexts(BuildActual(printer, snippets), LoadGolden("Eval.golden"))); } TEST(LookupSlot) { @@ -1781,14 +1860,15 @@ TEST(LookupSlot) { ConstantPoolType::kString); const char* snippets[] = { - "eval('var x = 10;'); return x;", + "eval('var x = 10;'); return x;\n", - "eval('var x = 10;'); return typeof x;", + "eval('var x = 10;'); return typeof x;\n", - "x = 20; return eval('');", + "x = 20; return eval('');\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("LookupSlot.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("LookupSlot.golden"))); } TEST(CallLookupSlot) { @@ -1796,10 +1876,11 @@ TEST(CallLookupSlot) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "g = function(){}; eval(''); return g();", + "g = function(){}; eval(''); return g();\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("CallLookupSlot.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("CallLookupSlot.golden"))); } // TODO(mythria): tests for variable/function declaration in lookup slots. @@ -1831,7 +1912,7 @@ TEST(LookupSlotInEval) { "}\n" "f1();"); - CHECK_EQ(actual, LoadGolden("LookupSlotInEval.golden")); + CHECK(CompareTexts(actual, LoadGolden("LookupSlotInEval.golden"))); } TEST(LookupSlotWideInEval) { @@ -1867,7 +1948,7 @@ TEST(LookupSlotWideInEval) { "}\n" "f1();"); - CHECK_EQ(actual, LoadGolden("LookupSlotWideInEval.golden")); + CHECK(CompareTexts(actual, LoadGolden("LookupSlotWideInEval.golden"))); } TEST(DeleteLookupSlotInEval) { @@ -1897,7 +1978,7 @@ TEST(DeleteLookupSlotInEval) { "}\n" "f1();"); - CHECK_EQ(actual, LoadGolden("DeleteLookupSlotInEval.golden")); + CHECK(CompareTexts(actual, LoadGolden("DeleteLookupSlotInEval.golden"))); } TEST(WideRegisters) { @@ -1913,41 +1994,41 @@ TEST(WideRegisters) { ConstantPoolType::kNumber); const char* snippets[] = { "x0 = x127;\n" - "return x0;", + "return x0;\n", "x127 = x126;\n" - "return x127;", + "return x127;\n", "if (x2 > 3) { return x129; }\n" - "return x128;", + "return x128;\n", "var x0 = 0;\n" "if (x129 == 3) { var x129 = x0; }\n" "if (x2 > 3) { return x0; }\n" - "return x129;", + "return x129;\n", "var x0 = 0;\n" "var x1 = 0;\n" "for (x128 = 0; x128 < 64; x128++) {" " x1 += x128;" "}" - "return x128;", + "return x128;\n", "var x0 = 1234;\n" "var x1 = 0;\n" "for (x128 in x0) {" " x1 += x128;" "}" - "return x1;", + "return x1;\n", "x0 = %Add(x64, x63);\n" "x1 = %Add(x27, x143);\n" "%TheHole();\n" - "return x1;", + "return x1;\n", }; - CHECK_EQ(BuildActual(printer, snippets, prologue.c_str()), - LoadGolden("WideRegisters.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets, prologue.c_str()), + LoadGolden("WideRegisters.golden"))); } TEST(ConstVariable) { @@ -1955,16 +2036,17 @@ TEST(ConstVariable) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "const x = 10;", + "const x = 10;\n", - "const x = 10; return x;", + "const x = 10; return x;\n", - "const x = ( x = 20);", + "const x = ( x = 20);\n", - "const x = 10; x = 20;", + "const x = 10; x = 20;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("ConstVariable.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ConstVariable.golden"))); } TEST(LetVariable) { @@ -1972,16 +2054,17 @@ TEST(LetVariable) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "let x = 10;", + "let x = 10;\n", - "let x = 10; return x;", + "let x = 10; return x;\n", - "let x = (x = 20);", + "let x = (x = 20);\n", - "let x = 10; x = 20;", + "let x = 10; x = 20;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("LetVariable.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("LetVariable.golden"))); } TEST(ConstVariableContextSlot) { @@ -1991,17 +2074,17 @@ TEST(ConstVariableContextSlot) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "const x = 10; function f1() {return x;}", + "const x = 10; function f1() {return x;}\n", - "const x = 10; function f1() {return x;} return x;", + "const x = 10; function f1() {return x;} return x;\n", - "const x = (x = 20); function f1() {return x;}", + "const x = (x = 20); function f1() {return x;}\n", - "const x = 10; x = 20; function f1() {return x;}", + "const x = 10; x = 20; function f1() {return x;}\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("ConstVariableContextSlot.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ConstVariableContextSlot.golden"))); } TEST(LetVariableContextSlot) { @@ -2009,17 +2092,17 @@ TEST(LetVariableContextSlot) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "let x = 10; function f1() {return x;}", + "let x = 10; function f1() {return x;}\n", - "let x = 10; function f1() {return x;} return x;", + "let x = 10; function f1() {return x;} return x;\n", - "let x = (x = 20); function f1() {return x;}", + "let x = (x = 20); function f1() {return x;}\n", - "let x = 10; x = 20; function f1() {return x;}", + "let x = 10; x = 20; function f1() {return x;}\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("LetVariableContextSlot.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("LetVariableContextSlot.golden"))); } TEST(DoExpression) { @@ -2030,14 +2113,15 @@ TEST(DoExpression) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "var a = do { }; return a;", + "var a = do { }; return a;\n", - "var a = do { var x = 100; }; return a;", + "var a = do { var x = 100; }; return a;\n", - "while(true) { var a = 10; a = do { ++a; break; }; a = 20; }", + "while(true) { var a = 10; a = do { ++a; break; }; a = 20; }\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("DoExpression.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("DoExpression.golden"))); FLAG_harmony_do_expressions = old_flag; } @@ -2047,10 +2131,11 @@ TEST(WithStatement) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kMixed); const char* snippets[] = { - "with ({x:42}) { return x; }", + "with ({x:42}) { return x; }\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("WithStatement.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("WithStatement.golden"))); } TEST(DoDebugger) { @@ -2058,10 +2143,11 @@ TEST(DoDebugger) { BytecodeExpectationsPrinter printer(CcTest::isolate(), ConstantPoolType::kString); const char* snippets[] = { - "debugger;", + "debugger;\n", }; - CHECK_EQ(BuildActual(printer, snippets), LoadGolden("DoDebugger.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("DoDebugger.golden"))); } TEST(ClassDeclarations) { @@ -2072,27 +2158,27 @@ TEST(ClassDeclarations) { "class Person {\n" " constructor(name) { this.name = name; }\n" " speak() { console.log(this.name + ' is speaking.'); }\n" - "}", + "}\n", "class person {\n" " constructor(name) { this.name = name; }\n" " speak() { console.log(this.name + ' is speaking.'); }\n" - "}", + "}\n", "var n0 = 'a';\n" "var n1 = 'b';\n" "class N {\n" " [n0]() { return n0; }\n" " static [n1]() { return n1; }\n" - "}", + "}\n", "var count = 0;\n" "class C { constructor() { count++; }}\n" "return new C();\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("ClassDeclarations.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ClassDeclarations.golden"))); } TEST(ClassAndSuperClass) { @@ -2150,8 +2236,30 @@ TEST(ClassAndSuperClass) { "})();\n", }; - CHECK_EQ(BuildActual(printer, snippets), - LoadGolden("ClassAndSuperClass.golden")); + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ClassAndSuperClass.golden"))); +} + +TEST(Generators) { + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate(), + ConstantPoolType::kMixed); + printer.set_wrap(false); + printer.set_test_function_name("f"); + + const char* snippets[] = { + "function* f() { }\n" + "f();\n", + + "function* f() { yield 42 }\n" + "f();\n", + + "function* f() { for (let x of [42]) yield x }\n" + "f();\n", + }; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("Generators.golden"))); } } // namespace interpreter diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc index e4cf809ad7..9591e2810e 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -28,8 +28,8 @@ class InvokeIntrinsicHelper { BytecodeArrayBuilder builder(isolate_, zone_, sizeof...(args), 0, 0); builder.CallRuntime(function_id_, builder.Parameter(0), sizeof...(args)) .Return(); - InterpreterTester tester(isolate_, builder.ToBytecodeArray()); - auto callable = tester.GetCallable<Handle<Object>>(); + InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_)); + auto callable = tester.GetCallable<A...>(); return callable(args...).ToHandleChecked(); } @@ -91,6 +91,203 @@ TEST(IsArray) { CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); } +TEST(IsJSProxy) { + HandleAndZoneScope handles; + + InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), + Runtime::kInlineIsJSProxy); + Factory* factory = handles.main_isolate()->factory(); + + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("new Date()"))); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("(function() {})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("'string'"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); + CHECK_EQ(*factory->true_value(), + *helper.Invoke(helper.NewObject("new Proxy({},{})"))); +} + +TEST(IsRegExp) { + HandleAndZoneScope handles; + + InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), + Runtime::kInlineIsRegExp); + Factory* factory = handles.main_isolate()->factory(); + + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("new Date()"))); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("(function() {})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); + CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("(/x/)"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("'string'"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); +} + +TEST(IsTypedArray) { + HandleAndZoneScope handles; + + InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), + Runtime::kInlineIsTypedArray); + Factory* factory = handles.main_isolate()->factory(); + + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("new Date()"))); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("(function() {})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("'string'"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); + + CHECK_EQ( + *factory->true_value(), + *helper.Invoke(helper.NewObject("new Uint8Array(new ArrayBuffer(1));"))); + CHECK_EQ( + *factory->true_value(), + *helper.Invoke(helper.NewObject("new Uint16Array(new ArrayBuffer(2));"))); + CHECK_EQ( + *factory->true_value(), + *helper.Invoke(helper.NewObject("new Int32Array(new ArrayBuffer(4));"))); +} + +TEST(IsSmi) { + HandleAndZoneScope handles; + + InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), + Runtime::kInlineIsSmi); + Factory* factory = handles.main_isolate()->factory(); + + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("new Date()"))); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("(function() {})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("'string'"))); + CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42.2"))); + CHECK_EQ(*factory->false_value(), + *helper.Invoke(helper.NewObject("4294967297"))); + CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("42"))); +} + +TEST(Call) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + InvokeIntrinsicHelper helper(isolate, handles.main_zone(), + Runtime::kInlineCall); + + CHECK_EQ(Smi::FromInt(20), + *helper.Invoke(helper.NewObject("(function() { return this.x; })"), + helper.NewObject("({ x: 20 })"))); + CHECK_EQ(Smi::FromInt(50), + *helper.Invoke(helper.NewObject("(function(arg1) { return arg1; })"), + factory->undefined_value(), + handle(Smi::FromInt(50), isolate))); + CHECK_EQ( + Smi::FromInt(20), + *helper.Invoke( + helper.NewObject("(function(a, b, c) { return a + b + c; })"), + factory->undefined_value(), handle(Smi::FromInt(10), isolate), + handle(Smi::FromInt(7), isolate), handle(Smi::FromInt(3), isolate))); +} + +TEST(IntrinsicAsStubCall) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + InvokeIntrinsicHelper to_number_helper(isolate, handles.main_zone(), + Runtime::kInlineToNumber); + CHECK_EQ(Smi::FromInt(46), + *to_number_helper.Invoke(to_number_helper.NewObject("'46'"))); + + InvokeIntrinsicHelper to_integer_helper(isolate, handles.main_zone(), + Runtime::kInlineToInteger); + CHECK_EQ(Smi::FromInt(502), + *to_integer_helper.Invoke(to_integer_helper.NewObject("502.67"))); + + InvokeIntrinsicHelper has_property_helper(isolate, handles.main_zone(), + Runtime::kInlineHasProperty); + CHECK_EQ(*factory->true_value(), + *has_property_helper.Invoke( + has_property_helper.NewObject("'x'"), + has_property_helper.NewObject("({ x: 20 })"))); + CHECK_EQ(*factory->false_value(), + *has_property_helper.Invoke( + has_property_helper.NewObject("'y'"), + has_property_helper.NewObject("({ x: 20 })"))); + + InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(), + Runtime::kInlineSubString); + CHECK(sub_string_helper + .Invoke(sub_string_helper.NewObject("'foobar'"), + sub_string_helper.NewObject("3"), + sub_string_helper.NewObject("6")) + ->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(); + Factory* factory = isolate->factory(); + InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), + Runtime::kInlineClassOf); + CHECK_EQ(*helper.Invoke(helper.NewObject("123")), *factory->null_value()); + CHECK_EQ(*helper.Invoke(helper.NewObject("'true'")), *factory->null_value()); + CHECK_EQ(*helper.Invoke(helper.NewObject("'foo'")), *factory->null_value()); + CHECK(helper.Invoke(helper.NewObject("({a:1})")) + ->SameValue(*helper.NewObject("'Object'"))); + CHECK(helper.Invoke(helper.NewObject("(function foo() {})")) + ->SameValue(*helper.NewObject("'Function'"))); + CHECK(helper.Invoke(helper.NewObject("new Date()")) + ->SameValue(*helper.NewObject("'Date'"))); + CHECK(helper.Invoke(helper.NewObject("new Set")) + ->SameValue(*helper.NewObject("'Set'"))); + CHECK(helper.Invoke(helper.NewObject("/x/")) + ->SameValue(*helper.NewObject("'RegExp'"))); +} + } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index c8dc776010..9572a2d731 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -8,6 +8,7 @@ #include "src/handles.h" #include "src/interpreter/bytecode-array-builder.h" #include "src/interpreter/bytecode-array-iterator.h" +#include "src/interpreter/bytecode-label.h" #include "src/interpreter/interpreter.h" #include "test/cctest/cctest.h" #include "test/cctest/interpreter/interpreter-tester.h" @@ -20,15 +21,14 @@ namespace interpreter { TEST(InterpreterReturn) { HandleAndZoneScope handles; - Handle<Object> undefined_value = - handles.main_isolate()->factory()->undefined_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> undefined_value = isolate->factory()->undefined_value(); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(undefined_value)); @@ -37,15 +37,14 @@ TEST(InterpreterReturn) { TEST(InterpreterLoadUndefined) { HandleAndZoneScope handles; - Handle<Object> undefined_value = - handles.main_isolate()->factory()->undefined_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> undefined_value = isolate->factory()->undefined_value(); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.LoadUndefined().Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(undefined_value)); @@ -54,14 +53,14 @@ TEST(InterpreterLoadUndefined) { TEST(InterpreterLoadNull) { HandleAndZoneScope handles; - Handle<Object> null_value = handles.main_isolate()->factory()->null_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> null_value = isolate->factory()->null_value(); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.LoadNull().Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(null_value)); @@ -70,15 +69,14 @@ TEST(InterpreterLoadNull) { TEST(InterpreterLoadTheHole) { HandleAndZoneScope handles; - Handle<Object> the_hole_value = - handles.main_isolate()->factory()->the_hole_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> the_hole_value = isolate->factory()->the_hole_value(); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.LoadTheHole().Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(the_hole_value)); @@ -87,14 +85,14 @@ TEST(InterpreterLoadTheHole) { TEST(InterpreterLoadTrue) { HandleAndZoneScope handles; - Handle<Object> true_value = handles.main_isolate()->factory()->true_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> true_value = isolate->factory()->true_value(); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.LoadTrue().Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(true_value)); @@ -103,14 +101,14 @@ TEST(InterpreterLoadTrue) { TEST(InterpreterLoadFalse) { HandleAndZoneScope handles; - Handle<Object> false_value = handles.main_isolate()->factory()->false_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> false_value = isolate->factory()->false_value(); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.LoadFalse().Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(false_value)); @@ -119,16 +117,16 @@ TEST(InterpreterLoadFalse) { TEST(InterpreterLoadLiteral) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // Small Smis. for (int i = -128; i < 128; i++) { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); builder.LoadLiteral(Smi::FromInt(i)).Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(i)); @@ -136,12 +134,12 @@ TEST(InterpreterLoadLiteral) { // Large Smis. { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + builder.LoadLiteral(Smi::FromInt(0x12345678)).Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(0x12345678)); @@ -149,12 +147,12 @@ TEST(InterpreterLoadLiteral) { // Heap numbers. { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + builder.LoadLiteral(factory->NewHeapNumber(-2.1e19)).Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK_EQ(i::HeapNumber::cast(*return_val)->value(), -2.1e19); @@ -162,13 +160,13 @@ TEST(InterpreterLoadLiteral) { // Strings. { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + Handle<i::String> string = factory->NewStringFromAsciiChecked("String"); builder.LoadLiteral(string).Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(i::String::cast(*return_val)->Equals(*string)); @@ -178,19 +176,20 @@ TEST(InterpreterLoadLiteral) { TEST(InterpreterLoadStoreRegisters) { HandleAndZoneScope handles; - Handle<Object> true_value = handles.main_isolate()->factory()->true_value(); + Isolate* isolate = handles.main_isolate(); + Handle<Object> true_value = isolate->factory()->true_value(); for (int i = 0; i <= kMaxInt8; i++) { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, i + 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, i + 1); + Register reg(i); builder.LoadTrue() .StoreAccumulatorInRegister(reg) .LoadFalse() .LoadAccumulatorWithRegister(reg) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(true_value)); @@ -262,20 +261,27 @@ TEST(InterpreterShiftOpsSmi) { for (size_t r = 0; r < arraysize(rhs_inputs); r++) { for (size_t o = 0; o < arraysize(kShiftOperators); o++) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 1, 0, 1); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0); int lhs = lhs_inputs[l]; int rhs = rhs_inputs[r]; builder.LoadLiteral(Smi::FromInt(lhs)) .StoreAccumulatorInRegister(reg) .LoadLiteral(Smi::FromInt(rhs)) - .BinaryOperation(kShiftOperators[o], reg) + .BinaryOperation(kShiftOperators[o], reg, vector->GetIndex(slot)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); Handle<Object> expected_value = @@ -294,20 +300,28 @@ TEST(InterpreterBinaryOpsSmi) { for (size_t r = 0; r < arraysize(rhs_inputs); r++) { for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 1, 0, 1); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0); int lhs = lhs_inputs[l]; int rhs = rhs_inputs[r]; builder.LoadLiteral(Smi::FromInt(lhs)) .StoreAccumulatorInRegister(reg) .LoadLiteral(Smi::FromInt(rhs)) - .BinaryOperation(kArithmeticOperators[o], reg) + .BinaryOperation(kArithmeticOperators[o], reg, + vector->GetIndex(slot)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); Handle<Object> expected_value = @@ -327,20 +341,28 @@ TEST(InterpreterBinaryOpsHeapNumber) { for (size_t r = 0; r < arraysize(rhs_inputs); r++) { for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 1, 0, 1); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0); double lhs = lhs_inputs[l]; double rhs = rhs_inputs[r]; builder.LoadLiteral(factory->NewNumber(lhs)) .StoreAccumulatorInRegister(reg) .LoadLiteral(factory->NewNumber(rhs)) - .BinaryOperation(kArithmeticOperators[o], reg) + .BinaryOperation(kArithmeticOperators[o], reg, + vector->GetIndex(slot)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); Handle<Object> expected_value = @@ -354,7 +376,9 @@ TEST(InterpreterBinaryOpsHeapNumber) { TEST(InterpreterStringAdd) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); struct TestCase { Handle<Object> lhs; @@ -385,17 +409,21 @@ TEST(InterpreterStringAdd) { }; for (size_t i = 0; i < arraysize(test_cases); i++) { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0); builder.LoadLiteral(test_cases[i].lhs) .StoreAccumulatorInRegister(reg) .LoadLiteral(test_cases[i].rhs) - .BinaryOperation(Token::Value::ADD, reg) + .BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*test_cases[i].expected_value)); @@ -405,16 +433,17 @@ TEST(InterpreterStringAdd) { TEST(InterpreterParameter1) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + Isolate* isolate = handles.main_isolate(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + builder.LoadAccumulatorWithRegister(builder.Parameter(0)).Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<Handle<Object>>(); // Check for heap objects. - Handle<Object> true_value = handles.main_isolate()->factory()->true_value(); + Handle<Object> true_value = isolate->factory()->true_value(); Handle<Object> return_val = callable(true_value).ToHandleChecked(); CHECK(return_val.is_identical_to(true_value)); @@ -427,20 +456,41 @@ TEST(InterpreterParameter1) { TEST(InterpreterParameter8) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 8, - 0, 0); + Isolate* isolate = handles.main_isolate(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot5 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot6 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + builder.LoadAccumulatorWithRegister(builder.Parameter(0)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(1)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(2)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(3)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(4)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(5)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(6)) - .BinaryOperation(Token::Value::ADD, builder.Parameter(7)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(1), + vector->GetIndex(slot)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(2), + vector->GetIndex(slot1)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(3), + vector->GetIndex(slot2)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(4), + vector->GetIndex(slot3)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(5), + vector->GetIndex(slot4)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(6), + vector->GetIndex(slot5)) + .BinaryOperation(Token::Value::ADD, builder.Parameter(7), + vector->GetIndex(slot6)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); typedef Handle<Object> H; auto callable = tester.GetCallable<H, H, H, H, H, H, H, H>(); @@ -459,18 +509,401 @@ TEST(InterpreterParameter8) { CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(36)); } +TEST(InterpreterBinaryOpTypeFeedback) { + HandleAndZoneScope handles; + i::Isolate* isolate = handles.main_isolate(); + i::Zone zone(isolate->allocator()); + + struct BinaryOpExpectation { + Token::Value op; + Handle<Object> arg1; + Handle<Object> 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), + Handle<Smi>(Smi::FromInt(5), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::ADD, Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate), + Handle<Smi>(Smi::FromInt(1), isolate), + isolate->factory()->NewHeapNumber(Smi::kMaxValue + 1.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::ADD, isolate->factory()->NewHeapNumber(3.1415), + Handle<Smi>(Smi::FromInt(3), isolate), + isolate->factory()->NewHeapNumber(3.1415 + 3), + BinaryOperationFeedback::kNumber}, + {Token::Value::ADD, isolate->factory()->NewHeapNumber(3.1415), + isolate->factory()->NewHeapNumber(1.4142), + isolate->factory()->NewHeapNumber(3.1415 + 1.4142), + BinaryOperationFeedback::kNumber}, + {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), + isolate->factory()->NewStringFromAsciiChecked("2"), + isolate->factory()->NewStringFromAsciiChecked("22"), + BinaryOperationFeedback::kAny}, + // SUB + {Token::Value::SUB, Handle<Smi>(Smi::FromInt(2), isolate), + Handle<Smi>(Smi::FromInt(3), isolate), + Handle<Smi>(Smi::FromInt(-1), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::SUB, Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate), + Handle<Smi>(Smi::FromInt(1), isolate), + isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::SUB, isolate->factory()->NewHeapNumber(3.1415), + Handle<Smi>(Smi::FromInt(3), isolate), + isolate->factory()->NewHeapNumber(3.1415 - 3), + BinaryOperationFeedback::kNumber}, + {Token::Value::SUB, isolate->factory()->NewHeapNumber(3.1415), + isolate->factory()->NewHeapNumber(1.4142), + isolate->factory()->NewHeapNumber(3.1415 - 1.4142), + BinaryOperationFeedback::kNumber}, + {Token::Value::SUB, Handle<Smi>(Smi::FromInt(2), isolate), + isolate->factory()->NewStringFromAsciiChecked("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), + Handle<Smi>(Smi::FromInt(6), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::MUL, Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate), + Handle<Smi>(Smi::FromInt(2), isolate), + isolate->factory()->NewHeapNumber(Smi::kMinValue * 2.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::MUL, isolate->factory()->NewHeapNumber(3.1415), + Handle<Smi>(Smi::FromInt(3), isolate), + isolate->factory()->NewHeapNumber(3 * 3.1415), + BinaryOperationFeedback::kNumber}, + {Token::Value::MUL, isolate->factory()->NewHeapNumber(3.1415), + isolate->factory()->NewHeapNumber(1.4142), + isolate->factory()->NewHeapNumber(3.1415 * 1.4142), + BinaryOperationFeedback::kNumber}, + {Token::Value::MUL, Handle<Smi>(Smi::FromInt(2), isolate), + isolate->factory()->NewStringFromAsciiChecked("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), + Handle<Smi>(Smi::FromInt(2), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::DIV, Handle<Smi>(Smi::FromInt(3), isolate), + Handle<Smi>(Smi::FromInt(2), isolate), + isolate->factory()->NewHeapNumber(3.0 / 2.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::DIV, isolate->factory()->NewHeapNumber(3.1415), + Handle<Smi>(Smi::FromInt(3), isolate), + isolate->factory()->NewHeapNumber(3.1415 / 3), + BinaryOperationFeedback::kNumber}, + {Token::Value::DIV, isolate->factory()->NewHeapNumber(3.1415), + isolate->factory()->NewHeapNumber( + -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"), + Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny}, + // MOD + {Token::Value::MOD, Handle<Smi>(Smi::FromInt(5), isolate), + Handle<Smi>(Smi::FromInt(3), isolate), + Handle<Smi>(Smi::FromInt(2), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::MOD, Handle<Smi>(Smi::FromInt(-4), isolate), + Handle<Smi>(Smi::FromInt(2), isolate), + isolate->factory()->NewHeapNumber(-0.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::MOD, isolate->factory()->NewHeapNumber(3.1415), + Handle<Smi>(Smi::FromInt(3), isolate), + isolate->factory()->NewHeapNumber(fmod(3.1415, 3.0)), + BinaryOperationFeedback::kNumber}, + {Token::Value::MOD, isolate->factory()->NewHeapNumber(-3.1415), + isolate->factory()->NewHeapNumber(-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"), + Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}}; + + for (const BinaryOpExpectation& test_case : kTestCases) { + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + + i::FeedbackVectorSpec feedback_spec(&zone); + i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + i::NewTypeFeedbackVector(isolate, &feedback_spec); + + Register reg(0); + builder.LoadLiteral(test_case.arg1) + .StoreAccumulatorInRegister(reg) + .LoadLiteral(test_case.arg2) + .BinaryOperation(test_case.op, reg, vector->GetIndex(slot0)) + .Return(); + + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + + InterpreterTester tester(isolate, bytecode_array, vector); + auto callable = tester.GetCallable<>(); + + Handle<Object> return_val = callable().ToHandleChecked(); + Object* feedback0 = 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()); + } +} + +TEST(InterpreterBinaryOpSmiTypeFeedback) { + HandleAndZoneScope handles; + i::Isolate* isolate = handles.main_isolate(); + i::Zone zone(isolate->allocator()); + + struct BinaryOpExpectation { + Token::Value op; + Handle<Object> arg1; + int32_t arg2; + Handle<Object> result; + int32_t feedback; + }; + + BinaryOpExpectation const kTestCases[] = { + // ADD + {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), 42, + Handle<Smi>(Smi::FromInt(44), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::ADD, Handle<Smi>(Smi::FromInt(2), isolate), Smi::kMaxValue, + isolate->factory()->NewHeapNumber(Smi::kMaxValue + 2.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::ADD, isolate->factory()->NewHeapNumber(3.1415), 2, + isolate->factory()->NewHeapNumber(3.1415 + 2.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::ADD, isolate->factory()->NewStringFromAsciiChecked("2"), 2, + isolate->factory()->NewStringFromAsciiChecked("22"), + BinaryOperationFeedback::kAny}, + // SUB + {Token::Value::SUB, Handle<Smi>(Smi::FromInt(2), isolate), 42, + Handle<Smi>(Smi::FromInt(-40), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::SUB, Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate), 1, + isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::SUB, isolate->factory()->NewHeapNumber(3.1415), 2, + isolate->factory()->NewHeapNumber(3.1415 - 2.0), + BinaryOperationFeedback::kNumber}, + {Token::Value::SUB, isolate->factory()->NewStringFromAsciiChecked("2"), 2, + Handle<Smi>(Smi::FromInt(0), isolate), BinaryOperationFeedback::kAny}, + // BIT_OR + {Token::Value::BIT_OR, Handle<Smi>(Smi::FromInt(4), isolate), 1, + Handle<Smi>(Smi::FromInt(5), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::BIT_OR, isolate->factory()->NewHeapNumber(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}, + // BIT_AND + {Token::Value::BIT_AND, Handle<Smi>(Smi::FromInt(3), isolate), 1, + Handle<Smi>(Smi::FromInt(1), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::BIT_AND, isolate->factory()->NewHeapNumber(3.1415), 2, + Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kNumber}, + {Token::Value::BIT_AND, + isolate->factory()->NewStringFromAsciiChecked("2"), 1, + Handle<Smi>(Smi::FromInt(0), isolate), BinaryOperationFeedback::kAny}, + // SHL + {Token::Value::SHL, Handle<Smi>(Smi::FromInt(3), isolate), 1, + Handle<Smi>(Smi::FromInt(6), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::SHL, isolate->factory()->NewHeapNumber(3.1415), 2, + Handle<Smi>(Smi::FromInt(12), isolate), + BinaryOperationFeedback::kNumber}, + {Token::Value::SHL, isolate->factory()->NewStringFromAsciiChecked("2"), 1, + Handle<Smi>(Smi::FromInt(4), isolate), BinaryOperationFeedback::kAny}, + // SAR + {Token::Value::SAR, Handle<Smi>(Smi::FromInt(3), isolate), 1, + Handle<Smi>(Smi::FromInt(1), isolate), + BinaryOperationFeedback::kSignedSmall}, + {Token::Value::SAR, isolate->factory()->NewHeapNumber(3.1415), 2, + Handle<Smi>(Smi::FromInt(0), isolate), BinaryOperationFeedback::kNumber}, + {Token::Value::SAR, isolate->factory()->NewStringFromAsciiChecked("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); + + i::FeedbackVectorSpec feedback_spec(&zone); + i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + i::NewTypeFeedbackVector(isolate, &feedback_spec); + + Register reg(0); + builder.LoadLiteral(test_case.arg1) + .StoreAccumulatorInRegister(reg) + .LoadLiteral(Smi::FromInt(test_case.arg2)) + .BinaryOperation(test_case.op, reg, vector->GetIndex(slot0)) + .Return(); + + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + + InterpreterTester tester(isolate, bytecode_array, vector); + auto callable = tester.GetCallable<>(); + + Handle<Object> return_val = callable().ToHandleChecked(); + Object* feedback0 = 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()); + } +} + +TEST(InterpreterUnaryOpFeedback) { + HandleAndZoneScope handles; + i::Isolate* isolate = handles.main_isolate(); + i::Zone zone(isolate->allocator()); + + Handle<Smi> smi_one = Handle<Smi>(Smi::FromInt(1), isolate); + Handle<Smi> smi_max = Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate); + Handle<Smi> smi_min = Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate); + Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(2.1); + Handle<String> str = isolate->factory()->NewStringFromAsciiChecked("42"); + + struct TestCase { + Token::Value op; + Handle<Smi> smi_feedback_value; + Handle<Smi> smi_to_number_feedback_value; + Handle<HeapNumber> number_feedback_value; + Handle<Object> any_feedback_value; + }; + TestCase const kTestCases[] = { + {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); + + i::FeedbackVectorSpec feedback_spec(&zone); + i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + i::NewTypeFeedbackVector(isolate, &feedback_spec); + + builder.LoadAccumulatorWithRegister(builder.Parameter(0)) + .CountOperation(test_case.op, vector->GetIndex(slot0)) + .LoadAccumulatorWithRegister(builder.Parameter(1)) + .CountOperation(test_case.op, vector->GetIndex(slot1)) + .LoadAccumulatorWithRegister(builder.Parameter(2)) + .CountOperation(test_case.op, vector->GetIndex(slot2)) + .LoadAccumulatorWithRegister(builder.Parameter(3)) + .CountOperation(test_case.op, vector->GetIndex(slot3)) + .Return(); + + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + + InterpreterTester tester(isolate, bytecode_array, vector); + typedef Handle<Object> H; + auto callable = tester.GetCallable<H, H, H, H>(); + + Handle<Object> return_val = + callable(test_case.smi_feedback_value, + test_case.smi_to_number_feedback_value, + test_case.number_feedback_value, test_case.any_feedback_value) + .ToHandleChecked(); + USE(return_val); + Object* feedback0 = vector->Get(slot0); + CHECK(feedback0->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kSignedSmall, + static_cast<Smi*>(feedback0)->value()); + + Object* feedback1 = vector->Get(slot1); + CHECK(feedback1->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kNumber, + static_cast<Smi*>(feedback1)->value()); + + Object* feedback2 = vector->Get(slot2); + CHECK(feedback2->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kNumber, + static_cast<Smi*>(feedback2)->value()); + + Object* feedback3 = vector->Get(slot3); + CHECK(feedback3->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kAny, + static_cast<Smi*>(feedback3)->value()); + } +} + +TEST(InterpreterBitwiseTypeFeedback) { + HandleAndZoneScope handles; + i::Isolate* isolate = handles.main_isolate(); + i::Zone zone(isolate->allocator()); + 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); + + i::FeedbackVectorSpec feedback_spec(&zone); + i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + i::NewTypeFeedbackVector(isolate, &feedback_spec); + + builder.LoadAccumulatorWithRegister(builder.Parameter(0)) + .BinaryOperation(op, builder.Parameter(1), vector->GetIndex(slot0)) + .BinaryOperation(op, builder.Parameter(2), vector->GetIndex(slot1)) + .BinaryOperation(op, builder.Parameter(3), vector->GetIndex(slot2)) + .Return(); + + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + + InterpreterTester tester(isolate, bytecode_array, vector); + typedef Handle<Object> H; + auto callable = tester.GetCallable<H, H, H, H>(); + + Handle<Smi> arg1 = Handle<Smi>(Smi::FromInt(2), isolate); + Handle<Smi> arg2 = Handle<Smi>(Smi::FromInt(2), isolate); + Handle<HeapNumber> arg3 = isolate->factory()->NewHeapNumber(2.2); + Handle<String> arg4 = isolate->factory()->NewStringFromAsciiChecked("2"); + + Handle<Object> return_val = + callable(arg1, arg2, arg3, arg4).ToHandleChecked(); + USE(return_val); + Object* feedback0 = vector->Get(slot0); + CHECK(feedback0->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kSignedSmall, + static_cast<Smi*>(feedback0)->value()); + + Object* feedback1 = vector->Get(slot1); + CHECK(feedback1->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kNumber, + static_cast<Smi*>(feedback1)->value()); + + Object* feedback2 = vector->Get(slot2); + CHECK(feedback2->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kAny, + static_cast<Smi*>(feedback2)->value()); + } +} TEST(InterpreterParameter1Assign) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + Isolate* isolate = handles.main_isolate(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + builder.LoadLiteral(Smi::FromInt(5)) .StoreAccumulatorInRegister(builder.Parameter(0)) .LoadAccumulatorWithRegister(builder.Parameter(0)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_val = @@ -482,6 +915,7 @@ TEST(InterpreterParameter1Assign) { TEST(InterpreterLoadGlobal) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); // Test loading a global. std::string source( @@ -489,7 +923,7 @@ TEST(InterpreterLoadGlobal) { "function " + InterpreterTester::function_name() + "() {\n" " return global;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -499,8 +933,8 @@ TEST(InterpreterLoadGlobal) { TEST(InterpreterStoreGlobal) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // Test storing to a global. std::string source( @@ -508,7 +942,7 @@ TEST(InterpreterStoreGlobal) { "function " + InterpreterTester::function_name() + "() {\n" " global = 999;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); callable().ToHandleChecked(); @@ -521,6 +955,7 @@ TEST(InterpreterStoreGlobal) { TEST(InterpreterCallGlobal) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); // Test calling a global function. std::string source( @@ -528,7 +963,7 @@ TEST(InterpreterCallGlobal) { "function " + InterpreterTester::function_name() + "() {\n" " return g_add(5, 10);\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -538,6 +973,7 @@ TEST(InterpreterCallGlobal) { TEST(InterpreterLoadUnallocated) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); // Test loading an unallocated global. std::string source( @@ -545,7 +981,7 @@ TEST(InterpreterLoadUnallocated) { "function " + InterpreterTester::function_name() + "() {\n" " return unallocated;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -555,8 +991,8 @@ TEST(InterpreterLoadUnallocated) { TEST(InterpreterStoreUnallocated) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // Test storing to an unallocated global. std::string source( @@ -564,7 +1000,7 @@ TEST(InterpreterStoreUnallocated) { "function " + InterpreterTester::function_name() + "() {\n" " unallocated = 999;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); callable().ToHandleChecked(); @@ -577,26 +1013,26 @@ TEST(InterpreterStoreUnallocated) { TEST(InterpreterLoadNamedProperty) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); - i::Zone zone(isolate->allocator()); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); Handle<i::TypeFeedbackVector> vector = - i::NewTypeFeedbackVector(isolate, &feedback_spec); + NewTypeFeedbackVector(isolate, &feedback_spec); Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); name = factory->string_table()->LookupString(isolate, name); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + builder.LoadNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); @@ -630,27 +1066,27 @@ TEST(InterpreterLoadNamedProperty) { TEST(InterpreterLoadKeyedProperty) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); - i::Zone zone(isolate->allocator()); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); Handle<i::TypeFeedbackVector> vector = - i::NewTypeFeedbackVector(isolate, &feedback_spec); + NewTypeFeedbackVector(isolate, &feedback_spec); Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); key = factory->string_table()->LookupString(isolate, key); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + builder.LoadLiteral(key) .LoadKeyedProperty(builder.Parameter(0), vector->GetIndex(slot)) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject("({ key : 123 })"); @@ -672,26 +1108,26 @@ TEST(InterpreterLoadKeyedProperty) { TEST(InterpreterStoreNamedProperty) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); - i::Zone zone(isolate->allocator()); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); Handle<i::TypeFeedbackVector> vector = - i::NewTypeFeedbackVector(isolate, &feedback_spec); + NewTypeFeedbackVector(isolate, &feedback_spec); Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); name = factory->string_table()->LookupString(isolate, name); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); + builder.LoadLiteral(Smi::FromInt(999)) .StoreNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot), - i::STRICT) + STRICT) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); @@ -731,28 +1167,28 @@ TEST(InterpreterStoreNamedProperty) { TEST(InterpreterStoreKeyedProperty) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); - i::Zone zone(isolate->allocator()); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); Handle<i::TypeFeedbackVector> vector = - i::NewTypeFeedbackVector(isolate, &feedback_spec); + NewTypeFeedbackVector(isolate, &feedback_spec); Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); name = factory->string_table()->LookupString(isolate, name); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + builder.LoadLiteral(name) .StoreAccumulatorInRegister(Register(0)) .LoadLiteral(Smi::FromInt(999)) .StoreKeyedProperty(builder.Parameter(0), Register(0), vector->GetIndex(slot), i::SLOPPY) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); @@ -778,31 +1214,37 @@ TEST(InterpreterStoreKeyedProperty) { static void TestInterpreterCall(TailCallMode tail_call_mode) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); - i::Zone zone(isolate->allocator()); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); - i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); + FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); Handle<i::TypeFeedbackVector> vector = - i::NewTypeFeedbackVector(isolate, &feedback_spec); + NewTypeFeedbackVector(isolate, &feedback_spec); int slot_index = vector->GetIndex(slot); + int call_slot_index = -1; + call_slot_index = vector->GetIndex(call_slot); Handle<i::String> name = factory->NewStringFromAsciiChecked("func"); name = factory->string_table()->LookupString(isolate, name); // Check with no args. { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) - .StoreAccumulatorInRegister(Register(0)) - .Call(Register(0), builder.Parameter(0), 1, 0, tail_call_mode) - .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + .StoreAccumulatorInRegister(Register(0)); + + builder.Call(Register(0), builder.Parameter(0), 1, call_slot_index, + tail_call_mode); - InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); + builder.Return(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -813,15 +1255,16 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check that receiver is passed properly. { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); + builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) - .StoreAccumulatorInRegister(Register(0)) - .Call(Register(0), builder.Parameter(0), 1, 0, tail_call_mode) - .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + .StoreAccumulatorInRegister(Register(0)); + builder.Call(Register(0), builder.Parameter(0), 1, call_slot_index, + tail_call_mode); + builder.Return(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -835,8 +1278,8 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with two parameters (+ receiver). { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 4); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 4); + builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) .StoreAccumulatorInRegister(Register(0)) .LoadAccumulatorWithRegister(builder.Parameter(0)) @@ -844,12 +1287,15 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .LoadLiteral(Smi::FromInt(51)) .StoreAccumulatorInRegister(Register(2)) .LoadLiteral(Smi::FromInt(11)) - .StoreAccumulatorInRegister(Register(3)) - .Call(Register(0), Register(1), 3, 0, tail_call_mode) - .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + .StoreAccumulatorInRegister(Register(3)); + + builder.Call(Register(0), Register(1), 3, call_slot_index, tail_call_mode); + + builder.Return(); + + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -862,8 +1308,8 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with 10 parameters (+ receiver). { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 12); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 12); + builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) .StoreAccumulatorInRegister(Register(0)) .LoadAccumulatorWithRegister(builder.Parameter(0)) @@ -887,12 +1333,15 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .LoadLiteral(factory->NewStringFromAsciiChecked("i")) .StoreAccumulatorInRegister(Register(10)) .LoadLiteral(factory->NewStringFromAsciiChecked("j")) - .StoreAccumulatorInRegister(Register(11)) - .Call(Register(0), Register(1), 11, 0, tail_call_mode) - .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + .StoreAccumulatorInRegister(Register(11)); + + builder.Call(Register(0), Register(1), 11, call_slot_index, tail_call_mode); + + builder.Return(); + + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> object = InterpreterTester::NewObject( @@ -922,13 +1371,13 @@ static BytecodeArrayBuilder& SetRegister(BytecodeArrayBuilder& builder, .LoadAccumulatorWithRegister(scratch); } - static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder, Register reg, int value, - Register scratch) { + Register scratch, + int slot_index) { return builder.StoreAccumulatorInRegister(scratch) .LoadLiteral(Smi::FromInt(value)) - .BinaryOperation(Token::Value::ADD, reg) + .BinaryOperation(Token::Value::ADD, reg, slot_index) .StoreAccumulatorInRegister(reg) .LoadAccumulatorWithRegister(scratch); } @@ -936,8 +1385,18 @@ static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder, TEST(InterpreterJumps) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, - 0, 2); + Isolate* isolate = handles.main_isolate(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0), scratch(1); BytecodeLabel label[3]; @@ -945,16 +1404,18 @@ TEST(InterpreterJumps) { .StoreAccumulatorInRegister(reg) .Jump(&label[1]); SetRegister(builder, reg, 1024, scratch).Bind(&label[0]); - IncrementRegister(builder, reg, 1, scratch).Jump(&label[2]); + IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot)) + .Jump(&label[2]); SetRegister(builder, reg, 2048, scratch).Bind(&label[1]); - IncrementRegister(builder, reg, 2, scratch).Jump(&label[0]); + IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot1)) + .Jump(&label[0]); SetRegister(builder, reg, 4096, scratch).Bind(&label[2]); - IncrementRegister(builder, reg, 4, scratch) + IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot2)) .LoadAccumulatorWithRegister(reg) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 7); @@ -963,8 +1424,20 @@ TEST(InterpreterJumps) { TEST(InterpreterConditionalJumps) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, - 0, 2); + Isolate* isolate = handles.main_isolate(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0), scratch(1); BytecodeLabel label[2]; BytecodeLabel done, done1; @@ -973,21 +1446,26 @@ TEST(InterpreterConditionalJumps) { .StoreAccumulatorInRegister(reg) .LoadFalse() .JumpIfFalse(&label[0]); - IncrementRegister(builder, reg, 1024, scratch) + IncrementRegister(builder, reg, 1024, scratch, vector->GetIndex(slot)) .Bind(&label[0]) .LoadTrue() .JumpIfFalse(&done); - IncrementRegister(builder, reg, 1, scratch).LoadTrue().JumpIfTrue(&label[1]); - IncrementRegister(builder, reg, 2048, scratch).Bind(&label[1]); - IncrementRegister(builder, reg, 2, scratch).LoadFalse().JumpIfTrue(&done1); - IncrementRegister(builder, reg, 4, scratch) + IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot1)) + .LoadTrue() + .JumpIfTrue(&label[1]); + IncrementRegister(builder, reg, 2048, scratch, vector->GetIndex(slot2)) + .Bind(&label[1]); + IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot3)) + .LoadFalse() + .JumpIfTrue(&done1); + IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot4)) .LoadAccumulatorWithRegister(reg) .Bind(&done) .Bind(&done1) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 7); @@ -996,8 +1474,20 @@ TEST(InterpreterConditionalJumps) { TEST(InterpreterConditionalJumps2) { // TODO(oth): Add tests for all conditional jumps near and far. HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, - 0, 2); + Isolate* isolate = handles.main_isolate(); + Zone zone(isolate->allocator()); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); + + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0), scratch(1); BytecodeLabel label[2]; BytecodeLabel done, done1; @@ -1006,21 +1496,26 @@ TEST(InterpreterConditionalJumps2) { .StoreAccumulatorInRegister(reg) .LoadFalse() .JumpIfFalse(&label[0]); - IncrementRegister(builder, reg, 1024, scratch) + IncrementRegister(builder, reg, 1024, scratch, vector->GetIndex(slot)) .Bind(&label[0]) .LoadTrue() .JumpIfFalse(&done); - IncrementRegister(builder, reg, 1, scratch).LoadTrue().JumpIfTrue(&label[1]); - IncrementRegister(builder, reg, 2048, scratch).Bind(&label[1]); - IncrementRegister(builder, reg, 2, scratch).LoadFalse().JumpIfTrue(&done1); - IncrementRegister(builder, reg, 4, scratch) + IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot1)) + .LoadTrue() + .JumpIfTrue(&label[1]); + IncrementRegister(builder, reg, 2048, scratch, vector->GetIndex(slot2)) + .Bind(&label[1]); + IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot3)) + .LoadFalse() + .JumpIfTrue(&done1); + IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot4)) .LoadAccumulatorWithRegister(reg) .Bind(&done) .Bind(&done1) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 7); @@ -1028,25 +1523,35 @@ TEST(InterpreterConditionalJumps2) { TEST(InterpreterJumpConstantWith16BitOperand) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 257); + Isolate* isolate = handles.main_isolate(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 257); + + Zone zone(isolate->allocator()); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register reg(0), scratch(256); - BytecodeLabel done; + BytecodeLabel done, fake; builder.LoadLiteral(Smi::FromInt(0)); builder.StoreAccumulatorInRegister(reg); // Consume all 8-bit operands for (int i = 1; i <= 256; i++) { - builder.LoadLiteral(handles.main_isolate()->factory()->NewNumber(i)); - builder.BinaryOperation(Token::Value::ADD, reg); + builder.LoadLiteral(isolate->factory()->NewNumber(i)); + builder.BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot)); builder.StoreAccumulatorInRegister(reg); } builder.Jump(&done); // Emit more than 16-bit immediate operands worth of code to jump over. + builder.Bind(&fake); for (int i = 0; i < 6600; i++) { builder.LoadLiteral(Smi::FromInt(0)); // 1-byte - builder.BinaryOperation(Token::Value::ADD, scratch); // 4-bytes + builder.BinaryOperation(Token::Value::ADD, scratch, + vector->GetIndex(slot)); // 6-bytes builder.StoreAccumulatorInRegister(scratch); // 4-bytes builder.MoveRegister(scratch, reg); // 6-bytes } @@ -1054,7 +1559,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { builder.LoadAccumulatorWithRegister(reg); builder.Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); BytecodeArrayIterator iterator(bytecode_array); bool found_16bit_constant_jump = false; @@ -1068,7 +1573,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { } CHECK(found_16bit_constant_jump); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 256.0 / 2 * (1 + 256)); @@ -1076,8 +1581,8 @@ TEST(InterpreterJumpConstantWith16BitOperand) { TEST(InterpreterJumpWith32BitOperand) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 1); + Isolate* isolate = handles.main_isolate(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); Register reg(0); BytecodeLabel done; @@ -1085,14 +1590,14 @@ TEST(InterpreterJumpWith32BitOperand) { builder.StoreAccumulatorInRegister(reg); // Consume all 16-bit constant pool entries for (int i = 1; i <= 65536; i++) { - builder.LoadLiteral(handles.main_isolate()->factory()->NewNumber(i)); + builder.LoadLiteral(isolate->factory()->NewNumber(i)); } builder.Jump(&done); builder.LoadLiteral(Smi::FromInt(0)); builder.Bind(&done); builder.Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); BytecodeArrayIterator iterator(bytecode_array); bool found_32bit_jump = false; @@ -1106,7 +1611,7 @@ TEST(InterpreterJumpWith32BitOperand) { } CHECK(found_32bit_jump); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK_EQ(Smi::cast(*return_value)->value(), 65536.0); @@ -1165,8 +1670,9 @@ TEST(InterpreterSmiComparisons) { for (size_t i = 0; i < arraysize(inputs); i++) { for (size_t j = 0; j < arraysize(inputs); j++) { HandleAndZoneScope handles; - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 0, 0, 1); + Isolate* isolate = handles.main_isolate(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Register r0(0); builder.LoadLiteral(Smi::FromInt(inputs[i])) .StoreAccumulatorInRegister(r0) @@ -1174,8 +1680,8 @@ TEST(InterpreterSmiComparisons) { .CompareOperation(comparison, r0) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1200,9 +1706,10 @@ TEST(InterpreterHeapNumberComparisons) { for (size_t i = 0; i < arraysize(inputs); i++) { for (size_t j = 0; j < arraysize(inputs); j++) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 0, 0, 1); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Register r0(0); builder.LoadLiteral(factory->NewHeapNumber(inputs[i])) .StoreAccumulatorInRegister(r0) @@ -1210,8 +1717,8 @@ TEST(InterpreterHeapNumberComparisons) { .CompareOperation(comparison, r0) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1224,18 +1731,20 @@ TEST(InterpreterHeapNumberComparisons) { TEST(InterpreterStringComparisons) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; 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++) { + CanonicalHandleScope canonical(isolate); const char* lhs = inputs[i].c_str(); const char* rhs = inputs[j].c_str(); - HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 0, 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); Register r0(0); builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs)) .StoreAccumulatorInRegister(r0) @@ -1243,8 +1752,8 @@ TEST(InterpreterStringComparisons) { .CompareOperation(comparison, r0) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1263,7 +1772,7 @@ TEST(InterpreterMixedComparisons) { // performed. const char* inputs[] = {"-1.77", "-40.333", "0.01", "55.77e5", "2.01"}; - i::UnicodeCache unicode_cache; + UnicodeCache unicode_cache; for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { Token::Value comparison = kComparisonTypes[c]; @@ -1273,13 +1782,14 @@ TEST(InterpreterMixedComparisons) { const char* lhs_cstr = inputs[i]; const char* rhs_cstr = inputs[j]; double lhs = StringToDouble(&unicode_cache, lhs_cstr, - i::ConversionFlags::NO_FLAGS); + ConversionFlags::NO_FLAGS); double rhs = StringToDouble(&unicode_cache, rhs_cstr, - i::ConversionFlags::NO_FLAGS); + ConversionFlags::NO_FLAGS); HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); - BytecodeArrayBuilder builder(handles.main_isolate(), - handles.main_zone(), 0, 0, 1); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Register r0(0); if (pass == 0) { // Comparison with HeapNumber on the lhs and String on the rhs @@ -1297,8 +1807,9 @@ TEST(InterpreterMixedComparisons) { .Return(); } - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = + builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1312,24 +1823,25 @@ TEST(InterpreterMixedComparisons) { TEST(InterpreterStrictNotEqual) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); const char* code_snippet = "function f(lhs, rhs) {\n" " return lhs !== rhs;\n" "}\n" "f(0, 0);\n"; - InterpreterTester tester(handles.main_isolate(), code_snippet); + InterpreterTester tester(isolate, code_snippet); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); // Test passing different types. const char* inputs[] = {"-1.77", "-40.333", "0.01", "55.77e5", "2.01"}; - i::UnicodeCache unicode_cache; + UnicodeCache unicode_cache; for (size_t i = 0; i < arraysize(inputs); i++) { for (size_t j = 0; j < arraysize(inputs); j++) { - double lhs = StringToDouble(&unicode_cache, inputs[i], - i::ConversionFlags::NO_FLAGS); - double rhs = StringToDouble(&unicode_cache, inputs[j], - i::ConversionFlags::NO_FLAGS); + double lhs = + StringToDouble(&unicode_cache, inputs[i], ConversionFlags::NO_FLAGS); + double rhs = + StringToDouble(&unicode_cache, inputs[j], ConversionFlags::NO_FLAGS); Handle<Object> lhs_obj = factory->NewNumber(lhs); Handle<Object> rhs_obj = factory->NewStringFromAsciiChecked(inputs[j]); @@ -1383,12 +1895,8 @@ TEST(InterpreterStrictNotEqual) { TEST(InterpreterInstanceOf) { HandleAndZoneScope handles; - // TODO(4447): The new ES6 'instanceof' operator is fully desugared in the - // parser and the Token::INSTANCEOF is not needed anymore. This test only - // makes sense with --no-harmony-instanceof and can be removed once we - // deprecate the ability to switch to old skool ES5 'instanceof' for good. - FLAG_harmony_instanceof = false; - i::Factory* factory = handles.main_isolate()->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); Handle<i::String> name = factory->NewStringFromAsciiChecked("cons"); Handle<i::JSFunction> func = factory->NewFunction(name); Handle<i::JSObject> instance = factory->NewJSObject(func); @@ -1396,8 +1904,8 @@ 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(handles.main_isolate(), handles.main_zone(), 0, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Register r0(0); builder.LoadLiteral(cases[i]); builder.StoreAccumulatorInRegister(r0) @@ -1405,8 +1913,8 @@ TEST(InterpreterInstanceOf) { .CompareOperation(Token::Value::INSTANCEOF, r0) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1417,7 +1925,8 @@ TEST(InterpreterInstanceOf) { TEST(InterpreterTestIn) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // Allocate an array Handle<i::JSArray> array = factory->NewJSArray(0, i::ElementsKind::FAST_SMI_ELEMENTS); @@ -1425,8 +1934,8 @@ 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(handles.main_isolate(), handles.main_zone(), 0, - 0, 1); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Register r0(0); builder.LoadLiteral(factory->NewStringFromAsciiChecked(properties[i])) .StoreAccumulatorInRegister(r0) @@ -1434,8 +1943,8 @@ TEST(InterpreterTestIn) { .CompareOperation(Token::Value::IN, r0) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1446,18 +1955,19 @@ TEST(InterpreterTestIn) { TEST(InterpreterUnaryNot) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); for (size_t i = 1; i < 10; i++) { bool expected_value = ((i & 1) == 1); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 0); + Register r0(0); builder.LoadFalse(); for (size_t j = 0; j < i; j++) { builder.LogicalNot(); } builder.Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1492,7 +2002,8 @@ static void LoadAny(BytecodeArrayBuilder* builder, TEST(InterpreterUnaryNotNonBoolean) { HandleAndZoneScope handles; - i::Factory* factory = handles.main_isolate()->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<Handle<Object>, bool> object_type_tuples[] = { std::make_pair(factory->undefined_value(), true), @@ -1509,14 +2020,14 @@ TEST(InterpreterUnaryNotNonBoolean) { }; for (size_t i = 0; i < arraysize(object_type_tuples); i++) { - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, - 0, 0); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 0); + Register r0(0); LoadAny(&builder, factory, object_type_tuples[i].first); builder.LogicalNot(); builder.Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); @@ -1527,6 +2038,7 @@ TEST(InterpreterUnaryNotNonBoolean) { TEST(InterpreterTypeof) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::pair<const char*, const char*> typeof_vals[] = { std::make_pair("return typeof undefined;", "undefined"), @@ -1541,7 +2053,7 @@ TEST(InterpreterTypeof) { for (size_t i = 0; i < arraysize(typeof_vals); i++) { std::string source(InterpreterTester::SourceForBody(typeof_vals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<v8::internal::String> return_value = @@ -1554,18 +2066,19 @@ TEST(InterpreterTypeof) { TEST(InterpreterCallRuntime) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 2); builder.LoadLiteral(Smi::FromInt(15)) .StoreAccumulatorInRegister(Register(0)) .LoadLiteral(Smi::FromInt(40)) .StoreAccumulatorInRegister(Register(1)) .CallRuntime(Runtime::kAdd, Register(0), 2) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -1574,16 +2087,17 @@ TEST(InterpreterCallRuntime) { TEST(InterpreterInvokeIntrinsic) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); - BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, - 0, 2); builder.LoadLiteral(Smi::FromInt(15)) .StoreAccumulatorInRegister(Register(0)) .CallRuntime(Runtime::kInlineIsArray, Register(0), 1) .Return(); - Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(handles.main_isolate(), bytecode_array); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -1593,13 +2107,14 @@ TEST(InterpreterInvokeIntrinsic) { TEST(InterpreterFunctionLiteral) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); // Test calling a function literal. std::string source( "function " + InterpreterTester::function_name() + "(a) {\n" " return (function(x){ return x + 2; })(a);\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<i::Object> return_val = callable( @@ -1610,8 +2125,8 @@ TEST(InterpreterFunctionLiteral) { TEST(InterpreterRegExpLiterals) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> literals[] = { std::make_pair("return /abd/.exec('cccabbdd');\n", @@ -1628,7 +2143,7 @@ TEST(InterpreterRegExpLiterals) { for (size_t i = 0; i < arraysize(literals); i++) { std::string source(InterpreterTester::SourceForBody(literals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1639,8 +2154,8 @@ TEST(InterpreterRegExpLiterals) { TEST(InterpreterArrayLiterals) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> literals[] = { std::make_pair("return [][0];\n", @@ -1659,7 +2174,7 @@ TEST(InterpreterArrayLiterals) { for (size_t i = 0; i < arraysize(literals); i++) { std::string source(InterpreterTester::SourceForBody(literals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1670,8 +2185,8 @@ TEST(InterpreterArrayLiterals) { TEST(InterpreterObjectLiterals) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> literals[] = { std::make_pair("return { }.name;", @@ -1712,7 +2227,7 @@ TEST(InterpreterObjectLiterals) { for (size_t i = 0; i < arraysize(literals); i++) { std::string source(InterpreterTester::SourceForBody(literals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1723,6 +2238,7 @@ TEST(InterpreterObjectLiterals) { TEST(InterpreterConstruct) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::string source( "function counter() { this.count = 0; }\n" @@ -1732,7 +2248,7 @@ TEST(InterpreterConstruct) { " var c = new counter();\n" " return c.count;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -1742,6 +2258,7 @@ TEST(InterpreterConstruct) { TEST(InterpreterConstructWithArgument) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::string source( "function counter(arg0) { this.count = 17; this.x = arg0; }\n" @@ -1751,7 +2268,7 @@ TEST(InterpreterConstructWithArgument) { " var c = new counter(3);\n" " return c.x;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -1761,6 +2278,7 @@ TEST(InterpreterConstructWithArgument) { TEST(InterpreterConstructWithArguments) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::string source( "function counter(arg0, arg1) {\n" @@ -1772,7 +2290,7 @@ TEST(InterpreterConstructWithArguments) { " var c = new counter(3, 5);\n" " return c.count + c.x + c.y;\n" "}"); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); @@ -1782,7 +2300,7 @@ TEST(InterpreterConstructWithArguments) { TEST(InterpreterContextVariables) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::ostringstream unique_vars; for (int i = 0; i < 250; i++) { @@ -1811,7 +2329,7 @@ TEST(InterpreterContextVariables) { for (size_t i = 0; i < arraysize(context_vars); i++) { std::string source( InterpreterTester::SourceForBody(context_vars[i].first.c_str())); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1822,7 +2340,7 @@ TEST(InterpreterContextVariables) { TEST(InterpreterContextParameters) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> context_params[] = { std::make_pair("return (function() { return arg1; })();", @@ -1836,7 +2354,7 @@ TEST(InterpreterContextParameters) { for (size_t i = 0; i < arraysize(context_params); i++) { std::string source = "function " + InterpreterTester::function_name() + "(arg1, arg2, arg3) {" + context_params[i].first + "}"; - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>(); @@ -1851,7 +2369,7 @@ TEST(InterpreterContextParameters) { TEST(InterpreterOuterContextVariables) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> context_vars[] = { std::make_pair("return outerVar * innerArg;", @@ -1873,7 +2391,7 @@ TEST(InterpreterOuterContextVariables) { for (size_t i = 0; i < arraysize(context_vars); i++) { std::string source = header + context_vars[i].first + footer; - InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); + InterpreterTester tester(isolate, source.c_str(), "*"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1884,8 +2402,8 @@ TEST(InterpreterOuterContextVariables) { TEST(InterpreterComma) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> literals[] = { std::make_pair("var a; return 0, a;\n", factory->undefined_value()), @@ -1901,7 +2419,7 @@ TEST(InterpreterComma) { for (size_t i = 0; i < arraysize(literals); i++) { std::string source(InterpreterTester::SourceForBody(literals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1912,8 +2430,8 @@ TEST(InterpreterComma) { TEST(InterpreterLogicalOr) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> literals[] = { std::make_pair("var a, b; return a || b;\n", factory->undefined_value()), @@ -1929,7 +2447,7 @@ TEST(InterpreterLogicalOr) { for (size_t i = 0; i < arraysize(literals); i++) { std::string source(InterpreterTester::SourceForBody(literals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1940,8 +2458,8 @@ TEST(InterpreterLogicalOr) { TEST(InterpreterLogicalAnd) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> literals[] = { std::make_pair("var a, b = 10; return a && b;\n", @@ -1962,7 +2480,7 @@ TEST(InterpreterLogicalAnd) { for (size_t i = 0; i < arraysize(literals); i++) { std::string source(InterpreterTester::SourceForBody(literals[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -1973,7 +2491,7 @@ TEST(InterpreterLogicalAnd) { TEST(InterpreterTryCatch) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> catches[] = { std::make_pair("var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;", @@ -1989,7 +2507,7 @@ TEST(InterpreterTryCatch) { for (size_t i = 0; i < arraysize(catches); i++) { std::string source(InterpreterTester::SourceForBody(catches[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2000,8 +2518,8 @@ TEST(InterpreterTryCatch) { TEST(InterpreterTryFinally) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> finallies[] = { std::make_pair( @@ -2047,7 +2565,7 @@ TEST(InterpreterTryFinally) { for (size_t i = 0; i < arraysize(finallies); i++) { std::string source(InterpreterTester::SourceForBody(finallies[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); tester.GetCallable<>(); Handle<Object> wrapped = v8::Utils::OpenHandle(*CompileRun(try_wrapper)); CHECK(wrapped->SameValue(*finallies[i].second)); @@ -2057,8 +2575,8 @@ TEST(InterpreterTryFinally) { TEST(InterpreterThrow) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> throws[] = { std::make_pair("throw undefined;\n", @@ -2080,7 +2598,7 @@ TEST(InterpreterThrow) { for (size_t i = 0; i < arraysize(throws); i++) { std::string source(InterpreterTester::SourceForBody(throws[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); tester.GetCallable<>(); Handle<Object> thrown_obj = v8::Utils::OpenHandle(*CompileRun(try_wrapper)); CHECK(thrown_obj->SameValue(*throws[i].second)); @@ -2090,8 +2608,8 @@ TEST(InterpreterThrow) { TEST(InterpreterCountOperators) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> count_ops[] = { std::make_pair("var a = 1; return ++a;", @@ -2143,7 +2661,7 @@ TEST(InterpreterCountOperators) { for (size_t i = 0; i < arraysize(count_ops); i++) { std::string source(InterpreterTester::SourceForBody(count_ops[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2154,7 +2672,7 @@ TEST(InterpreterCountOperators) { TEST(InterpreterGlobalCountOperators) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> count_ops[] = { std::make_pair("var global = 100;function f(){ return ++global; }", @@ -2172,7 +2690,7 @@ TEST(InterpreterGlobalCountOperators) { }; for (size_t i = 0; i < arraysize(count_ops); i++) { - InterpreterTester tester(handles.main_isolate(), count_ops[i].first); + InterpreterTester tester(isolate, count_ops[i].first); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2183,8 +2701,8 @@ TEST(InterpreterGlobalCountOperators) { TEST(InterpreterCompoundExpressions) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> compound_expr[] = { std::make_pair("var a = 1; a += 2; return a;", @@ -2203,7 +2721,7 @@ TEST(InterpreterCompoundExpressions) { for (size_t i = 0; i < arraysize(compound_expr); i++) { std::string source( InterpreterTester::SourceForBody(compound_expr[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2214,7 +2732,7 @@ TEST(InterpreterCompoundExpressions) { TEST(InterpreterGlobalCompoundExpressions) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> compound_expr[2] = { std::make_pair("var global = 100;" @@ -2226,7 +2744,7 @@ TEST(InterpreterGlobalCompoundExpressions) { }; for (size_t i = 0; i < arraysize(compound_expr); i++) { - InterpreterTester tester(handles.main_isolate(), compound_expr[i].first); + InterpreterTester tester(isolate, compound_expr[i].first); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2237,8 +2755,8 @@ TEST(InterpreterGlobalCompoundExpressions) { TEST(InterpreterCreateArguments) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, int> create_args[] = { std::make_pair("function f() { return arguments[0]; }", 0), @@ -2259,6 +2777,8 @@ TEST(InterpreterCreateArguments) { std::make_pair("function f(a, b, c, d) {" " 'use strict'; c = b; return arguments[2]; }", 2), + // Check arguments for duplicate parameters in sloppy mode. + std::make_pair("function f(a, a, b) { return arguments[1]; }", 1), // check rest parameters std::make_pair("function f(...restArray) { return restArray[0]; }", 0), std::make_pair("function f(a, ...restArray) { return restArray[0]; }", 1), @@ -2272,7 +2792,7 @@ TEST(InterpreterCreateArguments) { // Test passing no arguments. for (size_t i = 0; i < arraysize(create_args); i++) { - InterpreterTester tester(handles.main_isolate(), create_args[i].first); + InterpreterTester tester(isolate, create_args[i].first); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val.is_identical_to(factory->undefined_value())); @@ -2280,7 +2800,7 @@ TEST(InterpreterCreateArguments) { // Test passing one argument. for (size_t i = 0; i < arraysize(create_args); i++) { - InterpreterTester tester(handles.main_isolate(), create_args[i].first); + InterpreterTester tester(isolate, create_args[i].first); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_val = callable(handle(Smi::FromInt(40), isolate)).ToHandleChecked(); @@ -2299,7 +2819,7 @@ TEST(InterpreterCreateArguments) { handle(Smi::FromInt(80), isolate), }; - InterpreterTester tester(handles.main_isolate(), create_args[i].first); + InterpreterTester tester(isolate, create_args[i].first); auto callable = tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>(); Handle<Object> return_val = @@ -2311,7 +2831,7 @@ TEST(InterpreterCreateArguments) { TEST(InterpreterConditional) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> conditional[] = { std::make_pair("return true ? 2 : 3;", @@ -2334,7 +2854,7 @@ TEST(InterpreterConditional) { for (size_t i = 0; i < arraysize(conditional); i++) { std::string source(InterpreterTester::SourceForBody(conditional[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2345,8 +2865,8 @@ TEST(InterpreterConditional) { TEST(InterpreterDelete) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // Tests for delete for local variables that work both in strict // and sloppy modes @@ -2378,7 +2898,7 @@ TEST(InterpreterDelete) { // Test delete in sloppy mode for (size_t i = 0; i < arraysize(test_delete); i++) { std::string source(InterpreterTester::SourceForBody(test_delete[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2390,7 +2910,7 @@ TEST(InterpreterDelete) { std::string strict_test = "'use strict'; " + std::string(test_delete[i].first); std::string source(InterpreterTester::SourceForBody(strict_test.c_str())); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2401,8 +2921,8 @@ TEST(InterpreterDelete) { TEST(InterpreterDeleteSloppyUnqualifiedIdentifier) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // These tests generate a syntax error for strict mode. We don't // test for it here. @@ -2429,7 +2949,7 @@ TEST(InterpreterDeleteSloppyUnqualifiedIdentifier) { for (size_t i = 0; i < arraysize(test_delete); i++) { std::string source(InterpreterTester::SourceForBody(test_delete[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2440,8 +2960,8 @@ TEST(InterpreterDeleteSloppyUnqualifiedIdentifier) { TEST(InterpreterGlobalDelete) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> test_global_delete[] = { std::make_pair("var a = { x:10, y:'abc', z:30.2 };\n" @@ -2495,8 +3015,7 @@ TEST(InterpreterGlobalDelete) { factory->ToBoolean(true))}; for (size_t i = 0; i < arraysize(test_global_delete); i++) { - InterpreterTester tester(handles.main_isolate(), - test_global_delete[i].first); + InterpreterTester tester(isolate, test_global_delete[i].first); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2507,8 +3026,8 @@ TEST(InterpreterGlobalDelete) { TEST(InterpreterBasicLoops) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> loops[] = { std::make_pair("var a = 10; var b = 1;\n" @@ -2592,7 +3111,7 @@ TEST(InterpreterBasicLoops) { for (size_t i = 0; i < arraysize(loops); i++) { std::string source(InterpreterTester::SourceForBody(loops[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2769,6 +3288,7 @@ TEST(InterpreterForIn) { // used. for (int pass = 0; pass < 2; pass++) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::ostringstream wide_os; if (pass == 1) { for (int i = 0; i < 200; i++) { @@ -2781,7 +3301,7 @@ TEST(InterpreterForIn) { body_os << wide_os.str() << for_in_samples[i].first; std::string body(body_os.str()); std::string function = InterpreterTester::SourceForBody(body.c_str()); - InterpreterTester tester(handles.main_isolate(), function.c_str()); + InterpreterTester tester(isolate, function.c_str()); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK_EQ(Handle<Smi>::cast(return_val)->value(), @@ -2793,8 +3313,8 @@ TEST(InterpreterForIn) { TEST(InterpreterForOf) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> for_of[] = { {"function f() {\n" @@ -2893,7 +3413,7 @@ TEST(InterpreterForOf) { }; for (size_t i = 0; i < arraysize(for_of); i++) { - InterpreterTester tester(handles.main_isolate(), for_of[i].first); + InterpreterTester tester(isolate, for_of[i].first); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); CHECK(return_val->SameValue(*for_of[i].second)); @@ -2903,8 +3423,8 @@ TEST(InterpreterForOf) { TEST(InterpreterSwitch) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> switch_ops[] = { std::make_pair("var a = 1;\n" @@ -2972,7 +3492,7 @@ TEST(InterpreterSwitch) { for (size_t i = 0; i < arraysize(switch_ops); i++) { std::string source(InterpreterTester::SourceForBody(switch_ops[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -2983,8 +3503,8 @@ TEST(InterpreterSwitch) { TEST(InterpreterSloppyThis) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> sloppy_this[] = { std::make_pair("var global_val = 100;\n" @@ -3006,7 +3526,7 @@ TEST(InterpreterSloppyThis) { }; for (size_t i = 0; i < arraysize(sloppy_this); i++) { - InterpreterTester tester(handles.main_isolate(), sloppy_this[i].first); + InterpreterTester tester(isolate, sloppy_this[i].first); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3017,10 +3537,10 @@ TEST(InterpreterSloppyThis) { TEST(InterpreterThisFunction) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); - InterpreterTester tester(handles.main_isolate(), + InterpreterTester tester(isolate, "var f;\n f = function f() { return f.name; }"); auto callable = tester.GetCallable<>(); @@ -3031,13 +3551,12 @@ TEST(InterpreterThisFunction) { TEST(InterpreterNewTarget) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // TODO(rmcilroy): Add tests that we get the original constructor for // superclass constructors once we have class support. - InterpreterTester tester(handles.main_isolate(), - "function f() { this.a = new.target; }"); + InterpreterTester tester(isolate, "function f() { this.a = new.target; }"); auto callable = tester.GetCallable<>(); callable().ToHandleChecked(); @@ -3049,6 +3568,7 @@ TEST(InterpreterNewTarget) { TEST(InterpreterAssignmentInExpressions) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::pair<const char*, int> samples[] = { {"function f() {\n" @@ -3178,7 +3698,7 @@ TEST(InterpreterAssignmentInExpressions) { const int arg_value = 40; for (size_t i = 0; i < arraysize(samples); i++) { - InterpreterTester tester(handles.main_isolate(), samples[i].first); + InterpreterTester tester(isolate, samples[i].first); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> return_val = callable(handle(Smi::FromInt(arg_value), handles.main_isolate())) @@ -3190,8 +3710,8 @@ TEST(InterpreterAssignmentInExpressions) { TEST(InterpreterToName) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> to_name_tests[] = { {"var a = 'val'; var obj = {[a] : 10}; return obj.val;", @@ -3222,7 +3742,7 @@ TEST(InterpreterToName) { for (size_t i = 0; i < arraysize(to_name_tests); i++) { std::string source( InterpreterTester::SourceForBody(to_name_tests[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3233,8 +3753,8 @@ TEST(InterpreterToName) { TEST(TemporaryRegisterAllocation) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> reg_tests[] = { {"function add(a, b, c) {" @@ -3256,7 +3776,7 @@ TEST(TemporaryRegisterAllocation) { }; for (size_t i = 0; i < arraysize(reg_tests); i++) { - InterpreterTester tester(handles.main_isolate(), reg_tests[i].first); + InterpreterTester tester(isolate, reg_tests[i].first); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3267,8 +3787,8 @@ TEST(TemporaryRegisterAllocation) { TEST(InterpreterLookupSlot) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // TODO(mythria): Add more tests when we have support for eval/with. const char* function_prologue = "var f;" @@ -3293,7 +3813,7 @@ TEST(InterpreterLookupSlot) { std::string(lookup_slot[i].first) + std::string(function_epilogue); - InterpreterTester tester(handles.main_isolate(), script.c_str(), "t"); + InterpreterTester tester(isolate, script.c_str(), "t"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3304,7 +3824,7 @@ TEST(InterpreterLookupSlot) { TEST(InterpreterCallLookupSlot) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> call_lookup[] = { {"g = function(){ return 2 }; eval(''); return g();", @@ -3320,7 +3840,7 @@ TEST(InterpreterCallLookupSlot) { for (size_t i = 0; i < arraysize(call_lookup); i++) { std::string source(InterpreterTester::SourceForBody(call_lookup[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3331,8 +3851,8 @@ TEST(InterpreterCallLookupSlot) { TEST(InterpreterLookupSlotWide) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); const char* function_prologue = "var f;" @@ -3364,7 +3884,7 @@ TEST(InterpreterLookupSlotWide) { std::string script = std::string(function_prologue) + lookup_slot[i].first + std::string(function_epilogue); - InterpreterTester tester(handles.main_isolate(), script.c_str(), "t"); + InterpreterTester tester(isolate, script.c_str(), "t"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3375,8 +3895,8 @@ TEST(InterpreterLookupSlotWide) { TEST(InterpreterDeleteLookupSlot) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); // TODO(mythria): Add more tests when we have support for eval/with. const char* function_prologue = "var f;" @@ -3405,7 +3925,7 @@ TEST(InterpreterDeleteLookupSlot) { std::string(delete_lookup_slot[i].first) + std::string(function_epilogue); - InterpreterTester tester(handles.main_isolate(), script.c_str(), "t"); + InterpreterTester tester(isolate, script.c_str(), "t"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3416,10 +3936,10 @@ TEST(InterpreterDeleteLookupSlot) { TEST(JumpWithConstantsAndWideConstants) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); const int kStep = 13; for (int constants = 11; constants < 256 + 3 * kStep; constants += kStep) { - auto isolate = handles.main_isolate(); - auto factory = isolate->factory(); std::ostringstream filler_os; // Generate a string that consumes constant pool entries and // spread out branch distances in script below. @@ -3440,7 +3960,7 @@ TEST(JumpWithConstantsAndWideConstants) { script_os << "}\n"; std::string script(script_os.str()); for (int a = 0; a < 3; a++) { - InterpreterTester tester(handles.main_isolate(), script.c_str()); + InterpreterTester tester(isolate, script.c_str()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> argument = factory->NewNumberFromInt(a); Handle<Object> return_val = callable(argument).ToHandleChecked(); @@ -3453,8 +3973,8 @@ TEST(JumpWithConstantsAndWideConstants) { TEST(InterpreterEval) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> eval[] = { {"return eval('1;');", handle(Smi::FromInt(1), isolate)}, @@ -3492,7 +4012,7 @@ TEST(InterpreterEval) { for (size_t i = 0; i < arraysize(eval); i++) { std::string source(InterpreterTester::SourceForBody(eval[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*eval[i].second)); @@ -3502,7 +4022,7 @@ TEST(InterpreterEval) { TEST(InterpreterEvalParams) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> eval_params[] = { {"var x = 10; return eval('x + p1;');", @@ -3518,7 +4038,7 @@ TEST(InterpreterEvalParams) { for (size_t i = 0; i < arraysize(eval_params); i++) { std::string source = "function " + InterpreterTester::function_name() + "(p1) {" + eval_params[i].first + "}"; - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<Handle<Object>>(); Handle<i::Object> return_value = @@ -3530,8 +4050,8 @@ TEST(InterpreterEvalParams) { TEST(InterpreterEvalGlobal) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> eval_global[] = { {"function add_global() { eval('function test() { z = 33; }; test()'); };" @@ -3546,8 +4066,7 @@ TEST(InterpreterEvalGlobal) { }; for (size_t i = 0; i < arraysize(eval_global); i++) { - InterpreterTester tester(handles.main_isolate(), eval_global[i].first, - "test"); + InterpreterTester tester(isolate, eval_global[i].first, "test"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3558,8 +4077,8 @@ TEST(InterpreterEvalGlobal) { TEST(InterpreterEvalVariableDecl) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> eval_global[] = { {"function f() { eval('var x = 10; x++;'); return x; }", @@ -3597,7 +4116,7 @@ TEST(InterpreterEvalVariableDecl) { }; for (size_t i = 0; i < arraysize(eval_global); i++) { - InterpreterTester tester(handles.main_isolate(), eval_global[i].first, "*"); + InterpreterTester tester(isolate, eval_global[i].first, "*"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3608,7 +4127,7 @@ TEST(InterpreterEvalVariableDecl) { TEST(InterpreterEvalFunctionDecl) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> eval_func_decl[] = { {"function f() {\n" @@ -3621,8 +4140,7 @@ TEST(InterpreterEvalFunctionDecl) { }; for (size_t i = 0; i < arraysize(eval_func_decl); i++) { - InterpreterTester tester(handles.main_isolate(), eval_func_decl[i].first, - "*"); + InterpreterTester tester(isolate, eval_func_decl[i].first, "*"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3632,7 +4150,7 @@ TEST(InterpreterEvalFunctionDecl) { TEST(InterpreterWideRegisterArithmetic) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); static const size_t kMaxRegisterForTest = 150; std::ostringstream os; @@ -3662,7 +4180,7 @@ TEST(InterpreterWideRegisterArithmetic) { os << "}\n"; std::string source = os.str(); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<Handle<Object>>(); for (size_t i = 0; i < kMaxRegisterForTest; i++) { Handle<Object> arg = handle(Smi::FromInt(static_cast<int>(i)), isolate); @@ -3676,6 +4194,9 @@ TEST(InterpreterCallWideRegisters) { static const int kLength = 512; static const int kStartChar = 65; + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + for (int pass = 0; pass < 3; pass += 1) { std::ostringstream os; for (int i = 0; i < pass * 97; i += 1) { @@ -3688,8 +4209,7 @@ TEST(InterpreterCallWideRegisters) { } os << ");"; std::string source = InterpreterTester::SourceForBody(os.str().c_str()); - HandleAndZoneScope handles; - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable(); Handle<Object> return_val = callable().ToHandleChecked(); Handle<String> return_string = Handle<String>::cast(return_val); @@ -3701,10 +4221,10 @@ TEST(InterpreterCallWideRegisters) { } TEST(InterpreterWideParametersPickOne) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); static const int kParameterCount = 130; for (int parameter = 0; parameter < 10; parameter++) { - HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); std::ostringstream os; os << "function " << InterpreterTester::function_name() << "(arg) {\n"; os << " function selector(i"; @@ -3723,7 +4243,7 @@ TEST(InterpreterWideParametersPickOne) { os << "}\n"; std::string source = os.str(); - InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); + InterpreterTester tester(isolate, source.c_str(), "*"); auto callable = tester.GetCallable<Handle<Object>>(); Handle<Object> arg = handle(Smi::FromInt(0xaa55), isolate); Handle<Object> return_value = callable(arg).ToHandleChecked(); @@ -3736,7 +4256,7 @@ TEST(InterpreterWideParametersSummation) { static int kParameterCount = 200; static int kBaseValue = 17000; HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::ostringstream os; os << "function " << InterpreterTester::function_name() << "(arg) {\n"; os << " function summation(i"; @@ -3762,7 +4282,7 @@ TEST(InterpreterWideParametersSummation) { os << "}\n"; std::string source = os.str(); - InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); + InterpreterTester tester(isolate, source.c_str(), "*"); auto callable = tester.GetCallable<Handle<Object>>(); for (int i = 0; i < kParameterCount; i++) { Handle<Object> arg = handle(Smi::FromInt(i), isolate); @@ -3778,7 +4298,7 @@ TEST(InterpreterDoExpression) { FLAG_harmony_do_expressions = true; HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> do_expr[] = { @@ -3794,7 +4314,7 @@ TEST(InterpreterDoExpression) { for (size_t i = 0; i < arraysize(do_expr); i++) { std::string source(InterpreterTester::SourceForBody(do_expr[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3806,7 +4326,7 @@ TEST(InterpreterDoExpression) { TEST(InterpreterWithStatement) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> with_stmt[] = { {"with({x:42}) return x;", handle(Smi::FromInt(42), isolate)}, @@ -3829,7 +4349,7 @@ TEST(InterpreterWithStatement) { for (size_t i = 0; i < arraysize(with_stmt); i++) { std::string source(InterpreterTester::SourceForBody(with_stmt[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3839,7 +4359,7 @@ TEST(InterpreterWithStatement) { TEST(InterpreterClassLiterals) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> examples[] = { {"class C {\n" " constructor(x) { this.x_ = x; }\n" @@ -3890,7 +4410,7 @@ TEST(InterpreterClassLiterals) { for (size_t i = 0; i < arraysize(examples); ++i) { std::string source(InterpreterTester::SourceForBody(examples[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); + InterpreterTester tester(isolate, source.c_str(), "*"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -3900,7 +4420,7 @@ TEST(InterpreterClassLiterals) { TEST(InterpreterClassAndSuperClass) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); std::pair<const char*, Handle<Object>> examples[] = { {"class A {\n" " constructor(x) { this.x_ = x; }\n" @@ -3950,7 +4470,7 @@ TEST(InterpreterClassAndSuperClass) { for (size_t i = 0; i < arraysize(examples); ++i) { std::string source(InterpreterTester::SourceForBody(examples[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); + InterpreterTester tester(isolate, source.c_str(), "*"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*examples[i].second)); @@ -3959,8 +4479,8 @@ TEST(InterpreterClassAndSuperClass) { TEST(InterpreterConstDeclaration) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> const_decl[] = { {"const x = 3; return x;", handle(Smi::FromInt(3), isolate)}, @@ -3992,7 +4512,7 @@ TEST(InterpreterConstDeclaration) { // Tests for sloppy mode. for (size_t i = 0; i < arraysize(const_decl); i++) { std::string source(InterpreterTester::SourceForBody(const_decl[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -4004,7 +4524,7 @@ TEST(InterpreterConstDeclaration) { std::string strict_body = "'use strict'; " + std::string(const_decl[i].first); std::string source(InterpreterTester::SourceForBody(strict_body.c_str())); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -4014,8 +4534,8 @@ TEST(InterpreterConstDeclaration) { TEST(InterpreterConstDeclarationLookupSlots) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); - i::Factory* factory = isolate->factory(); + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); std::pair<const char*, Handle<Object>> const_decl[] = { {"const x = 3; function f1() {return x;}; return x;", @@ -4031,7 +4551,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { // Tests for sloppy mode. for (size_t i = 0; i < arraysize(const_decl); i++) { std::string source(InterpreterTester::SourceForBody(const_decl[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -4043,7 +4563,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { std::string strict_body = "'use strict'; " + std::string(const_decl[i].first); std::string source(InterpreterTester::SourceForBody(strict_body.c_str())); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -4053,7 +4573,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { TEST(InterpreterConstInLookupContextChain) { HandleAndZoneScope handles; - i::Isolate* isolate = handles.main_isolate(); + Isolate* isolate = handles.main_isolate(); const char* prologue = "function OuterMost() {\n" @@ -4088,7 +4608,7 @@ TEST(InterpreterConstInLookupContextChain) { std::string script = std::string(prologue) + std::string(const_decl[i].first) + std::string(epilogue); - InterpreterTester tester(handles.main_isolate(), script.c_str(), "*"); + InterpreterTester tester(isolate, script.c_str(), "*"); auto callable = tester.GetCallable<>(); Handle<i::Object> return_value = callable().ToHandleChecked(); @@ -4098,6 +4618,7 @@ TEST(InterpreterConstInLookupContextChain) { TEST(InterpreterIllegalConstDeclaration) { HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); std::pair<const char*, const char*> const_decl[] = { {"const x = x = 10 + 3; return x;", @@ -4117,7 +4638,7 @@ TEST(InterpreterIllegalConstDeclaration) { // Tests for sloppy mode. for (size_t i = 0; i < arraysize(const_decl); i++) { std::string source(InterpreterTester::SourceForBody(const_decl[i].first)); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); v8::Local<v8::String> expected_string = v8_str(const_decl[i].second); CHECK( @@ -4130,7 +4651,7 @@ TEST(InterpreterIllegalConstDeclaration) { std::string strict_body = "'use strict'; " + std::string(const_decl[i].first); std::string source(InterpreterTester::SourceForBody(strict_body.c_str())); - InterpreterTester tester(handles.main_isolate(), source.c_str()); + InterpreterTester tester(isolate, source.c_str()); v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); v8::Local<v8::String> expected_string = v8_str(const_decl[i].second); CHECK( @@ -4139,6 +4660,30 @@ TEST(InterpreterIllegalConstDeclaration) { } } +TEST(InterpreterGenerators) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Factory* factory = isolate->factory(); + + std::pair<const char*, Handle<Object>> tests[] = { + {"function* f() { }; return f().next().value", + factory->undefined_value()}, + {"function* f() { yield 42 }; return f().next().value", + factory->NewNumberFromInt(42)}, + {"function* f() { for (let x of [42]) yield x}; return f().next().value", + factory->NewNumberFromInt(42)}, + }; + + for (size_t i = 0; i < arraysize(tests); i++) { + std::string source(InterpreterTester::SourceForBody(tests[i].first)); + InterpreterTester tester(isolate, source.c_str()); + auto callable = tester.GetCallable<>(); + + Handle<i::Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*tests[i].second)); + } +} + } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/test-source-positions.cc b/deps/v8/test/cctest/interpreter/test-source-positions.cc new file mode 100644 index 0000000000..3161f92db9 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/test-source-positions.cc @@ -0,0 +1,250 @@ +// 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/compiler/pipeline.h" +#include "src/handles.h" +#include "src/interpreter/bytecode-generator.h" +#include "src/interpreter/interpreter.h" +#include "src/isolate.h" +#include "src/parsing/parser.h" +#include "test/cctest/cctest.h" +#include "test/cctest/interpreter/source-position-matcher.h" + +namespace v8 { +namespace internal { +namespace interpreter { + +// Flags enabling optimizations that change generated bytecode array. +// Format is <command-line flag> <flag name> <bit index> +#define OPTIMIZATION_FLAGS(V) \ + V(FLAG_ignition_reo, kUseReo, 0) \ + V(FLAG_ignition_peephole, kUsePeephole, 1) \ + V(FLAG_ignition_filter_expression_positions, kUseFilterExpressionPositions, \ + 2) \ + V(FLAG_ignition_deadcode, kUseDeadCode, 3) + +#define DECLARE_BIT(_, Name, BitIndex) static const int Name = 1 << BitIndex; +OPTIMIZATION_FLAGS(DECLARE_BIT) +#undef DECLARE_BIT + +// Test cases source positions are checked for. Please ensure all +// combinations of flags are present here. This is done manually +// because it provides easier to comprehend failure case for humans. +#define TEST_CASES(V) \ + V(UsingReo, kUseReo) \ + V(UsingPeephole, kUsePeephole) \ + V(UsingDeadCode, kUseDeadCode) \ + V(UsingFilterExpressionPositions, kUseFilterExpressionPositions) \ + V(UsingReoAndPeephole, kUseReo | kUsePeephole) \ + V(UsingReoAndFilterExpressionPositions, \ + kUseReo | kUseFilterExpressionPositions) \ + V(UsingReoAndDeadCode, kUseReo | kUseDeadCode) \ + V(UsingPeepholeAndFilterExpressionPositions, \ + kUsePeephole | kUseFilterExpressionPositions) \ + V(UsingPeepholeAndDeadCode, kUsePeephole | kUseDeadCode) \ + V(UsingFilterExpressionPositionsAndDeadCode, \ + kUseFilterExpressionPositions | kUseDeadCode) \ + V(UsingAllOptimizations, \ + kUseReo | kUsePeephole | kUseFilterExpressionPositions | kUseDeadCode) + +struct TestCaseData { + TestCaseData(const char* const script, + const char* const declaration_parameters = "", + const char* const arguments = "") + : script_(script), + declaration_parameters_(declaration_parameters), + arguments_(arguments) {} + + const char* script() const { return script_; } + const char* declaration_parameters() const { return declaration_parameters_; } + const char* arguments() const { return arguments_; } + + private: + TestCaseData(); + + const char* const script_; + const char* const declaration_parameters_; + const char* const arguments_; +}; + +static const TestCaseData kTestCaseData[] = { + {"var x = (y = 3) + (x = y); return x + y;"}, + {"var x = 55;\n" + "var y = x + (x = 1) + (x = 2) + (x = 3);\n" + "return y;"}, + {"var x = 10; return x >>> 3;\n"}, + {"var x = 0; return x || (1, 2, 3);\n"}, + {"return a || (a, b, a, b, c = 5, 3);\n"}, + {"var a = 3; var b = 4; a = b; b = a; a = b; return a;\n"}, + {"var a = 1; return [[a, 2], [a + 2]];\n"}, + {"var a = 1; if (a || a < 0) { return 1; }\n"}, + {"var b;" + "b = a.name;" + "b = a.name;" + "a.name = a;" + "b = a.name;" + "a.name = a;" + "return b;"}, + {"var sum = 0;\n" + "outer: {\n" + " for (var x = 0; x < 10; ++x) {\n" + " for (var y = 0; y < 3; ++y) {\n" + " ++sum;\n" + " if (x + y == 12) { break outer; }\n" + " }\n" + " }\n" + "}\n" + "return sum;\n"}, + {"var a = 1;" + "switch (a) {" + " case 1: return a * a + 1;" + " case 1: break;" + " case 2: return (a = 3) * a + (a = 4);" + " case 3:" + "}" + "return a;"}, + {"for (var p of [0, 1, 2]) {}"}, + {"var x = { 'a': 1, 'b': 2 };" + "for (x['a'] of [1,2,3]) { return x['a']; }"}, + {"while (x == 4) {\n" + " var y = x + 1;\n" + " if (y == 2) break;\n" + " for (z['a'] of [0]) {\n" + " x += (x *= 3) + y;" + " }\n" + "}\n"}, + {"function g(a, b) { return a.func(b + b, b); }\n" + "g(new (function Obj() { this.func = function() { return; }})(), 1)\n"}, + {"return some_global[name];", "name", "'a'"}}; + +class OptimizedBytecodeSourcePositionTester final { + public: + explicit OptimizedBytecodeSourcePositionTester(Isolate* isolate) + : isolate_(isolate) { + SaveOptimizationFlags(); + saved_flag_ignition_ = FLAG_ignition; + FLAG_ignition = true; + saved_flag_always_opt_ = FLAG_always_opt; + FLAG_always_opt = false; + } + + ~OptimizedBytecodeSourcePositionTester() { + RestoreOptimizationFlags(); + FLAG_ignition = saved_flag_ignition_; + FLAG_always_opt = saved_flag_always_opt_; + } + + bool SourcePositionsMatch(int optimization_bitmap, const char* function_body, + const char* function_decl_params, + const char* function_args); + + private: + Handle<BytecodeArray> MakeBytecode(int optimization_bitmap, + const char* function_body, + const char* function_decl_params, + const char* function_args); + static std::string MakeScript(const char* function_body, + const char* function_decl_params, + const char* function_args); + + void SetOptimizationFlags(int optimization_bitmap); + void SaveOptimizationFlags(); + void RestoreOptimizationFlags(); + + Isolate* isolate() const { return isolate_; } + + Isolate* isolate_; + int saved_optimization_bitmap_; + bool saved_flag_ignition_; + bool saved_flag_always_opt_; +}; + +// static +std::string OptimizedBytecodeSourcePositionTester::MakeScript( + const char* function_body, const char* function_decl_params, + const char* function_args) { + std::ostringstream os; + os << "function test_function" + << "(" << function_decl_params << ") {"; + os << function_body; + os << "}"; + os << "test_function(" << function_args << ");"; + return os.str(); +} + +Handle<BytecodeArray> OptimizedBytecodeSourcePositionTester::MakeBytecode( + int optimization_bitmap, const char* function_body, + const char* function_decl_params, const char* function_args) { + std::string script = + MakeScript(function_body, function_decl_params, function_args); + SetOptimizationFlags(optimization_bitmap); + CompileRun(script.c_str()); + + Local<Function> api_function = Local<Function>::Cast( + CcTest::global() + ->Get(CcTest::isolate()->GetCurrentContext(), v8_str("test_function")) + .ToLocalChecked()); + Handle<JSFunction> function = + Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function)); + return handle(function->shared()->bytecode_array()); +} + +void OptimizedBytecodeSourcePositionTester::SetOptimizationFlags( + int optimization_bitmap) { +#define SET_FLAG(V8Flag, BitName, _) \ + V8Flag = (optimization_bitmap & BitName) ? true : false; + OPTIMIZATION_FLAGS(SET_FLAG) +#undef SET_FLAG +} + +void OptimizedBytecodeSourcePositionTester::SaveOptimizationFlags() { + saved_optimization_bitmap_ = 0; +#define SAVE_FLAG(V8Flag, BitName, _) \ + if (V8Flag) saved_optimization_bitmap_ |= BitName; +#undef SET_FLAG +} + +void OptimizedBytecodeSourcePositionTester::RestoreOptimizationFlags() { + SetOptimizationFlags(saved_optimization_bitmap_); +} + +bool OptimizedBytecodeSourcePositionTester::SourcePositionsMatch( + int optimization_bitmap, const char* function_body, + const char* function_decl_params, const char* function_args) { + Handle<BytecodeArray> unoptimized_bytecode = + MakeBytecode(0, function_body, function_decl_params, function_args); + Handle<BytecodeArray> optimized_bytecode = MakeBytecode( + optimization_bitmap, function_body, function_decl_params, function_args); + SourcePositionMatcher matcher; + if (!matcher.Match(unoptimized_bytecode, optimized_bytecode)) { + return false; + } + return true; +} + +void TestSourcePositionsEquivalent(int optimization_bitmap) { + HandleAndZoneScope handles; + // Ensure handler table is generated. + handles.main_isolate()->interpreter()->Initialize(); + + OptimizedBytecodeSourcePositionTester tester(handles.main_isolate()); + for (auto test_case_data : kTestCaseData) { + CHECK(tester.SourcePositionsMatch( + optimization_bitmap, test_case_data.script(), + test_case_data.declaration_parameters(), test_case_data.arguments())); + } +} + +#define MAKE_TEST(Name, Bitmap) \ + TEST(TestSourcePositionsEquivalent##Name) { \ + TestSourcePositionsEquivalent(Bitmap); \ + } +TEST_CASES(MAKE_TEST) +#undef MAKE_TEST + +} // namespace interpreter +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/libplatform/test-tracing.cc b/deps/v8/test/cctest/libplatform/test-tracing.cc new file mode 100644 index 0000000000..2e15d6af9e --- /dev/null +++ b/deps/v8/test/cctest/libplatform/test-tracing.cc @@ -0,0 +1,312 @@ +// 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 <limits> + +#include "include/libplatform/v8-tracing.h" +#include "src/tracing/trace-event.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace platform { +namespace tracing { + +TEST(TestTraceConfig) { + LocalContext env; + TraceConfig* trace_config = new TraceConfig(); + trace_config->EnableSampling(); + trace_config->AddIncludedCategory("v8"); + trace_config->AddIncludedCategory(TRACE_DISABLED_BY_DEFAULT("v8.runtime")); + trace_config->AddExcludedCategory("v8.cpu_profile"); + + CHECK_EQ(trace_config->IsSamplingEnabled(), true); + CHECK_EQ(trace_config->IsSystraceEnabled(), false); + CHECK_EQ(trace_config->IsArgumentFilterEnabled(), false); + CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8"), true); + CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8.cpu_profile"), false); + CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8.cpu_profile.hires"), false); + CHECK_EQ(trace_config->IsCategoryGroupEnabled( + TRACE_DISABLED_BY_DEFAULT("v8.runtime")), + true); + delete trace_config; +} + +TEST(TestTraceObject) { + TraceObject trace_object; + uint8_t category_enabled_flag = 41; + trace_object.Initialize('X', &category_enabled_flag, "Test.Trace", + "Test.Scope", 42, 123, 0, NULL, NULL, NULL, 0); + CHECK_EQ('X', trace_object.phase()); + CHECK_EQ(category_enabled_flag, *trace_object.category_enabled_flag()); + CHECK_EQ(std::string("Test.Trace"), std::string(trace_object.name())); + CHECK_EQ(std::string("Test.Scope"), std::string(trace_object.scope())); + CHECK_EQ(0, trace_object.duration()); + CHECK_EQ(0, trace_object.cpu_duration()); +} + +class MockTraceWriter : public TraceWriter { + public: + void AppendTraceEvent(TraceObject* trace_event) override { + events_.push_back(trace_event->name()); + } + + void Flush() override {} + + std::vector<std::string> events() { return events_; } + + private: + std::vector<std::string> events_; +}; + +TEST(TestTraceBufferRingBuffer) { + // We should be able to add kChunkSize * 2 + 1 trace events. + const int HANDLES_COUNT = TraceBufferChunk::kChunkSize * 2 + 1; + MockTraceWriter* writer = new MockTraceWriter(); + TraceBuffer* ring_buffer = + TraceBuffer::CreateTraceBufferRingBuffer(2, writer); + std::string names[HANDLES_COUNT]; + for (int i = 0; i < HANDLES_COUNT; ++i) { + names[i] = "Test.EventNo" + std::to_string(i); + } + + std::vector<uint64_t> handles(HANDLES_COUNT); + uint8_t category_enabled_flag = 41; + for (size_t i = 0; i < handles.size(); ++i) { + TraceObject* trace_object = ring_buffer->AddTraceEvent(&handles[i]); + CHECK_NOT_NULL(trace_object); + trace_object->Initialize('X', &category_enabled_flag, names[i].c_str(), + "Test.Scope", 42, 123, 0, NULL, NULL, NULL, 0); + trace_object = ring_buffer->GetEventByHandle(handles[i]); + CHECK_NOT_NULL(trace_object); + CHECK_EQ('X', trace_object->phase()); + CHECK_EQ(names[i], std::string(trace_object->name())); + CHECK_EQ(category_enabled_flag, *trace_object->category_enabled_flag()); + } + + // We should only be able to retrieve the last kChunkSize + 1. + for (size_t i = 0; i < TraceBufferChunk::kChunkSize; ++i) { + CHECK_NULL(ring_buffer->GetEventByHandle(handles[i])); + } + + for (size_t i = TraceBufferChunk::kChunkSize; i < handles.size(); ++i) { + TraceObject* trace_object = ring_buffer->GetEventByHandle(handles[i]); + CHECK_NOT_NULL(trace_object); + // The object properties should be correct. + CHECK_EQ('X', trace_object->phase()); + CHECK_EQ(names[i], std::string(trace_object->name())); + CHECK_EQ(category_enabled_flag, *trace_object->category_enabled_flag()); + } + + // Check Flush(), that the writer wrote the last kChunkSize 1 event names. + ring_buffer->Flush(); + auto events = writer->events(); + CHECK_EQ(TraceBufferChunk::kChunkSize + 1, events.size()); + for (size_t i = TraceBufferChunk::kChunkSize; i < handles.size(); ++i) { + CHECK_EQ(names[i], events[i - TraceBufferChunk::kChunkSize]); + } + delete ring_buffer; +} + +TEST(TestJSONTraceWriter) { + std::ostringstream stream; + v8::Platform* old_platform = i::V8::GetCurrentPlatform(); + v8::Platform* default_platform = v8::platform::CreateDefaultPlatform(); + i::V8::SetPlatformForTesting(default_platform); + // Create a scope for the tracing controller to terminate the trace writer. + { + TracingController tracing_controller; + platform::SetTracingController(default_platform, &tracing_controller); + TraceWriter* writer = TraceWriter::CreateJSONTraceWriter(stream); + + TraceBuffer* ring_buffer = + TraceBuffer::CreateTraceBufferRingBuffer(1, writer); + tracing_controller.Initialize(ring_buffer); + TraceConfig* trace_config = new TraceConfig(); + trace_config->AddIncludedCategory("v8-cat"); + tracing_controller.StartTracing(trace_config); + + TraceObject trace_object; + trace_object.InitializeForTesting( + 'X', tracing_controller.GetCategoryGroupEnabled("v8-cat"), "Test0", + v8::internal::tracing::kGlobalScope, 42, 123, 0, NULL, NULL, NULL, + TRACE_EVENT_FLAG_HAS_ID, 11, 22, 100, 50, 33, 44); + writer->AppendTraceEvent(&trace_object); + trace_object.InitializeForTesting( + 'Y', tracing_controller.GetCategoryGroupEnabled("v8-cat"), "Test1", + v8::internal::tracing::kGlobalScope, 43, 456, 0, NULL, NULL, NULL, 0, + 55, 66, 110, 55, 77, 88); + writer->AppendTraceEvent(&trace_object); + tracing_controller.StopTracing(); + } + + std::string trace_str = stream.str(); + std::string expected_trace_str = + "{\"traceEvents\":[{\"pid\":11,\"tid\":22,\"ts\":100,\"tts\":50," + "\"ph\":\"X\",\"cat\":\"v8-cat\",\"name\":\"Test0\",\"dur\":33," + "\"tdur\":44,\"id\":\"0x2a\",\"args\":{}},{\"pid\":55,\"tid\":66," + "\"ts\":110,\"tts\":55,\"ph\":\"Y\",\"cat\":\"v8-cat\",\"name\":" + "\"Test1\",\"dur\":77,\"tdur\":88,\"args\":{}}]}"; + + CHECK_EQ(expected_trace_str, trace_str); + + i::V8::SetPlatformForTesting(old_platform); +} + +TEST(TestTracingController) { + v8::Platform* old_platform = i::V8::GetCurrentPlatform(); + v8::Platform* default_platform = v8::platform::CreateDefaultPlatform(); + i::V8::SetPlatformForTesting(default_platform); + + TracingController tracing_controller; + platform::SetTracingController(default_platform, &tracing_controller); + + MockTraceWriter* writer = new MockTraceWriter(); + TraceBuffer* ring_buffer = + TraceBuffer::CreateTraceBufferRingBuffer(1, writer); + tracing_controller.Initialize(ring_buffer); + TraceConfig* trace_config = new TraceConfig(); + trace_config->AddIncludedCategory("v8"); + tracing_controller.StartTracing(trace_config); + + TRACE_EVENT0("v8", "v8.Test"); + // cat category is not included in default config + TRACE_EVENT0("cat", "v8.Test2"); + TRACE_EVENT0("v8", "v8.Test3"); + tracing_controller.StopTracing(); + + CHECK_EQ(2, writer->events().size()); + CHECK_EQ(std::string("v8.Test"), writer->events()[0]); + CHECK_EQ(std::string("v8.Test3"), writer->events()[1]); + + i::V8::SetPlatformForTesting(old_platform); +} + +void GetJSONStrings(std::vector<std::string>& ret, std::string str, + std::string param, std::string start_delim, + std::string end_delim) { + size_t pos = str.find(param); + while (pos != std::string::npos) { + size_t start_pos = str.find(start_delim, pos + param.length()); + size_t end_pos = str.find(end_delim, start_pos + 1); + CHECK_NE(start_pos, std::string::npos); + CHECK_NE(end_pos, std::string::npos); + ret.push_back(str.substr(start_pos + 1, end_pos - start_pos - 1)); + pos = str.find(param, pos + 1); + } +} + +TEST(TestTracingControllerMultipleArgsAndCopy) { + std::ostringstream stream; + v8::Platform* old_platform = i::V8::GetCurrentPlatform(); + v8::Platform* default_platform = v8::platform::CreateDefaultPlatform(); + i::V8::SetPlatformForTesting(default_platform); + + uint64_t aa = 11; + unsigned int bb = 22; + uint16_t cc = 33; + unsigned char dd = 44; + int64_t ee = -55; + int ff = -66; + int16_t gg = -77; + signed char hh = -88; + bool ii1 = true; + bool ii2 = false; + double jj1 = 99.0; + double jj2 = 1e100; + double jj3 = std::numeric_limits<double>::quiet_NaN(); + double jj4 = std::numeric_limits<double>::infinity(); + double jj5 = -std::numeric_limits<double>::infinity(); + void* kk = &aa; + const char* ll = "100"; + std::string mm = "INIT"; + std::string mmm = "\"INIT\""; + + // Create a scope for the tracing controller to terminate the trace writer. + { + TracingController tracing_controller; + platform::SetTracingController(default_platform, &tracing_controller); + TraceWriter* writer = TraceWriter::CreateJSONTraceWriter(stream); + + TraceBuffer* ring_buffer = + TraceBuffer::CreateTraceBufferRingBuffer(1, writer); + tracing_controller.Initialize(ring_buffer); + TraceConfig* trace_config = new TraceConfig(); + trace_config->AddIncludedCategory("v8"); + tracing_controller.StartTracing(trace_config); + + TRACE_EVENT1("v8", "v8.Test.aa", "aa", aa); + TRACE_EVENT1("v8", "v8.Test.bb", "bb", bb); + TRACE_EVENT1("v8", "v8.Test.cc", "cc", cc); + TRACE_EVENT1("v8", "v8.Test.dd", "dd", dd); + TRACE_EVENT1("v8", "v8.Test.ee", "ee", ee); + TRACE_EVENT1("v8", "v8.Test.ff", "ff", ff); + TRACE_EVENT1("v8", "v8.Test.gg", "gg", gg); + TRACE_EVENT1("v8", "v8.Test.hh", "hh", hh); + TRACE_EVENT1("v8", "v8.Test.ii", "ii1", ii1); + TRACE_EVENT1("v8", "v8.Test.ii", "ii2", ii2); + TRACE_EVENT1("v8", "v8.Test.jj1", "jj1", jj1); + TRACE_EVENT1("v8", "v8.Test.jj2", "jj2", jj2); + TRACE_EVENT1("v8", "v8.Test.jj3", "jj3", jj3); + TRACE_EVENT1("v8", "v8.Test.jj4", "jj4", jj4); + TRACE_EVENT1("v8", "v8.Test.jj5", "jj5", jj5); + TRACE_EVENT1("v8", "v8.Test.kk", "kk", kk); + TRACE_EVENT1("v8", "v8.Test.ll", "ll", ll); + TRACE_EVENT1("v8", "v8.Test.mm", "mm", TRACE_STR_COPY(mmm.c_str())); + + TRACE_EVENT2("v8", "v8.Test2.1", "aa", aa, "ll", ll); + TRACE_EVENT2("v8", "v8.Test2.2", "mm1", TRACE_STR_COPY(mm.c_str()), "mm2", + TRACE_STR_COPY(mmm.c_str())); + + // Check copies are correct. + TRACE_EVENT_COPY_INSTANT0("v8", mm.c_str(), TRACE_EVENT_SCOPE_THREAD); + TRACE_EVENT_COPY_INSTANT2("v8", mm.c_str(), TRACE_EVENT_SCOPE_THREAD, "mm1", + mm.c_str(), "mm2", mmm.c_str()); + mm = "CHANGED"; + mmm = "CHANGED"; + + tracing_controller.StopTracing(); + } + + std::string trace_str = stream.str(); + + std::vector<std::string> all_args, all_names, all_cats; + GetJSONStrings(all_args, trace_str, "\"args\"", "{", "}"); + GetJSONStrings(all_names, trace_str, "\"name\"", "\"", "\""); + GetJSONStrings(all_cats, trace_str, "\"cat\"", "\"", "\""); + + CHECK_EQ(all_args.size(), 22); + CHECK_EQ(all_args[0], "\"aa\":11"); + CHECK_EQ(all_args[1], "\"bb\":22"); + CHECK_EQ(all_args[2], "\"cc\":33"); + CHECK_EQ(all_args[3], "\"dd\":44"); + CHECK_EQ(all_args[4], "\"ee\":-55"); + CHECK_EQ(all_args[5], "\"ff\":-66"); + CHECK_EQ(all_args[6], "\"gg\":-77"); + CHECK_EQ(all_args[7], "\"hh\":-88"); + CHECK_EQ(all_args[8], "\"ii1\":true"); + CHECK_EQ(all_args[9], "\"ii2\":false"); + CHECK_EQ(all_args[10], "\"jj1\":99.0"); + CHECK_EQ(all_args[11], "\"jj2\":1e+100"); + CHECK_EQ(all_args[12], "\"jj3\":\"NaN\""); + CHECK_EQ(all_args[13], "\"jj4\":\"Infinity\""); + CHECK_EQ(all_args[14], "\"jj5\":\"-Infinity\""); + std::ostringstream pointer_stream; + pointer_stream << "\"kk\":\"" << &aa << "\""; + CHECK_EQ(all_args[15], pointer_stream.str()); + CHECK_EQ(all_args[16], "\"ll\":\"100\""); + CHECK_EQ(all_args[17], "\"mm\":\"\\\"INIT\\\"\""); + + CHECK_EQ(all_names[18], "v8.Test2.1"); + CHECK_EQ(all_args[18], "\"aa\":11,\"ll\":\"100\""); + CHECK_EQ(all_args[19], "\"mm1\":\"INIT\",\"mm2\":\"\\\"INIT\\\"\""); + + CHECK_EQ(all_names[20], "INIT"); + CHECK_EQ(all_names[21], "INIT"); + CHECK_EQ(all_args[21], "\"mm1\":\"INIT\",\"mm2\":\"\\\"INIT\\\"\""); + + i::V8::SetPlatformForTesting(old_platform); +} + +} // namespace tracing +} // namespace platform +} // namespace v8 diff --git a/deps/v8/test/cctest/libsampler/test-sampler.cc b/deps/v8/test/cctest/libsampler/test-sampler.cc new file mode 100644 index 0000000000..b88d347914 --- /dev/null +++ b/deps/v8/test/cctest/libsampler/test-sampler.cc @@ -0,0 +1,140 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Tests of sampler functionalities. + +#include "src/libsampler/sampler.h" + +#include "src/base/platform/platform.h" +#include "test/cctest/cctest.h" + + +namespace v8 { +namespace sampler { + +namespace { + +class TestSamplingThread : public base::Thread { + public: + static const int kSamplerThreadStackSize = 64 * 1024; + + explicit TestSamplingThread(Sampler* sampler) + : Thread(base::Thread::Options("TestSamplingThread", + kSamplerThreadStackSize)), + sampler_(sampler) {} + + // Implement Thread::Run(). + void Run() override { + while (sampler_->IsProfiling()) { + sampler_->DoSample(); + base::OS::Sleep(base::TimeDelta::FromMilliseconds(1)); + } + } + + private: + Sampler* sampler_; +}; + + +class TestSampler : public Sampler { + public: + explicit TestSampler(Isolate* isolate) : Sampler(isolate) {} + + void SampleStack(const v8::RegisterState& regs) override { + void* frames[kMaxFramesCount]; + SampleInfo sample_info; + isolate()->GetStackSample(regs, frames, kMaxFramesCount, &sample_info); + if (is_counting_samples_) { + if (sample_info.vm_state == JS) ++js_sample_count_; + if (sample_info.vm_state == EXTERNAL) ++external_sample_count_; + } + } +}; + + +class TestApiCallbacks { + public: + TestApiCallbacks() {} + + static void Getter(v8::Local<v8::String> name, + const v8::PropertyCallbackInfo<v8::Value>& info) { + } + + static void Setter(v8::Local<v8::String> name, + v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<void>& info) { + } +}; + + +static void RunSampler(v8::Local<v8::Context> env, + v8::Local<v8::Function> function, + v8::Local<v8::Value> argv[], int argc, + unsigned min_js_samples = 0, + unsigned min_external_samples = 0) { + Sampler::SetUp(); + TestSampler* sampler = new TestSampler(env->GetIsolate()); + TestSamplingThread* thread = new TestSamplingThread(sampler); + sampler->IncreaseProfilingDepth(); + sampler->Start(); + sampler->StartCountingSamples(); + thread->StartSynchronously(); + do { + function->Call(env, env->Global(), argc, argv).ToLocalChecked(); + } while (sampler->js_sample_count() < min_js_samples || + sampler->external_sample_count() < min_external_samples); + sampler->Stop(); + sampler->DecreaseProfilingDepth(); + thread->Join(); + delete thread; + delete sampler; + Sampler::TearDown(); +} + +} // namespace + +static const char* sampler_test_source = "function start(count) {\n" +" for (var i = 0; i < count; i++) {\n" +" var o = instance.foo;\n" +" instance.foo = o + 1;\n" +" }\n" +"}\n"; + +static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, + const char* name) { + return v8::Local<v8::Function>::Cast( + env->Global()->Get(env, v8_str(name)).ToLocalChecked()); +} + + +TEST(LibSamplerCollectSample) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::FunctionTemplate> func_template = + v8::FunctionTemplate::New(isolate); + v8::Local<v8::ObjectTemplate> instance_template = + func_template->InstanceTemplate(); + + TestApiCallbacks accessors; + v8::Local<v8::External> data = + v8::External::New(isolate, &accessors); + instance_template->SetAccessor(v8_str("foo"), &TestApiCallbacks::Getter, + &TestApiCallbacks::Setter, data); + v8::Local<v8::Function> func = + func_template->GetFunction(env.local()).ToLocalChecked(); + v8::Local<v8::Object> instance = + func->NewInstance(env.local()).ToLocalChecked(); + env->Global()->Set(env.local(), v8_str("instance"), instance).FromJust(); + + CompileRun(sampler_test_source); + v8::Local<v8::Function> function = GetFunction(env.local(), "start"); + + int32_t repeat_count = 100; + v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; + RunSampler(env.local(), function, args, arraysize(args), 100, 100); +} + +} // namespace sampler +} // namespace v8 diff --git a/deps/v8/test/cctest/profiler-extension.cc b/deps/v8/test/cctest/profiler-extension.cc index 024cc9c635..df5cec79ce 100644 --- a/deps/v8/test/cctest/profiler-extension.cc +++ b/deps/v8/test/cctest/profiler-extension.cc @@ -33,7 +33,8 @@ namespace v8 { namespace internal { -v8::CpuProfile* ProfilerExtension::last_profile = NULL; +v8::CpuProfiler* ProfilerExtension::profiler_ = nullptr; +v8::CpuProfile* ProfilerExtension::last_profile = nullptr; const char* ProfilerExtension::kSource = "native function startProfiling();" "native function stopProfiling();" @@ -58,24 +59,22 @@ v8::Local<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate( void ProfilerExtension::StartProfiling( const v8::FunctionCallbackInfo<v8::Value>& args) { - last_profile = NULL; - v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler(); - cpu_profiler->StartProfiling((args.Length() > 0) - ? args[0].As<v8::String>() - : v8::String::Empty(args.GetIsolate())); + last_profile = nullptr; + profiler_->StartProfiling(args.Length() > 0 + ? args[0].As<v8::String>() + : v8::String::Empty(args.GetIsolate())); } void ProfilerExtension::StopProfiling( const v8::FunctionCallbackInfo<v8::Value>& args) { - v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler(); - last_profile = cpu_profiler->StopProfiling((args.Length() > 0) - ? args[0].As<v8::String>() - : v8::String::Empty(args.GetIsolate())); + last_profile = profiler_->StopProfiling( + args.Length() > 0 ? args[0].As<v8::String>() + : v8::String::Empty(args.GetIsolate())); } void ProfilerExtension::CollectSample( const v8::FunctionCallbackInfo<v8::Value>& args) { - args.GetIsolate()->GetCpuProfiler()->CollectSample(); + profiler_->CollectSample(); } } // namespace internal diff --git a/deps/v8/test/cctest/profiler-extension.h b/deps/v8/test/cctest/profiler-extension.h index 00f9a5a808..dbc12f47a0 100644 --- a/deps/v8/test/cctest/profiler-extension.h +++ b/deps/v8/test/cctest/profiler-extension.h @@ -35,11 +35,20 @@ namespace v8 { namespace internal { +class CpuProfiler; + class ProfilerExtension : public v8::Extension { public: ProfilerExtension() : v8::Extension("v8/profiler", kSource) { } + virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate* isolate, v8::Local<v8::String> name); + + static void set_profiler(v8::CpuProfiler* profiler) { profiler_ = profiler; } + static void set_profiler(CpuProfiler* profiler) { + profiler_ = reinterpret_cast<v8::CpuProfiler*>(profiler); + } + static v8::CpuProfiler* profiler() { return profiler_; } static v8::CpuProfile* last_profile; private: @@ -47,6 +56,7 @@ class ProfilerExtension : public v8::Extension { static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args); static void CollectSample(const v8::FunctionCallbackInfo<v8::Value>& args); + static v8::CpuProfiler* profiler_; static const char* kSource; }; diff --git a/deps/v8/test/cctest/test-access-checks.cc b/deps/v8/test/cctest/test-access-checks.cc new file mode 100644 index 0000000000..59c17b89eb --- /dev/null +++ b/deps/v8/test/cctest/test-access-checks.cc @@ -0,0 +1,305 @@ +// 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 <stdlib.h> + +#include "test/cctest/cctest.h" + +namespace { + +int32_t g_cross_context_int = 0; + +bool g_expect_interceptor_call = false; + +void NamedGetter(v8::Local<v8::Name> property, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (property->Equals(context, v8_str("cross_context_int")).FromJust()) + info.GetReturnValue().Set(g_cross_context_int); +} + +void NamedSetter(v8::Local<v8::Name> property, v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (!property->Equals(context, v8_str("cross_context_int")).FromJust()) + return; + if (value->IsInt32()) { + g_cross_context_int = value->ToInt32(context).ToLocalChecked()->Value(); + } + info.GetReturnValue().Set(value); +} + +void NamedQuery(v8::Local<v8::Name> property, + const v8::PropertyCallbackInfo<v8::Integer>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (!property->Equals(context, v8_str("cross_context_int")).FromJust()) + return; + info.GetReturnValue().Set(v8::DontDelete); +} + +void NamedDeleter(v8::Local<v8::Name> property, + const v8::PropertyCallbackInfo<v8::Boolean>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (!property->Equals(context, v8_str("cross_context_int")).FromJust()) + return; + info.GetReturnValue().Set(false); +} + +void NamedEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + v8::Local<v8::Array> names = v8::Array::New(isolate, 1); + names->Set(context, 0, v8_str("cross_context_int")).FromJust(); + info.GetReturnValue().Set(names); +} + +void IndexedGetter(uint32_t index, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(g_expect_interceptor_call); + if (index == 7) info.GetReturnValue().Set(g_cross_context_int); +} + +void IndexedSetter(uint32_t index, v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (index != 7) return; + if (value->IsInt32()) { + g_cross_context_int = value->ToInt32(context).ToLocalChecked()->Value(); + } + info.GetReturnValue().Set(value); +} + +void IndexedQuery(uint32_t index, + const v8::PropertyCallbackInfo<v8::Integer>& info) { + CHECK(g_expect_interceptor_call); + if (index == 7) info.GetReturnValue().Set(v8::DontDelete); +} + +void IndexedDeleter(uint32_t index, + const v8::PropertyCallbackInfo<v8::Boolean>& info) { + CHECK(g_expect_interceptor_call); + if (index == 7) info.GetReturnValue().Set(false); +} + +void IndexedEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { + CHECK(g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + v8::Local<v8::Array> names = v8::Array::New(isolate, 1); + names->Set(context, 0, v8_str("7")).FromJust(); + info.GetReturnValue().Set(names); +} + +bool AccessCheck(v8::Local<v8::Context> accessing_context, + v8::Local<v8::Object> accessed_object, + v8::Local<v8::Value> data) { + return false; +} + +void GetCrossContextInt(v8::Local<v8::String> property, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(!g_expect_interceptor_call); + info.GetReturnValue().Set(g_cross_context_int); +} + +void SetCrossContextInt(v8::Local<v8::String> property, + v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<void>& info) { + CHECK(!g_expect_interceptor_call); + v8::Isolate* isolate = info.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (value->IsInt32()) { + g_cross_context_int = value->ToInt32(context).ToLocalChecked()->Value(); + } +} + +void Return42(v8::Local<v8::String> property, + const v8::PropertyCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(42); +} + +void CheckCanRunScriptInContext(v8::Isolate* isolate, + v8::Local<v8::Context> context) { + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope(context); + + g_expect_interceptor_call = false; + g_cross_context_int = 0; + + // Running script in this context should work. + CompileRunChecked(isolate, "this.foo = 42; this[23] = true;"); + ExpectInt32("this.all_can_read", 42); + CompileRunChecked(isolate, "this.cross_context_int = 23"); + CHECK_EQ(g_cross_context_int, 23); + ExpectInt32("this.cross_context_int", 23); +} + +void CheckCrossContextAccess(v8::Isolate* isolate, + v8::Local<v8::Context> accessing_context, + v8::Local<v8::Object> accessed_object) { + v8::HandleScope handle_scope(isolate); + accessing_context->Global() + ->Set(accessing_context, v8_str("other"), accessed_object) + .FromJust(); + v8::Context::Scope context_scope(accessing_context); + + g_expect_interceptor_call = true; + g_cross_context_int = 23; + + { + v8::TryCatch try_catch(isolate); + CHECK(CompileRun(accessing_context, "this.other.foo").IsEmpty()); + } + { + v8::TryCatch try_catch(isolate); + CHECK(CompileRun(accessing_context, "this.other[23]").IsEmpty()); + } + + // AllCanRead properties are also inaccessible. + { + v8::TryCatch try_catch(isolate); + CHECK(CompileRun(accessing_context, "this.other.all_can_read").IsEmpty()); + } + + // Intercepted properties are accessible, however. + ExpectInt32("this.other.cross_context_int", 23); + CompileRunChecked(isolate, "this.other.cross_context_int = 42"); + ExpectInt32("this.other[7]", 42); + ExpectString("JSON.stringify(Object.getOwnPropertyNames(this.other))", + "[\"7\",\"cross_context_int\"]"); +} + +void Ctor(const v8::FunctionCallbackInfo<v8::Value>& info) { + CHECK(info.IsConstructCall()); +} + +} // namespace + +TEST(AccessCheckWithInterceptor) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::ObjectTemplate> global_template = + v8::ObjectTemplate::New(isolate); + global_template->SetAccessCheckCallbackAndHandler( + AccessCheck, + v8::NamedPropertyHandlerConfiguration( + NamedGetter, NamedSetter, NamedQuery, NamedDeleter, NamedEnumerator), + v8::IndexedPropertyHandlerConfiguration(IndexedGetter, IndexedSetter, + IndexedQuery, IndexedDeleter, + IndexedEnumerator)); + global_template->SetNativeDataProperty( + v8_str("cross_context_int"), GetCrossContextInt, SetCrossContextInt); + global_template->SetNativeDataProperty( + v8_str("all_can_read"), Return42, nullptr, v8::Local<v8::Value>(), + v8::None, v8::Local<v8::AccessorSignature>(), v8::ALL_CAN_READ); + + v8::Local<v8::Context> context0 = + v8::Context::New(isolate, nullptr, global_template); + CheckCanRunScriptInContext(isolate, context0); + + // Create another context. + v8::Local<v8::Context> context1 = + v8::Context::New(isolate, nullptr, global_template); + CheckCrossContextAccess(isolate, context1, context0->Global()); +} + +TEST(NewRemoteContext) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::ObjectTemplate> global_template = + v8::ObjectTemplate::New(isolate); + global_template->SetAccessCheckCallbackAndHandler( + AccessCheck, + v8::NamedPropertyHandlerConfiguration( + NamedGetter, NamedSetter, NamedQuery, NamedDeleter, NamedEnumerator), + v8::IndexedPropertyHandlerConfiguration(IndexedGetter, IndexedSetter, + IndexedQuery, IndexedDeleter, + IndexedEnumerator)); + global_template->SetNativeDataProperty( + v8_str("cross_context_int"), GetCrossContextInt, SetCrossContextInt); + global_template->SetNativeDataProperty( + v8_str("all_can_read"), Return42, nullptr, v8::Local<v8::Value>(), + v8::None, v8::Local<v8::AccessorSignature>(), v8::ALL_CAN_READ); + + v8::Local<v8::Object> global0 = + v8::Context::NewRemoteContext(isolate, global_template).ToLocalChecked(); + + // Create a real context. + { + v8::HandleScope other_scope(isolate); + v8::Local<v8::Context> context1 = + v8::Context::New(isolate, nullptr, global_template); + + CheckCrossContextAccess(isolate, context1, global0); + } + + // Create a context using the detached global. + { + v8::HandleScope other_scope(isolate); + v8::Local<v8::Context> context2 = + v8::Context::New(isolate, nullptr, global_template, global0); + + CheckCanRunScriptInContext(isolate, context2); + } + + // Turn a regular context into a remote context. + { + v8::HandleScope other_scope(isolate); + v8::Local<v8::Context> context3 = + v8::Context::New(isolate, nullptr, global_template); + + CheckCanRunScriptInContext(isolate, context3); + + // Turn the global object into a remote context, and try to access it. + v8::Local<v8::Object> context3_global = context3->Global(); + context3->DetachGlobal(); + v8::Local<v8::Object> global3 = + v8::Context::NewRemoteContext(isolate, global_template, context3_global) + .ToLocalChecked(); + v8::Local<v8::Context> context4 = + v8::Context::New(isolate, nullptr, global_template); + + CheckCrossContextAccess(isolate, context4, global3); + + // Turn it back into a regular context. + v8::Local<v8::Context> context5 = + v8::Context::New(isolate, nullptr, global_template, global3); + + CheckCanRunScriptInContext(isolate, context5); + } +} + +TEST(NewRemoteInstance) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::FunctionTemplate> tmpl = + v8::FunctionTemplate::New(isolate, Ctor); + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + instance->SetAccessCheckCallbackAndHandler( + AccessCheck, + v8::NamedPropertyHandlerConfiguration( + NamedGetter, NamedSetter, NamedQuery, NamedDeleter, NamedEnumerator), + v8::IndexedPropertyHandlerConfiguration(IndexedGetter, IndexedSetter, + IndexedQuery, IndexedDeleter, + IndexedEnumerator)); + tmpl->SetNativeDataProperty( + v8_str("all_can_read"), Return42, nullptr, v8::Local<v8::Value>(), + v8::None, v8::Local<v8::AccessorSignature>(), v8::ALL_CAN_READ); + + v8::Local<v8::Object> obj = tmpl->NewRemoteInstance().ToLocalChecked(); + + v8::Local<v8::Context> context = v8::Context::New(isolate); + CheckCrossContextAccess(isolate, context, obj); +} diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc index 67803eeed6..9667afb703 100644 --- a/deps/v8/test/cctest/test-accessors.cc +++ b/deps/v8/test/cctest/test-accessors.cc @@ -775,19 +775,18 @@ TEST(PrototypeGetterAccessCheck) { } } -static void check_receiver(Local<String> name, - const v8::PropertyCallbackInfo<v8::Value>& info) { +static void CheckReceiver(Local<String> name, + const v8::PropertyCallbackInfo<v8::Value>& info) { CHECK(info.This()->IsObject()); } TEST(Regress609134) { - v8::internal::FLAG_allow_natives_syntax = true; LocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); auto fun_templ = v8::FunctionTemplate::New(isolate); fun_templ->InstanceTemplate()->SetNativeDataProperty(v8_str("foo"), - check_receiver); + CheckReceiver); CHECK(env->Global() ->Set(env.local(), v8_str("Fun"), @@ -797,5 +796,6 @@ TEST(Regress609134) { CompileRun( "var f = new Fun();" "Number.prototype.__proto__ = f;" - "[42][0].foo"); + "var a = 42;" + "for (var i = 0; i<3; i++) { a.foo; }"); } diff --git a/deps/v8/test/cctest/test-api-fast-accessor-builder.cc b/deps/v8/test/cctest/test-api-fast-accessor-builder.cc index eeb6b96fbc..6612f9047c 100644 --- a/deps/v8/test/cctest/test-api-fast-accessor-builder.cc +++ b/deps/v8/test/cctest/test-api-fast-accessor-builder.cc @@ -60,8 +60,24 @@ static void NativePropertyAccessor( info.GetReturnValue().Set(v8_num(123)); } +const char* kWatermarkProperty = "watermark"; + } // anonymous namespace +void CheckImplicitParameters(const v8::FunctionCallbackInfo<v8::Value>& info) { + v8::Isolate* isolate = info.GetIsolate(); + CHECK_NOT_NULL(isolate); + + auto context = isolate->GetCurrentContext(); + CHECK(!context.IsEmpty()); + + // The context must point to the same isolate, this should be enough to + // validate the context, mainly to prevent having a random object instead. + CHECK_EQ(isolate, context->GetIsolate()); + CHECK(info.Data()->IsUndefined()); + + CHECK(info.Holder()->Has(context, v8_str(kWatermarkProperty)).FromJust()); +} // Build a simple "fast accessor" and verify that it is being called. TEST(FastAccessor) { @@ -97,33 +113,40 @@ TEST(FastAccessor) { ExpectInt32("barf()", 124); // Call via warmed-up callsite. } - void AddInternalFieldAccessor(v8::Isolate* isolate, v8::Local<v8::Template> templ, const char* name, - int field_no) { + int field_no, bool useUncheckedLoader) { auto builder = v8::experimental::FastAccessorBuilder::New(isolate); - builder->ReturnValue( - builder->LoadInternalField(builder->GetReceiver(), field_no)); + + if (useUncheckedLoader) { + builder->ReturnValue( + builder->LoadInternalFieldUnchecked(builder->GetReceiver(), field_no)); + } else { + builder->ReturnValue( + builder->LoadInternalField(builder->GetReceiver(), field_no)); + } + templ->SetAccessorProperty(v8_str(name), v8::FunctionTemplate::NewWithFastHandler( isolate, NativePropertyAccessor, builder)); } - -// "Fast" accessor that accesses an internal field. -TEST(FastAccessorWithInternalField) { +void checkLoadInternalField(bool useUncheckedLoader, bool emitDebugChecks) { // Crankshaft support for fast accessors is not implemented; crankshafted // code uses the slow accessor which breaks this test's expectations. v8::internal::FLAG_always_opt = false; + + // De/activate debug checks. + v8::internal::FLAG_debug_code = emitDebugChecks; LocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> foo = v8::ObjectTemplate::New(isolate); foo->SetInternalFieldCount(3); - AddInternalFieldAccessor(isolate, foo, "field0", 0); - AddInternalFieldAccessor(isolate, foo, "field1", 1); - AddInternalFieldAccessor(isolate, foo, "field2", 2); + AddInternalFieldAccessor(isolate, foo, "field0", 0, useUncheckedLoader); + AddInternalFieldAccessor(isolate, foo, "field1", 1, useUncheckedLoader); + AddInternalFieldAccessor(isolate, foo, "field2", 2, useUncheckedLoader); // Create an instance w/ 3 internal fields, put in a string, a Smi, nothing. v8::Local<v8::Object> obj = foo->NewInstance(env.local()).ToLocalChecked(); @@ -142,6 +165,15 @@ TEST(FastAccessorWithInternalField) { ExpectUndefined("field2()"); } +// "Fast" accessor that accesses an internal field. +TEST(FastAccessorWithInternalField) { checkLoadInternalField(false, false); } + +// "Fast" accessor that accesses an internal field using the fast(er) +// implementation of LoadInternalField. +TEST(FastAccessorLoadInternalFieldUnchecked) { + checkLoadInternalField(true, false); + checkLoadInternalField(true, true); +} // "Fast" accessor with control flow via ...OrReturnNull methods. TEST(FastAccessorOrReturnNull) { @@ -189,9 +221,9 @@ TEST(FastAccessorOrReturnNull) { // CheckFlagSetOrReturnNull: CompileRun(FN_WARMUP("maskcheck", "return obj.maskcheck")); obj->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0xf0)); - ExpectInt32("maskcheck()", 42); - obj->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0xfe)); ExpectNull("maskcheck()"); + obj->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0xfe)); + ExpectInt32("maskcheck()", 42); } @@ -212,9 +244,9 @@ TEST(FastAccessorControlFlowWithLabels) { auto label = builder->MakeLabel(); auto val = builder->LoadInternalField(builder->GetReceiver(), 0); builder->CheckNotZeroOrJump(val, label); - builder->ReturnValue(builder->IntegerConstant(0)); - builder->SetLabel(label); builder->ReturnValue(builder->IntegerConstant(1)); + builder->SetLabel(label); + builder->ReturnValue(builder->IntegerConstant(0)); foo->SetAccessorProperty(v8_str("isnull"), v8::FunctionTemplate::NewWithFastHandler( isolate, NativePropertyAccessor, builder)); @@ -262,9 +294,9 @@ TEST(FastAccessorLoad) { auto val = builder->LoadValue( builder->LoadInternalField(builder->GetReceiver(), 0), intval_offset); builder->CheckNotZeroOrJump(val, label); - builder->ReturnValue(builder->IntegerConstant(0)); - builder->SetLabel(label); builder->ReturnValue(builder->IntegerConstant(1)); + builder->SetLabel(label); + builder->ReturnValue(builder->IntegerConstant(0)); foo->SetAccessorProperty(v8_str("nonzero"), v8::FunctionTemplate::NewWithFastHandler( isolate, NativePropertyAccessor, builder)); @@ -300,16 +332,19 @@ TEST(FastAccessorLoad) { } void ApiCallbackInt(const v8::FunctionCallbackInfo<v8::Value>& info) { + CheckImplicitParameters(info); info.GetReturnValue().Set(12345); } const char* kApiCallbackStringValue = "Hello World! Bizarro C++ world, actually."; void ApiCallbackString(const v8::FunctionCallbackInfo<v8::Value>& info) { + CheckImplicitParameters(info); info.GetReturnValue().Set(v8_str(kApiCallbackStringValue)); } void ApiCallbackParam(const v8::FunctionCallbackInfo<v8::Value>& info) { + CheckImplicitParameters(info); CHECK_EQ(1, info.Length()); CHECK(info[0]->IsNumber()); info.GetReturnValue().Set(info[0]); @@ -348,6 +383,9 @@ TEST(FastAccessorCallback) { isolate, NativePropertyAccessor, builder)); } + // Add dummy property to validate the holder. + foo->Set(isolate, kWatermarkProperty, v8::Undefined(isolate)); + // Create an instance. v8::Local<v8::Object> obj = foo->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); @@ -362,3 +400,92 @@ TEST(FastAccessorCallback) { CompileRun(FN_WARMUP("callbackparam", "return obj.param")); ExpectInt32("callbackparam()", 1000); } + +TEST(FastAccessorToSmi) { + // Crankshaft support for fast accessors is not implemented; crankshafted + // code uses the slow accessor which breaks this test's expectations. + v8::internal::FLAG_always_opt = false; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::ObjectTemplate> foo = v8::ObjectTemplate::New(isolate); + foo->SetInternalFieldCount(1); + + { + // Accessor load_smi. + auto builder = v8::experimental::FastAccessorBuilder::New(isolate); + + // Read the variable and convert it to a Smi. + auto flags = builder->LoadValue( + builder->LoadInternalField(builder->GetReceiver(), 0), 0); + builder->ReturnValue(builder->ToSmi(flags)); + foo->SetAccessorProperty(v8_str("load_smi"), + v8::FunctionTemplate::NewWithFastHandler( + isolate, NativePropertyAccessor, builder)); + } + + // Create an instance. + v8::Local<v8::Object> obj = foo->NewInstance(env.local()).ToLocalChecked(); + + uintptr_t flags; + obj->SetAlignedPointerInInternalField(0, &flags); + CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); + + // Access flags. + CompileRun(FN_WARMUP("load_smi", "return obj.load_smi")); + + flags = 54321; + ExpectInt32("load_smi()", 54321); + + flags = 0; + ExpectInt32("load_smi()", 0); + + flags = 123456789; + ExpectInt32("load_smi()", 123456789); +} + +TEST(FastAccessorGoto) { + // Crankshaft support for fast accessors is not implemented; crankshafted + // code uses the slow accessor which breaks this test's expectations. + v8::internal::FLAG_always_opt = false; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::ObjectTemplate> foo = v8::ObjectTemplate::New(isolate); + foo->SetInternalFieldCount(1); + + { + auto builder = v8::experimental::FastAccessorBuilder::New(isolate); + auto successLabel = builder->MakeLabel(); + auto failLabel = builder->MakeLabel(); + + // The underlying raw assembler is clever enough to reject unreachable + // basic blocks, this instruction has no effect besides marking the failed + // return BB as reachable. + builder->CheckNotZeroOrJump(builder->IntegerConstant(1234), failLabel); + + builder->Goto(successLabel); + + builder->SetLabel(failLabel); + builder->ReturnValue(builder->IntegerConstant(0)); + + builder->SetLabel(successLabel); + builder->ReturnValue(builder->IntegerConstant(60707357)); + + foo->SetAccessorProperty(v8_str("goto_test"), + v8::FunctionTemplate::NewWithFastHandler( + isolate, NativePropertyAccessor, builder)); + } + + // Create an instance. + v8::Local<v8::Object> obj = foo->NewInstance(env.local()).ToLocalChecked(); + + CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); + + // Access flags. + CompileRun(FN_WARMUP("test", "return obj.goto_test")); + + ExpectInt32("test()", 60707357); +} diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc index a1894fad1a..6e4c6028e9 100644 --- a/deps/v8/test/cctest/test-api-interceptors.cc +++ b/deps/v8/test/cctest/test-api-interceptors.cc @@ -16,7 +16,6 @@ #include "src/parsing/parser.h" #include "src/unicode-inl.h" #include "src/utils.h" -#include "src/vm-state.h" using ::v8::Boolean; using ::v8::BooleanObject; @@ -854,6 +853,66 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) { CHECK_EQ(42 * 10, value->Int32Value(context.local()).FromJust()); } +// Test load of a non-existing global when a global object has an interceptor. +THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::ObjectTemplate> templ_global = v8::ObjectTemplate::New(isolate); + templ_global->SetHandler(v8::NamedPropertyHandlerConfiguration( + EmptyInterceptorGetter, EmptyInterceptorSetter)); + + LocalContext context(nullptr, templ_global); + i::Handle<i::JSReceiver> global_proxy = + v8::Utils::OpenHandle<Object, i::JSReceiver>(context->Global()); + CHECK(global_proxy->IsJSGlobalProxy()); + i::Handle<i::JSGlobalObject> global( + i::JSGlobalObject::cast(global_proxy->map()->prototype())); + CHECK(global->map()->has_named_interceptor()); + + v8::Local<Value> value = CompileRun( + "var f = function() { " + " try {" + " x1;" + " } catch(e) {" + " }" + " return typeof x1 === 'undefined';" + "};" + "for (var i = 0; i < 10; i++) {" + " f();" + "};" + "f();"); + CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + + value = CompileRun( + "var f = function() { " + " try {" + " x2;" + " return false;" + " } catch(e) {" + " return true;" + " }" + "};" + "for (var i = 0; i < 10; i++) {" + " f();" + "};" + "f();"); + CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); + + value = CompileRun( + "var f = function() { " + " try {" + " typeof(x3);" + " return true;" + " } catch(e) {" + " return false;" + " }" + "};" + "for (var i = 0; i < 10; i++) {" + " f();" + "};" + "f();"); + CHECK_EQ(true, value->BooleanValue(context.local()).FromJust()); +} static void InterceptorLoadICGetter0( Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { @@ -2270,33 +2329,34 @@ THREADED_TEST(Enumerators) { // This order is not mandated by the spec, so this test is just // documenting our behavior. CHECK_EQ(17u, result->Length()); - // Indexed properties + indexed interceptor properties in numerical order. - CHECK(v8_str("0") + // Indexed properties. + CHECK(v8_str("5") ->Equals(context.local(), result->Get(context.local(), v8::Integer::New(isolate, 0)) .ToLocalChecked()) .FromJust()); - CHECK(v8_str("1") + CHECK(v8_str("10") ->Equals(context.local(), result->Get(context.local(), v8::Integer::New(isolate, 1)) .ToLocalChecked()) .FromJust()); - CHECK(v8_str("5") + CHECK(v8_str("140000") ->Equals(context.local(), result->Get(context.local(), v8::Integer::New(isolate, 2)) .ToLocalChecked()) .FromJust()); - CHECK(v8_str("10") + CHECK(v8_str("4294967294") ->Equals(context.local(), result->Get(context.local(), v8::Integer::New(isolate, 3)) .ToLocalChecked()) .FromJust()); - CHECK(v8_str("140000") + // Indexed Interceptor properties + CHECK(v8_str("0") ->Equals(context.local(), result->Get(context.local(), v8::Integer::New(isolate, 4)) .ToLocalChecked()) .FromJust()); - CHECK(v8_str("4294967294") + CHECK(v8_str("1") ->Equals(context.local(), result->Get(context.local(), v8::Integer::New(isolate, 5)) .ToLocalChecked()) @@ -3245,6 +3305,25 @@ THREADED_TEST(Regress149912) { CompileRun("Number.prototype.__proto__ = new Bug; var x = 0; x.foo();"); } +THREADED_TEST(Regress625155) { + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); + AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); + context->Global() + ->Set(context.local(), v8_str("Bug"), + templ->GetFunction(context.local()).ToLocalChecked()) + .FromJust(); + CompileRun( + "Number.prototype.__proto__ = new Bug;" + "var x;" + "x = 0xdead;" + "x.boom = 0;" + "x = 's';" + "x.boom = 0;" + "x = 1.5;" + "x.boom = 0;"); +} THREADED_TEST(Regress125988) { v8::HandleScope scope(CcTest::isolate()); diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 220b0cd077..484d2f3226 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -28,6 +28,7 @@ #include <climits> #include <csignal> #include <map> +#include <memory> #include <string> #include "test/cctest/test-api.h" @@ -40,18 +41,19 @@ #include "src/api.h" #include "src/arguments.h" #include "src/base/platform/platform.h" -#include "src/base/smart-pointers.h" +#include "src/code-stubs.h" #include "src/compilation-cache.h" #include "src/debug/debug.h" #include "src/execution.h" #include "src/futex-emulation.h" #include "src/objects.h" #include "src/parsing/parser.h" +#include "src/profiler/cpu-profiler.h" #include "src/unicode-inl.h" #include "src/utils.h" #include "src/vm-state.h" #include "test/cctest/heap/heap-tester.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" static const bool kLogThreading = false; @@ -95,11 +97,11 @@ void RunWithProfiler(void (*test)()) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); v8::Local<v8::String> profile_name = v8_str("my_profile1"); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); - + v8::CpuProfiler* cpu_profiler = v8::CpuProfiler::New(env->GetIsolate()); cpu_profiler->StartProfiling(profile_name); (*test)(); reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles(); + cpu_profiler->Dispose(); } @@ -330,6 +332,11 @@ THREADED_TEST(Access) { CHECK(!foo_after->IsUndefined()); CHECK(foo_after->IsString()); CHECK(bar_str->Equals(env.local(), foo_after).FromJust()); + + CHECK(obj->Set(env.local(), v8_str("foo"), bar_str).ToChecked()); + bool result; + CHECK(obj->Set(env.local(), v8_str("foo"), bar_str).To(&result)); + CHECK(result); } @@ -555,40 +562,19 @@ TEST(MakingExternalStringConditions) { CcTest::heap()->CollectGarbage(i::NEW_SPACE); uint16_t* two_byte_string = AsciiToTwoByteString("s1"); - Local<String> small_string = + Local<String> local_string = String::NewFromTwoByte(env->GetIsolate(), two_byte_string, v8::NewStringType::kNormal) .ToLocalChecked(); i::DeleteArray(two_byte_string); - // We should refuse to externalize small strings. - CHECK(!small_string->CanMakeExternal()); + // We should refuse to externalize new space strings. + CHECK(!local_string->CanMakeExternal()); // Trigger GCs so that the newly allocated string moves to old gen. CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now // Old space strings should be accepted. - CHECK(small_string->CanMakeExternal()); - - two_byte_string = AsciiToTwoByteString("small string 2"); - small_string = String::NewFromTwoByte(env->GetIsolate(), two_byte_string, - v8::NewStringType::kNormal) - .ToLocalChecked(); - i::DeleteArray(two_byte_string); - - const int buf_size = 10 * 1024; - char* buf = i::NewArray<char>(buf_size); - memset(buf, 'a', buf_size); - buf[buf_size - 1] = '\0'; - - two_byte_string = AsciiToTwoByteString(buf); - Local<String> large_string = - String::NewFromTwoByte(env->GetIsolate(), two_byte_string, - v8::NewStringType::kNormal) - .ToLocalChecked(); - i::DeleteArray(buf); - i::DeleteArray(two_byte_string); - // Large strings should be immediately accepted. - CHECK(large_string->CanMakeExternal()); + CHECK(local_string->CanMakeExternal()); } @@ -600,23 +586,14 @@ TEST(MakingExternalOneByteStringConditions) { CcTest::heap()->CollectGarbage(i::NEW_SPACE); CcTest::heap()->CollectGarbage(i::NEW_SPACE); - Local<String> small_string = v8_str("s1"); - // We should refuse to externalize small strings. - CHECK(!small_string->CanMakeExternal()); + Local<String> local_string = v8_str("s1"); + // We should refuse to externalize new space strings. + CHECK(!local_string->CanMakeExternal()); // Trigger GCs so that the newly allocated string moves to old gen. CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now // Old space strings should be accepted. - CHECK(small_string->CanMakeExternal()); - - const int buf_size = 10 * 1024; - char* buf = i::NewArray<char>(buf_size); - memset(buf, 'a', buf_size); - buf[buf_size - 1] = '\0'; - Local<String> large_string = v8_str(buf); - i::DeleteArray(buf); - // Large strings should be immediately accepted. - CHECK(large_string->CanMakeExternal()); + CHECK(local_string->CanMakeExternal()); } @@ -634,7 +611,7 @@ TEST(MakingExternalUnalignedOneByteString) { "slice('abcdefghijklmnopqrstuvwxyz');")); // Trigger GCs so that the newly allocated string moves to old gen. - SimulateFullSpace(CcTest::heap()->old_space()); + i::heap::SimulateFullSpace(CcTest::heap()->old_space()); CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now @@ -2142,6 +2119,95 @@ THREADED_TEST(TestObjectTemplateInheritedWithPrototype2) { Constructor_GetFunction_New); } +THREADED_TEST(TestObjectTemplateClassInheritance) { + LocalContext env; + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + + Local<v8::FunctionTemplate> fun_A = v8::FunctionTemplate::New(isolate); + fun_A->SetClassName(v8_str("A")); + + Local<ObjectTemplate> templ_A = fun_A->InstanceTemplate(); + templ_A->SetNativeDataProperty(v8_str("nirk"), GetNirk); + templ_A->SetNativeDataProperty(v8_str("rino"), GetRino); + + Local<v8::FunctionTemplate> fun_B = v8::FunctionTemplate::New(isolate); + v8::Local<v8::String> class_name = v8_str("B"); + fun_B->SetClassName(class_name); + fun_B->Inherit(fun_A); + + v8::Local<v8::String> subclass_name = v8_str("C"); + v8::Local<v8::Object> b_proto; + v8::Local<v8::Object> c_proto; + // Perform several iterations to make sure the cache doesn't break + // subclassing. + for (int i = 0; i < 3; i++) { + Local<v8::Function> function_B = + fun_B->GetFunction(env.local()).ToLocalChecked(); + if (i == 0) { + CHECK(env->Global()->Set(env.local(), class_name, function_B).FromJust()); + CompileRun("class C extends B {}"); + b_proto = + CompileRun("B.prototype")->ToObject(env.local()).ToLocalChecked(); + c_proto = + CompileRun("C.prototype")->ToObject(env.local()).ToLocalChecked(); + CHECK(b_proto->Equals(env.local(), c_proto->GetPrototype()).FromJust()); + } + Local<v8::Object> instance = + CompileRun("new C()")->ToObject(env.local()).ToLocalChecked(); + CHECK(c_proto->Equals(env.local(), instance->GetPrototype()).FromJust()); + + CHECK(subclass_name->StrictEquals(instance->GetConstructorName())); + CHECK(env->Global()->Set(env.local(), v8_str("o"), instance).FromJust()); + + CHECK_EQ(900, CompileRun("o.nirk")->IntegerValue(env.local()).FromJust()); + CHECK_EQ(560, CompileRun("o.rino")->IntegerValue(env.local()).FromJust()); + } +} + +static void NamedPropertyGetterWhichReturns42( + Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(v8_num(42)); +} + +THREADED_TEST(TestObjectTemplateReflectConstruct) { + LocalContext env; + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + + Local<v8::FunctionTemplate> fun_B = v8::FunctionTemplate::New(isolate); + fun_B->InstanceTemplate()->SetHandler( + v8::NamedPropertyHandlerConfiguration(NamedPropertyGetterWhichReturns42)); + v8::Local<v8::String> class_name = v8_str("B"); + fun_B->SetClassName(class_name); + + v8::Local<v8::String> subclass_name = v8_str("C"); + v8::Local<v8::Object> b_proto; + v8::Local<v8::Object> c_proto; + // Perform several iterations to make sure the cache doesn't break + // subclassing. + for (int i = 0; i < 3; i++) { + Local<v8::Function> function_B = + fun_B->GetFunction(env.local()).ToLocalChecked(); + if (i == 0) { + CHECK(env->Global()->Set(env.local(), class_name, function_B).FromJust()); + CompileRun("function C() {}"); + c_proto = + CompileRun("C.prototype")->ToObject(env.local()).ToLocalChecked(); + } + Local<v8::Object> instance = CompileRun("Reflect.construct(B, [], C)") + ->ToObject(env.local()) + .ToLocalChecked(); + CHECK(c_proto->Equals(env.local(), instance->GetPrototype()).FromJust()); + + CHECK(subclass_name->StrictEquals(instance->GetConstructorName())); + CHECK(env->Global()->Set(env.local(), v8_str("o"), instance).FromJust()); + + CHECK_EQ(42, CompileRun("o.nirk")->IntegerValue(env.local()).FromJust()); + CHECK_EQ(42, CompileRun("o.rino")->IntegerValue(env.local()).FromJust()); + } +} + static void GetFlabby(const v8::FunctionCallbackInfo<v8::Value>& args) { ApiTestFuzzer::Fuzz(); args.GetReturnValue().Set(v8_num(17.2)); @@ -2412,8 +2478,7 @@ THREADED_TEST(UndefinedIsNotEnumerable) { v8::Local<Script> call_recursively_script; -static const int kTargetRecursionDepth = 150; // near maximum - +static const int kTargetRecursionDepth = 100; // near maximum static void CallScriptRecursivelyCall( const v8::FunctionCallbackInfo<v8::Value>& args) { @@ -2622,6 +2687,40 @@ THREADED_TEST(InternalFieldsAlignedPointers) { CHECK_EQ(huge, Object::GetAlignedPointerFromInternalField(persistent, 0)); } +THREADED_TEST(SetAlignedPointerInInternalFields) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); + Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate(); + instance_templ->SetInternalFieldCount(2); + Local<v8::Object> obj = templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked(); + CHECK_EQ(2, obj->InternalFieldCount()); + + int* heap_allocated_1 = new int[100]; + int* heap_allocated_2 = new int[100]; + int indices[] = {0, 1}; + void* values[] = {heap_allocated_1, heap_allocated_2}; + + obj->SetAlignedPointerInInternalFields(2, indices, values); + CcTest::heap()->CollectAllGarbage(); + CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0)); + CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1)); + + indices[0] = 1; + indices[1] = 0; + obj->SetAlignedPointerInInternalFields(2, indices, values); + CcTest::heap()->CollectAllGarbage(); + CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(0)); + CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(1)); + + delete[] heap_allocated_1; + delete[] heap_allocated_2; +} static void CheckAlignedPointerInEmbedderData(LocalContext* env, int index, void* value) { @@ -2663,7 +2762,6 @@ THREADED_TEST(EmbedderDataAlignedPointers) { } } - static void CheckEmbedderData(LocalContext* env, int index, v8::Local<Value> data) { (*env)->SetEmbedderData(index, data); @@ -2738,16 +2836,15 @@ void GlobalProxyIdentityHash(bool set_in_js) { CHECK(env->Global() ->Set(env.local(), v8_str("global"), global_proxy) .FromJust()); - i::Handle<i::Object> original_hash; + int32_t hash1; if (set_in_js) { CompileRun("var m = new Set(); m.add(global);"); - original_hash = i::Handle<i::Object>(i_global_proxy->GetHash(), i_isolate); + i::Object* original_hash = i_global_proxy->GetHash(); + CHECK(original_hash->IsSmi()); + hash1 = i::Smi::cast(original_hash)->value(); } else { - original_hash = i::Handle<i::Object>( - i::Object::GetOrCreateHash(i_isolate, i_global_proxy)); + hash1 = i::Object::GetOrCreateHash(i_isolate, i_global_proxy)->value(); } - CHECK(original_hash->IsSmi()); - int32_t hash1 = i::Handle<i::Smi>::cast(original_hash)->value(); // Hash should be retained after being detached. env->DetachGlobal(); int hash2 = global_proxy->GetIdentityHash(); @@ -4687,126 +4784,6 @@ THREADED_TEST(ApiObjectGroupsCycle) { } -// TODO(mstarzinger): This should be a THREADED_TEST but causes failures -// on the buildbots, so was made non-threaded for the time being. -TEST(ApiObjectGroupsCycleForScavenger) { - i::FLAG_stress_compaction = false; - i::FLAG_gc_global = false; - LocalContext env; - v8::Isolate* iso = env->GetIsolate(); - HandleScope scope(iso); - - WeakCallCounter counter(1234); - - WeakCallCounterAndPersistent<Value> g1s1(&counter); - WeakCallCounterAndPersistent<Value> g1s2(&counter); - WeakCallCounterAndPersistent<Value> g2s1(&counter); - WeakCallCounterAndPersistent<Value> g2s2(&counter); - WeakCallCounterAndPersistent<Value> g3s1(&counter); - WeakCallCounterAndPersistent<Value> g3s2(&counter); - - { - HandleScope scope(iso); - g1s1.handle.Reset(iso, Object::New(iso)); - g1s2.handle.Reset(iso, Object::New(iso)); - g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - - g2s1.handle.Reset(iso, Object::New(iso)); - g2s2.handle.Reset(iso, Object::New(iso)); - g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - - g3s1.handle.Reset(iso, Object::New(iso)); - g3s2.handle.Reset(iso, Object::New(iso)); - g3s1.handle.SetWeak(&g3s1, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - g3s2.handle.SetWeak(&g3s2, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - } - - // Make a root. - WeakCallCounterAndPersistent<Value> root(&counter); - root.handle.Reset(iso, g1s1.handle); - root.handle.MarkPartiallyDependent(); - - // Connect groups. We're building the following cycle: - // G1: { g1s1, g2s1 }, g1s1 implicitly references g2s1, ditto for other - // groups. - { - HandleScope handle_scope(iso); - g1s1.handle.MarkPartiallyDependent(); - g1s2.handle.MarkPartiallyDependent(); - g2s1.handle.MarkPartiallyDependent(); - g2s2.handle.MarkPartiallyDependent(); - g3s1.handle.MarkPartiallyDependent(); - g3s2.handle.MarkPartiallyDependent(); - iso->SetObjectGroupId(g1s1.handle, UniqueId(1)); - iso->SetObjectGroupId(g1s2.handle, UniqueId(1)); - Local<Object>::New(iso, g1s1.handle.As<Object>()) - ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g2s1.handle)) - .FromJust(); - iso->SetObjectGroupId(g2s1.handle, UniqueId(2)); - iso->SetObjectGroupId(g2s2.handle, UniqueId(2)); - Local<Object>::New(iso, g2s1.handle.As<Object>()) - ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g3s1.handle)) - .FromJust(); - iso->SetObjectGroupId(g3s1.handle, UniqueId(3)); - iso->SetObjectGroupId(g3s2.handle, UniqueId(3)); - Local<Object>::New(iso, g3s1.handle.As<Object>()) - ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g1s1.handle)) - .FromJust(); - } - - v8::internal::Heap* heap = - reinterpret_cast<v8::internal::Isolate*>(iso)->heap(); - heap->CollectAllGarbage(); - - // All objects should be alive. - CHECK_EQ(0, counter.NumberOfWeakCalls()); - - // Weaken the root. - root.handle.SetWeak(&root, &WeakPointerCallback, - v8::WeakCallbackType::kParameter); - root.handle.MarkPartiallyDependent(); - - // Groups are deleted, rebuild groups. - { - HandleScope handle_scope(iso); - g1s1.handle.MarkPartiallyDependent(); - g1s2.handle.MarkPartiallyDependent(); - g2s1.handle.MarkPartiallyDependent(); - g2s2.handle.MarkPartiallyDependent(); - g3s1.handle.MarkPartiallyDependent(); - g3s2.handle.MarkPartiallyDependent(); - iso->SetObjectGroupId(g1s1.handle, UniqueId(1)); - iso->SetObjectGroupId(g1s2.handle, UniqueId(1)); - Local<Object>::New(iso, g1s1.handle.As<Object>()) - ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g2s1.handle)) - .FromJust(); - iso->SetObjectGroupId(g2s1.handle, UniqueId(2)); - iso->SetObjectGroupId(g2s2.handle, UniqueId(2)); - Local<Object>::New(iso, g2s1.handle.As<Object>()) - ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g3s1.handle)) - .FromJust(); - iso->SetObjectGroupId(g3s1.handle, UniqueId(3)); - iso->SetObjectGroupId(g3s2.handle, UniqueId(3)); - Local<Object>::New(iso, g3s1.handle.As<Object>()) - ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g1s1.handle)) - .FromJust(); - } - - heap->CollectAllGarbage(); - - // All objects should be gone. 7 global handles in total. - CHECK_EQ(7, counter.NumberOfWeakCalls()); -} - - THREADED_TEST(ScriptException) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); @@ -6511,6 +6488,46 @@ THREADED_TEST(Equality) { CHECK(!v8::False(isolate)->SameValue(v8::Undefined(isolate))); } +THREADED_TEST(TypeOf) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope scope(context->GetIsolate()); + + Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate); + Local<v8::Function> fun = t1->GetFunction(context.local()).ToLocalChecked(); + + CHECK(v8::Undefined(isolate) + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("undefined")) + .FromJust()); + CHECK(v8::Null(isolate) + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("object")) + .FromJust()); + CHECK(v8_str("str") + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("string")) + .FromJust()); + CHECK(v8_num(0.0) + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("number")) + .FromJust()); + CHECK(v8_num(1) + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("number")) + .FromJust()); + CHECK(v8::Object::New(isolate) + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("object")) + .FromJust()); + CHECK(v8::Boolean::New(isolate, true) + ->TypeOf(isolate) + ->Equals(context.local(), v8_str("boolean")) + .FromJust()); + CHECK(fun->TypeOf(isolate) + ->Equals(context.local(), v8_str("function")) + .FromJust()); +} THREADED_TEST(MultiRun) { LocalContext context; @@ -9046,33 +9063,6 @@ TEST(ApiUncaughtException) { } -TEST(ApiUncaughtExceptionInObjectObserve) { - v8::internal::FLAG_harmony_object_observe = true; - v8::internal::FLAG_stack_size = 150; - report_count = 0; - LocalContext env; - v8::Isolate* isolate = env->GetIsolate(); - v8::HandleScope scope(isolate); - isolate->AddMessageListener(ApiUncaughtExceptionTestListener); - CompileRun( - "var obj = {};" - "var observe_count = 0;" - "function observer1() { ++observe_count; };" - "function observer2() { ++observe_count; };" - "function observer_throws() { throw new Error(); };" - "function stack_overflow() { return (function f(x) { f(x+1); })(0); };" - "Object.observe(obj, observer_throws.bind());" - "Object.observe(obj, observer1);" - "Object.observe(obj, stack_overflow);" - "Object.observe(obj, observer2);" - "Object.observe(obj, observer_throws.bind());" - "obj.foo = 'bar';"); - CHECK_EQ(3, report_count); - ExpectInt32("observe_count", 2); - isolate->RemoveMessageListeners(ApiUncaughtExceptionTestListener); -} - - static const char* script_resource_name = "ExceptionInNativeScript.js"; static void ExceptionInNativeScriptTestListener(v8::Local<v8::Message> message, v8::Local<Value>) { @@ -10179,6 +10169,12 @@ static bool AccessAlwaysBlocked(Local<v8::Context> accessing_context, return false; } +static bool AccessAlwaysAllowed(Local<v8::Context> accessing_context, + Local<v8::Object> global, + Local<v8::Value> data) { + i::PrintF("Access allowed.\n"); + return true; +} THREADED_TEST(AccessControlGetOwnPropertyNames) { v8::Isolate* isolate = CcTest::isolate(); @@ -10541,6 +10537,69 @@ THREADED_TEST(GlobalObjectInstanceProperties) { } } +THREADED_TEST(ObjectGetOwnPropertyNames) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + v8::Local<v8::Object> value = + v8::Local<v8::Object>::Cast(v8::StringObject::New(v8_str("test"))); + v8::Local<v8::Array> properties; + + CHECK(value + ->GetOwnPropertyNames(context.local(), + static_cast<v8::PropertyFilter>( + v8::PropertyFilter::ALL_PROPERTIES | + v8::PropertyFilter::SKIP_SYMBOLS)) + .ToLocal(&properties)); + CHECK_EQ(5, properties->Length()); + v8::Local<v8::Value> property; + CHECK(properties->Get(context.local(), 4).ToLocal(&property) && + property->IsString()); + CHECK(property.As<v8::String>() + ->Equals(context.local(), v8_str("length")) + .FromMaybe(false)); + for (int i = 0; i < 4; ++i) { + v8::Local<v8::Value> property; + CHECK(properties->Get(context.local(), i).ToLocal(&property) && + property->IsInt32()); + CHECK_EQ(property.As<v8::Int32>()->Value(), i); + } + + CHECK(value->GetOwnPropertyNames(context.local(), v8::ONLY_ENUMERABLE) + .ToLocal(&properties)); + CHECK_EQ(4, properties->Length()); + for (int i = 0; i < 4; ++i) { + v8::Local<v8::Value> property; + CHECK(properties->Get(context.local(), i).ToLocal(&property) && + property->IsInt32()); + CHECK_EQ(property.As<v8::Int32>()->Value(), i); + } + + value = value->GetPrototype().As<v8::Object>(); + CHECK(value + ->GetOwnPropertyNames(context.local(), + static_cast<v8::PropertyFilter>( + v8::PropertyFilter::ALL_PROPERTIES | + v8::PropertyFilter::SKIP_SYMBOLS)) + .ToLocal(&properties)); + bool concat_found = false; + bool starts_with_found = false; + for (uint32_t i = 0; i < properties->Length(); ++i) { + v8::Local<v8::Value> property; + CHECK(properties->Get(context.local(), i).ToLocal(&property)); + if (!property->IsString()) continue; + if (!concat_found) + concat_found = property.As<v8::String>() + ->Equals(context.local(), v8_str("concat")) + .FromMaybe(false); + if (!starts_with_found) + starts_with_found = property.As<v8::String>() + ->Equals(context.local(), v8_str("startsWith")) + .FromMaybe(false); + } + CHECK(concat_found && starts_with_found); +} THREADED_TEST(CallKnownGlobalReceiver) { v8::Isolate* isolate = CcTest::isolate(); @@ -11185,6 +11244,7 @@ THREADED_TEST(FunctionRemovePrototype) { Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate); t1->RemovePrototype(); Local<v8::Function> fun = t1->GetFunction(context.local()).ToLocalChecked(); + CHECK(!fun->IsConstructor()); CHECK(context->Global()->Set(context.local(), v8_str("fun"), fun).FromJust()); CHECK(!CompileRun("'prototype' in fun") ->BooleanValue(context.local()) @@ -11648,6 +11708,9 @@ THREADED_TEST(EvalInDetachedGlobal) { v8::Local<Context> context0 = Context::New(isolate); v8::Local<Context> context1 = Context::New(isolate); + Local<String> token = v8_str("<security token>"); + context0->SetSecurityToken(token); + context1->SetSecurityToken(token); // Set up function in context0 that uses eval from context0. context0->Enter(); @@ -11661,15 +11724,14 @@ THREADED_TEST(EvalInDetachedGlobal) { // Put the function into context1 and call it before and after // detaching the global. Before detaching, the call succeeds and - // after detaching and exception is thrown. + // after detaching undefined is returned. context1->Enter(); CHECK(context1->Global()->Set(context1, v8_str("fun"), fun).FromJust()); v8::Local<v8::Value> x_value = CompileRun("fun('x')"); CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); context0->DetachGlobal(); - v8::TryCatch catcher(isolate); x_value = CompileRun("fun('x')"); - CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); + CHECK(x_value->IsUndefined()); context1->Exit(); } @@ -13261,6 +13323,43 @@ THREADED_TEST(IsConstructCall) { CHECK(value->BooleanValue(context.local()).FromJust()); } +static void NewTargetHandler(const v8::FunctionCallbackInfo<v8::Value>& args) { + ApiTestFuzzer::Fuzz(); + args.GetReturnValue().Set(args.NewTarget()); +} + +THREADED_TEST(NewTargetHandler) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + + // Function template with call handler. + Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); + templ->SetCallHandler(NewTargetHandler); + + LocalContext context; + + Local<Function> function = + templ->GetFunction(context.local()).ToLocalChecked(); + CHECK(context->Global() + ->Set(context.local(), v8_str("f"), function) + .FromJust()); + Local<Value> value = CompileRun("f()"); + CHECK(value->IsUndefined()); + value = CompileRun("new f()"); + CHECK(value->IsFunction()); + CHECK(value == function); + Local<Value> subclass = CompileRun("var g = class extends f { }; g"); + CHECK(subclass->IsFunction()); + value = CompileRun("new g()"); + CHECK(value->IsFunction()); + CHECK(value == subclass); + value = CompileRun("Reflect.construct(f, [], Array)"); + CHECK(value->IsFunction()); + CHECK(value == + context->Global() + ->Get(context.local(), v8_str("Array")) + .ToLocalChecked()); +} THREADED_TEST(ObjectProtoToString) { v8::Isolate* isolate = CcTest::isolate(); @@ -13298,7 +13397,7 @@ THREADED_TEST(ObjectProtoToString) { value = context->Global()->ObjectProtoToString(context.local()).ToLocalChecked(); CHECK(value->IsString() && - value->Equals(context.local(), v8_str("[object global]")).FromJust()); + value->Equals(context.local(), v8_str("[object Object]")).FromJust()); // Check ordinary object Local<Value> object = @@ -13344,7 +13443,7 @@ TEST(ObjectProtoToStringES6) { value = context->Global()->ObjectProtoToString(context.local()).ToLocalChecked(); CHECK(value->IsString() && - value->Equals(context.local(), v8_str("[object global]")).FromJust()); + value->Equals(context.local(), v8_str("[object Object]")).FromJust()); // Check ordinary object Local<Value> object = CompileRun("new Object()"); @@ -13707,6 +13806,16 @@ void ApiTestFuzzer::TearDown() { } } +void ApiTestFuzzer::CallTest() { + v8::Isolate::Scope scope(CcTest::isolate()); + if (kLogThreading) + printf("Start test %s #%d\n", + RegisterThreadedTest::nth(test_number_)->name(), test_number_); + CallTestNumber(test_number_); + if (kLogThreading) + printf("End test %s #%d\n", RegisterThreadedTest::nth(test_number_)->name(), + test_number_); +} // Lets not be needlessly self-referential. TEST(Threading1) { @@ -13737,16 +13846,6 @@ TEST(Threading4) { } -void ApiTestFuzzer::CallTest() { - v8::Isolate::Scope scope(CcTest::isolate()); - if (kLogThreading) - printf("Start test %d\n", test_number_); - CallTestNumber(test_number_); - if (kLogThreading) - printf("End test %d\n", test_number_); -} - - static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) { v8::Isolate* isolate = args.GetIsolate(); CHECK(v8::Locker::IsLocked(isolate)); @@ -14416,7 +14515,6 @@ int SetFunctionEntryHookTest::CountInvocations( return invocations; } - void SetFunctionEntryHookTest::RunLoopInNewEnv(v8::Isolate* isolate) { v8::HandleScope outer(isolate); v8::Local<Context> env = Context::New(isolate); @@ -14474,10 +14572,19 @@ void SetFunctionEntryHookTest::RunTest() { RunLoopInNewEnv(isolate); - // Check the exepected invocation counts. - CHECK_EQ(2, CountInvocations(NULL, "bar")); - CHECK_EQ(200, CountInvocations("bar", "foo")); - CHECK_EQ(200, CountInvocations(NULL, "foo")); + // Check the expected invocation counts. + if (!i::FLAG_ignition) { + CHECK_EQ(2, CountInvocations(NULL, "bar")); + CHECK_EQ(200, CountInvocations("bar", "foo")); + CHECK_EQ(200, CountInvocations(NULL, "foo")); + } else { + // For ignition we don't see the actual functions being called, instead + // we see the IterpreterEntryTrampoline at least 102 times + // (100 unoptimized calls to foo, and 2 calls to bar). + CHECK_LE(102, CountInvocations(NULL, "InterpreterEntryTrampoline")); + // We should also see the calls to the optimized function foo. + CHECK_EQ(100, CountInvocations(NULL, "foo")); + } // Verify that we have an entry hook on some specific stubs. CHECK_NE(0, CountInvocations(NULL, "CEntryStub")); @@ -14519,9 +14626,8 @@ TEST(SetFunctionEntryHook) { test.RunTest(); } - -static i::HashMap* code_map = NULL; -static i::HashMap* jitcode_line_info = NULL; +static v8::base::HashMap* code_map = NULL; +static v8::base::HashMap* jitcode_line_info = NULL; static int saw_bar = 0; static int move_events = 0; @@ -14581,7 +14687,7 @@ static void event_handler(const v8::JitCodeEvent* event) { CHECK(event->code_start != NULL); CHECK_NE(0, static_cast<int>(event->code_len)); CHECK(event->name.str != NULL); - i::HashMap::Entry* entry = code_map->LookupOrInsert( + v8::base::HashMap::Entry* entry = code_map->LookupOrInsert( event->code_start, i::ComputePointerHash(event->code_start)); entry->value = reinterpret_cast<void*>(event->code_len); @@ -14600,7 +14706,8 @@ static void event_handler(const v8::JitCodeEvent* event) { // Compiler::RecordFunctionCompilation) and the line endings // calculations can cause a GC, which can move the newly created code // before its existence can be logged. - i::HashMap::Entry* entry = code_map->Lookup(event->code_start, hash); + v8::base::HashMap::Entry* entry = + code_map->Lookup(event->code_start, hash); if (entry != NULL) { ++move_events; @@ -14627,7 +14734,7 @@ static void event_handler(const v8::JitCodeEvent* event) { DummyJitCodeLineInfo* line_info = new DummyJitCodeLineInfo(); v8::JitCodeEvent* temp_event = const_cast<v8::JitCodeEvent*>(event); temp_event->user_data = line_info; - i::HashMap::Entry* entry = jitcode_line_info->LookupOrInsert( + v8::base::HashMap::Entry* entry = jitcode_line_info->LookupOrInsert( line_info, i::ComputePointerHash(line_info)); entry->value = reinterpret_cast<void*>(line_info); } @@ -14638,7 +14745,7 @@ static void event_handler(const v8::JitCodeEvent* event) { case v8::JitCodeEvent::CODE_END_LINE_INFO_RECORDING: { CHECK(event->user_data != NULL); uint32_t hash = i::ComputePointerHash(event->user_data); - i::HashMap::Entry* entry = + v8::base::HashMap::Entry* entry = jitcode_line_info->Lookup(event->user_data, hash); CHECK(entry != NULL); delete reinterpret_cast<DummyJitCodeLineInfo*>(event->user_data); @@ -14648,7 +14755,7 @@ static void event_handler(const v8::JitCodeEvent* event) { case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: { CHECK(event->user_data != NULL); uint32_t hash = i::ComputePointerHash(event->user_data); - i::HashMap::Entry* entry = + v8::base::HashMap::Entry* entry = jitcode_line_info->Lookup(event->user_data, hash); CHECK(entry != NULL); } @@ -14690,10 +14797,10 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { { v8::HandleScope scope(isolate); - i::HashMap code(MatchPointers); + v8::base::HashMap code(MatchPointers); code_map = &code; - i::HashMap lineinfo(MatchPointers); + v8::base::HashMap lineinfo(MatchPointers); jitcode_line_info = &lineinfo; saw_bar = 0; @@ -14707,8 +14814,8 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { for (int i = 0; i < kIterations; ++i) { LocalContext env(isolate); i::AlwaysAllocateScope always_allocate(i_isolate); - SimulateFullSpace(i::FLAG_ignition ? heap->old_space() - : heap->code_space()); + i::heap::SimulateFullSpace(i::FLAG_ignition ? heap->old_space() + : heap->code_space()); CompileRun(script); // Keep a strong reference to the code object in the handle scope. @@ -14756,10 +14863,10 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { CompileRun(script); // Now get code through initial iteration. - i::HashMap code(MatchPointers); + v8::base::HashMap code(MatchPointers); code_map = &code; - i::HashMap lineinfo(MatchPointers); + v8::base::HashMap lineinfo(MatchPointers); jitcode_line_info = &lineinfo; isolate->SetJitCodeEventHandler(v8::kJitCodeEventEnumExisting, @@ -14792,8 +14899,7 @@ THREADED_TEST(ExternalAllocatedMemory) { isolate->AdjustAmountOfExternalAllocatedMemory(kSize)); CHECK_EQ(baseline, isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)); - const int64_t kTriggerGCSize = - v8::internal::Internals::kExternalAllocationLimit + 1; + const int64_t kTriggerGCSize = i::kExternalAllocationLimit + 1; CHECK_EQ(baseline + kTriggerGCSize, isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize)); CHECK_EQ(baseline, @@ -14805,8 +14911,7 @@ TEST(Regress51719) { i::FLAG_incremental_marking = false; CcTest::InitializeVM(); - const int64_t kTriggerGCSize = - v8::internal::Internals::kExternalAllocationLimit + 1; + const int64_t kTriggerGCSize = i::kExternalAllocationLimit + 1; v8::Isolate* isolate = CcTest::isolate(); isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize); } @@ -14981,18 +15086,39 @@ THREADED_TEST(DateAccess) { CHECK_EQ(1224744689038.0, date.As<v8::Date>()->ValueOf()); } +void CheckIsSymbolAt(v8::Isolate* isolate, v8::Local<v8::Array> properties, + unsigned index, const char* name) { + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + v8::Local<v8::Value> value = + properties->Get(context, v8::Integer::New(isolate, index)) + .ToLocalChecked(); + CHECK(value->IsSymbol()); + v8::String::Utf8Value symbol_name(Local<Symbol>::Cast(value)->Name()); + CHECK_EQ(0, strcmp(name, *symbol_name)); +} + +void CheckStringArray(v8::Isolate* isolate, v8::Local<v8::Array> properties, + unsigned length, const char* names[]) { + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + CHECK_EQ(length, properties->Length()); + for (unsigned i = 0; i < length; i++) { + v8::Local<v8::Value> value = + properties->Get(context, v8::Integer::New(isolate, i)).ToLocalChecked(); + if (names[i] == nullptr) { + DCHECK(value->IsSymbol()); + } else { + v8::String::Utf8Value elm(value); + CHECK_EQ(0, strcmp(names[i], *elm)); + } + } +} void CheckProperties(v8::Isolate* isolate, v8::Local<v8::Value> val, - unsigned elmc, const char* elmv[]) { + unsigned length, const char* names[]) { v8::Local<v8::Context> context = isolate->GetCurrentContext(); v8::Local<v8::Object> obj = val.As<v8::Object>(); v8::Local<v8::Array> props = obj->GetPropertyNames(context).ToLocalChecked(); - CHECK_EQ(elmc, props->Length()); - for (unsigned i = 0; i < elmc; i++) { - v8::String::Utf8Value elm( - props->Get(context, v8::Integer::New(isolate, i)).ToLocalChecked()); - CHECK_EQ(0, strcmp(elmv[i], *elm)); - } + CheckStringArray(isolate, props, length, names); } @@ -15103,6 +15229,97 @@ THREADED_TEST(PropertyEnumeration2) { } } +THREADED_TEST(PropertyNames) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::Value> result = CompileRun( + "var result = {0: 0, 1: 1, a: 2, b: 3};" + "result[Symbol('symbol')] = true;" + "result.__proto__ = {2: 4, 3: 5, c: 6, d: 7};" + "result;"); + v8::Local<v8::Object> object = result.As<v8::Object>(); + v8::PropertyFilter default_filter = + static_cast<v8::PropertyFilter>(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS); + v8::PropertyFilter include_symbols_filter = v8::ONLY_ENUMERABLE; + + v8::Local<v8::Array> properties = + object->GetPropertyNames(context.local()).ToLocalChecked(); + const char* expected_properties1[] = {"0", "1", "a", "b", "2", "3", "c", "d"}; + CheckStringArray(isolate, properties, 8, expected_properties1); + + properties = + object + ->GetPropertyNames(context.local(), + v8::KeyCollectionMode::kIncludePrototypes, + default_filter, v8::IndexFilter::kIncludeIndices) + .ToLocalChecked(); + CheckStringArray(isolate, properties, 8, expected_properties1); + + properties = object + ->GetPropertyNames(context.local(), + v8::KeyCollectionMode::kIncludePrototypes, + include_symbols_filter, + v8::IndexFilter::kIncludeIndices) + .ToLocalChecked(); + const char* expected_properties1_1[] = {"0", "1", "a", "b", nullptr, + "2", "3", "c", "d"}; + CheckStringArray(isolate, properties, 9, expected_properties1_1); + CheckIsSymbolAt(isolate, properties, 4, "symbol"); + + properties = + object + ->GetPropertyNames(context.local(), + v8::KeyCollectionMode::kIncludePrototypes, + default_filter, v8::IndexFilter::kSkipIndices) + .ToLocalChecked(); + const char* expected_properties2[] = {"a", "b", "c", "d"}; + CheckStringArray(isolate, properties, 4, expected_properties2); + + properties = object + ->GetPropertyNames(context.local(), + v8::KeyCollectionMode::kIncludePrototypes, + include_symbols_filter, + v8::IndexFilter::kSkipIndices) + .ToLocalChecked(); + const char* expected_properties2_1[] = {"a", "b", nullptr, "c", "d"}; + CheckStringArray(isolate, properties, 5, expected_properties2_1); + CheckIsSymbolAt(isolate, properties, 2, "symbol"); + + properties = + object + ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly, + default_filter, v8::IndexFilter::kIncludeIndices) + .ToLocalChecked(); + const char* expected_properties3[] = {"0", "1", "a", "b"}; + CheckStringArray(isolate, properties, 4, expected_properties3); + + properties = object + ->GetPropertyNames( + context.local(), v8::KeyCollectionMode::kOwnOnly, + include_symbols_filter, v8::IndexFilter::kIncludeIndices) + .ToLocalChecked(); + const char* expected_properties3_1[] = {"0", "1", "a", "b", nullptr}; + CheckStringArray(isolate, properties, 5, expected_properties3_1); + CheckIsSymbolAt(isolate, properties, 4, "symbol"); + + properties = + object + ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly, + default_filter, v8::IndexFilter::kSkipIndices) + .ToLocalChecked(); + const char* expected_properties4[] = {"a", "b"}; + CheckStringArray(isolate, properties, 2, expected_properties4); + + properties = object + ->GetPropertyNames( + context.local(), v8::KeyCollectionMode::kOwnOnly, + include_symbols_filter, v8::IndexFilter::kSkipIndices) + .ToLocalChecked(); + const char* expected_properties4_1[] = {"a", "b", nullptr}; + CheckStringArray(isolate, properties, 3, expected_properties4_1); + CheckIsSymbolAt(isolate, properties, 2, "symbol"); +} THREADED_TEST(AccessChecksReenabledCorrectly) { LocalContext context; @@ -16824,40 +17041,6 @@ TEST(CaptureStackTraceForUncaughtException) { CHECK_EQ(1, report_count); } - -TEST(GetStackTraceForUncaughtExceptionFromSimpleStackTrace) { - report_count = 0; - LocalContext env; - v8::Isolate* isolate = env->GetIsolate(); - v8::HandleScope scope(isolate); - - // Create an Error object first. - CompileRunWithOrigin( - "function foo() {\n" - "e=new Error('err');\n" - "};\n" - "function bar() {\n" - " foo();\n" - "};\n" - "var e;", - "origin"); - v8::Local<v8::Object> global = env->Global(); - Local<Value> trouble = - global->Get(env.local(), v8_str("bar")).ToLocalChecked(); - CHECK(trouble->IsFunction()); - Function::Cast(*trouble)->Call(env.local(), global, 0, NULL).ToLocalChecked(); - - // Enable capturing detailed stack trace late, and throw the exception. - // The detailed stack trace should be extracted from the simple stack. - isolate->AddMessageListener(StackTraceForUncaughtExceptionListener); - isolate->SetCaptureStackTraceForUncaughtExceptions(true); - CompileRunWithOrigin("throw e", "origin"); - isolate->SetCaptureStackTraceForUncaughtExceptions(false); - isolate->RemoveMessageListeners(StackTraceForUncaughtExceptionListener); - CHECK_EQ(1, report_count); -} - - TEST(CaptureStackTraceForUncaughtExceptionAndSetters) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -18371,7 +18554,6 @@ THREADED_TEST(FunctionGetInferredName) { THREADED_TEST(FunctionGetDebugName) { - i::FLAG_harmony_function_name = true; LocalContext env; v8::HandleScope scope(env->GetIsolate()); const char* code = @@ -18728,12 +18910,6 @@ TEST(SetterOnConstructorPrototype) { } -static void NamedPropertyGetterWhichReturns42( - Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { - info.GetReturnValue().Set(v8_num(42)); -} - - static void NamedPropertySetterWhichSetsYOnThisTo23( Local<Name> name, Local<Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { @@ -18916,7 +19092,7 @@ void PrologueCallbackAlloc(v8::Isolate* isolate, ++prologue_call_count_alloc; // Simulate full heap to see if we will reenter this callback - SimulateFullSpace(CcTest::heap()->new_space()); + i::heap::SimulateFullSpace(CcTest::heap()->new_space()); Local<Object> obj = Object::New(isolate); CHECK(!obj.IsEmpty()); @@ -18936,7 +19112,7 @@ void EpilogueCallbackAlloc(v8::Isolate* isolate, ++epilogue_call_count_alloc; // Simulate full heap to see if we will reenter this callback - SimulateFullSpace(CcTest::heap()->new_space()); + i::heap::SimulateFullSpace(CcTest::heap()->new_space()); Local<Object> obj = Object::New(isolate); CHECK(!obj.IsEmpty()); @@ -19126,8 +19302,7 @@ TEST(ContainsOnlyOneByte) { const int length = 512; // Ensure word aligned assignment. const int aligned_length = length*sizeof(uintptr_t)/sizeof(uint16_t); - v8::base::SmartArrayPointer<uintptr_t> aligned_contents( - new uintptr_t[aligned_length]); + std::unique_ptr<uintptr_t[]> aligned_contents(new uintptr_t[aligned_length]); uint16_t* string_contents = reinterpret_cast<uint16_t*>(aligned_contents.get()); // Set to contain only one byte. @@ -19912,7 +20087,6 @@ TEST(PersistentHandleInNewSpaceVisitor) { TEST(RegExp) { - i::FLAG_harmony_unicode_regexps = true; LocalContext context; v8::HandleScope scope(context->GetIsolate()); @@ -20313,6 +20487,7 @@ TEST(HasOwnProperty) { HasOwnPropertyNamedPropertyGetter)); Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(!instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); + CHECK(!instance->HasOwnProperty(env.local(), 42).FromJust()); CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); } @@ -20322,7 +20497,9 @@ TEST(HasOwnProperty) { HasOwnPropertyIndexedPropertyGetter)); Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); + CHECK(instance->HasOwnProperty(env.local(), 42).FromJust()); CHECK(!instance->HasOwnProperty(env.local(), v8_str("43")).FromJust()); + CHECK(!instance->HasOwnProperty(env.local(), 43).FromJust()); CHECK(!instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); } { // Check named query interceptors. @@ -20339,7 +20516,9 @@ TEST(HasOwnProperty) { 0, 0, HasOwnPropertyIndexedPropertyQuery)); Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); + CHECK(instance->HasOwnProperty(env.local(), 42).FromJust()); CHECK(!instance->HasOwnProperty(env.local(), v8_str("41")).FromJust()); + CHECK(!instance->HasOwnProperty(env.local(), 41).FromJust()); } { // Check callbacks. Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); @@ -20917,6 +21096,7 @@ TEST(CallCompletedCallbackTwoExceptions) { static void MicrotaskOne(const v8::FunctionCallbackInfo<Value>& info) { + CHECK(v8::MicrotasksScope::IsRunningMicrotasks(info.GetIsolate())); v8::HandleScope scope(info.GetIsolate()); v8::MicrotasksScope microtasks(info.GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); @@ -20925,6 +21105,7 @@ static void MicrotaskOne(const v8::FunctionCallbackInfo<Value>& info) { static void MicrotaskTwo(const v8::FunctionCallbackInfo<Value>& info) { + CHECK(v8::MicrotasksScope::IsRunningMicrotasks(info.GetIsolate())); v8::HandleScope scope(info.GetIsolate()); v8::MicrotasksScope microtasks(info.GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); @@ -20943,6 +21124,7 @@ static void MicrotaskThree(void* data) { TEST(EnqueueMicrotask) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); + CHECK(!v8::MicrotasksScope::IsRunningMicrotasks(env->GetIsolate())); CompileRun( "var ext1Calls = 0;" "var ext2Calls = 0;"); @@ -21282,48 +21464,17 @@ TEST(ScopedMicrotasks) { env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); } - -static void DebugEventInObserver(const v8::Debug::EventDetails& event_details) { - v8::DebugEvent event = event_details.GetEvent(); - if (event != v8::Break) return; - Local<Object> exec_state = event_details.GetExecutionState(); - Local<Context> context = CcTest::isolate()->GetCurrentContext(); - Local<Value> break_id = - exec_state->Get(context, v8_str("break_id")).ToLocalChecked(); - CompileRun("function f(id) { new FrameDetails(id, 0); }"); - Local<Function> fun = Local<Function>::Cast( - CcTest::global()->Get(context, v8_str("f")).ToLocalChecked()); - fun->Call(context, CcTest::global(), 1, &break_id).ToLocalChecked(); -} - - -TEST(Regress385349) { - i::FLAG_harmony_object_observe = true; - i::FLAG_allow_natives_syntax = true; - v8::Isolate* isolate = CcTest::isolate(); - HandleScope handle_scope(isolate); - isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit); - Local<Context> context = Context::New(isolate); - v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver); - { - Context::Scope context_scope(context); - CompileRun("var obj = {};" - "Object.observe(obj, function(changes) { debugger; });" - "obj.a = 0;"); - } - isolate->RunMicrotasks(); - isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); - v8::Debug::SetDebugEventListener(isolate, nullptr); -} - - #ifdef ENABLE_DISASSEMBLER -static int probes_counter = 0; -static int misses_counter = 0; -static int updates_counter = 0; +// FLAG_test_primary_stub_cache and FLAG_test_secondary_stub_cache are read +// only when ENABLE_DISASSEMBLER is not defined. + +namespace { +int probes_counter = 0; +int misses_counter = 0; +int updates_counter = 0; -static int* LookupCounter(const char* name) { +int* LookupCounter(const char* name) { if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { return &probes_counter; } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) { @@ -21334,24 +21485,33 @@ static int* LookupCounter(const char* name) { return NULL; } +const char* kMegamorphicTestProgram = + "function CreateClass(name) {\n" + " var src = \n" + " ` function ${name}() {};` +\n" + " ` ${name}.prototype.foo = function() {};` +\n" + " ` ${name};\\n`;\n" + " return (0, eval)(src);\n" + "}\n" + "function fooify(obj) { obj.foo(); };\n" + "var objs = [];\n" + "for (var i = 0; i < 50; i++) {\n" + " var Class = CreateClass('Class' + i);\n" + " var obj = new Class();\n" + " objs.push(obj);\n" + "}\n" + "for (var i = 0; i < 1000; i++) {\n" + " for (var obj of objs) {\n" + " fooify(obj);\n" + " }\n" + "}\n"; -static const char* kMegamorphicTestProgram = - "function ClassA() { };" - "function ClassB() { };" - "ClassA.prototype.foo = function() { };" - "ClassB.prototype.foo = function() { };" - "function fooify(obj) { obj.foo(); };" - "var a = new ClassA();" - "var b = new ClassB();" - "for (var i = 0; i < 10000; i++) {" - " fooify(a);" - " fooify(b);" - "}"; -#endif - +void TestStubCache(bool primary) { + // The test does not work with interpreter because bytecode handlers taken + // from the snapshot already refer to ICs with disabled counters and there + // is no way to trigger bytecode handlers recompilation. + if (i::FLAG_ignition) return; -static void StubCacheHelper(bool primary) { -#ifdef ENABLE_DISASSEMBLER i::FLAG_native_code_counters = true; if (primary) { i::FLAG_test_primary_stub_cache = true; @@ -21359,36 +21519,83 @@ static void StubCacheHelper(bool primary) { i::FLAG_test_secondary_stub_cache = true; } i::FLAG_crankshaft = false; - LocalContext env; - env->GetIsolate()->SetCounterFunction(LookupCounter); - v8::HandleScope scope(env->GetIsolate()); - int initial_probes = probes_counter; - int initial_misses = misses_counter; - int initial_updates = updates_counter; - CompileRun(kMegamorphicTestProgram); - int probes = probes_counter - initial_probes; - int misses = misses_counter - initial_misses; - int updates = updates_counter - initial_updates; - CHECK_LT(updates, 10); - CHECK_LT(misses, 10); - // TODO(verwaest): Update this test to overflow the degree of polymorphism - // before megamorphism. The number of probes will only work once we teach the - // serializer to embed references to counters in the stubs, given that the - // megamorphic_stub_cache_probes is updated in a snapshot-generated stub. - CHECK_GE(probes, 0); -#endif + i::FLAG_turbo = false; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + create_params.counter_lookup_callback = LookupCounter; + v8::Isolate* isolate = v8::Isolate::New(create_params); + + { + v8::Isolate::Scope isolate_scope(isolate); + LocalContext env(isolate); + v8::HandleScope scope(isolate); + + { + // Enforce recompilation of IC stubs that access megamorphic stub cache + // to respect enabled native code counters and stub cache test flags. + i::CodeStub::Major code_stub_keys[] = { + i::CodeStub::LoadIC, i::CodeStub::LoadICTrampoline, + i::CodeStub::LoadICTF, i::CodeStub::LoadICTrampolineTF, + i::CodeStub::KeyedLoadIC, i::CodeStub::KeyedLoadICTrampoline, + i::CodeStub::StoreIC, i::CodeStub::StoreICTrampoline, + i::CodeStub::KeyedStoreIC, i::CodeStub::KeyedStoreICTrampoline, + }; + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + i::Heap* heap = i_isolate->heap(); + i::Handle<i::UnseededNumberDictionary> dict(heap->code_stubs()); + for (size_t i = 0; i < arraysize(code_stub_keys); i++) { + dict = i::UnseededNumberDictionary::DeleteKey(dict, code_stub_keys[i]); + } + heap->SetRootCodeStubs(*dict); + } + + int initial_probes = probes_counter; + int initial_misses = misses_counter; + int initial_updates = updates_counter; + CompileRun(kMegamorphicTestProgram); + int probes = probes_counter - initial_probes; + int misses = misses_counter - initial_misses; + int updates = updates_counter - initial_updates; + const int kClassesCount = 50; + const int kIterationsCount = 1000; + CHECK_LE(kClassesCount, updates); + // Check that updates and misses counts are bounded. + // If there are too many updates then most likely the stub cache does not + // work properly. + CHECK_LE(updates, kClassesCount * 2); + CHECK_LE(1, misses); + CHECK_LE(misses, kClassesCount * 2); + // 2 is for PREMONOMORPHIC and MONOMORPHIC states, + // 4 is for POLYMORPHIC states, + // and all the others probes are for MEGAMORPHIC state. + CHECK_EQ(kIterationsCount * kClassesCount - 2 - 4, probes); + } + isolate->Dispose(); } +} // namespace + +UNINITIALIZED_TEST(PrimaryStubCache) { + i::FLAG_tf_load_ic_stub = false; + TestStubCache(true); +} -TEST(SecondaryStubCache) { - StubCacheHelper(true); +UNINITIALIZED_TEST(SecondaryStubCache) { + i::FLAG_tf_load_ic_stub = false; + TestStubCache(false); } +UNINITIALIZED_TEST(PrimaryStubCacheTF) { + i::FLAG_tf_load_ic_stub = true; + TestStubCache(true); +} -TEST(PrimaryStubCache) { - StubCacheHelper(false); +UNINITIALIZED_TEST(SecondaryStubCacheTF) { + i::FLAG_tf_load_ic_stub = true; + TestStubCache(false); } +#endif // ENABLE_DISASSEMBLER #ifdef DEBUG static int cow_arrays_created_runtime = 0; @@ -21960,31 +22167,55 @@ THREADED_TEST(Regress260106) { CHECK(function->IsFunction()); } - THREADED_TEST(JSONParseObject) { LocalContext context; HandleScope scope(context->GetIsolate()); Local<Value> obj = - v8::JSON::Parse(context->GetIsolate(), v8_str("{\"x\":42}")) - .ToLocalChecked(); + v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked(); Local<Object> global = context->Global(); global->Set(context.local(), v8_str("obj"), obj).FromJust(); ExpectString("JSON.stringify(obj)", "{\"x\":42}"); } - THREADED_TEST(JSONParseNumber) { LocalContext context; HandleScope scope(context->GetIsolate()); Local<Value> obj = - v8::JSON::Parse(context->GetIsolate(), v8_str("42")).ToLocalChecked(); + v8::JSON::Parse(context.local(), v8_str("42")).ToLocalChecked(); Local<Object> global = context->Global(); global->Set(context.local(), v8_str("obj"), obj).FromJust(); ExpectString("JSON.stringify(obj)", "42"); } +THREADED_TEST(JSONStringifyObject) { + LocalContext context; + HandleScope scope(context->GetIsolate()); + Local<Value> value = + v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked(); + Local<Object> obj = value->ToObject(context.local()).ToLocalChecked(); + Local<Object> global = context->Global(); + global->Set(context.local(), v8_str("obj"), obj).FromJust(); + Local<String> json = + v8::JSON::Stringify(context.local(), obj).ToLocalChecked(); + v8::String::Utf8Value utf8(json); + ExpectString("JSON.stringify(obj)", *utf8); +} -#if V8_OS_POSIX && !V8_OS_NACL +THREADED_TEST(JSONStringifyObjectWithGap) { + LocalContext context; + HandleScope scope(context->GetIsolate()); + Local<Value> value = + v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked(); + Local<Object> obj = value->ToObject(context.local()).ToLocalChecked(); + Local<Object> global = context->Global(); + global->Set(context.local(), v8_str("obj"), obj).FromJust(); + Local<String> json = + v8::JSON::Stringify(context.local(), obj, v8_str("*")).ToLocalChecked(); + v8::String::Utf8Value utf8(json); + ExpectString("JSON.stringify(obj, null, '*')", *utf8); +} + +#if V8_OS_POSIX class ThreadInterruptTest { public: ThreadInterruptTest() : sem_(0), sem_value_(0) { } @@ -22207,8 +22438,8 @@ TEST(AccessCheckThrows) { CheckCorrectThrow("%DeleteProperty_Sloppy(other, '1')"); CheckCorrectThrow("%DeleteProperty_Strict(other, '1')"); CheckCorrectThrow("Object.prototype.hasOwnProperty.call(other, 'x')"); - CheckCorrectThrow("%HasProperty('x', other)"); - CheckCorrectThrow("%PropertyIsEnumerable(other, 'x')"); + CheckCorrectThrow("%HasProperty(other, 'x')"); + CheckCorrectThrow("Object.prototype.propertyIsEnumerable(other, 'x')"); // PROPERTY_ATTRIBUTES_NONE = 0 CheckCorrectThrow("%DefineAccessorPropertyUnchecked(" "other, 'x', null, null, 1)"); @@ -22615,9 +22846,12 @@ THREADED_TEST(FunctionNew) { ->get_api_func_data() ->serial_number()), i_isolate); - auto cache = i_isolate->template_instantiations_cache(); - CHECK(cache->FindEntry(static_cast<uint32_t>(serial_number->value())) == + auto slow_cache = i_isolate->slow_template_instantiations_cache(); + CHECK(slow_cache->FindEntry(static_cast<uint32_t>(serial_number->value())) == i::UnseededNumberDictionary::kNotFound); + auto fast_cache = i_isolate->fast_template_instantiations_cache(); + CHECK(fast_cache->get(static_cast<uint32_t>(serial_number->value())) + ->IsUndefined(i_isolate)); // Verify that each Function::New creates a new function instance Local<Object> data2 = v8::Object::New(isolate); function_new_expected_env = data2; @@ -23344,6 +23578,88 @@ TEST(ScriptNameAndLineNumber) { CHECK_EQ(13, line_number); } +TEST(ScriptPositionInfo) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + const char* url = "http://www.foo.com/foo.js"; + v8::ScriptOrigin origin(v8_str(url), v8::Integer::New(isolate, 13)); + v8::ScriptCompiler::Source script_source(v8_str("var foo;\n" + "var bar;\n" + "var fisk = foo + bar;\n"), + origin); + Local<Script> script = + v8::ScriptCompiler::Compile(env.local(), &script_source).ToLocalChecked(); + + i::Handle<i::SharedFunctionInfo> obj = i::Handle<i::SharedFunctionInfo>::cast( + v8::Utils::OpenHandle(*script->GetUnboundScript())); + CHECK(obj->script()->IsScript()); + + i::Handle<i::Script> script1(i::Script::cast(obj->script())); + + v8::internal::Script::PositionInfo info; + + // With offset. + + // Behave as if 0 was passed if position is negative. + CHECK(script1->GetPositionInfo(-1, &info, script1->WITH_OFFSET)); + CHECK_EQ(13, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(0, &info, script1->WITH_OFFSET)); + CHECK_EQ(13, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(8, &info, script1->WITH_OFFSET)); + CHECK_EQ(13, info.line); + CHECK_EQ(8, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(9, &info, script1->WITH_OFFSET)); + CHECK_EQ(14, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(9, info.line_start); + CHECK_EQ(17, info.line_end); + + // Fail when position is larger than script size. + CHECK(!script1->GetPositionInfo(220384, &info, script1->WITH_OFFSET)); + + // Without offset. + + // Behave as if 0 was passed if position is negative. + CHECK(script1->GetPositionInfo(-1, &info, script1->NO_OFFSET)); + CHECK_EQ(0, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(0, &info, script1->NO_OFFSET)); + CHECK_EQ(0, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(8, &info, script1->NO_OFFSET)); + CHECK_EQ(0, info.line); + CHECK_EQ(8, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(9, &info, script1->NO_OFFSET)); + CHECK_EQ(1, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(9, info.line_start); + CHECK_EQ(17, info.line_end); + + // Fail when position is larger than script size. + CHECK(!script1->GetPositionInfo(220384, &info, script1->NO_OFFSET)); +} + void CheckMagicComments(Local<Script> script, const char* expected_source_url, const char* expected_source_mapping_url) { if (expected_source_url != NULL) { @@ -23623,7 +23939,6 @@ void RunStreamingTest(const char** chunks, delete[] full_source; } - TEST(StreamingSimpleScript) { // This script is unrealistically small, since no one chunk is enough to fill // the backing buffer of Scanner, let alone overflow it. @@ -23632,6 +23947,35 @@ TEST(StreamingSimpleScript) { RunStreamingTest(chunks); } +TEST(StreamingScriptConstantArray) { + // When run with Ignition, tests that the streaming parser canonicalizes + // handles so that they are only added to the constant pool array once. + const char* chunks[] = {"var a = {};", + "var b = {};", + "var c = 'testing';", + "var d = 'testing';", + "13;", + NULL}; + RunStreamingTest(chunks); +} + +TEST(StreamingScriptEvalShadowing) { + // When run with Ignition, tests that the streaming parser canonicalizes + // handles so the Variable::is_possibly_eval() is correct. + const char* chunk1 = + "(function() {\n" + " var y = 2;\n" + " return (function() {\n" + " eval('var y = 13;');\n" + " function g() {\n" + " return y\n" + " }\n" + " return g();\n" + " })()\n" + "})()\n"; + const char* chunks[] = {chunk1, NULL}; + RunStreamingTest(chunks); +} TEST(StreamingBiggerScript) { const char* chunk1 = @@ -24077,8 +24421,7 @@ void TestInvalidCacheData(v8::ScriptCompiler::CompileOptions option) { script->Run(context).ToLocalChecked()->Int32Value(context).FromJust()); } - -TEST(InvalidCacheData) { +TEST(InvalidParserCacheData) { v8::V8::Initialize(); v8::HandleScope scope(CcTest::isolate()); LocalContext context; @@ -24086,6 +24429,12 @@ TEST(InvalidCacheData) { // Cached parser data is not consumed while parsing eagerly. TestInvalidCacheData(v8::ScriptCompiler::kConsumeParserCache); } +} + +TEST(InvalidCodeCacheData) { + v8::V8::Initialize(); + v8::HandleScope scope(CcTest::isolate()); + LocalContext context; TestInvalidCacheData(v8::ScriptCompiler::kConsumeCodeCache); } @@ -24168,6 +24517,7 @@ TEST(StringConcatOverflow) { TEST(TurboAsmDisablesNeuter) { + i::FLAG_allow_natives_syntax = true; v8::V8::Initialize(); v8::HandleScope scope(CcTest::isolate()); LocalContext context; @@ -24180,10 +24530,11 @@ TEST(TurboAsmDisablesNeuter) { " return { load: load };" "}" "var buffer = new ArrayBuffer(4);" - "Module(this, {}, buffer).load();" + "var module = Module(this, {}, buffer);" + "%OptimizeFunctionOnNextCall(module.load);" + "module.load();" "buffer"; - i::FLAG_turbo_osr = false; // TODO(titzer): test requires eager TF. v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>(); CHECK_EQ(should_be_neuterable, result->IsNeuterable()); @@ -24195,10 +24546,11 @@ TEST(TurboAsmDisablesNeuter) { " return { store: store };" "}" "var buffer = new ArrayBuffer(4);" - "Module(this, {}, buffer).store();" + "var module = Module(this, {}, buffer);" + "%OptimizeFunctionOnNextCall(module.store);" + "module.store();" "buffer"; - i::FLAG_turbo_osr = false; // TODO(titzer): test requires eager TF. result = CompileRun(store).As<v8::ArrayBuffer>(); CHECK_EQ(should_be_neuterable, result->IsNeuterable()); } @@ -24629,6 +24981,60 @@ TEST(Set) { CHECK_EQ(0U, set->Size()); } +TEST(SetDeleteThenAsArray) { + // https://bugs.chromium.org/p/v8/issues/detail?id=4946 + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope handle_scope(isolate); + LocalContext env; + + // make a Set + v8::Local<v8::Value> val = CompileRun("new Set([1, 2, 3])"); + v8::Local<v8::Set> set = v8::Local<v8::Set>::Cast(val); + CHECK_EQ(3U, set->Size()); + + // delete the "middle" element (using AsArray to + // determine which element is the "middle" element) + v8::Local<v8::Array> array1 = set->AsArray(); + CHECK_EQ(3U, array1->Length()); + CHECK(set->Delete(env.local(), array1->Get(env.local(), 1).ToLocalChecked()) + .FromJust()); + + // make sure there are no undefined values when we convert to an array again. + v8::Local<v8::Array> array2 = set->AsArray(); + uint32_t length = array2->Length(); + CHECK_EQ(2U, length); + for (uint32_t i = 0; i < length; i++) { + CHECK(!array2->Get(env.local(), i).ToLocalChecked()->IsUndefined()); + } +} + +TEST(MapDeleteThenAsArray) { + // https://bugs.chromium.org/p/v8/issues/detail?id=4946 + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope handle_scope(isolate); + LocalContext env; + + // make a Map + v8::Local<v8::Value> val = CompileRun("new Map([[1, 2], [3, 4], [5, 6]])"); + v8::Local<v8::Map> map = v8::Local<v8::Map>::Cast(val); + CHECK_EQ(3U, map->Size()); + + // delete the "middle" element (using AsArray to + // determine which element is the "middle" element) + v8::Local<v8::Array> array1 = map->AsArray(); + CHECK_EQ(6U, array1->Length()); + // Map::AsArray returns a flat array, so the second key is at index 2. + v8::Local<v8::Value> key = array1->Get(env.local(), 2).ToLocalChecked(); + CHECK(map->Delete(env.local(), key).FromJust()); + + // make sure there are no undefined values when we convert to an array again. + v8::Local<v8::Array> array2 = map->AsArray(); + uint32_t length = array2->Length(); + CHECK_EQ(4U, length); + for (uint32_t i = 0; i < length; i++) { + CHECK(!array2->Get(env.local(), i).ToLocalChecked()->IsUndefined()); + } +} TEST(CompatibleReceiverCheckOnCachedICHandler) { v8::Isolate* isolate = CcTest::isolate(); @@ -24748,7 +25154,7 @@ TEST(FutexInterruption) { CompileRun( "var ab = new SharedArrayBuffer(4);" "var i32a = new Int32Array(ab);" - "Atomics.futexWait(i32a, 0, 0);"); + "Atomics.wait(i32a, 0, 0);"); CHECK(try_catch.HasTerminated()); timeout_thread.Join(); } @@ -24960,6 +25366,7 @@ class MemoryPressureThread : public v8::base::Thread { }; TEST(MemoryPressure) { + if (v8::internal::FLAG_optimize_for_size) return; v8::Isolate* isolate = CcTest::isolate(); WeakCallCounter counter(1234); @@ -25025,3 +25432,102 @@ TEST(PrivateForApiIsNumber) { // Shouldn't crash. v8::Private::ForApi(isolate, v8_str("42")); } + +THREADED_TEST(ImmutableProto) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); + templ->InstanceTemplate()->SetImmutableProto(); + + Local<v8::Object> object = templ->GetFunction(context.local()) + .ToLocalChecked() + ->NewInstance(context.local()) + .ToLocalChecked(); + + // Look up the prototype + Local<v8::Value> original_proto = + object->Get(context.local(), v8_str("__proto__")).ToLocalChecked(); + + // Setting the prototype (e.g., to null) throws + CHECK(object->SetPrototype(context.local(), v8::Null(isolate)).IsNothing()); + + // The original prototype is still there + Local<Value> new_proto = + object->Get(context.local(), v8_str("__proto__")).ToLocalChecked(); + CHECK(new_proto->IsObject()); + CHECK(new_proto.As<v8::Object>() + ->Equals(context.local(), original_proto) + .FromJust()); +} + +Local<v8::Context> call_eval_context; +Local<v8::Function> call_eval_bound_function; + +static void CallEval(const v8::FunctionCallbackInfo<v8::Value>& args) { + v8::Context::Scope scope(call_eval_context); + args.GetReturnValue().Set( + call_eval_bound_function + ->Call(call_eval_context, call_eval_context->Global(), 0, NULL) + .ToLocalChecked()); +} + +TEST(CrossActivationEval) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + { + call_eval_context = v8::Context::New(isolate); + v8::Context::Scope scope(call_eval_context); + call_eval_bound_function = + Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); + } + env->Global() + ->Set(env.local(), v8_str("CallEval"), + v8::FunctionTemplate::New(isolate, CallEval) + ->GetFunction(env.local()) + .ToLocalChecked()) + .FromJust(); + Local<Value> result = CompileRun("CallEval();"); + CHECK(result->IsInt32()); + CHECK_EQ(1, result->Int32Value(env.local()).FromJust()); +} + +TEST(EvalInAccessCheckedContext) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate); + + obj_template->SetAccessCheckCallback(AccessAlwaysAllowed); + + v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template); + v8::Local<Context> context1 = Context::New(isolate, NULL, obj_template); + + Local<Value> foo = v8_str("foo"); + Local<Value> bar = v8_str("bar"); + + // Set to different domains. + context0->SetSecurityToken(foo); + context1->SetSecurityToken(bar); + + // Set up function in context0 that uses eval from context0. + context0->Enter(); + v8::Local<v8::Value> fun = CompileRun( + "var x = 42;" + "(function() {" + " var e = eval;" + " return function(s) { return e(s); }" + "})()"); + context0->Exit(); + + // Put the function into context1 and call it. Since the access check + // callback always returns true, the call succeeds even though the tokens + // are different. + context1->Enter(); + context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); + v8::Local<v8::Value> x_value = CompileRun("fun('x')"); + CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); + context1->Exit(); +} diff --git a/deps/v8/test/cctest/test-api.h b/deps/v8/test/cctest/test-api.h index 8887a8a976..f9a335a7f4 100644 --- a/deps/v8/test/cctest/test-api.h +++ b/deps/v8/test/cctest/test-api.h @@ -5,7 +5,6 @@ #include "src/v8.h" #include "src/isolate.h" -#include "src/profiler/cpu-profiler.h" #include "src/vm-state.h" #include "test/cctest/cctest.h" @@ -14,10 +13,11 @@ static void CheckReturnValue(const T& t, i::Address callback) { v8::ReturnValue<v8::Value> rv = t.GetReturnValue(); i::Object** o = *reinterpret_cast<i::Object***>(&rv); CHECK_EQ(CcTest::isolate(), t.GetIsolate()); + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate()); CHECK_EQ(t.GetIsolate(), rv.GetIsolate()); - CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); + CHECK((*o)->IsTheHole(isolate) || (*o)->IsUndefined(isolate)); // Verify reset - bool is_runtime = (*o)->IsTheHole(); + bool is_runtime = (*o)->IsTheHole(isolate); if (is_runtime) { CHECK(rv.Get()->IsUndefined()); } else { @@ -25,14 +25,13 @@ static void CheckReturnValue(const T& t, i::Address callback) { CHECK_EQ(*v, *o); } rv.Set(true); - CHECK(!(*o)->IsTheHole() && !(*o)->IsUndefined()); + CHECK(!(*o)->IsTheHole(isolate) && !(*o)->IsUndefined(isolate)); rv.Set(v8::Local<v8::Object>()); - CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); - CHECK_EQ(is_runtime, (*o)->IsTheHole()); - i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate()); + CHECK((*o)->IsTheHole(isolate) || (*o)->IsUndefined(isolate)); + CHECK_EQ(is_runtime, (*o)->IsTheHole(isolate)); // If CPU profiler is active check that when API callback is invoked // VMState is set to EXTERNAL. - if (isolate->cpu_profiler()->is_profiling()) { + if (isolate->is_profiling()) { CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state()); CHECK(isolate->external_callback_scope()); CHECK_EQ(callback, isolate->external_callback_scope()->callback()); diff --git a/deps/v8/test/cctest/test-asm-validator.cc b/deps/v8/test/cctest/test-asm-validator.cc deleted file mode 100644 index d5b51797d6..0000000000 --- a/deps/v8/test/cctest/test-asm-validator.cc +++ /dev/null @@ -1,2514 +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/ast/ast.h" -#include "src/ast/ast-expression-visitor.h" -#include "src/ast/scopes.h" -#include "src/parsing/parser.h" -#include "src/parsing/rewriter.h" -#include "src/type-cache.h" -#include "src/typing-asm.h" -#include "test/cctest/cctest.h" -#include "test/cctest/expression-type-collector.h" -#include "test/cctest/expression-type-collector-macros.h" - -// Macros for function types. -#define FUNC_FOREIGN_TYPE Bounds(Type::Function(Type::Any(), zone)) -#define FUNC_V_TYPE Bounds(Type::Function(Type::Undefined(), zone)) -#define FUNC_I_TYPE Bounds(Type::Function(cache.kAsmSigned, zone)) -#define FUNC_F_TYPE Bounds(Type::Function(cache.kAsmFloat, zone)) -#define FUNC_D_TYPE Bounds(Type::Function(cache.kAsmDouble, zone)) -#define FUNC_D2D_TYPE \ - Bounds(Type::Function(cache.kAsmDouble, cache.kAsmDouble, zone)) -#define FUNC_N2F_TYPE \ - Bounds(Type::Function(cache.kAsmFloat, Type::Number(), zone)) -#define FUNC_I2I_TYPE \ - Bounds(Type::Function(cache.kAsmSigned, cache.kAsmInt, zone)) -#define FUNC_II2D_TYPE \ - Bounds(Type::Function(cache.kAsmDouble, cache.kAsmInt, cache.kAsmInt, zone)) -#define FUNC_II2I_TYPE \ - Bounds(Type::Function(cache.kAsmSigned, cache.kAsmInt, cache.kAsmInt, zone)) -#define FUNC_DD2D_TYPE \ - Bounds(Type::Function(cache.kAsmDouble, cache.kAsmDouble, cache.kAsmDouble, \ - zone)) -#define FUNC_NN2N_TYPE \ - Bounds(Type::Function(Type::Number(), Type::Number(), Type::Number(), zone)) -#define FUNC_N2N_TYPE \ - Bounds(Type::Function(Type::Number(), Type::Number(), zone)) - -// Macros for array types. -#define FLOAT64_ARRAY_TYPE Bounds(Type::Array(cache.kAsmDouble, zone)) -#define FUNC_I2I_ARRAY_TYPE \ - Bounds(Type::Array(Type::Function(cache.kAsmSigned, cache.kAsmInt, zone), \ - zone)) - -using namespace v8::internal; - -namespace { - -std::string Validate(Zone* zone, const char* source, - ZoneVector<ExpressionTypeEntry>* types) { - i::Isolate* isolate = CcTest::i_isolate(); - i::Factory* factory = isolate->factory(); - - i::Handle<i::String> source_code = - factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); - - i::Handle<i::Script> script = factory->NewScript(source_code); - - i::ParseInfo info(zone, script); - i::Parser parser(&info); - parser.set_allow_harmony_sloppy(true); - info.set_global(); - info.set_lazy(false); - info.set_allow_lazy_parsing(false); - info.set_toplevel(true); - - CHECK(i::Compiler::ParseAndAnalyze(&info)); - - FunctionLiteral* root = - info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); - AsmTyper typer(isolate, zone, *script, root); - if (typer.Validate()) { - ExpressionTypeCollector(isolate, root, types).Run(); - return ""; - } else { - return typer.error_message(); - } -} - -} // namespace - - -TEST(ValidateMinimum) { - const char test_function[] = - "function GeometricMean(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - "\n" - " var exp = stdlib.Math.exp;\n" - " var log = stdlib.Math.log;\n" - " var values = new stdlib.Float64Array(buffer);\n" - "\n" - " function logSum(start, end) {\n" - " start = start|0;\n" - " end = end|0;\n" - "\n" - " var sum = 0.0, p = 0, q = 0;\n" - "\n" - " // asm.js forces byte addressing of the heap by requiring shifting " - "by 3\n" - " for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {\n" - " sum = sum + +log(values[p>>3]);\n" - " }\n" - "\n" - " return +sum;\n" - " }\n" - "\n" - " function geometricMean(start, end) {\n" - " start = start|0;\n" - " end = end|0;\n" - "\n" - " return +exp(+logSum(start, end) / +((end - start)|0));\n" - " }\n" - "\n" - " return { geometricMean: geometricMean };\n" - "}\n"; - - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("", Validate(zone, test_function, &types)); - TypeCache cache; - - CHECK_TYPES_BEGIN { - // Module. - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - // function logSum - CHECK_EXPR(FunctionLiteral, FUNC_II2D_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(start, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(start, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(end, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(end, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(sum, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(p, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(q, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - // for (p = start << 3, q = end << 3; - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(p, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(start, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(q, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(end, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - // (p|0) < (q|0); - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(p, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(q, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - // p = (p + 8)|0) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(p, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(p, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - // sum = sum + +log(values[p>>3]); - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(sum, Bounds(cache.kAsmDouble)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_VAR(sum, Bounds(cache.kAsmDouble)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(log, FUNC_D2D_TYPE); - CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) { - CHECK_VAR(values, FLOAT64_ARRAY_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(p, Bounds(cache.kAsmSigned)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - } - // return +sum; - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_VAR(sum, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - // function geometricMean - CHECK_EXPR(FunctionLiteral, FUNC_II2D_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(start, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(start, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(end, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(end, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - // return +exp(+logSum(start, end) / +((end - start)|0)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(exp, FUNC_D2D_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(logSum, FUNC_II2D_TYPE); - CHECK_VAR(start, Bounds(cache.kAsmInt)); - CHECK_VAR(end, Bounds(cache.kAsmInt)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(end, Bounds(cache.kAsmInt)); - CHECK_VAR(start, Bounds(cache.kAsmInt)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - // "use asm"; - CHECK_EXPR(Literal, Bounds(Type::String())); - // var exp = stdlib.Math.exp; - CHECK_EXPR(Assignment, FUNC_D2D_TYPE) { - CHECK_VAR(exp, FUNC_D2D_TYPE); - CHECK_EXPR(Property, FUNC_D2D_TYPE) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(stdlib, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // var log = stdlib.Math.log; - CHECK_EXPR(Assignment, FUNC_D2D_TYPE) { - CHECK_VAR(log, FUNC_D2D_TYPE); - CHECK_EXPR(Property, FUNC_D2D_TYPE) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(stdlib, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // var values = new stdlib.Float64Array(buffer); - CHECK_EXPR(Assignment, FLOAT64_ARRAY_TYPE) { - CHECK_VAR(values, FLOAT64_ARRAY_TYPE); - CHECK_EXPR(CallNew, FLOAT64_ARRAY_TYPE) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(stdlib, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_VAR(buffer, Bounds::Unbounded()); - } - } - // return { geometricMean: geometricMean }; - CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { - CHECK_VAR(geometricMean, FUNC_II2D_TYPE); - } - } - } - CHECK_TYPES_END -} - - -TEST(MissingUseAsm) { - const char test_function[] = - "function foo() {\n" - " function bar() {}\n" - " return { bar: bar };\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 1: missing \"use asm\"\n", - Validate(zone, test_function, &types)); -} - - -TEST(WrongUseAsm) { - const char test_function[] = - "function foo() {\n" - " \"use wasm\"\n" - " function bar() {}\n" - " return { bar: bar };\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 1: missing \"use asm\"\n", - Validate(zone, test_function, &types)); -} - - -TEST(MissingReturnExports) { - const char test_function[] = - "function foo() {\n" - " \"use asm\"\n" - " function bar() {}\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 2: last statement in module is not a return\n", - Validate(zone, test_function, &types)); -} - -#define HARNESS_STDLIB() \ - "var Infinity = stdlib.Infinity; " \ - "var NaN = stdlib.NaN; " \ - "var acos = stdlib.Math.acos; " \ - "var asin = stdlib.Math.asin; " \ - "var atan = stdlib.Math.atan; " \ - "var cos = stdlib.Math.cos; " \ - "var sin = stdlib.Math.sin; " \ - "var tan = stdlib.Math.tan; " \ - "var exp = stdlib.Math.exp; " \ - "var log = stdlib.Math.log; " \ - "var ceil = stdlib.Math.ceil; " \ - "var floor = stdlib.Math.floor; " \ - "var sqrt = stdlib.Math.sqrt; " \ - "var min = stdlib.Math.min; " \ - "var max = stdlib.Math.max; " \ - "var atan2 = stdlib.Math.atan2; " \ - "var pow = stdlib.Math.pow; " \ - "var abs = stdlib.Math.abs; " \ - "var imul = stdlib.Math.imul; " \ - "var fround = stdlib.Math.fround; " \ - "var E = stdlib.Math.E; " \ - "var LN10 = stdlib.Math.LN10; " \ - "var LN2 = stdlib.Math.LN2; " \ - "var LOG2E = stdlib.Math.LOG2E; " \ - "var LOG10E = stdlib.Math.LOG10E; " \ - "var PI = stdlib.Math.PI; " \ - "var SQRT1_2 = stdlib.Math.SQRT1_2; " \ - "var SQRT2 = stdlib.Math.SQRT2; " - -#define HARNESS_HEAP() \ - "var u8 = new stdlib.Uint8Array(buffer); " \ - "var i8 = new stdlib.Int8Array(buffer); " \ - "var u16 = new stdlib.Uint16Array(buffer); " \ - "var i16 = new stdlib.Int16Array(buffer); " \ - "var u32 = new stdlib.Uint32Array(buffer); " \ - "var i32 = new stdlib.Int32Array(buffer); " \ - "var f32 = new stdlib.Float32Array(buffer); " \ - "var f64 = new stdlib.Float64Array(buffer); " - -#define HARNESS_PREAMBLE() \ - const char test_function[] = \ - "function Module(stdlib, foreign, buffer) { " \ - "\"use asm\"; " HARNESS_STDLIB() HARNESS_HEAP() - -#define HARNESS_POSTAMBLE() \ - "return { foo: foo }; " \ - "} "; - -#define CHECK_VAR_MATH_SHORTCUT(name, type) \ - CHECK_EXPR(Assignment, type) { \ - CHECK_VAR(name, type); \ - CHECK_EXPR(Property, type) { \ - CHECK_EXPR(Property, Bounds::Unbounded()) { \ - CHECK_VAR(stdlib, Bounds::Unbounded()); \ - CHECK_EXPR(Literal, Bounds::Unbounded()); \ - } \ - CHECK_EXPR(Literal, Bounds::Unbounded()); \ - } \ - } - - -#define CHECK_VAR_SHORTCUT(name, type) \ - CHECK_EXPR(Assignment, type) { \ - CHECK_VAR(name, type); \ - CHECK_EXPR(Property, type) { \ - CHECK_VAR(stdlib, Bounds::Unbounded()); \ - CHECK_EXPR(Literal, Bounds::Unbounded()); \ - } \ - } - - -#define CHECK_VAR_NEW_SHORTCUT(name, type) \ - CHECK_EXPR(Assignment, type) { \ - CHECK_VAR(name, type); \ - CHECK_EXPR(CallNew, type) { \ - CHECK_EXPR(Property, Bounds::Unbounded()) { \ - CHECK_VAR(stdlib, Bounds::Unbounded()); \ - CHECK_EXPR(Literal, Bounds::Unbounded()); \ - } \ - CHECK_VAR(buffer, Bounds::Unbounded()); \ - } \ - } - - -namespace { - -void CheckStdlibShortcuts1(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, - size_t& index, int& depth, TypeCache& cache) { - // var exp = stdlib.*; - CHECK_VAR_SHORTCUT(Infinity, Bounds(cache.kAsmDouble)); - CHECK_VAR_SHORTCUT(NaN, Bounds(cache.kAsmDouble)); - // var x = stdlib.Math.x; - CHECK_VAR_MATH_SHORTCUT(acos, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(asin, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(atan, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(cos, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(sin, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(tan, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(exp, FUNC_D2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(log, FUNC_D2D_TYPE); - - CHECK_VAR_MATH_SHORTCUT(ceil, FUNC_N2N_TYPE); - CHECK_VAR_MATH_SHORTCUT(floor, FUNC_N2N_TYPE); - CHECK_VAR_MATH_SHORTCUT(sqrt, FUNC_N2N_TYPE); - - CHECK_VAR_MATH_SHORTCUT(min, FUNC_NN2N_TYPE); - CHECK_VAR_MATH_SHORTCUT(max, FUNC_NN2N_TYPE); - - CHECK_VAR_MATH_SHORTCUT(atan2, FUNC_DD2D_TYPE); - CHECK_VAR_MATH_SHORTCUT(pow, FUNC_DD2D_TYPE); - - CHECK_VAR_MATH_SHORTCUT(abs, FUNC_N2N_TYPE); - CHECK_VAR_MATH_SHORTCUT(imul, FUNC_II2I_TYPE); - CHECK_VAR_MATH_SHORTCUT(fround, FUNC_N2F_TYPE); -} - - -void CheckStdlibShortcuts2(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, - size_t& index, int& depth, TypeCache& cache) { - // var exp = stdlib.Math.*; (D * 12) - CHECK_VAR_MATH_SHORTCUT(E, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(LN10, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(LN2, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(LOG2E, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(LOG10E, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(PI, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(SQRT1_2, Bounds(cache.kAsmDouble)); - CHECK_VAR_MATH_SHORTCUT(SQRT2, Bounds(cache.kAsmDouble)); - // var values = new stdlib.*Array(buffer); - CHECK_VAR_NEW_SHORTCUT(u8, Bounds(cache.kUint8Array)); - CHECK_VAR_NEW_SHORTCUT(i8, Bounds(cache.kInt8Array)); - CHECK_VAR_NEW_SHORTCUT(u16, Bounds(cache.kUint16Array)); - CHECK_VAR_NEW_SHORTCUT(i16, Bounds(cache.kInt16Array)); - CHECK_VAR_NEW_SHORTCUT(u32, Bounds(cache.kUint32Array)); - CHECK_VAR_NEW_SHORTCUT(i32, Bounds(cache.kInt32Array)); - CHECK_VAR_NEW_SHORTCUT(f32, Bounds(cache.kFloat32Array)); - CHECK_VAR_NEW_SHORTCUT(f64, Bounds(cache.kFloat64Array)); -} - -} // namespace - - -#define CHECK_FUNC_TYPES_BEGIN(func) \ - HARNESS_PREAMBLE() \ - func "\n" HARNESS_POSTAMBLE(); \ - \ - v8::V8::Initialize(); \ - HandleAndZoneScope handles; \ - Zone* zone = handles.main_zone(); \ - ZoneVector<ExpressionTypeEntry> types(zone); \ - CHECK_EQ("", Validate(zone, test_function, &types)); \ - TypeCache cache; \ - \ - CHECK_TYPES_BEGIN { \ - /* Module. */ \ - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { -#define CHECK_FUNC_TYPES_END_1() \ - /* "use asm"; */ \ - CHECK_EXPR(Literal, Bounds(Type::String())); \ - /* stdlib shortcuts. */ \ - CheckStdlibShortcuts1(zone, types, index, depth, cache); \ - CheckStdlibShortcuts2(zone, types, index, depth, cache); - -#define CHECK_FUNC_TYPES_END_2() \ - /* return { foo: foo }; */ \ - CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { \ - CHECK_VAR(foo, FUNC_V_TYPE); \ - } \ - } \ - } \ - CHECK_TYPES_END - - -#define CHECK_FUNC_TYPES_END \ - CHECK_FUNC_TYPES_END_1(); \ - CHECK_FUNC_TYPES_END_2(); - - -#define CHECK_FUNC_ERROR(func, message) \ - HARNESS_PREAMBLE() \ - func "\n" HARNESS_POSTAMBLE(); \ - \ - v8::V8::Initialize(); \ - HandleAndZoneScope handles; \ - Zone* zone = handles.main_zone(); \ - ZoneVector<ExpressionTypeEntry> types(zone); \ - CHECK_EQ(message, Validate(zone, test_function, &types)); - - -TEST(BareHarness) { - CHECK_FUNC_TYPES_BEGIN("function foo() {}") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {} - } - CHECK_FUNC_TYPES_END -} - - -TEST(ReturnVoid) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { return; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - // return undefined; - CHECK_EXPR(Literal, Bounds(Type::Undefined())); - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(Type::Undefined())) { - CHECK_VAR(bar, FUNC_V_TYPE); - } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(EmptyBody) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE); - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(Type::Undefined())) { - CHECK_VAR(bar, FUNC_V_TYPE); - } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(DoesNothing) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1.0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(Type::Undefined())) { - CHECK_VAR(bar, FUNC_V_TYPE); - } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(ReturnInt32Literal) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { return 1; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - // return 1; - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { - CHECK_VAR(bar, FUNC_I_TYPE); - } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(ReturnFloat64Literal) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { return 1.0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { - // return 1.0; - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(bar, FUNC_D_TYPE); - } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(ReturnFloat32Literal) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { return fround(1.0); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { - // return fround(1.0); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { CHECK_VAR(bar, FUNC_F_TYPE); } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(ReturnFloat64Var) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1.0; return +x; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { - // return 1.0; - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - // return 1.0; - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(bar, FUNC_D_TYPE); - } - } - } - CHECK_FUNC_TYPES_END -} - - -TEST(Addition2) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 2; return (x+y)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_VAR(y, Bounds(cache.kAsmInt)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -#define TEST_COMPARE_OP(name, op) \ - TEST(name) { \ - CHECK_FUNC_TYPES_BEGIN("function bar() { return (0 " op \ - " 0)|0; }\n" \ - "function foo() { bar(); }") { \ - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { \ - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { \ - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { \ - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ - } \ - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ - } \ - } \ - CHECK_SKIP(); \ - } \ - CHECK_FUNC_TYPES_END \ - } - - -TEST_COMPARE_OP(EqOperator, "==") -TEST_COMPARE_OP(LtOperator, "<") -TEST_COMPARE_OP(LteOperator, "<=") -TEST_COMPARE_OP(GtOperator, ">") -TEST_COMPARE_OP(GteOperator, ">=") - - -TEST(NeqOperator) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { return (0 != 0)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(UnaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(NotOperator) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0; return (!x)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(UnaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(InvertOperator) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0; return (~x)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(InvertConversion) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0.0; return (~~x)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(Ternary) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return (x?y:5)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Conditional, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -#define TEST_INT_BIN_OP(name, op) \ - TEST(name) { \ - CHECK_FUNC_TYPES_BEGIN("function bar() { var x = 0; return (x " op \ - " 123)|0; }\n" \ - "function foo() { bar(); }") { \ - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { \ - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { \ - CHECK_VAR(x, Bounds(cache.kAsmInt)); \ - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ - } \ - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { \ - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { \ - CHECK_VAR(x, Bounds(cache.kAsmInt)); \ - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ - } \ - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ - } \ - } \ - CHECK_SKIP(); \ - } \ - CHECK_FUNC_TYPES_END \ - } - - -TEST_INT_BIN_OP(AndOperator, "&") -TEST_INT_BIN_OP(OrOperator, "|") -TEST_INT_BIN_OP(XorOperator, "^") - - -TEST(SignedCompare) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return ((x|0) < (y|0))|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(SignedCompareConst) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return ((x|0) < (1<<31))|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(UnsignedCompare) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return ((x>>>0) < (y>>>0))|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(UnsignedCompareConst0) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return ((x>>>0) < (0>>>0))|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(UnsignedCompareConst1) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return ((x>>>0) < " - "(0xffffffff>>>0))|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmUnsigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(UnsignedDivide) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; return ((x>>>0) / (y>>>0))|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(Type::None(), Type::Any())) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(UnsignedFromFloat64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; return (x>>>0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: left bitwise operand expected to be an integer\n"); -} - - -TEST(AndFloat64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; return (x&0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: left bitwise operand expected to be an integer\n"); -} - - -TEST(TypeMismatchAddInt32Float64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; var y = 0; return (x + y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: ill-typed arithmetic operation\n"); -} - - -TEST(TypeMismatchSubInt32Float64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; var y = 0; return (x - y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: ill-typed arithmetic operation\n"); -} - - -TEST(TypeMismatchDivInt32Float64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; var y = 0; return (x / y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: ill-typed arithmetic operation\n"); -} - - -TEST(TypeMismatchModInt32Float64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; var y = 0; return (x % y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: ill-typed arithmetic operation\n"); -} - - -TEST(ModFloat32) { - CHECK_FUNC_ERROR( - "function bar() { var x = fround(1.0); return (x % x)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: ill-typed arithmetic operation\n"); -} - - -TEST(TernaryMismatchInt32Float64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 0.0; return (1 ? x : y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: then and else expressions in ? must have the same type\n"); -} - - -TEST(TernaryMismatchIntish) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 0; return (1 ? x + x : y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: invalid type in ? then expression\n"); -} - - -TEST(TernaryMismatchInt32Float32) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2.0; return (x?fround(y):x)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: then and else expressions in ? must have the same type\n"); -} - - -TEST(TernaryBadCondition) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2.0; return (y?x:1)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: condition must be of type int\n"); -} - -TEST(BadIntishMultiply) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; return ((x + x) * 4) | 0; }\n" - "function foo() { bar(); }", - "asm: line 1: intish not allowed in multiply\n"); -} - -TEST(IntToFloat32) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; return fround(x); }\n" - "function foo() { bar(); }", - "asm: line 1: illegal function argument type\n"); -} - -TEST(Int32ToFloat32) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; return fround(x|0); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(Uint32ToFloat32) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; return fround(x>>>0); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(Float64ToFloat32) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1.0; return fround(x); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(Int32ToFloat32ToInt32) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; return ~~fround(x|0) | 0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(Addition4) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 2; return (x+y+x+y)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_VAR(y, Bounds(cache.kAsmInt)); - } - CHECK_VAR(x, Bounds(cache.kAsmInt)); - } - CHECK_VAR(y, Bounds(cache.kAsmInt)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(Multiplication2) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: multiply must be by an integer literal\n"); -} - - -TEST(Division4) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: too many consecutive multiplicative ops\n"); -} - - -TEST(CompareToStringLeft) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; return ('hi' > x)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: bad type on left side of comparison\n"); -} - - -TEST(CompareToStringRight) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; return (x < 'hi')|0; }\n" - "function foo() { bar(); }", - "asm: line 1: bad type on right side of comparison\n"); -} - - -TEST(CompareMismatchInt32Float64) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2.0; return (x < y)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: left and right side of comparison must match\n"); -} - - -TEST(CompareMismatchInt32Uint32) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2; return ((x|0) < (y>>>0))|0; }\n" - "function foo() { bar(); }", - "asm: line 1: left and right side of comparison must match\n"); -} - - -TEST(CompareMismatchInt32Float32) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; var y = 2.0; return (x < fround(y))|0; }\n" - "function foo() { bar(); }", - "asm: line 1: left and right side of comparison must match\n"); -} - - -TEST(Float64ToInt32) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 0.0; x = ~~y; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(y, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(y, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(Load1) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = i8[x>>0]|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Property, Bounds(cache.kAsmInt)) { - CHECK_VAR(i8, Bounds(cache.kInt8Array)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(LoadDouble) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 0.0; y = +f64[x>>3]; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(y, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(y, Bounds(cache.kAsmDouble)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) { - CHECK_VAR(f64, Bounds(cache.kFloat64Array)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmSigned)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(Store1) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; i8[x>>0] = 0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(i8, Bounds(cache.kInt8Array)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(StoreFloat) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = fround(1.0); " - "f32[0] = fround(x + fround(1.0)); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(f32, Bounds(cache.kFloat32Array)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(StoreIntish) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = 1; i32[0] = x + y; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(i32, Bounds(cache.kInt32Array)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_VAR(y, Bounds(cache.kAsmInt)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(StoreFloatish) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { " - "var x = fround(1.0); " - "var y = fround(1.0); f32[0] = x + y; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_VAR(y, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(f32, Bounds(cache.kFloat32Array)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_VAR(y, Bounds(cache.kAsmFloat)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(Load1Constant) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 1; var y = i8[5]|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Property, Bounds(cache.kAsmInt)) { - CHECK_VAR(i8, Bounds(cache.kInt8Array)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(FunctionTables) { - CHECK_FUNC_TYPES_BEGIN( - "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" - "function func2(x) { x = x | 0; return (x * 25) | 0; }\n" - "var table1 = [func1, func2];\n" - "function bar(x, y) { x = x | 0; y = y | 0;\n" - " return table1[x & 1](y)|0; }\n" - "function foo() { bar(1, 2); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(FunctionLiteral, FUNC_II2I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(y, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Property, FUNC_I2I_TYPE) { - CHECK_VAR(table1, FUNC_I2I_ARRAY_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - // TODO(bradnelson): revert this - // CHECK_VAR(x, Bounds(cache.kAsmSigned)); - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_VAR(y, Bounds(cache.kAsmInt)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END_1(); - CHECK_EXPR(Assignment, FUNC_I2I_ARRAY_TYPE) { - CHECK_VAR(table1, FUNC_I2I_ARRAY_TYPE); - CHECK_EXPR(ArrayLiteral, FUNC_I2I_ARRAY_TYPE) { - CHECK_VAR(func1, FUNC_I2I_TYPE); - CHECK_VAR(func2, FUNC_I2I_TYPE); - } - } - CHECK_FUNC_TYPES_END_2(); -} - - -TEST(BadFunctionTable) { - CHECK_FUNC_ERROR( - "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" - "var table1 = [func1, 1];\n" - "function bar(x, y) { x = x | 0; y = y | 0;\n" - " return table1[x & 1](y)|0; }\n" - "function foo() { bar(1, 2); }", - "asm: line 2: array component expected to be a function\n"); -} - - -TEST(MissingParameterTypes) { - CHECK_FUNC_ERROR( - "function bar(x) { var y = 1; }\n" - "function foo() { bar(2); }", - "asm: line 1: missing parameter type annotations\n"); -} - - -TEST(InvalidTypeAnnotationBinaryOpDiv) { - CHECK_FUNC_ERROR( - "function bar(x) { x = x / 4; }\n" - "function foo() { bar(2); }", - "asm: line 1: invalid type annotation on binary op\n"); -} - - -TEST(InvalidTypeAnnotationBinaryOpMul) { - CHECK_FUNC_ERROR( - "function bar(x) { x = x * 4.0; }\n" - "function foo() { bar(2); }", - "asm: line 1: invalid type annotation on binary op\n"); -} - - -TEST(InvalidArgumentCount) { - CHECK_FUNC_ERROR( - "function bar(x) { return fround(4, 5); }\n" - "function foo() { bar(); }", - "asm: line 1: invalid argument count calling function\n"); -} - - -TEST(InvalidTypeAnnotationArity) { - CHECK_FUNC_ERROR( - "function bar(x) { x = max(x); }\n" - "function foo() { bar(3); }", - "asm: line 1: only fround allowed on expression annotations\n"); -} - - -TEST(InvalidTypeAnnotationOnlyFround) { - CHECK_FUNC_ERROR( - "function bar(x) { x = sin(x); }\n" - "function foo() { bar(3); }", - "asm: line 1: only fround allowed on expression annotations\n"); -} - - -TEST(InvalidTypeAnnotation) { - CHECK_FUNC_ERROR( - "function bar(x) { x = (x+x)(x); }\n" - "function foo() { bar(3); }", - "asm: line 1: invalid type annotation\n"); -} - - -TEST(WithStatement) { - CHECK_FUNC_ERROR( - "function bar() { var x = 0; with (x) { x = x + 1; } }\n" - "function foo() { bar(); }", - "asm: line 1: bad with statement\n"); -} - - -TEST(NestedFunction) { - CHECK_FUNC_ERROR( - "function bar() { function x() { return 1; } }\n" - "function foo() { bar(); }", - "asm: line 1: function declared inside another\n"); -} - - -TEST(UnboundVariable) { - CHECK_FUNC_ERROR( - "function bar() { var x = y; }\n" - "function foo() { bar(); }", - "asm: line 1: unbound variable\n"); -} - - -TEST(EqStrict) { - CHECK_FUNC_ERROR( - "function bar() { return (0 === 0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal comparison operator\n"); -} - - -TEST(NeStrict) { - CHECK_FUNC_ERROR( - "function bar() { return (0 !== 0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal comparison operator\n"); -} - - -TEST(InstanceOf) { - const char* errorMsg = FLAG_harmony_instanceof - ? "asm: line 0: do-expression encountered\n" - : "asm: line 1: illegal comparison operator\n"; - - CHECK_FUNC_ERROR( - "function bar() { return (0 instanceof 0)|0; }\n" - "function foo() { bar(); }", - errorMsg); -} - - -TEST(InOperator) { - CHECK_FUNC_ERROR( - "function bar() { return (0 in 0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal comparison operator\n"); -} - - -TEST(LogicalAndOperator) { - CHECK_FUNC_ERROR( - "function bar() { return (0 && 0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal logical operator\n"); -} - - -TEST(LogicalOrOperator) { - CHECK_FUNC_ERROR( - "function bar() { return (0 || 0)|0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal logical operator\n"); -} - -TEST(BitOrDouble) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1.0; return x | 0; }\n" - "function foo() { bar(); }", - "asm: line 1: intish required\n"); -} - -TEST(BadLiteral) { - CHECK_FUNC_ERROR( - "function bar() { return true | 0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal literal\n"); -} - - -TEST(MismatchedReturnTypeLiteral) { - CHECK_FUNC_ERROR( - "function bar() { if(1) { return 1; } return 1.0; }\n" - "function foo() { bar(); }", - "asm: line 1: return type does not match function signature\n"); -} - - -TEST(MismatchedReturnTypeExpression) { - CHECK_FUNC_ERROR( - "function bar() {\n" - " var x = 1; var y = 1.0; if(1) { return x; } return +y; }\n" - "function foo() { bar(); }", - "asm: line 2: return type does not match function signature\n"); -} - - -TEST(AssignToFloatishToF64) { - CHECK_FUNC_ERROR( - "function bar() { var v = fround(1.0); f64[0] = v + fround(1.0); }\n" - "function foo() { bar(); }", - "asm: line 1: floatish assignment to double array\n"); -} - - -TEST(ForeignFunction) { - CHECK_FUNC_TYPES_BEGIN( - "var baz = foreign.baz;\n" - "function bar() { return baz(1, 2)|0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { - CHECK_VAR(baz, FUNC_FOREIGN_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { - CHECK_VAR(bar, FUNC_I_TYPE); - } - } - } - CHECK_FUNC_TYPES_END_1() - CHECK_EXPR(Assignment, Bounds(FUNC_FOREIGN_TYPE)) { - CHECK_VAR(baz, Bounds(FUNC_FOREIGN_TYPE)); - CHECK_EXPR(Property, Bounds(FUNC_FOREIGN_TYPE)) { - CHECK_VAR(foreign, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - CHECK_FUNC_TYPES_END_2() -} - -TEST(ByteArray) { - // Forbidden by asm.js spec, present in embenchen. - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0; i8[x] = 2; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(i8, Bounds(cache.kInt8Array)); - CHECK_VAR(x, Bounds(cache.kAsmSigned)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(BadExports) { - HARNESS_PREAMBLE() - "function foo() {};\n" - "return {foo: foo, bar: 1};" - "}\n"; - - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 2: non-function in function table\n", - Validate(zone, test_function, &types)); -} - - -TEST(NestedHeapAssignment) { - CHECK_FUNC_ERROR( - "function bar() { var x = 0; i16[x = 1] = 2; }\n" - "function foo() { bar(); }", - "asm: line 1: expected >> in heap access\n"); -} - -TEST(BadOperatorHeapAssignment) { - CHECK_FUNC_ERROR( - "function bar() { var x = 0; i16[x & 1] = 2; }\n" - "function foo() { bar(); }", - "asm: line 1: expected >> in heap access\n"); -} - - -TEST(BadArrayAssignment) { - CHECK_FUNC_ERROR( - "function bar() { i8[0] = 0.0; }\n" - "function foo() { bar(); }", - "asm: line 1: illegal type in assignment\n"); -} - - -TEST(BadStandardFunctionCallOutside) { - CHECK_FUNC_ERROR( - "var s0 = sin(0);\n" - "function bar() { }\n" - "function foo() { bar(); }", - "asm: line 1: illegal variable reference in module body\n"); -} - - -TEST(BadFunctionCallOutside) { - CHECK_FUNC_ERROR( - "function bar() { return 0.0; }\n" - "var s0 = bar(0);\n" - "function foo() { bar(); }", - "asm: line 2: illegal variable reference in module body\n"); -} - -TEST(UnaryPlusOnIntForbidden) { - CHECK_FUNC_ERROR( - "function bar() { var x = 1; return +x; }\n" - "function foo() { bar(); }", - "asm: line 1: " - "unary + only allowed on signed, unsigned, float?, or double?\n"); -} - -TEST(MultiplyNon1ConvertForbidden) { - CHECK_FUNC_ERROR( - "function bar() { var x = 0.0; return x * 2.0; }\n" - "function foo() { bar(); }", - "asm: line 1: invalid type annotation on binary op\n"); -} - -TEST(NestedVariableAssignment) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0; x = x = 4; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(NestedAssignmentInHeap) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0; i8[(x = 1) >> 0] = 2; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(i8, Bounds(cache.kInt8Array)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(NegativeDouble) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = -123.2; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(NegativeInteger) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = -123; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(AbsFunction) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = -123.0; x = abs(x); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(abs, FUNC_N2N_TYPE); - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(CeilFloat) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = fround(3.1); x = ceil(x); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(ceil, FUNC_N2N_TYPE); - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(FloatReturnAsDouble) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = fround(3.1); return +fround(x); }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) { - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { - CHECK_VAR(fround, FUNC_N2F_TYPE); - CHECK_VAR(x, Bounds(cache.kAsmFloat)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(TypeConsistency) { - v8::V8::Initialize(); - TypeCache cache; - // Check the consistency of each of the main Asm.js types. - CHECK(cache.kAsmFixnum->Is(cache.kAsmFixnum)); - CHECK(cache.kAsmFixnum->Is(cache.kAsmSigned)); - CHECK(cache.kAsmFixnum->Is(cache.kAsmUnsigned)); - CHECK(cache.kAsmFixnum->Is(cache.kAsmInt)); - CHECK(!cache.kAsmFixnum->Is(cache.kAsmFloat)); - CHECK(!cache.kAsmFixnum->Is(cache.kAsmDouble)); - - CHECK(cache.kAsmSigned->Is(cache.kAsmSigned)); - CHECK(cache.kAsmSigned->Is(cache.kAsmInt)); - CHECK(!cache.kAsmSigned->Is(cache.kAsmFixnum)); - CHECK(!cache.kAsmSigned->Is(cache.kAsmUnsigned)); - CHECK(!cache.kAsmSigned->Is(cache.kAsmFloat)); - CHECK(!cache.kAsmSigned->Is(cache.kAsmDouble)); - - CHECK(cache.kAsmUnsigned->Is(cache.kAsmUnsigned)); - CHECK(cache.kAsmUnsigned->Is(cache.kAsmInt)); - CHECK(!cache.kAsmUnsigned->Is(cache.kAsmSigned)); - CHECK(!cache.kAsmUnsigned->Is(cache.kAsmFixnum)); - CHECK(!cache.kAsmUnsigned->Is(cache.kAsmFloat)); - CHECK(!cache.kAsmUnsigned->Is(cache.kAsmDouble)); - - CHECK(cache.kAsmInt->Is(cache.kAsmInt)); - CHECK(!cache.kAsmInt->Is(cache.kAsmUnsigned)); - CHECK(!cache.kAsmInt->Is(cache.kAsmSigned)); - CHECK(!cache.kAsmInt->Is(cache.kAsmFixnum)); - CHECK(!cache.kAsmInt->Is(cache.kAsmFloat)); - CHECK(!cache.kAsmInt->Is(cache.kAsmDouble)); - - CHECK(cache.kAsmFloat->Is(cache.kAsmFloat)); - CHECK(!cache.kAsmFloat->Is(cache.kAsmInt)); - CHECK(!cache.kAsmFloat->Is(cache.kAsmUnsigned)); - CHECK(!cache.kAsmFloat->Is(cache.kAsmSigned)); - CHECK(!cache.kAsmFloat->Is(cache.kAsmFixnum)); - CHECK(!cache.kAsmFloat->Is(cache.kAsmDouble)); - - CHECK(cache.kAsmDouble->Is(cache.kAsmDouble)); - CHECK(!cache.kAsmDouble->Is(cache.kAsmInt)); - CHECK(!cache.kAsmDouble->Is(cache.kAsmUnsigned)); - CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned)); - CHECK(!cache.kAsmDouble->Is(cache.kAsmFixnum)); - CHECK(!cache.kAsmDouble->Is(cache.kAsmFloat)); -} - - -TEST(SwitchTest) { - CHECK_FUNC_TYPES_BEGIN( - "function switcher(x) {\n" - " x = x|0;\n" - " switch (x|0) {\n" - " case 1: return 23;\n" - " case 2: return 43;\n" - " default: return 66;\n" - " }\n" - " return 0;\n" - "}\n" - "function foo() { switcher(1); }") { - CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(.switch_tag, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(x, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(Type::Undefined())); - CHECK_VAR(.switch_tag, Bounds(cache.kAsmSigned)); - // case 1: return 23; - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - // case 2: return 43; - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - // default: return 66; - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - // return 0; - CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - - -TEST(BadSwitchRange) { - CHECK_FUNC_ERROR( - "function bar() { switch (1) { case -1: case 0x7fffffff: } }\n" - "function foo() { bar(); }", - "asm: line 1: case range too large\n"); -} - - -TEST(DuplicateSwitchCase) { - CHECK_FUNC_ERROR( - "function bar() { switch (1) { case 0: case 0: } }\n" - "function foo() { bar(); }", - "asm: line 1: duplicate case value\n"); -} - - -TEST(BadSwitchOrder) { - CHECK_FUNC_ERROR( - "function bar() { switch (1) { default: case 0: } }\n" - "function foo() { bar(); }", - "asm: line 1: default case out of order\n"); -} - -TEST(BadForeignCall) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var ffunc = foreign.foo;\n" - " function test1() { var x = 0; ffunc(x); }\n" - " return { testFunc1: test1 };\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ( - "asm: line 4: foreign call argument expected to be int, double, or " - "fixnum\n", - Validate(zone, test_function, &types)); -} - -TEST(BadImports) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var fint = (foreign.bar | 0) | 0;\n" - " function test1() {}\n" - " return { testFunc1: test1 };\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 3: illegal computation inside module body\n", - Validate(zone, test_function, &types)); -} - -TEST(BadVariableReference) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var x = 0;\n" - " var y = x;\n" - " function test1() {}\n" - " return { testFunc1: test1 };\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 4: illegal variable reference in module body\n", - Validate(zone, test_function, &types)); -} - -TEST(BadForeignVariableReferenceValueOr) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var fint = foreign.bar | 1;\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 3: illegal integer annotation value\n", - Validate(zone, test_function, &types)); -} - -TEST(BadForeignVariableReferenceValueOrDot) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var fint = foreign.bar | 1.0;\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 3: illegal integer annotation value\n", - Validate(zone, test_function, &types)); -} - -TEST(BadForeignVariableReferenceValueMul) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var fint = foreign.bar * 2.0;\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 3: illegal double annotation value\n", - Validate(zone, test_function, &types)); -} - -TEST(BadForeignVariableReferenceValueMulNoDot) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var fint = foreign.bar * 1;\n" - "}\n"; - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("asm: line 3: ill-typed arithmetic operation\n", - Validate(zone, test_function, &types)); -} - -TEST(Imports) { - const char test_function[] = - "function TestModule(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - " var ffunc = foreign.foo;\n" - " var fint = foreign.bar | 0;\n" - " var fdouble = +foreign.baz;\n" - " function test1() { return ffunc(fint|0, fdouble) | 0; }\n" - " function test2() { return +ffunc(fdouble, fint|0); }\n" - " return { testFunc1: test1, testFunc2: test2 };\n" - "}\n"; - - v8::V8::Initialize(); - HandleAndZoneScope handles; - Zone* zone = handles.main_zone(); - ZoneVector<ExpressionTypeEntry> types(zone); - CHECK_EQ("", Validate(zone, test_function, &types)); - TypeCache cache; - - CHECK_TYPES_BEGIN { - // Module. - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - // function test1 - CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { - CHECK_VAR(ffunc, FUNC_FOREIGN_TYPE); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(fint, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_VAR(fdouble, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - // function test2 - CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { - CHECK_VAR(ffunc, FUNC_FOREIGN_TYPE); - CHECK_VAR(fdouble, Bounds(cache.kAsmDouble)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_VAR(fint, Bounds(cache.kAsmInt)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - // "use asm"; - CHECK_EXPR(Literal, Bounds(Type::String())); - // var func = foreign.foo; - CHECK_EXPR(Assignment, Bounds(FUNC_FOREIGN_TYPE)) { - CHECK_VAR(ffunc, Bounds(FUNC_FOREIGN_TYPE)); - CHECK_EXPR(Property, Bounds(FUNC_FOREIGN_TYPE)) { - CHECK_VAR(foreign, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // var fint = foreign.bar | 0; - CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { - CHECK_VAR(fint, Bounds(cache.kAsmInt)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { - CHECK_EXPR(Property, Bounds(Type::Number())) { - CHECK_VAR(foreign, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - } - // var fdouble = +foreign.baz; - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(fdouble, Bounds(cache.kAsmDouble)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Property, Bounds(Type::Number())) { - CHECK_VAR(foreign, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - // return { testFunc1: test1, testFunc2: test2 }; - CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { - CHECK_VAR(test1, FUNC_I_TYPE); - CHECK_VAR(test2, FUNC_D_TYPE); - } - } - } - CHECK_TYPES_END -} - -TEST(StoreFloatFromDouble) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { f32[0] = 0.0; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(f32, Bounds(cache.kFloat32Array)); - CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); - } - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} - -TEST(NegateDouble) { - CHECK_FUNC_TYPES_BEGIN( - "function bar() { var x = 0.0; x = -x; }\n" - "function foo() { bar(); }") { - CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { - CHECK_VAR(x, Bounds(cache.kAsmDouble)); - CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); - } - } - } - CHECK_SKIP(); - } - CHECK_FUNC_TYPES_END -} diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index 3763f06493..93a19c1a14 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -412,29 +412,26 @@ TEST(6) { Assembler assm(isolate, NULL, 0); - if (CpuFeatures::IsSupported(ARMv7)) { - CpuFeatureScope scope(&assm, ARMv7); - __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. - __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. - __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. - __ add(r0, r1, Operand(r2)); - __ add(r0, r0, Operand(r3)); - __ mov(pc, Operand(lr)); + __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. + __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. + __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. + __ add(r0, r1, Operand(r2)); + __ add(r0, r0, Operand(r3)); + __ mov(pc, Operand(lr)); - CodeDesc desc; - assm.GetCode(&desc); - Handle<Code> code = isolate->factory()->NewCode( - desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); #ifdef DEBUG - OFStream os(stdout); - code->Print(os); + OFStream os(stdout); + code->Print(os); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0)); - ::printf("f() = %d\n", res); - CHECK_EQ(382, res); - } + F1 f = FUNCTION_CAST<F1>(code->entry()); + int res = reinterpret_cast<int>( + CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0)); + ::printf("f() = %d\n", res); + CHECK_EQ(382, res); } @@ -2231,6 +2228,272 @@ TEST(ARMv8_vrintX) { } } +TEST(ARMv8_vsel) { + // Test the vsel floating point instructions. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + Assembler assm(isolate, NULL, 0); + + // Used to indicate whether a condition passed or failed. + static constexpr float kResultPass = 1.0f; + static constexpr float kResultFail = -kResultPass; + + struct ResultsF32 { + float vseleq_; + float vselge_; + float vselgt_; + float vselvs_; + + // The following conditions aren't architecturally supported, but the + // assembler implements them by swapping the inputs. + float vselne_; + float vsellt_; + float vselle_; + float vselvc_; + }; + + struct ResultsF64 { + double vseleq_; + double vselge_; + double vselgt_; + double vselvs_; + + // The following conditions aren't architecturally supported, but the + // assembler implements them by swapping the inputs. + double vselne_; + double vsellt_; + double vselle_; + double vselvc_; + }; + + if (CpuFeatures::IsSupported(ARMv8)) { + CpuFeatureScope scope(&assm, ARMv8); + + // Create a helper function: + // void TestVsel(uint32_t nzcv, + // ResultsF32* results_f32, + // ResultsF64* results_f64); + __ msr(CPSR_f, Operand(r0)); + + __ vmov(s1, kResultPass); + __ vmov(s2, kResultFail); + + __ vsel(eq, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vseleq_)); + __ vsel(ge, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vselge_)); + __ vsel(gt, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vselgt_)); + __ vsel(vs, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vselvs_)); + + __ vsel(ne, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vselne_)); + __ vsel(lt, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vsellt_)); + __ vsel(le, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vselle_)); + __ vsel(vc, s0, s1, s2); + __ vstr(s0, r1, offsetof(ResultsF32, vselvc_)); + + __ vmov(d1, kResultPass); + __ vmov(d2, kResultFail); + + __ vsel(eq, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vseleq_)); + __ vsel(ge, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vselge_)); + __ vsel(gt, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vselgt_)); + __ vsel(vs, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vselvs_)); + + __ vsel(ne, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vselne_)); + __ vsel(lt, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vsellt_)); + __ vsel(le, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vselle_)); + __ vsel(vc, d0, d1, d2); + __ vstr(d0, r2, offsetof(ResultsF64, vselvc_)); + + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + F5 f = FUNCTION_CAST<F5>(code->entry()); + Object* dummy = nullptr; + USE(dummy); + + STATIC_ASSERT(kResultPass == -kResultFail); +#define CHECK_VSEL(n, z, c, v, vseleq, vselge, vselgt, vselvs) \ + do { \ + ResultsF32 results_f32; \ + ResultsF64 results_f64; \ + uint32_t nzcv = (n << 31) | (z << 30) | (c << 29) | (v << 28); \ + dummy = CALL_GENERATED_CODE(isolate, f, nzcv, &results_f32, &results_f64, \ + 0, 0); \ + CHECK_EQ(vseleq, results_f32.vseleq_); \ + CHECK_EQ(vselge, results_f32.vselge_); \ + CHECK_EQ(vselgt, results_f32.vselgt_); \ + CHECK_EQ(vselvs, results_f32.vselvs_); \ + CHECK_EQ(-vseleq, results_f32.vselne_); \ + CHECK_EQ(-vselge, results_f32.vsellt_); \ + CHECK_EQ(-vselgt, results_f32.vselle_); \ + CHECK_EQ(-vselvs, results_f32.vselvc_); \ + CHECK_EQ(vseleq, results_f64.vseleq_); \ + CHECK_EQ(vselge, results_f64.vselge_); \ + CHECK_EQ(vselgt, results_f64.vselgt_); \ + CHECK_EQ(vselvs, results_f64.vselvs_); \ + CHECK_EQ(-vseleq, results_f64.vselne_); \ + CHECK_EQ(-vselge, results_f64.vsellt_); \ + CHECK_EQ(-vselgt, results_f64.vselle_); \ + CHECK_EQ(-vselvs, results_f64.vselvc_); \ + } while (0); + + // N Z C V vseleq vselge vselgt vselvs + CHECK_VSEL(0, 0, 0, 0, kResultFail, kResultPass, kResultPass, kResultFail); + CHECK_VSEL(0, 0, 0, 1, kResultFail, kResultFail, kResultFail, kResultPass); + CHECK_VSEL(0, 0, 1, 0, kResultFail, kResultPass, kResultPass, kResultFail); + CHECK_VSEL(0, 0, 1, 1, kResultFail, kResultFail, kResultFail, kResultPass); + CHECK_VSEL(0, 1, 0, 0, kResultPass, kResultPass, kResultFail, kResultFail); + CHECK_VSEL(0, 1, 0, 1, kResultPass, kResultFail, kResultFail, kResultPass); + CHECK_VSEL(0, 1, 1, 0, kResultPass, kResultPass, kResultFail, kResultFail); + CHECK_VSEL(0, 1, 1, 1, kResultPass, kResultFail, kResultFail, kResultPass); + CHECK_VSEL(1, 0, 0, 0, kResultFail, kResultFail, kResultFail, kResultFail); + CHECK_VSEL(1, 0, 0, 1, kResultFail, kResultPass, kResultPass, kResultPass); + CHECK_VSEL(1, 0, 1, 0, kResultFail, kResultFail, kResultFail, kResultFail); + CHECK_VSEL(1, 0, 1, 1, kResultFail, kResultPass, kResultPass, kResultPass); + CHECK_VSEL(1, 1, 0, 0, kResultPass, kResultFail, kResultFail, kResultFail); + CHECK_VSEL(1, 1, 0, 1, kResultPass, kResultPass, kResultFail, kResultPass); + CHECK_VSEL(1, 1, 1, 0, kResultPass, kResultFail, kResultFail, kResultFail); + CHECK_VSEL(1, 1, 1, 1, kResultPass, kResultPass, kResultFail, kResultPass); + +#undef CHECK_VSEL + } +} + +TEST(unaligned_loads) { + // All supported ARM targets allow unaligned accesses. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + typedef struct { + uint32_t ldrh; + uint32_t ldrsh; + uint32_t ldr; + } T; + T t; + + Assembler assm(isolate, NULL, 0); + __ ldrh(ip, MemOperand(r1, r2)); + __ str(ip, MemOperand(r0, offsetof(T, ldrh))); + __ ldrsh(ip, MemOperand(r1, r2)); + __ str(ip, MemOperand(r0, offsetof(T, ldrsh))); + __ ldr(ip, MemOperand(r1, r2)); + __ str(ip, MemOperand(r0, offsetof(T, ldr))); + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + F4 f = FUNCTION_CAST<F4>(code->entry()); + + Object* dummy = nullptr; + USE(dummy); + +#ifndef V8_TARGET_LITTLE_ENDIAN +#error This test assumes a little-endian layout. +#endif + uint64_t data = UINT64_C(0x84838281807f7e7d); + dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 0, 0, 0); + CHECK_EQ(0x00007e7d, t.ldrh); + CHECK_EQ(0x00007e7d, t.ldrsh); + CHECK_EQ(0x807f7e7d, t.ldr); + dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 1, 0, 0); + CHECK_EQ(0x00007f7e, t.ldrh); + CHECK_EQ(0x00007f7e, t.ldrsh); + CHECK_EQ(0x81807f7e, t.ldr); + dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 2, 0, 0); + CHECK_EQ(0x0000807f, t.ldrh); + CHECK_EQ(0xffff807f, t.ldrsh); + CHECK_EQ(0x8281807f, t.ldr); + dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 3, 0, 0); + CHECK_EQ(0x00008180, t.ldrh); + CHECK_EQ(0xffff8180, t.ldrsh); + CHECK_EQ(0x83828180, t.ldr); +} + +TEST(unaligned_stores) { + // All supported ARM targets allow unaligned accesses. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + Assembler assm(isolate, NULL, 0); + __ strh(r3, MemOperand(r0, r2)); + __ str(r3, MemOperand(r1, r2)); + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + F4 f = FUNCTION_CAST<F4>(code->entry()); + + Object* dummy = nullptr; + USE(dummy); + +#ifndef V8_TARGET_LITTLE_ENDIAN +#error This test assumes a little-endian layout. +#endif + { + uint64_t strh = 0; + uint64_t str = 0; + dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 0, 0xfedcba98, 0); + CHECK_EQ(UINT64_C(0x000000000000ba98), strh); + CHECK_EQ(UINT64_C(0x00000000fedcba98), str); + } + { + uint64_t strh = 0; + uint64_t str = 0; + dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 1, 0xfedcba98, 0); + CHECK_EQ(UINT64_C(0x0000000000ba9800), strh); + CHECK_EQ(UINT64_C(0x000000fedcba9800), str); + } + { + uint64_t strh = 0; + uint64_t str = 0; + dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 2, 0xfedcba98, 0); + CHECK_EQ(UINT64_C(0x00000000ba980000), strh); + CHECK_EQ(UINT64_C(0x0000fedcba980000), str); + } + { + uint64_t strh = 0; + uint64_t str = 0; + dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 3, 0xfedcba98, 0); + CHECK_EQ(UINT64_C(0x000000ba98000000), strh); + CHECK_EQ(UINT64_C(0x00fedcba98000000), str); + } +} TEST(regress4292_b) { CcTest::InitializeVM(); diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc index c2c5b782dc..68bef59d86 100644 --- a/deps/v8/test/cctest/test-assembler-arm64.cc +++ b/deps/v8/test/cctest/test-assembler-arm64.cc @@ -3819,6 +3819,375 @@ TEST(neg) { } +template <typename T, typename Op> +static void AdcsSbcsHelper(Op op, T left, T right, int carry, T expected, + StatusFlags expected_flags) { + int reg_size = sizeof(T) * 8; + auto left_reg = Register::Create(0, reg_size); + auto right_reg = Register::Create(1, reg_size); + auto result_reg = Register::Create(2, reg_size); + + SETUP(); + START(); + + __ Mov(left_reg, left); + __ Mov(right_reg, right); + __ Mov(x10, (carry ? CFlag : NoFlag)); + + __ Msr(NZCV, x10); + (masm.*op)(result_reg, left_reg, right_reg); + + END(); + RUN(); + + CHECK_EQUAL_64(left, left_reg.X()); + CHECK_EQUAL_64(right, right_reg.X()); + CHECK_EQUAL_64(expected, result_reg.X()); + CHECK_EQUAL_NZCV(expected_flags); + + TEARDOWN(); +} + + +TEST(adcs_sbcs_x) { + INIT_V8(); + uint64_t inputs[] = { + 0x0000000000000000, 0x0000000000000001, 0x7ffffffffffffffe, + 0x7fffffffffffffff, 0x8000000000000000, 0x8000000000000001, + 0xfffffffffffffffe, 0xffffffffffffffff, + }; + static const size_t input_count = sizeof(inputs) / sizeof(inputs[0]); + + struct Expected { + uint64_t carry0_result; + StatusFlags carry0_flags; + uint64_t carry1_result; + StatusFlags carry1_flags; + }; + + static const Expected expected_adcs_x[input_count][input_count] = { + {{0x0000000000000000, ZFlag, 0x0000000000000001, NoFlag}, + {0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}, + {0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x8000000000000000, NFlag, 0x8000000000000001, NFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}}, + {{0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}, + {0x0000000000000002, NoFlag, 0x0000000000000003, NoFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}}, + {{0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0xfffffffffffffffc, NVFlag, 0xfffffffffffffffd, NVFlag}, + {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}}, + {{0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, + {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, + {0xfffffffffffffffe, NVFlag, 0xffffffffffffffff, NVFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}}, + {{0x8000000000000000, NFlag, 0x8000000000000001, NFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x0000000000000000, ZCVFlag, 0x0000000000000001, CVFlag}, + {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, + {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}}, + {{0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, + {0x0000000000000002, CVFlag, 0x0000000000000003, CVFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}}, + {{0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0xfffffffffffffffc, NCFlag, 0xfffffffffffffffd, NCFlag}, + {0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}}, + {{0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}, + {0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}, + {0xfffffffffffffffe, NCFlag, 0xffffffffffffffff, NCFlag}}}; + + static const Expected expected_sbcs_x[input_count][input_count] = { + {{0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0x8000000000000000, NFlag, 0x8000000000000001, NFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}, + {0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}, + {0x0000000000000000, ZFlag, 0x0000000000000001, NoFlag}}, + {{0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x0000000000000002, NoFlag, 0x0000000000000003, NoFlag}, + {0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}}, + {{0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, + {0xfffffffffffffffc, NVFlag, 0xfffffffffffffffd, NVFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}}, + {{0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xfffffffffffffffe, NVFlag, 0xffffffffffffffff, NVFlag}, + {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, + {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, + {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}}, + {{0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, + {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, + {0x0000000000000000, ZCVFlag, 0x0000000000000001, CVFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, + {0x8000000000000000, NFlag, 0x8000000000000001, NFlag}}, + {{0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x0000000000000002, CVFlag, 0x0000000000000003, CVFlag}, + {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, + {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}}, + {{0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}, + {0xfffffffffffffffc, NCFlag, 0xfffffffffffffffd, NCFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}}, + {{0xfffffffffffffffe, NCFlag, 0xffffffffffffffff, NCFlag}, + {0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}, + {0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}, + {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}, + {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, + {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}}}; + + for (size_t left = 0; left < input_count; left++) { + for (size_t right = 0; right < input_count; right++) { + const Expected& expected = expected_adcs_x[left][right]; + AdcsSbcsHelper(&MacroAssembler::Adcs, inputs[left], inputs[right], 0, + expected.carry0_result, expected.carry0_flags); + AdcsSbcsHelper(&MacroAssembler::Adcs, inputs[left], inputs[right], 1, + expected.carry1_result, expected.carry1_flags); + } + } + + for (size_t left = 0; left < input_count; left++) { + for (size_t right = 0; right < input_count; right++) { + const Expected& expected = expected_sbcs_x[left][right]; + AdcsSbcsHelper(&MacroAssembler::Sbcs, inputs[left], inputs[right], 0, + expected.carry0_result, expected.carry0_flags); + AdcsSbcsHelper(&MacroAssembler::Sbcs, inputs[left], inputs[right], 1, + expected.carry1_result, expected.carry1_flags); + } + } +} + + +TEST(adcs_sbcs_w) { + INIT_V8(); + uint32_t inputs[] = { + 0x00000000, 0x00000001, 0x7ffffffe, 0x7fffffff, + 0x80000000, 0x80000001, 0xfffffffe, 0xffffffff, + }; + static const size_t input_count = sizeof(inputs) / sizeof(inputs[0]); + + struct Expected { + uint32_t carry0_result; + StatusFlags carry0_flags; + uint32_t carry1_result; + StatusFlags carry1_flags; + }; + + static const Expected expected_adcs_w[input_count][input_count] = { + {{0x00000000, ZFlag, 0x00000001, NoFlag}, + {0x00000001, NoFlag, 0x00000002, NoFlag}, + {0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x80000000, NFlag, 0x80000001, NFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}}, + {{0x00000001, NoFlag, 0x00000002, NoFlag}, + {0x00000002, NoFlag, 0x00000003, NoFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x80000000, NVFlag, 0x80000001, NVFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}, + {0x80000002, NFlag, 0x80000003, NFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}}, + {{0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0xfffffffc, NVFlag, 0xfffffffd, NVFlag}, + {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}}, + {{0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x80000000, NVFlag, 0x80000001, NVFlag}, + {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, + {0xfffffffe, NVFlag, 0xffffffff, NVFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x7ffffffe, CFlag, 0x7fffffff, CFlag}}, + {{0x80000000, NFlag, 0x80000001, NFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x00000000, ZCVFlag, 0x00000001, CVFlag}, + {0x00000001, CVFlag, 0x00000002, CVFlag}, + {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}}, + {{0x80000001, NFlag, 0x80000002, NFlag}, + {0x80000002, NFlag, 0x80000003, NFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}, + {0x00000001, CVFlag, 0x00000002, CVFlag}, + {0x00000002, CVFlag, 0x00000003, CVFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x80000000, NCFlag, 0x80000001, NCFlag}}, + {{0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0xfffffffc, NCFlag, 0xfffffffd, NCFlag}, + {0xfffffffd, NCFlag, 0xfffffffe, NCFlag}}, + {{0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x7ffffffe, CFlag, 0x7fffffff, CFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x80000000, NCFlag, 0x80000001, NCFlag}, + {0xfffffffd, NCFlag, 0xfffffffe, NCFlag}, + {0xfffffffe, NCFlag, 0xffffffff, NCFlag}}}; + + static const Expected expected_sbcs_w[input_count][input_count] = { + {{0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}, + {0x80000000, NFlag, 0x80000001, NFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}, + {0x00000001, NoFlag, 0x00000002, NoFlag}, + {0x00000000, ZFlag, 0x00000001, NoFlag}}, + {{0x00000000, ZCFlag, 0x00000001, CFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x80000002, NFlag, 0x80000003, NFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}, + {0x80000000, NVFlag, 0x80000001, NVFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x00000002, NoFlag, 0x00000003, NoFlag}, + {0x00000001, NoFlag, 0x00000002, NoFlag}}, + {{0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, + {0xfffffffc, NVFlag, 0xfffffffd, NVFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}}, + {{0x7ffffffe, CFlag, 0x7fffffff, CFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xfffffffe, NVFlag, 0xffffffff, NVFlag}, + {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, + {0x80000000, NVFlag, 0x80000001, NVFlag}, + {0x7fffffff, NoFlag, 0x80000000, NVFlag}}, + {{0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, + {0x00000001, CVFlag, 0x00000002, CVFlag}, + {0x00000000, ZCVFlag, 0x00000001, CVFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}, + {0x80000000, NFlag, 0x80000001, NFlag}}, + {{0x80000000, NCFlag, 0x80000001, NCFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x00000002, CVFlag, 0x00000003, CVFlag}, + {0x00000001, CVFlag, 0x00000002, CVFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0x80000002, NFlag, 0x80000003, NFlag}, + {0x80000001, NFlag, 0x80000002, NFlag}}, + {{0xfffffffd, NCFlag, 0xfffffffe, NCFlag}, + {0xfffffffc, NCFlag, 0xfffffffd, NCFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xfffffffe, NFlag, 0xffffffff, NFlag}}, + {{0xfffffffe, NCFlag, 0xffffffff, NCFlag}, + {0xfffffffd, NCFlag, 0xfffffffe, NCFlag}, + {0x80000000, NCFlag, 0x80000001, NCFlag}, + {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x7ffffffe, CFlag, 0x7fffffff, CFlag}, + {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x00000000, ZCFlag, 0x00000001, CFlag}, + {0xffffffff, NFlag, 0x00000000, ZCFlag}}}; + + for (size_t left = 0; left < input_count; left++) { + for (size_t right = 0; right < input_count; right++) { + const Expected& expected = expected_adcs_w[left][right]; + AdcsSbcsHelper(&MacroAssembler::Adcs, inputs[left], inputs[right], 0, + expected.carry0_result, expected.carry0_flags); + AdcsSbcsHelper(&MacroAssembler::Adcs, inputs[left], inputs[right], 1, + expected.carry1_result, expected.carry1_flags); + } + } + + for (size_t left = 0; left < input_count; left++) { + for (size_t right = 0; right < input_count; right++) { + const Expected& expected = expected_sbcs_w[left][right]; + AdcsSbcsHelper(&MacroAssembler::Sbcs, inputs[left], inputs[right], 0, + expected.carry0_result, expected.carry0_flags); + AdcsSbcsHelper(&MacroAssembler::Sbcs, inputs[left], inputs[right], 1, + expected.carry1_result, expected.carry1_flags); + } + } +} + + TEST(adc_sbc_shift) { INIT_V8(); SETUP(); @@ -3887,132 +4256,6 @@ TEST(adc_sbc_shift) { CHECK_EQUAL_32(0x91111110 + 1, w26); CHECK_EQUAL_32(0x9a222221 + 1, w27); - // Check that adc correctly sets the condition flags. - START(); - __ Mov(x0, 1); - __ Mov(x1, 0xffffffffffffffffL); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Adcs(x10, x0, Operand(x1)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(ZCFlag); - CHECK_EQUAL_64(0, x10); - - START(); - __ Mov(x0, 1); - __ Mov(x1, 0x8000000000000000L); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Adcs(x10, x0, Operand(x1, ASR, 63)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(ZCFlag); - CHECK_EQUAL_64(0, x10); - - START(); - __ Mov(x0, 0x10); - __ Mov(x1, 0x07ffffffffffffffL); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Adcs(x10, x0, Operand(x1, LSL, 4)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(NVFlag); - CHECK_EQUAL_64(0x8000000000000000L, x10); - - // Check that sbc correctly sets the condition flags. - START(); - __ Mov(x0, 0); - __ Mov(x1, 0xffffffffffffffffL); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Sbcs(x10, x0, Operand(x1)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(ZFlag); - CHECK_EQUAL_64(0, x10); - - START(); - __ Mov(x0, 1); - __ Mov(x1, 0xffffffffffffffffL); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Sbcs(x10, x0, Operand(x1, LSR, 1)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(NFlag); - CHECK_EQUAL_64(0x8000000000000001L, x10); - - START(); - __ Mov(x0, 0); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Sbcs(x10, x0, Operand(0xffffffffffffffffL)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(ZFlag); - CHECK_EQUAL_64(0, x10); - - START() - __ Mov(w0, 0x7fffffff); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Ngcs(w10, w0); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(NFlag); - CHECK_EQUAL_64(0x80000000, x10); - - START(); - // Clear the C flag. - __ Adds(x0, x0, Operand(0)); - __ Ngcs(x10, 0x7fffffffffffffffL); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(NFlag); - CHECK_EQUAL_64(0x8000000000000000L, x10); - - START() - __ Mov(x0, 0); - // Set the C flag. - __ Cmp(x0, Operand(x0)); - __ Sbcs(x10, x0, Operand(1)); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(NFlag); - CHECK_EQUAL_64(0xffffffffffffffffL, x10); - - START() - __ Mov(x0, 0); - // Set the C flag. - __ Cmp(x0, Operand(x0)); - __ Ngcs(x10, 0x7fffffffffffffffL); - END(); - - RUN(); - - CHECK_EQUAL_NZCV(NFlag); - CHECK_EQUAL_64(0x8000000000000001L, x10); - TEARDOWN(); } diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc index b8a04267e7..e73b40e96b 100644 --- a/deps/v8/test/cctest/test-assembler-mips.cc +++ b/deps/v8/test/cctest/test-assembler-mips.cc @@ -2048,7 +2048,7 @@ TEST(movz_movn) { v8::internal::CodeObjectRequired::kYes); typedef struct test_float { - int64_t rt; + int32_t rt; double a; double b; double bold; @@ -3191,6 +3191,8 @@ TEST(jump_tables1) { __ jr(ra); __ nop(); + CHECK_EQ(assm.UnboundLabelsCount(), 0); + CodeDesc desc; assm.GetCode(&desc); Handle<Code> code = isolate->factory()->NewCode( diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc index dd6ed6b68c..9529dab242 100644 --- a/deps/v8/test/cctest/test-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-assembler-mips64.cc @@ -1385,16 +1385,22 @@ TEST(MIPS16) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - typedef struct { + struct T { int64_t r1; int64_t r2; int64_t r3; int64_t r4; int64_t r5; int64_t r6; + int64_t r7; + int64_t r8; + int64_t r9; + int64_t r10; + int64_t r11; + int64_t r12; uint32_t ui; int32_t si; - } T; + }; T t; Assembler assm(isolate, NULL, 0); @@ -1423,26 +1429,25 @@ TEST(MIPS16) { // lh with positive data. __ lh(a5, MemOperand(a0, offsetof(T, ui))); - __ sw(a5, MemOperand(a0, offsetof(T, r2))); + __ sw(a5, MemOperand(a0, offsetof(T, r7))); // lh with negative data. __ lh(a6, MemOperand(a0, offsetof(T, si))); - __ sw(a6, MemOperand(a0, offsetof(T, r3))); + __ sw(a6, MemOperand(a0, offsetof(T, r8))); // lhu with negative data. __ lhu(a7, MemOperand(a0, offsetof(T, si))); - __ sw(a7, MemOperand(a0, offsetof(T, r4))); + __ sw(a7, MemOperand(a0, offsetof(T, r9))); // lb with negative data. __ lb(t0, MemOperand(a0, offsetof(T, si))); - __ sw(t0, MemOperand(a0, offsetof(T, r5))); + __ sw(t0, MemOperand(a0, offsetof(T, r10))); - // // sh writes only 1/2 of word. - __ lui(t1, 0x3333); - __ ori(t1, t1, 0x3333); - __ sw(t1, MemOperand(a0, offsetof(T, r6))); - __ lhu(t1, MemOperand(a0, offsetof(T, si))); - __ sh(t1, MemOperand(a0, offsetof(T, r6))); + // sh writes only 1/2 of word. + __ lw(a4, MemOperand(a0, offsetof(T, ui))); + __ sh(a4, MemOperand(a0, offsetof(T, r11))); + __ lw(a4, MemOperand(a0, offsetof(T, si))); + __ sh(a4, MemOperand(a0, offsetof(T, r12))); __ jr(ra); __ nop(); @@ -1454,26 +1459,75 @@ TEST(MIPS16) { F3 f = FUNCTION_CAST<F3>(code->entry()); t.ui = 0x44332211; t.si = 0x99aabbcc; - t.r1 = 0x1111111111111111; - t.r2 = 0x2222222222222222; - t.r3 = 0x3333333333333333; - t.r4 = 0x4444444444444444; + t.r1 = 0x5555555555555555; + t.r2 = 0x5555555555555555; + t.r3 = 0x5555555555555555; + t.r4 = 0x5555555555555555; t.r5 = 0x5555555555555555; - t.r6 = 0x6666666666666666; + t.r6 = 0x5555555555555555; + t.r7 = 0x5555555555555555; + t.r8 = 0x5555555555555555; + t.r9 = 0x5555555555555555; + t.r10 = 0x5555555555555555; + t.r11 = 0x5555555555555555; + t.r12 = 0x5555555555555555; + Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); USE(dummy); - // Unsigned data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x1111111144332211L), t.r1); - CHECK_EQ(static_cast<int64_t>(0x0000000000002211L), t.r2); + if (kArchEndian == kLittle) { + // Unsigned data, 32 & 64 + CHECK_EQ(static_cast<int64_t>(0x5555555544332211L), t.r1); // lw, sw. + CHECK_EQ(static_cast<int64_t>(0x0000000044332211L), t.r2); // sd. + + // Signed data, 32 & 64. + CHECK_EQ(static_cast<int64_t>(0x5555555599aabbccL), t.r3); // lw, sw. + CHECK_EQ(static_cast<int64_t>(0xffffffff99aabbccL), t.r4); // sd. + + // Signed data, 32 & 64. + CHECK_EQ(static_cast<int64_t>(0x5555555599aabbccL), t.r5); // lwu, sw. + CHECK_EQ(static_cast<int64_t>(0x0000000099aabbccL), t.r6); // sd. + + // lh with unsigned and signed data. + CHECK_EQ(static_cast<int64_t>(0x5555555500002211L), t.r7); // lh, sw. + CHECK_EQ(static_cast<int64_t>(0x55555555ffffbbccL), t.r8); // lh, sw. + + // lhu with signed data. + CHECK_EQ(static_cast<int64_t>(0x555555550000bbccL), t.r9); // lhu, sw. - // Signed data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x33333333ffffbbccL), t.r3); - CHECK_EQ(static_cast<int64_t>(0xffffffff0000bbccL), t.r4); + // lb with signed data. + CHECK_EQ(static_cast<int64_t>(0x55555555ffffffccL), t.r10); // lb, sw. - // Signed data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x55555555ffffffccL), t.r5); - CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6); + // sh with unsigned and signed data. + CHECK_EQ(static_cast<int64_t>(0x5555555555552211L), t.r11); // lw, sh. + CHECK_EQ(static_cast<int64_t>(0x555555555555bbccL), t.r12); // lw, sh. + } else { + // Unsigned data, 32 & 64 + CHECK_EQ(static_cast<int64_t>(0x4433221155555555L), t.r1); // lw, sw. + CHECK_EQ(static_cast<int64_t>(0x0000000044332211L), t.r2); // sd. + + // Signed data, 32 & 64. + CHECK_EQ(static_cast<int64_t>(0x99aabbcc55555555L), t.r3); // lw, sw. + CHECK_EQ(static_cast<int64_t>(0xffffffff99aabbccL), t.r4); // sd. + + // Signed data, 32 & 64. + CHECK_EQ(static_cast<int64_t>(0x99aabbcc55555555L), t.r5); // lwu, sw. + CHECK_EQ(static_cast<int64_t>(0x0000000099aabbccL), t.r6); // sd. + + // lh with unsigned and signed data. + CHECK_EQ(static_cast<int64_t>(0x0000443355555555L), t.r7); // lh, sw. + CHECK_EQ(static_cast<int64_t>(0xffff99aa55555555L), t.r8); // lh, sw. + + // lhu with signed data. + CHECK_EQ(static_cast<int64_t>(0x000099aa55555555L), t.r9); // lhu, sw. + + // lb with signed data. + CHECK_EQ(static_cast<int64_t>(0xffffff9955555555L), t.r10); // lb, sw. + + // sh with unsigned and signed data. + CHECK_EQ(static_cast<int64_t>(0x2211555555555555L), t.r11); // lw, sh. + CHECK_EQ(static_cast<int64_t>(0xbbcc555555555555L), t.r12); // lw, sh. + } } @@ -2162,7 +2216,7 @@ TEST(movz_movn) { __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, a)) ); __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, c)) ); - __ lw(t0, MemOperand(a0, offsetof(TestFloat, rt)) ); + __ ld(t0, MemOperand(a0, offsetof(TestFloat, rt))); __ Move(f12, 0.0); __ Move(f10, 0.0); __ Move(f16, 0.0); @@ -3261,6 +3315,8 @@ TEST(jump_tables1) { __ jr(ra); __ nop(); + CHECK_EQ(assm.UnboundLabelsCount(), 0); + CodeDesc desc; assm.GetCode(&desc); Handle<Code> code = isolate->factory()->NewCode( @@ -5559,15 +5615,22 @@ TEST(r6_ldpc) { uint64_t expected_res; }; - struct TestCaseLdpc tc[] = { - // offset, expected_res - { -131072, 0x250ffffe250fffff }, - { -4, 0x250c0006250c0007 }, - { -1, 0x250c0000250c0001 }, - { 0, 0x03001025ef180000 }, - { 1, 0x2508000125080000 }, - { 4, 0x2508000725080006 }, - { 131071, 0x250bfffd250bfffc }, + auto doubleword = [](uint32_t word2, uint32_t word1) { + if (kArchEndian == kLittle) + return (static_cast<uint64_t>(word2) << 32) + word1; + else + return (static_cast<uint64_t>(word1) << 32) + word2; + }; + + TestCaseLdpc tc[] = { + // offset, expected_res + {-131072, doubleword(0x250ffffe, 0x250fffff)}, + {-4, doubleword(0x250c0006, 0x250c0007)}, + {-1, doubleword(0x250c0000, 0x250c0001)}, + {0, doubleword(0x03001025, 0xef180000)}, + {1, doubleword(0x25080001, 0x25080000)}, + {4, doubleword(0x25080007, 0x25080006)}, + {131071, doubleword(0x250bfffd, 0x250bfffc)}, }; size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLdpc); diff --git a/deps/v8/test/cctest/test-assembler-s390.cc b/deps/v8/test/cctest/test-assembler-s390.cc index dee8e07935..ab6796bf18 100644 --- a/deps/v8/test/cctest/test-assembler-s390.cc +++ b/deps/v8/test/cctest/test-assembler-s390.cc @@ -202,7 +202,7 @@ TEST(3) { __ sll(r13, Operand(10)); v8::internal::byte* bufPos = assm.buffer_pos(); - ::printf("buffer position = %p", bufPos); + ::printf("buffer position = %p", static_cast<void*>(bufPos)); ::fflush(stdout); // OS::DebugBreak(); diff --git a/deps/v8/test/cctest/test-assembler-x64.cc b/deps/v8/test/cctest/test-assembler-x64.cc index 66199fb540..36f1b30df9 100644 --- a/deps/v8/test/cctest/test-assembler-x64.cc +++ b/deps/v8/test/cctest/test-assembler-x64.cc @@ -328,6 +328,32 @@ TEST(AssemblerX64TestlOperations) { CHECK_EQ(1u, result); } +TEST(AssemblerX64TestwOperations) { + typedef uint16_t (*F)(uint16_t * x); + CcTest::InitializeVM(); + // Allocate an executable page of memory. + size_t actual_size; + byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( + Assembler::kMinimalBufferSize, &actual_size, true)); + CHECK(buffer); + Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); + + // Set rax with the ZF flag of the testl instruction. + Label done; + __ movq(rax, Immediate(1)); + __ testw(Operand(arg1, 0), Immediate(0xf0f0)); + __ j(not_zero, &done, Label::kNear); + __ movq(rax, Immediate(0)); + __ bind(&done); + __ ret(0); + + CodeDesc desc; + assm.GetCode(&desc); + // Call the function from C++. + uint16_t operand = 0x8000; + uint16_t result = FUNCTION_CAST<F>(buffer)(&operand); + CHECK_EQ(1u, result); +} TEST(AssemblerX64XorlOperations) { CcTest::InitializeVM(); @@ -2270,4 +2296,60 @@ TEST(AssemblerX64JumpTables2) { } } +TEST(AssemblerX64PslldWithXmm15) { + CcTest::InitializeVM(); + // Allocate an executable page of memory. + size_t actual_size; + byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( + Assembler::kMinimalBufferSize, &actual_size, true)); + CHECK(buffer); + Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); + + __ movq(xmm15, arg1); + __ pslld(xmm15, 1); + __ movq(rax, xmm15); + __ ret(0); + + CodeDesc desc; + assm.GetCode(&desc); + uint64_t result = FUNCTION_CAST<F5>(buffer)(V8_UINT64_C(0x1122334455667788)); + CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result); +} + +typedef float (*F9)(float x, float y); +TEST(AssemblerX64vmovups) { + CcTest::InitializeVM(); + if (!CpuFeatures::IsSupported(AVX)) return; + + Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); + HandleScope scope(isolate); + v8::internal::byte buffer[256]; + MacroAssembler assm(isolate, buffer, sizeof(buffer), + v8::internal::CodeObjectRequired::kYes); + { + CpuFeatureScope avx_scope(&assm, AVX); + __ shufps(xmm0, xmm0, 0x0); // brocast first argument + __ shufps(xmm1, xmm1, 0x0); // brocast second argument + // copy xmm1 to xmm0 through the stack to test the "vmovups reg, mem". + __ subq(rsp, Immediate(kSimd128Size)); + __ vmovups(Operand(rsp, 0), xmm1); + __ vmovups(xmm0, Operand(rsp, 0)); + __ addq(rsp, Immediate(kSimd128Size)); + + __ ret(0); + } + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef OBJECT_PRINT + OFStream os(stdout); + code->Print(os); +#endif + + F9 f = FUNCTION_CAST<F9>(code->entry()); + CHECK_EQ(-1.5, f(1.5, -1.5)); +} + #undef __ diff --git a/deps/v8/test/cctest/test-assembler-x87.cc b/deps/v8/test/cctest/test-assembler-x87.cc index a831a0b2f1..3649b5bf88 100644 --- a/deps/v8/test/cctest/test-assembler-x87.cc +++ b/deps/v8/test/cctest/test-assembler-x87.cc @@ -407,4 +407,45 @@ TEST(AssemblerIa32JumpTables2) { } } +TEST(Regress621926) { + // Bug description: + // The opcodes for cmpw r/m16, r16 and cmpw r16, r/m16 were swapped. + // This was causing non-commutative comparisons to produce the wrong result. + CcTest::InitializeVM(); + Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); + HandleScope scope(isolate); + Assembler assm(isolate, nullptr, 0); + + uint16_t a = 42; + + Label fail; + __ push(ebx); + __ mov(ebx, Immediate(reinterpret_cast<intptr_t>(&a))); + __ mov(eax, Immediate(41)); + __ cmpw(eax, Operand(ebx, 0)); + __ j(above_equal, &fail); + __ cmpw(Operand(ebx, 0), eax); + __ j(below_equal, &fail); + __ mov(eax, 1); + __ pop(ebx); + __ ret(0); + __ bind(&fail); + __ mov(eax, 0); + __ pop(ebx); + __ ret(0); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + +#ifdef OBJECT_PRINT + OFStream os(stdout); + code->Print(os); +#endif + + F0 f = FUNCTION_CAST<F0>(code->entry()); + CHECK_EQ(f(), 1); +} + #undef __ diff --git a/deps/v8/test/cctest/test-ast-expression-visitor.cc b/deps/v8/test/cctest/test-ast-expression-visitor.cc deleted file mode 100644 index bda1fba3b4..0000000000 --- a/deps/v8/test/cctest/test-ast-expression-visitor.cc +++ /dev/null @@ -1,423 +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 <stdlib.h> - -#include "src/v8.h" - -#include "src/ast/ast.h" -#include "src/ast/ast-expression-visitor.h" -#include "src/ast/scopes.h" -#include "src/parsing/parser.h" -#include "src/parsing/rewriter.h" -#include "test/cctest/cctest.h" -#include "test/cctest/expression-type-collector.h" -#include "test/cctest/expression-type-collector-macros.h" - -using namespace v8::internal; - -namespace { - -static void CollectTypes(HandleAndZoneScope* handles, const char* source, - ZoneVector<ExpressionTypeEntry>* dst) { - i::Isolate* isolate = CcTest::i_isolate(); - i::Factory* factory = isolate->factory(); - - i::Handle<i::String> source_code = - factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); - - i::Handle<i::Script> script = factory->NewScript(source_code); - - i::ParseInfo info(handles->main_zone(), script); - i::Parser parser(&info); - parser.set_allow_harmony_sloppy(true); - info.set_global(); - info.set_lazy(false); - info.set_allow_lazy_parsing(false); - info.set_toplevel(true); - - CHECK(i::Compiler::ParseAndAnalyze(&info)); - - ExpressionTypeCollector( - isolate, - info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(), dst) - .Run(); -} - -} // namespace - - -TEST(VisitExpressions) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - const char test_function[] = - "function GeometricMean(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - "\n" - " var exp = stdlib.Math.exp;\n" - " var log = stdlib.Math.log;\n" - " var values = new stdlib.Float64Array(buffer);\n" - "\n" - " function logSum(start, end) {\n" - " start = start|0;\n" - " end = end|0;\n" - "\n" - " var sum = 0.0, p = 0, q = 0;\n" - "\n" - " // asm.js forces byte addressing of the heap by requiring shifting " - "by 3\n" - " for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {\n" - " sum = sum + +log(values[p>>3]);\n" - " }\n" - "\n" - " return +sum;\n" - " }\n" - "\n" - " function geometricMean(start, end) {\n" - " start = start|0;\n" - " end = end|0;\n" - "\n" - " return +exp(+logSum(start, end) / +((end - start)|0));\n" - " }\n" - "\n" - " return { geometricMean: geometricMean };\n" - "}\n"; - - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - // function logSum - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(start, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(start, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(end, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(end, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(sum, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(p, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(q, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - // for (p = start << 3, q = end << 3; - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(p, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(start, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(q, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(end, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - } - // (p|0) < (q|0); - CHECK_EXPR(CompareOperation, Bounds::Unbounded()) { - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(p, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(q, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // p = (p + 8)|0) {\n" - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(p, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(p, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // sum = sum + +log(values[p>>3]); - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(sum, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(sum, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(Call, Bounds::Unbounded()) { - CHECK_VAR(log, Bounds::Unbounded()); - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(values, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(p, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - } - // return +sum; - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(sum, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // function geometricMean - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(start, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(start, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(end, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(end, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // return +exp(+logSum(start, end) / +((end - start)|0)); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(Call, Bounds::Unbounded()) { - CHECK_VAR(exp, Bounds::Unbounded()); - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(Call, Bounds::Unbounded()) { - CHECK_VAR(logSum, Bounds::Unbounded()); - CHECK_VAR(start, Bounds::Unbounded()); - CHECK_VAR(end, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - CHECK_VAR(end, Bounds::Unbounded()); - CHECK_VAR(start, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // "use asm"; - CHECK_EXPR(Literal, Bounds::Unbounded()); - // var exp = stdlib.Math.exp; - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(exp, Bounds::Unbounded()); - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(stdlib, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // var log = stdlib.Math.log; - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(log, Bounds::Unbounded()); - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(stdlib, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // var values = new stdlib.Float64Array(buffer); - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(values, Bounds::Unbounded()); - CHECK_EXPR(CallNew, Bounds::Unbounded()) { - CHECK_EXPR(Property, Bounds::Unbounded()) { - CHECK_VAR(stdlib, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_VAR(buffer, Bounds::Unbounded()); - } - } - // return { geometricMean: geometricMean }; - CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { - CHECK_VAR(geometricMean, Bounds::Unbounded()); - } - } - } - CHECK_TYPES_END -} - - -TEST(VisitConditional) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - // Check that traversing the ternary operator works. - const char test_function[] = - "function foo() {\n" - " var a, b, c;\n" - " var x = a ? b : c;\n" - "}\n"; - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(x, Bounds::Unbounded()); - CHECK_EXPR(Conditional, Bounds::Unbounded()) { - CHECK_VAR(a, Bounds::Unbounded()); - CHECK_VAR(b, Bounds::Unbounded()); - CHECK_VAR(c, Bounds::Unbounded()); - } - } - } - } - CHECK_TYPES_END -} - - -TEST(VisitEmptyForStatment) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - // Check that traversing an empty for statement works. - const char test_function[] = - "function foo() {\n" - " for (;;) {}\n" - "}\n"; - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) {} - } - CHECK_TYPES_END -} - - -TEST(VisitSwitchStatment) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - // Check that traversing a switch with a default works. - const char test_function[] = - "function foo() {\n" - " switch (0) { case 1: break; default: break; }\n" - "}\n"; - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(.switch_tag, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - CHECK_EXPR(Literal, Bounds::Unbounded()); - CHECK_VAR(.switch_tag, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - CHECK_TYPES_END -} - - -TEST(VisitThrow) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - const char test_function[] = - "function foo() {\n" - " throw 123;\n" - "}\n"; - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(Throw, Bounds::Unbounded()) { - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - } - CHECK_TYPES_END -} - - -TEST(VisitYield) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - const char test_function[] = - "function* foo() {\n" - " yield 123;\n" - "}\n"; - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - // Implicit initial yield - CHECK_EXPR(Yield, Bounds::Unbounded()) { - CHECK_VAR(.generator_object, Bounds::Unbounded()); - CHECK_EXPR(Assignment, Bounds::Unbounded()) { - CHECK_VAR(.generator_object, Bounds::Unbounded()); - CHECK_EXPR(CallRuntime, Bounds::Unbounded()); - } - } - // Explicit yield (argument wrapped with CreateIterResultObject) - CHECK_EXPR(Yield, Bounds::Unbounded()) { - CHECK_VAR(.generator_object, Bounds::Unbounded()); - CHECK_EXPR(CallRuntime, Bounds::Unbounded()) { - CHECK_EXPR(Literal, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - // Argument to implicit final return - CHECK_EXPR(CallRuntime, Bounds::Unbounded()) { // CreateIterResultObject - CHECK_EXPR(Literal, Bounds::Unbounded()); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - // Implicit finally clause - CHECK_EXPR(CallRuntime, Bounds::Unbounded()) { - CHECK_VAR(.generator_object, Bounds::Unbounded()); - } - } - } - CHECK_TYPES_END -} - - -TEST(VisitSkipping) { - v8::V8::Initialize(); - HandleAndZoneScope handles; - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - const char test_function[] = - "function foo(x) {\n" - " return (x + x) + 1;\n" - "}\n"; - CollectTypes(&handles, test_function, &types); - CHECK_TYPES_BEGIN { - CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { - CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { - // Skip x + x - CHECK_SKIP(); - CHECK_EXPR(Literal, Bounds::Unbounded()); - } - } - } - CHECK_TYPES_END -} diff --git a/deps/v8/test/cctest/test-ast.cc b/deps/v8/test/cctest/test-ast.cc index 365652ef1d..c2cc89828e 100644 --- a/deps/v8/test/cctest/test-ast.cc +++ b/deps/v8/test/cctest/test-ast.cc @@ -42,7 +42,7 @@ TEST(List) { Zone zone(&allocator); AstValueFactory value_factory(&zone, 0); AstNodeFactory factory(&value_factory); - AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition); + AstNode* node = factory.NewEmptyStatement(kNoSourcePosition); list->Add(node); CHECK_EQ(1, list->length()); CHECK_EQ(node, list->at(0)); diff --git a/deps/v8/test/cctest/test-code-cache.cc b/deps/v8/test/cctest/test-code-cache.cc new file mode 100644 index 0000000000..817fa15b34 --- /dev/null +++ b/deps/v8/test/cctest/test-code-cache.cc @@ -0,0 +1,77 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/v8.h" + +#include "src/list.h" +#include "src/objects.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace internal { + +namespace { + +static Handle<Code> GetDummyCode(Isolate* isolate) { + CodeDesc desc = {nullptr, // buffer + 0, // buffer_size + 0, // instr_size + 0, // reloc_size + 0, // constant_pool_size + nullptr, // unwinding_info + 0, // unwinding_info_size + nullptr}; // origin + Code::Flags flags = + Code::ComputeFlags(Code::LOAD_IC, kNoExtraICState, kCacheOnReceiver); + Handle<Code> self_ref; + return isolate->factory()->NewCode(desc, flags, self_ref); +} + +} // namespace + +TEST(CodeCache) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope handle_scope(isolate); + + Handle<Map> map = + factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize, FAST_ELEMENTS); + + // This number should be large enough to cause the code cache to use its + // hash table storage format. + static const int kEntries = 150; + + // Prepare name/code pairs. + List<Handle<Name>> names(kEntries); + List<Handle<Code>> codes(kEntries); + for (int i = 0; i < kEntries; i++) { + names.Add(isolate->factory()->NewSymbol()); + codes.Add(GetDummyCode(isolate)); + } + Handle<Name> bad_name = isolate->factory()->NewSymbol(); + Code::Flags bad_flags = + Code::ComputeFlags(Code::LOAD_IC, kNoExtraICState, kCacheOnPrototype); + DCHECK(bad_flags != codes[0]->flags()); + + // Cache name/code pairs. + for (int i = 0; i < kEntries; i++) { + Handle<Name> name = names.at(i); + Handle<Code> code = codes.at(i); + Map::UpdateCodeCache(map, name, code); + CHECK_EQ(*code, map->LookupInCodeCache(*name, code->flags())); + CHECK_NULL(map->LookupInCodeCache(*name, bad_flags)); + } + CHECK_NULL(map->LookupInCodeCache(*bad_name, bad_flags)); + + // Check that lookup works not only right after storing. + for (int i = 0; i < kEntries; i++) { + Handle<Name> name = names.at(i); + Handle<Code> code = codes.at(i); + CHECK_EQ(*code, map->LookupInCodeCache(*name, code->flags())); + } +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-code-layout.cc b/deps/v8/test/cctest/test-code-layout.cc new file mode 100644 index 0000000000..a88c8783e6 --- /dev/null +++ b/deps/v8/test/cctest/test-code-layout.cc @@ -0,0 +1,84 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/objects.h" +#include "test/cctest/cctest.h" + +using namespace v8::internal; + +TEST(CodeLayoutWithoutUnwindingInfo) { + CcTest::InitializeVM(); + HandleScope handle_scope(CcTest::i_isolate()); + + // "Hello, World!" in ASCII. + byte buffer_array[13] = {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, + 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21}; + + byte* buffer = &buffer_array[0]; + int buffer_size = sizeof(buffer_array); + + CodeDesc code_desc; + code_desc.buffer = buffer; + code_desc.buffer_size = buffer_size; + code_desc.constant_pool_size = 0; + code_desc.instr_size = buffer_size; + code_desc.reloc_size = 0; + code_desc.origin = nullptr; + code_desc.unwinding_info = nullptr; + code_desc.unwinding_info_size = 0; + + Handle<Code> code = CcTest::i_isolate()->factory()->NewCode( + code_desc, 0, Handle<Object>::null()); + + CHECK(!code->has_unwinding_info()); + CHECK_EQ(code->instruction_size(), buffer_size); + CHECK_EQ(memcmp(code->instruction_start(), buffer, buffer_size), 0); + CHECK_EQ(code->instruction_end() - reinterpret_cast<byte*>(*code), + Code::kHeaderSize + buffer_size - kHeapObjectTag); +} + +TEST(CodeLayoutWithUnwindingInfo) { + CcTest::InitializeVM(); + HandleScope handle_scope(CcTest::i_isolate()); + + // "Hello, World!" in ASCII. + byte buffer_array[13] = {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, + 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21}; + + // "JavaScript" in ASCII. + byte unwinding_info_array[10] = {0x4a, 0x61, 0x76, 0x61, 0x53, + 0x63, 0x72, 0x69, 0x70, 0x74}; + + byte* buffer = &buffer_array[0]; + int buffer_size = sizeof(buffer_array); + byte* unwinding_info = &unwinding_info_array[0]; + int unwinding_info_size = sizeof(unwinding_info_array); + + CodeDesc code_desc; + code_desc.buffer = buffer; + code_desc.buffer_size = buffer_size; + code_desc.constant_pool_size = 0; + code_desc.instr_size = buffer_size; + code_desc.reloc_size = 0; + code_desc.origin = nullptr; + code_desc.unwinding_info = unwinding_info; + code_desc.unwinding_info_size = unwinding_info_size; + + Handle<Code> code = CcTest::i_isolate()->factory()->NewCode( + code_desc, 0, Handle<Object>::null()); + + CHECK(code->has_unwinding_info()); + CHECK_EQ(code->instruction_size(), buffer_size); + CHECK_EQ(memcmp(code->instruction_start(), buffer, buffer_size), 0); + CHECK(IsAligned(code->GetUnwindingInfoSizeOffset(), 8)); + CHECK_EQ(code->unwinding_info_size(), unwinding_info_size); + CHECK( + IsAligned(reinterpret_cast<uintptr_t>(code->unwinding_info_start()), 8)); + CHECK_EQ( + memcmp(code->unwinding_info_start(), unwinding_info, unwinding_info_size), + 0); + CHECK_EQ(code->unwinding_info_end() - reinterpret_cast<byte*>(*code), + Code::kHeaderSize + RoundUp(buffer_size, kInt64Size) + kInt64Size + + unwinding_info_size - kHeapObjectTag); +} diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc new file mode 100644 index 0000000000..2d153e3822 --- /dev/null +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -0,0 +1,1477 @@ +// 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/base/utils/random-number-generator.h" +#include "src/ic/stub-cache.h" +#include "src/isolate.h" +#include "test/cctest/compiler/code-assembler-tester.h" +#include "test/cctest/compiler/function-tester.h" + +namespace v8 { +namespace internal { + +using compiler::FunctionTester; +using compiler::Node; + +typedef compiler::CodeAssemblerTesterImpl<CodeStubAssembler> + CodeStubAssemblerTester; + +TEST(FixedArrayAccessSmiIndex) { + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeStubAssemblerTester m(isolate, descriptor); + Handle<FixedArray> array = isolate->factory()->NewFixedArray(5); + array->set(4, Smi::FromInt(733)); + m.Return(m.LoadFixedArrayElement(m.HeapConstant(array), + m.SmiTag(m.Int32Constant(4)), 0, + CodeStubAssembler::SMI_PARAMETERS)); + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(descriptor, code); + MaybeHandle<Object> result = ft.Call(); + CHECK_EQ(733, Handle<Smi>::cast(result.ToHandleChecked())->value()); +} + +TEST(LoadHeapNumberValue) { + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeStubAssemblerTester m(isolate, descriptor); + Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(1234); + m.Return(m.SmiTag( + m.ChangeFloat64ToUint32(m.LoadHeapNumberValue(m.HeapConstant(number))))); + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(descriptor, code); + MaybeHandle<Object> result = ft.Call(); + CHECK_EQ(1234, Handle<Smi>::cast(result.ToHandleChecked())->value()); +} + +TEST(LoadInstanceType) { + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeStubAssemblerTester m(isolate, descriptor); + Handle<HeapObject> undefined = isolate->factory()->undefined_value(); + m.Return(m.SmiTag(m.LoadInstanceType(m.HeapConstant(undefined)))); + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(descriptor, code); + MaybeHandle<Object> result = ft.Call(); + CHECK_EQ(InstanceType::ODDBALL_TYPE, + Handle<Smi>::cast(result.ToHandleChecked())->value()); +} + +TEST(BitFieldDecode) { + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeStubAssemblerTester m(isolate, descriptor); + + class TestBitField : public BitField<unsigned, 3, 3> {}; + m.Return(m.SmiTag(m.BitFieldDecode<TestBitField>(m.Int32Constant(0x2f)))); + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(descriptor, code); + MaybeHandle<Object> result = ft.Call(); + // value = 00101111 + // mask = 00111000 + // result = 101 + CHECK_EQ(5, Handle<Smi>::cast(result.ToHandleChecked())->value()); +} + +TEST(JSFunction) { + const int kNumParams = 3; // Receiver, left, right. + Isolate* isolate(CcTest::InitIsolateOnce()); + CodeStubAssemblerTester m(isolate, kNumParams); + m.Return(m.SmiFromWord32(m.Int32Add(m.SmiToWord32(m.Parameter(1)), + m.SmiToWord32(m.Parameter(2))))); + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + MaybeHandle<Object> result = ft.Call(isolate->factory()->undefined_value(), + handle(Smi::FromInt(23), isolate), + handle(Smi::FromInt(34), isolate)); + CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value()); +} + +TEST(ComputeIntegerHash) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 2; + CodeStubAssemblerTester m(isolate, kNumParams); + m.Return(m.SmiFromWord32(m.ComputeIntegerHash( + m.SmiToWord32(m.Parameter(0)), m.SmiToWord32(m.Parameter(1))))); + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Smi> hash_seed = isolate->factory()->hash_seed(); + + base::RandomNumberGenerator rand_gen(FLAG_random_seed); + + for (int i = 0; i < 1024; i++) { + int k = rand_gen.NextInt(Smi::kMaxValue); + + Handle<Smi> key(Smi::FromInt(k), isolate); + Handle<Object> result = ft.Call(key, hash_seed).ToHandleChecked(); + + uint32_t hash = ComputeIntegerHash(k, hash_seed->value()); + Smi* expected = Smi::FromInt(hash & Smi::kMaxValue); + CHECK_EQ(expected, Smi::cast(*result)); + } +} + +TEST(TryToName) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 3; + CodeStubAssemblerTester m(isolate, kNumParams); + + enum Result { kKeyIsIndex, kKeyIsUnique, kBailout }; + { + Node* key = m.Parameter(0); + Node* expected_result = m.Parameter(1); + Node* expected_arg = m.Parameter(2); + + Label passed(&m), failed(&m); + Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m); + Variable var_index(&m, MachineRepresentation::kWord32); + + 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.Word32Equal(m.SmiToWord32(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); + + m.Bind(&if_bailout); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))), + &passed, &failed); + + m.Bind(&passed); + m.Return(m.BooleanConstant(true)); + + m.Bind(&failed); + m.Return(m.BooleanConstant(false)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Object> expect_index(Smi::FromInt(kKeyIsIndex), isolate); + Handle<Object> expect_unique(Smi::FromInt(kKeyIsUnique), isolate); + Handle<Object> expect_bailout(Smi::FromInt(kBailout), isolate); + + { + // TryToName(<zero smi>) => if_keyisindex: smi value. + Handle<Object> key(Smi::FromInt(0), isolate); + ft.CheckTrue(key, expect_index, key); + } + + { + // TryToName(<positive smi>) => if_keyisindex: smi value. + Handle<Object> key(Smi::FromInt(153), isolate); + ft.CheckTrue(key, expect_index, key); + } + + { + // TryToName(<negative smi>) => bailout. + Handle<Object> key(Smi::FromInt(-1), isolate); + ft.CheckTrue(key, expect_bailout); + } + + { + // TryToName(<symbol>) => if_keyisunique: <symbol>. + Handle<Object> key = isolate->factory()->NewSymbol(); + ft.CheckTrue(key, expect_unique, key); + } + + { + // TryToName(<internalized string>) => if_keyisunique: <internalized string> + Handle<Object> key = isolate->factory()->InternalizeUtf8String("test"); + ft.CheckTrue(key, expect_unique, key); + } + + { + // TryToName(<internalized number string>) => if_keyisindex: number. + Handle<Object> key = isolate->factory()->InternalizeUtf8String("153"); + Handle<Object> index(Smi::FromInt(153), isolate); + ft.CheckTrue(key, expect_index, index); + } + + { + // TryToName(<non-internalized string>) => bailout. + Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test"); + ft.CheckTrue(key, expect_bailout); + } +} + +namespace { + +template <typename Dictionary> +void TestNameDictionaryLookup() { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeStubAssemblerTester m(isolate, kNumParams); + + enum Result { kFound, kNotFound }; + { + Node* dictionary = m.Parameter(0); + Node* unique_name = m.Parameter(1); + Node* expected_result = m.Parameter(2); + Node* expected_arg = m.Parameter(3); + + Label passed(&m), failed(&m); + Label if_found(&m), if_not_found(&m); + Variable var_name_index(&m, MachineRepresentation::kWord32); + + m.NameDictionaryLookup<Dictionary>(dictionary, unique_name, &if_found, + &var_name_index, &if_not_found); + m.Bind(&if_found); + m.GotoUnless( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), + &failed); + m.Branch(m.Word32Equal(m.SmiToWord32(expected_arg), var_name_index.value()), + &passed, &failed); + + m.Bind(&if_not_found); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), + &passed, &failed); + + m.Bind(&passed); + m.Return(m.BooleanConstant(true)); + + m.Bind(&failed); + m.Return(m.BooleanConstant(false)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Object> expect_found(Smi::FromInt(kFound), isolate); + Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); + + Handle<Dictionary> dictionary = Dictionary::New(isolate, 40); + PropertyDetails fake_details = PropertyDetails::Empty(); + + Factory* factory = isolate->factory(); + Handle<Name> keys[] = { + factory->InternalizeUtf8String("0"), + factory->InternalizeUtf8String("42"), + factory->InternalizeUtf8String("-153"), + factory->InternalizeUtf8String("0.0"), + factory->InternalizeUtf8String("4.2"), + factory->InternalizeUtf8String(""), + factory->InternalizeUtf8String("name"), + factory->NewSymbol(), + factory->NewPrivateSymbol(), + }; + + for (size_t i = 0; i < arraysize(keys); i++) { + Handle<Object> value = factory->NewPropertyCell(); + dictionary = Dictionary::Add(dictionary, keys[i], value, fake_details); + } + + for (size_t i = 0; i < arraysize(keys); i++) { + int entry = dictionary->FindEntry(keys[i]); + int name_index = + Dictionary::EntryToIndex(entry) + Dictionary::kEntryKeyIndex; + CHECK_NE(Dictionary::kNotFound, entry); + + Handle<Object> expected_name_index(Smi::FromInt(name_index), isolate); + ft.CheckTrue(dictionary, keys[i], expect_found, expected_name_index); + } + + Handle<Name> non_existing_keys[] = { + factory->InternalizeUtf8String("1"), + factory->InternalizeUtf8String("-42"), + factory->InternalizeUtf8String("153"), + factory->InternalizeUtf8String("-1.0"), + factory->InternalizeUtf8String("1.3"), + factory->InternalizeUtf8String("a"), + factory->InternalizeUtf8String("boom"), + factory->NewSymbol(), + factory->NewPrivateSymbol(), + }; + + for (size_t i = 0; i < arraysize(non_existing_keys); i++) { + int entry = dictionary->FindEntry(non_existing_keys[i]); + CHECK_EQ(Dictionary::kNotFound, entry); + + ft.CheckTrue(dictionary, non_existing_keys[i], expect_not_found); + } +} + +} // namespace + +TEST(NameDictionaryLookup) { TestNameDictionaryLookup<NameDictionary>(); } + +TEST(GlobalDictionaryLookup) { TestNameDictionaryLookup<GlobalDictionary>(); } + +namespace { + +template <typename Dictionary> +void TestNumberDictionaryLookup() { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeStubAssemblerTester m(isolate, kNumParams); + + enum Result { kFound, kNotFound }; + { + Node* dictionary = m.Parameter(0); + Node* key = m.SmiToWord32(m.Parameter(1)); + Node* expected_result = m.Parameter(2); + Node* expected_arg = m.Parameter(3); + + Label passed(&m), failed(&m); + Label if_found(&m), if_not_found(&m); + Variable var_entry(&m, MachineRepresentation::kWord32); + + m.NumberDictionaryLookup<Dictionary>(dictionary, key, &if_found, &var_entry, + &if_not_found); + m.Bind(&if_found); + m.GotoUnless( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), + &failed); + m.Branch(m.Word32Equal(m.SmiToWord32(expected_arg), var_entry.value()), + &passed, &failed); + + m.Bind(&if_not_found); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), + &passed, &failed); + + m.Bind(&passed); + m.Return(m.BooleanConstant(true)); + + m.Bind(&failed); + m.Return(m.BooleanConstant(false)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Object> expect_found(Smi::FromInt(kFound), isolate); + Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); + + const int kKeysCount = 1000; + Handle<Dictionary> dictionary = Dictionary::New(isolate, kKeysCount); + uint32_t keys[kKeysCount]; + + Handle<Object> fake_value(Smi::FromInt(42), isolate); + PropertyDetails fake_details = PropertyDetails::Empty(); + + base::RandomNumberGenerator rand_gen(FLAG_random_seed); + + for (int i = 0; i < kKeysCount; i++) { + int random_key = rand_gen.NextInt(Smi::kMaxValue); + keys[i] = static_cast<uint32_t>(random_key); + if (dictionary->FindEntry(keys[i]) != Dictionary::kNotFound) continue; + + dictionary = Dictionary::Add(dictionary, keys[i], fake_value, fake_details); + } + + // Now try querying existing keys. + for (int i = 0; i < kKeysCount; i++) { + int entry = dictionary->FindEntry(keys[i]); + CHECK_NE(Dictionary::kNotFound, entry); + + Handle<Object> key(Smi::FromInt(keys[i]), isolate); + Handle<Object> expected_entry(Smi::FromInt(entry), isolate); + ft.CheckTrue(dictionary, key, expect_found, expected_entry); + } + + // Now try querying random keys which do not exist in the dictionary. + for (int i = 0; i < kKeysCount;) { + int random_key = rand_gen.NextInt(Smi::kMaxValue); + int entry = dictionary->FindEntry(random_key); + if (entry != Dictionary::kNotFound) continue; + i++; + + Handle<Object> key(Smi::FromInt(random_key), isolate); + ft.CheckTrue(dictionary, key, expect_not_found); + } +} + +} // namespace + +TEST(SeededNumberDictionaryLookup) { + TestNumberDictionaryLookup<SeededNumberDictionary>(); +} + +TEST(UnseededNumberDictionaryLookup) { + TestNumberDictionaryLookup<UnseededNumberDictionary>(); +} + +namespace { + +void AddProperties(Handle<JSObject> object, Handle<Name> names[], + size_t count) { + Isolate* isolate = object->GetIsolate(); + for (size_t i = 0; i < count; i++) { + Handle<Object> value(Smi::FromInt(static_cast<int>(42 + i)), isolate); + JSObject::AddProperty(object, names[i], value, NONE); + } +} + +Handle<AccessorPair> CreateAccessorPair(FunctionTester* ft, + const char* getter_body, + const char* setter_body) { + Handle<AccessorPair> pair = ft->isolate->factory()->NewAccessorPair(); + if (getter_body) { + pair->set_getter(*ft->NewFunction(getter_body)); + } + if (setter_body) { + pair->set_setter(*ft->NewFunction(setter_body)); + } + return pair; +} + +void AddProperties(Handle<JSObject> object, Handle<Name> names[], + size_t names_count, Handle<Object> values[], + size_t values_count, int seed = 0) { + Isolate* isolate = object->GetIsolate(); + for (size_t i = 0; i < names_count; i++) { + Handle<Object> value = values[(seed + i) % values_count]; + if (value->IsAccessorPair()) { + Handle<AccessorPair> pair = Handle<AccessorPair>::cast(value); + Handle<Object> getter(pair->getter(), isolate); + Handle<Object> setter(pair->setter(), isolate); + JSObject::DefineAccessor(object, names[i], getter, setter, NONE).Check(); + } else { + JSObject::AddProperty(object, names[i], value, NONE); + } + } +} + +} // namespace + +TEST(TryHasOwnProperty) { + typedef CodeStubAssembler::Label Label; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeStubAssemblerTester m(isolate, kNumParams); + + enum Result { kFound, kNotFound, kBailout }; + { + Node* object = m.Parameter(0); + Node* unique_name = m.Parameter(1); + Node* expected_result = m.Parameter(2); + + Label passed(&m), failed(&m); + Label if_found(&m), if_not_found(&m), if_bailout(&m); + + Node* map = m.LoadMap(object); + Node* instance_type = m.LoadMapInstanceType(map); + + m.TryHasOwnProperty(object, map, instance_type, unique_name, &if_found, + &if_not_found, &if_bailout); + + m.Bind(&if_found); + m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), + &passed, &failed); + + m.Bind(&if_not_found); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), + &passed, &failed); + + m.Bind(&if_bailout); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))), + &passed, &failed); + + m.Bind(&passed); + m.Return(m.BooleanConstant(true)); + + m.Bind(&failed); + m.Return(m.BooleanConstant(false)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Object> expect_found(Smi::FromInt(kFound), isolate); + Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); + Handle<Object> expect_bailout(Smi::FromInt(kBailout), isolate); + + Factory* factory = isolate->factory(); + + Handle<Name> deleted_property_name = + factory->InternalizeUtf8String("deleted"); + + Handle<Name> names[] = { + factory->InternalizeUtf8String("a"), + factory->InternalizeUtf8String("bb"), + factory->InternalizeUtf8String("ccc"), + factory->InternalizeUtf8String("dddd"), + factory->InternalizeUtf8String("eeeee"), + factory->InternalizeUtf8String(""), + factory->InternalizeUtf8String("name"), + factory->NewSymbol(), + factory->NewPrivateSymbol(), + }; + + std::vector<Handle<JSObject>> objects; + + { + // Fast object, no inobject properties. + int inobject_properties = 0; + Handle<Map> map = Map::Create(isolate, inobject_properties); + Handle<JSObject> object = factory->NewJSObjectFromMap(map); + AddProperties(object, names, arraysize(names)); + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); + CHECK(!object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Fast object, all inobject properties. + int inobject_properties = arraysize(names) * 2; + Handle<Map> map = Map::Create(isolate, inobject_properties); + Handle<JSObject> object = factory->NewJSObjectFromMap(map); + AddProperties(object, names, arraysize(names)); + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); + CHECK(!object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Fast object, half inobject properties. + int inobject_properties = arraysize(names) / 2; + Handle<Map> map = Map::Create(isolate, inobject_properties); + Handle<JSObject> object = factory->NewJSObjectFromMap(map); + AddProperties(object, names, arraysize(names)); + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); + CHECK(!object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Dictionary mode object. + Handle<JSFunction> function = factory->NewFunction(factory->empty_string()); + Handle<JSObject> object = factory->NewJSObject(function); + AddProperties(object, names, arraysize(names)); + JSObject::NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0, "test"); + + JSObject::AddProperty(object, deleted_property_name, object, NONE); + CHECK(JSObject::DeleteProperty(object, deleted_property_name, SLOPPY) + .FromJust()); + + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK(object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Global object. + Handle<JSFunction> function = factory->NewFunction(factory->empty_string()); + JSFunction::EnsureHasInitialMap(function); + function->initial_map()->set_instance_type(JS_GLOBAL_OBJECT_TYPE); + function->initial_map()->set_is_prototype_map(true); + function->initial_map()->set_dictionary_map(true); + Handle<JSObject> object = factory->NewJSGlobalObject(function); + AddProperties(object, names, arraysize(names)); + + JSObject::AddProperty(object, deleted_property_name, object, NONE); + CHECK(JSObject::DeleteProperty(object, deleted_property_name, SLOPPY) + .FromJust()); + + CHECK_EQ(JS_GLOBAL_OBJECT_TYPE, object->map()->instance_type()); + CHECK(object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + for (Handle<JSObject> object : objects) { + for (size_t name_index = 0; name_index < arraysize(names); name_index++) { + Handle<Name> name = names[name_index]; + CHECK(JSReceiver::HasProperty(object, name).FromJust()); + ft.CheckTrue(object, name, expect_found); + } + } + } + + { + Handle<Name> non_existing_names[] = { + factory->NewSymbol(), + factory->InternalizeUtf8String("ne_a"), + factory->InternalizeUtf8String("ne_bb"), + factory->NewPrivateSymbol(), + factory->InternalizeUtf8String("ne_ccc"), + factory->InternalizeUtf8String("ne_dddd"), + deleted_property_name, + }; + for (Handle<JSObject> object : objects) { + for (size_t key_index = 0; key_index < arraysize(non_existing_names); + key_index++) { + Handle<Name> name = non_existing_names[key_index]; + CHECK(!JSReceiver::HasProperty(object, name).FromJust()); + ft.CheckTrue(object, name, expect_not_found); + } + } + } + + { + Handle<JSFunction> function = factory->NewFunction(factory->empty_string()); + Handle<JSProxy> object = factory->NewJSProxy(function, objects[0]); + CHECK_EQ(JS_PROXY_TYPE, object->map()->instance_type()); + ft.CheckTrue(object, names[0], expect_bailout); + } + + { + Handle<JSObject> object = isolate->global_proxy(); + CHECK_EQ(JS_GLOBAL_PROXY_TYPE, object->map()->instance_type()); + ft.CheckTrue(object, names[0], expect_bailout); + } +} + +TEST(TryGetOwnProperty) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + Factory* factory = isolate->factory(); + + const int kNumParams = 2; + CodeStubAssemblerTester m(isolate, kNumParams); + + Handle<Symbol> not_found_symbol = factory->NewSymbol(); + Handle<Symbol> bailout_symbol = factory->NewSymbol(); + { + Node* object = m.Parameter(0); + Node* unique_name = m.Parameter(1); + Node* context = m.Parameter(kNumParams + 2); + + Variable var_value(&m, MachineRepresentation::kTagged); + Label if_found(&m), if_not_found(&m), if_bailout(&m); + + Node* map = m.LoadMap(object); + Node* instance_type = m.LoadMapInstanceType(map); + + m.TryGetOwnProperty(context, object, object, map, instance_type, + unique_name, &if_found, &var_value, &if_not_found, + &if_bailout); + + m.Bind(&if_found); + m.Return(var_value.value()); + + m.Bind(&if_not_found); + m.Return(m.HeapConstant(not_found_symbol)); + + m.Bind(&if_bailout); + m.Return(m.HeapConstant(bailout_symbol)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Name> deleted_property_name = + factory->InternalizeUtf8String("deleted"); + + Handle<Name> names[] = { + factory->InternalizeUtf8String("bb"), + factory->NewSymbol(), + factory->InternalizeUtf8String("a"), + factory->InternalizeUtf8String("ccc"), + factory->InternalizeUtf8String("esajefe"), + factory->NewPrivateSymbol(), + factory->InternalizeUtf8String("eeeee"), + factory->InternalizeUtf8String("p1"), + factory->InternalizeUtf8String("acshw23e"), + factory->InternalizeUtf8String(""), + factory->InternalizeUtf8String("dddd"), + factory->NewPrivateSymbol(), + factory->InternalizeUtf8String("name"), + factory->InternalizeUtf8String("p2"), + factory->InternalizeUtf8String("p3"), + factory->InternalizeUtf8String("p4"), + factory->NewPrivateSymbol(), + }; + Handle<Object> values[] = { + factory->NewFunction(factory->empty_string()), + factory->NewSymbol(), + factory->InternalizeUtf8String("a"), + CreateAccessorPair(&ft, "() => 188;", "() => 199;"), + factory->NewFunction(factory->InternalizeUtf8String("bb")), + factory->InternalizeUtf8String("ccc"), + CreateAccessorPair(&ft, "() => 88;", nullptr), + handle(Smi::FromInt(1), isolate), + factory->InternalizeUtf8String(""), + CreateAccessorPair(&ft, nullptr, "() => 99;"), + factory->NewHeapNumber(4.2), + handle(Smi::FromInt(153), isolate), + factory->NewJSObject(factory->NewFunction(factory->empty_string())), + factory->NewPrivateSymbol(), + }; + STATIC_ASSERT(arraysize(values) < arraysize(names)); + + base::RandomNumberGenerator rand_gen(FLAG_random_seed); + + std::vector<Handle<JSObject>> objects; + + { + // Fast object, no inobject properties. + int inobject_properties = 0; + Handle<Map> map = Map::Create(isolate, inobject_properties); + Handle<JSObject> object = factory->NewJSObjectFromMap(map); + AddProperties(object, names, arraysize(names), values, arraysize(values), + rand_gen.NextInt()); + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); + CHECK(!object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Fast object, all inobject properties. + int inobject_properties = arraysize(names) * 2; + Handle<Map> map = Map::Create(isolate, inobject_properties); + Handle<JSObject> object = factory->NewJSObjectFromMap(map); + AddProperties(object, names, arraysize(names), values, arraysize(values), + rand_gen.NextInt()); + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); + CHECK(!object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Fast object, half inobject properties. + int inobject_properties = arraysize(names) / 2; + Handle<Map> map = Map::Create(isolate, inobject_properties); + Handle<JSObject> object = factory->NewJSObjectFromMap(map); + AddProperties(object, names, arraysize(names), values, arraysize(values), + rand_gen.NextInt()); + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); + CHECK(!object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Dictionary mode object. + Handle<JSFunction> function = factory->NewFunction(factory->empty_string()); + Handle<JSObject> object = factory->NewJSObject(function); + AddProperties(object, names, arraysize(names), values, arraysize(values), + rand_gen.NextInt()); + JSObject::NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0, "test"); + + JSObject::AddProperty(object, deleted_property_name, object, NONE); + CHECK(JSObject::DeleteProperty(object, deleted_property_name, SLOPPY) + .FromJust()); + + CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); + CHECK(object->map()->is_dictionary_map()); + objects.push_back(object); + } + + { + // Global object. + Handle<JSGlobalObject> object = isolate->global_object(); + AddProperties(object, names, arraysize(names), values, arraysize(values), + rand_gen.NextInt()); + + JSObject::AddProperty(object, deleted_property_name, object, NONE); + CHECK(JSObject::DeleteProperty(object, deleted_property_name, SLOPPY) + .FromJust()); + + CHECK_EQ(JS_GLOBAL_OBJECT_TYPE, object->map()->instance_type()); + CHECK(object->map()->is_dictionary_map()); + objects.push_back(object); + } + + // TODO(ishell): test proxy and interceptors when they are supported. + + { + for (Handle<JSObject> object : objects) { + for (size_t name_index = 0; name_index < arraysize(names); name_index++) { + Handle<Name> name = names[name_index]; + Handle<Object> expected_value = + JSReceiver::GetProperty(object, name).ToHandleChecked(); + Handle<Object> value = ft.Call(object, name).ToHandleChecked(); + CHECK(expected_value->SameValue(*value)); + } + } + } + + { + Handle<Name> non_existing_names[] = { + factory->NewSymbol(), + factory->InternalizeUtf8String("ne_a"), + factory->InternalizeUtf8String("ne_bb"), + factory->NewPrivateSymbol(), + factory->InternalizeUtf8String("ne_ccc"), + factory->InternalizeUtf8String("ne_dddd"), + deleted_property_name, + }; + for (Handle<JSObject> object : objects) { + for (size_t key_index = 0; key_index < arraysize(non_existing_names); + key_index++) { + Handle<Name> name = non_existing_names[key_index]; + Handle<Object> expected_value = + JSReceiver::GetProperty(object, name).ToHandleChecked(); + CHECK(expected_value->IsUndefined(isolate)); + Handle<Object> value = ft.Call(object, name).ToHandleChecked(); + CHECK_EQ(*not_found_symbol, *value); + } + } + } + + { + Handle<JSFunction> function = factory->NewFunction(factory->empty_string()); + Handle<JSProxy> object = factory->NewJSProxy(function, objects[0]); + CHECK_EQ(JS_PROXY_TYPE, object->map()->instance_type()); + Handle<Object> value = ft.Call(object, names[0]).ToHandleChecked(); + // Proxies are not supported yet. + CHECK_EQ(*bailout_symbol, *value); + } + + { + Handle<JSObject> object = isolate->global_proxy(); + CHECK_EQ(JS_GLOBAL_PROXY_TYPE, object->map()->instance_type()); + // Global proxies are not supported yet. + Handle<Object> value = ft.Call(object, names[0]).ToHandleChecked(); + CHECK_EQ(*bailout_symbol, *value); + } +} + +namespace { + +void AddElement(Handle<JSObject> object, uint32_t index, Handle<Object> value, + PropertyAttributes attributes = NONE) { + JSObject::AddDataElement(object, index, value, attributes).ToHandleChecked(); +} + +} // namespace + +TEST(TryLookupElement) { + typedef CodeStubAssembler::Label Label; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 3; + CodeStubAssemblerTester m(isolate, kNumParams); + + enum Result { kFound, kNotFound, kBailout }; + { + Node* object = m.Parameter(0); + Node* index = m.SmiToWord32(m.Parameter(1)); + Node* expected_result = m.Parameter(2); + + Label passed(&m), failed(&m); + Label if_found(&m), if_not_found(&m), if_bailout(&m); + + Node* map = m.LoadMap(object); + Node* instance_type = m.LoadMapInstanceType(map); + + m.TryLookupElement(object, map, instance_type, index, &if_found, + &if_not_found, &if_bailout); + + m.Bind(&if_found); + m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), + &passed, &failed); + + m.Bind(&if_not_found); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), + &passed, &failed); + + m.Bind(&if_bailout); + m.Branch( + m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))), + &passed, &failed); + + m.Bind(&passed); + m.Return(m.BooleanConstant(true)); + + m.Bind(&failed); + m.Return(m.BooleanConstant(false)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Factory* factory = isolate->factory(); + Handle<Object> smi0(Smi::FromInt(0), isolate); + Handle<Object> smi1(Smi::FromInt(1), isolate); + Handle<Object> smi7(Smi::FromInt(7), isolate); + Handle<Object> smi13(Smi::FromInt(13), isolate); + Handle<Object> smi42(Smi::FromInt(42), isolate); + + Handle<Object> expect_found(Smi::FromInt(kFound), isolate); + Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); + Handle<Object> expect_bailout(Smi::FromInt(kBailout), isolate); + +#define CHECK_FOUND(object, index) \ + CHECK(JSReceiver::HasElement(object, index).FromJust()); \ + ft.CheckTrue(object, smi##index, expect_found); + +#define CHECK_NOT_FOUND(object, index) \ + CHECK(!JSReceiver::HasElement(object, index).FromJust()); \ + ft.CheckTrue(object, smi##index, expect_not_found); + + { + Handle<JSArray> object = factory->NewJSArray(0, FAST_SMI_ELEMENTS); + AddElement(object, 0, smi0); + AddElement(object, 1, smi0); + CHECK_EQ(FAST_SMI_ELEMENTS, object->map()->elements_kind()); + + CHECK_FOUND(object, 0); + CHECK_FOUND(object, 1); + CHECK_NOT_FOUND(object, 7); + CHECK_NOT_FOUND(object, 13); + CHECK_NOT_FOUND(object, 42); + } + + { + Handle<JSArray> object = factory->NewJSArray(0, FAST_HOLEY_SMI_ELEMENTS); + AddElement(object, 0, smi0); + AddElement(object, 13, smi0); + CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, object->map()->elements_kind()); + + CHECK_FOUND(object, 0); + CHECK_NOT_FOUND(object, 1); + CHECK_NOT_FOUND(object, 7); + CHECK_FOUND(object, 13); + CHECK_NOT_FOUND(object, 42); + } + + { + Handle<JSArray> object = factory->NewJSArray(0, FAST_ELEMENTS); + AddElement(object, 0, smi0); + AddElement(object, 1, smi0); + CHECK_EQ(FAST_ELEMENTS, object->map()->elements_kind()); + + CHECK_FOUND(object, 0); + CHECK_FOUND(object, 1); + CHECK_NOT_FOUND(object, 7); + CHECK_NOT_FOUND(object, 13); + CHECK_NOT_FOUND(object, 42); + } + + { + Handle<JSArray> object = factory->NewJSArray(0, FAST_HOLEY_ELEMENTS); + AddElement(object, 0, smi0); + AddElement(object, 13, smi0); + CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind()); + + CHECK_FOUND(object, 0); + CHECK_NOT_FOUND(object, 1); + CHECK_NOT_FOUND(object, 7); + CHECK_FOUND(object, 13); + CHECK_NOT_FOUND(object, 42); + } + + { + Handle<JSFunction> constructor = isolate->string_function(); + Handle<JSObject> object = factory->NewJSObject(constructor); + Handle<String> str = factory->InternalizeUtf8String("ab"); + Handle<JSValue>::cast(object)->set_value(*str); + AddElement(object, 13, smi0); + CHECK_EQ(FAST_STRING_WRAPPER_ELEMENTS, object->map()->elements_kind()); + + CHECK_FOUND(object, 0); + CHECK_FOUND(object, 1); + CHECK_NOT_FOUND(object, 7); + CHECK_FOUND(object, 13); + CHECK_NOT_FOUND(object, 42); + } + + { + Handle<JSFunction> constructor = isolate->string_function(); + Handle<JSObject> object = factory->NewJSObject(constructor); + Handle<String> str = factory->InternalizeUtf8String("ab"); + Handle<JSValue>::cast(object)->set_value(*str); + AddElement(object, 13, smi0); + JSObject::NormalizeElements(object); + CHECK_EQ(SLOW_STRING_WRAPPER_ELEMENTS, object->map()->elements_kind()); + + CHECK_FOUND(object, 0); + CHECK_FOUND(object, 1); + CHECK_NOT_FOUND(object, 7); + CHECK_FOUND(object, 13); + CHECK_NOT_FOUND(object, 42); + } + +// TODO(ishell): uncomment once NO_ELEMENTS kind is supported. +// { +// Handle<Map> map = Map::Create(isolate, 0); +// map->set_elements_kind(NO_ELEMENTS); +// Handle<JSObject> object = factory->NewJSObjectFromMap(map); +// CHECK_EQ(NO_ELEMENTS, object->map()->elements_kind()); +// +// CHECK_NOT_FOUND(object, 0); +// CHECK_NOT_FOUND(object, 1); +// CHECK_NOT_FOUND(object, 7); +// CHECK_NOT_FOUND(object, 13); +// CHECK_NOT_FOUND(object, 42); +// } + +#undef CHECK_FOUND +#undef CHECK_NOT_FOUND + + { + Handle<JSArray> handler = factory->NewJSArray(0); + Handle<JSFunction> function = factory->NewFunction(factory->empty_string()); + Handle<JSProxy> object = factory->NewJSProxy(function, handler); + CHECK_EQ(JS_PROXY_TYPE, object->map()->instance_type()); + ft.CheckTrue(object, smi0, expect_bailout); + } + + { + Handle<JSObject> object = isolate->global_object(); + CHECK_EQ(JS_GLOBAL_OBJECT_TYPE, object->map()->instance_type()); + ft.CheckTrue(object, smi0, expect_bailout); + } + + { + Handle<JSObject> object = isolate->global_proxy(); + CHECK_EQ(JS_GLOBAL_PROXY_TYPE, object->map()->instance_type()); + ft.CheckTrue(object, smi0, expect_bailout); + } +} + +TEST(DeferredCodePhiHints) { + typedef compiler::Node Node; + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeStubAssemblerTester m(isolate, descriptor); + Label block1(&m, Label::kDeferred); + m.Goto(&block1); + m.Bind(&block1); + { + Variable var_object(&m, MachineRepresentation::kTagged); + Label loop(&m, &var_object); + var_object.Bind(m.IntPtrConstant(0)); + m.Goto(&loop); + m.Bind(&loop); + { + Node* map = m.LoadMap(var_object.value()); + var_object.Bind(map); + m.Goto(&loop); + } + } + CHECK(!m.GenerateCode().is_null()); +} + +TEST(TestOutOfScopeVariable) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + VoidDescriptor descriptor(isolate); + CodeStubAssemblerTester m(isolate, descriptor); + Label block1(&m); + Label block2(&m); + Label block3(&m); + Label block4(&m); + m.Branch(m.WordEqual(m.Parameter(0), m.IntPtrConstant(0)), &block1, &block4); + m.Bind(&block4); + { + Variable var_object(&m, MachineRepresentation::kTagged); + m.Branch(m.WordEqual(m.Parameter(0), m.IntPtrConstant(0)), &block2, + &block3); + + m.Bind(&block2); + var_object.Bind(m.IntPtrConstant(55)); + m.Goto(&block1); + + m.Bind(&block3); + var_object.Bind(m.IntPtrConstant(66)); + m.Goto(&block1); + } + m.Bind(&block1); + CHECK(!m.GenerateCode().is_null()); +} + +namespace { + +void TestStubCacheOffsetCalculation(StubCache::Table table) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 2; + CodeStubAssemblerTester m(isolate, kNumParams); + + { + Node* name = m.Parameter(0); + Node* map = m.Parameter(1); + Node* primary_offset = m.StubCachePrimaryOffset(name, map); + Node* result; + if (table == StubCache::kPrimary) { + result = primary_offset; + } else { + CHECK_EQ(StubCache::kSecondary, table); + result = m.StubCacheSecondaryOffset(name, primary_offset); + } + m.Return(m.SmiFromWord32(result)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Factory* factory = isolate->factory(); + Handle<Name> names[] = { + factory->NewSymbol(), + factory->InternalizeUtf8String("a"), + factory->InternalizeUtf8String("bb"), + factory->InternalizeUtf8String("ccc"), + factory->NewPrivateSymbol(), + factory->InternalizeUtf8String("dddd"), + factory->InternalizeUtf8String("eeeee"), + factory->InternalizeUtf8String("name"), + factory->NewSymbol(), + factory->NewPrivateSymbol(), + }; + + Handle<Map> maps[] = { + Handle<Map>(nullptr, isolate), + factory->cell_map(), + Map::Create(isolate, 0), + factory->meta_map(), + factory->code_map(), + Map::Create(isolate, 0), + factory->hash_table_map(), + factory->symbol_map(), + factory->string_map(), + Map::Create(isolate, 0), + factory->sloppy_arguments_elements_map(), + }; + + for (int name_index = 0; name_index < arraysize(names); name_index++) { + Handle<Name> name = names[name_index]; + for (int map_index = 0; map_index < arraysize(maps); map_index++) { + Handle<Map> map = maps[map_index]; + + int expected_result; + { + int primary_offset = StubCache::PrimaryOffsetForTesting(*name, *map); + if (table == StubCache::kPrimary) { + expected_result = primary_offset; + } else { + expected_result = + StubCache::SecondaryOffsetForTesting(*name, primary_offset); + } + } + Handle<Object> result = ft.Call(name, map).ToHandleChecked(); + + Smi* expected = Smi::FromInt(expected_result & Smi::kMaxValue); + CHECK_EQ(expected, Smi::cast(*result)); + } + } +} + +} // namespace + +TEST(StubCachePrimaryOffset) { + TestStubCacheOffsetCalculation(StubCache::kPrimary); +} + +TEST(StubCacheSecondaryOffset) { + TestStubCacheOffsetCalculation(StubCache::kSecondary); +} + +namespace { + +Handle<Code> CreateCodeWithFlags(Code::Flags flags) { + Isolate* isolate(CcTest::InitIsolateOnce()); + CodeStubAssemblerTester m(isolate, flags); + m.Return(m.UndefinedConstant()); + return m.GenerateCodeCloseAndEscape(); +} + +} // namespace + +TEST(TryProbeStubCache) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 3; + CodeStubAssemblerTester m(isolate, kNumParams); + + Code::Kind ic_kind = Code::LOAD_IC; + StubCache stub_cache(isolate, ic_kind); + stub_cache.Clear(); + + { + Node* receiver = m.Parameter(0); + Node* name = m.Parameter(1); + Node* expected_handler = m.Parameter(2); + + Label passed(&m), failed(&m); + + Variable var_handler(&m, MachineRepresentation::kTagged); + Label if_handler(&m), if_miss(&m); + + m.TryProbeStubCache(&stub_cache, receiver, name, &if_handler, &var_handler, + &if_miss); + m.Bind(&if_handler); + m.BranchIfWordEqual(expected_handler, var_handler.value(), &passed, + &failed); + + m.Bind(&if_miss); + m.BranchIfWordEqual(expected_handler, m.IntPtrConstant(0), &passed, + &failed); + + m.Bind(&passed); + m.Return(m.BooleanConstant(true)); + + m.Bind(&failed); + m.Return(m.BooleanConstant(false)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + std::vector<Handle<Name>> names; + std::vector<Handle<JSObject>> receivers; + std::vector<Handle<Code>> handlers; + + base::RandomNumberGenerator rand_gen(FLAG_random_seed); + + Factory* factory = isolate->factory(); + + // Generate some number of names. + for (int i = 0; i < StubCache::kPrimaryTableSize / 7; i++) { + Handle<Name> name; + switch (rand_gen.NextInt(3)) { + case 0: { + // Generate string. + std::stringstream ss; + ss << "s" << std::hex + << (rand_gen.NextInt(Smi::kMaxValue) % StubCache::kPrimaryTableSize); + name = factory->InternalizeUtf8String(ss.str().c_str()); + break; + } + case 1: { + // Generate number string. + std::stringstream ss; + ss << (rand_gen.NextInt(Smi::kMaxValue) % StubCache::kPrimaryTableSize); + name = factory->InternalizeUtf8String(ss.str().c_str()); + break; + } + case 2: { + // Generate symbol. + name = factory->NewSymbol(); + break; + } + default: + UNREACHABLE(); + } + names.push_back(name); + } + + // Generate some number of receiver maps and receivers. + for (int i = 0; i < StubCache::kSecondaryTableSize / 2; i++) { + Handle<Map> map = Map::Create(isolate, 0); + receivers.push_back(factory->NewJSObjectFromMap(map)); + } + + // Generate some number of handlers. + for (int i = 0; i < 30; i++) { + Code::Flags flags = + Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(ic_kind)); + handlers.push_back(CreateCodeWithFlags(flags)); + } + + // Ensure that GC does happen because from now on we are going to fill our + // own stub cache instance with raw values. + DisallowHeapAllocation no_gc; + + // Populate {stub_cache}. + const int N = StubCache::kPrimaryTableSize + StubCache::kSecondaryTableSize; + for (int i = 0; i < N; i++) { + int index = rand_gen.NextInt(); + Handle<Name> name = names[index % names.size()]; + Handle<JSObject> receiver = receivers[index % receivers.size()]; + Handle<Code> handler = handlers[index % handlers.size()]; + stub_cache.Set(*name, receiver->map(), *handler); + } + + // Perform some queries. + bool queried_existing = false; + bool queried_non_existing = false; + for (int i = 0; i < N; i++) { + int index = rand_gen.NextInt(); + Handle<Name> name = names[index % names.size()]; + Handle<JSObject> receiver = receivers[index % receivers.size()]; + Code* handler = stub_cache.Get(*name, receiver->map()); + if (handler == nullptr) { + queried_non_existing = true; + } else { + queried_existing = true; + } + + Handle<Code> expected_handler(handler, isolate); + ft.CheckTrue(receiver, name, expected_handler); + } + + for (int i = 0; i < N; i++) { + int index1 = rand_gen.NextInt(); + int index2 = rand_gen.NextInt(); + Handle<Name> name = names[index1 % names.size()]; + Handle<JSObject> receiver = receivers[index2 % receivers.size()]; + Code* handler = stub_cache.Get(*name, receiver->map()); + if (handler == nullptr) { + queried_non_existing = true; + } else { + queried_existing = true; + } + + Handle<Code> expected_handler(handler, isolate); + ft.CheckTrue(receiver, name, expected_handler); + } + // Ensure we performed both kind of queries. + CHECK(queried_existing && queried_non_existing); +} + +TEST(GotoIfException) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 1; + CodeStubAssemblerTester m(isolate, kNumParams); + + Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); + Node* to_string_tag = + m.HeapConstant(isolate->factory()->to_string_tag_symbol()); + Variable exception(&m, MachineRepresentation::kTagged); + + Label exception_handler(&m); + Callable to_string = CodeFactory::ToString(isolate); + Node* string = m.CallStub(to_string, context, to_string_tag); + m.GotoIfException(string, &exception_handler, &exception); + m.Return(string); + + m.Bind(&exception_handler); + m.Return(exception.value()); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + // Emulate TFJ builtin + code->set_flags(Code::ComputeFlags(Code::BUILTIN)); + + FunctionTester ft(code, kNumParams); + Handle<Object> result = ft.Call().ToHandleChecked(); + + // Should be a TypeError + CHECK(result->IsJSObject()); + + Handle<Object> constructor = + Object::GetPropertyOrElement(result, + isolate->factory()->constructor_string()) + .ToHandleChecked(); + CHECK(constructor->SameValue(*isolate->type_error_function())); +} + +TEST(GotoIfExceptionMultiple) { + typedef CodeStubAssembler::Label Label; + typedef CodeStubAssembler::Variable Variable; + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; // receiver, first, second, third + CodeStubAssemblerTester m(isolate, kNumParams); + + Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); + Node* first_value = m.Parameter(0); + Node* second_value = m.Parameter(1); + Node* third_value = m.Parameter(2); + + Label exception_handler1(&m); + Label exception_handler2(&m); + Label exception_handler3(&m); + Variable return_value(&m, MachineRepresentation::kWord32); + Variable error(&m, MachineRepresentation::kTagged); + + return_value.Bind(m.Int32Constant(0)); + + // try { return ToString(param1) } catch (e) { ... } + Callable to_string = CodeFactory::ToString(isolate); + Node* string = m.CallStub(to_string, context, first_value); + m.GotoIfException(string, &exception_handler1, &error); + m.Return(string); + + // try { ToString(param2); return 7 } catch (e) { ... } + m.Bind(&exception_handler1); + return_value.Bind(m.Int32Constant(7)); + error.Bind(m.UndefinedConstant()); + string = m.CallStub(to_string, context, second_value); + m.GotoIfException(string, &exception_handler2, &error); + m.Return(m.SmiFromWord32(return_value.value())); + + // try { ToString(param3); return 7 & ~2; } catch (e) { return e; } + m.Bind(&exception_handler2); + // Return returnValue & ~2 + error.Bind(m.UndefinedConstant()); + string = m.CallStub(to_string, context, third_value); + m.GotoIfException(string, &exception_handler3, &error); + m.Return(m.SmiFromWord32( + m.Word32And(return_value.value(), + m.Word32Xor(m.Int32Constant(2), m.Int32Constant(-1))))); + + m.Bind(&exception_handler3); + m.Return(error.value()); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + // Emulate TFJ builtin + code->set_flags(Code::ComputeFlags(Code::BUILTIN)); + + FunctionTester ft(code, kNumParams); + + Handle<Object> result; + // First handler does not throw, returns result of first value + result = ft.Call(isolate->factory()->undefined_value(), + isolate->factory()->to_string_tag_symbol()) + .ToHandleChecked(); + CHECK(String::cast(*result)->IsOneByteEqualTo(OneByteVector("undefined"))); + + // First handler returns a number + result = ft.Call(isolate->factory()->to_string_tag_symbol(), + isolate->factory()->undefined_value()) + .ToHandleChecked(); + CHECK_EQ(7, Smi::cast(*result)->value()); + + // First handler throws, second handler returns a number + result = ft.Call(isolate->factory()->to_string_tag_symbol(), + isolate->factory()->to_primitive_symbol()) + .ToHandleChecked(); + CHECK_EQ(7 & ~2, Smi::cast(*result)->value()); + + // First handler throws, second handler throws, third handler returns thrown + // value. + result = ft.Call(isolate->factory()->to_string_tag_symbol(), + isolate->factory()->to_primitive_symbol(), + isolate->factory()->unscopables_symbol()) + .ToHandleChecked(); + + // Should be a TypeError + CHECK(result->IsJSObject()); + + Handle<Object> constructor = + Object::GetPropertyOrElement(result, + isolate->factory()->constructor_string()) + .ToHandleChecked(); + CHECK(constructor->SameValue(*isolate->type_error_function())); +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-code-stubs-arm.cc b/deps/v8/test/cctest/test-code-stubs-arm.cc index f59d85483d..0e0a132146 100644 --- a/deps/v8/test/cctest/test-code-stubs-arm.cc +++ b/deps/v8/test/cctest/test-code-stubs-arm.cc @@ -78,8 +78,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, int source_reg_offset = kDoubleSize; int reg_num = 0; for (; reg_num < Register::kNumRegisters; ++reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { __ push(reg); source_reg_offset += kPointerSize; @@ -107,8 +108,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Make sure no registers have been unexpectedly clobbered for (--reg_num; reg_num >= 0; --reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { __ ldr(ip, MemOperand(sp, 0)); __ cmp(reg, ip); diff --git a/deps/v8/test/cctest/test-code-stubs-arm64.cc b/deps/v8/test/cctest/test-code-stubs-arm64.cc index f5a40789be..2edb923675 100644 --- a/deps/v8/test/cctest/test-code-stubs-arm64.cc +++ b/deps/v8/test/cctest/test-code-stubs-arm64.cc @@ -74,8 +74,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, int source_reg_offset = kDoubleSize; int reg_num = 0; for (; reg_num < Register::kNumRegisters; ++reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { queue.Queue(reg); source_reg_offset += kPointerSize; @@ -103,8 +104,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // // Make sure no registers have been unexpectedly clobbered for (--reg_num; reg_num >= 0; --reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { __ Pop(ip0); __ cmp(reg, ip0); diff --git a/deps/v8/test/cctest/test-code-stubs-ia32.cc b/deps/v8/test/cctest/test-code-stubs-ia32.cc index efc39e9a2e..5a420b1a80 100644 --- a/deps/v8/test/cctest/test-code-stubs-ia32.cc +++ b/deps/v8/test/cctest/test-code-stubs-ia32.cc @@ -72,8 +72,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Save registers make sure they don't get clobbered. int reg_num = 0; for (; reg_num < Register::kNumRegisters; ++reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(esp) && !reg.is(ebp) && !reg.is(destination_reg)) { __ push(reg); param_offset += kPointerSize; @@ -92,8 +93,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Make sure no registers have been unexpectedly clobbered for (--reg_num; reg_num >= 0; --reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(esp) && !reg.is(ebp) && !reg.is(destination_reg)) { __ cmp(reg, MemOperand(esp, 0)); __ Assert(equal, kRegisterWasClobbered); diff --git a/deps/v8/test/cctest/test-code-stubs-mips.cc b/deps/v8/test/cctest/test-code-stubs-mips.cc index ce577da46b..149a1742f8 100644 --- a/deps/v8/test/cctest/test-code-stubs-mips.cc +++ b/deps/v8/test/cctest/test-code-stubs-mips.cc @@ -82,8 +82,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, int source_reg_offset = kDoubleSize; int reg_num = 2; for (; reg_num < Register::kNumRegisters; ++reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { __ push(reg); source_reg_offset += kPointerSize; @@ -111,8 +112,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Make sure no registers have been unexpectedly clobbered for (--reg_num; reg_num >= 2; --reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { __ lw(at, MemOperand(sp, 0)); __ Assert(eq, kRegisterWasClobbered, reg, Operand(at)); diff --git a/deps/v8/test/cctest/test-code-stubs-mips64.cc b/deps/v8/test/cctest/test-code-stubs-mips64.cc index 97f57b9168..bef21717ee 100644 --- a/deps/v8/test/cctest/test-code-stubs-mips64.cc +++ b/deps/v8/test/cctest/test-code-stubs-mips64.cc @@ -81,8 +81,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Save registers make sure they don't get clobbered. int source_reg_offset = kDoubleSize; int reg_num = 2; - const RegisterConfiguration* config = - RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT); + const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); for (; reg_num < config->num_allocatable_general_registers(); ++reg_num) { Register reg = Register::from_code(reg_num); if (!reg.is(destination_reg)) { diff --git a/deps/v8/test/cctest/test-code-stubs-x64.cc b/deps/v8/test/cctest/test-code-stubs-x64.cc index 786da547e4..b9eddd6c57 100644 --- a/deps/v8/test/cctest/test-code-stubs-x64.cc +++ b/deps/v8/test/cctest/test-code-stubs-x64.cc @@ -64,9 +64,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, __ pushq(rsi); __ pushq(rdi); - - const RegisterConfiguration* config = - RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT); + const RegisterConfiguration* config = RegisterConfiguration::Crankshaft(); if (!source_reg.is(rsp)) { // The argument we pass to the stub is not a heap number, but instead // stack-allocated and offset-wise made to look like a heap number for diff --git a/deps/v8/test/cctest/test-code-stubs-x87.cc b/deps/v8/test/cctest/test-code-stubs-x87.cc index efc39e9a2e..5a420b1a80 100644 --- a/deps/v8/test/cctest/test-code-stubs-x87.cc +++ b/deps/v8/test/cctest/test-code-stubs-x87.cc @@ -72,8 +72,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Save registers make sure they don't get clobbered. int reg_num = 0; for (; reg_num < Register::kNumRegisters; ++reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(esp) && !reg.is(ebp) && !reg.is(destination_reg)) { __ push(reg); param_offset += kPointerSize; @@ -92,8 +93,9 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Make sure no registers have been unexpectedly clobbered for (--reg_num; reg_num >= 0; --reg_num) { - Register reg = Register::from_code(reg_num); - if (reg.IsAllocatable()) { + if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( + reg_num)) { + Register reg = Register::from_code(reg_num); if (!reg.is(esp) && !reg.is(ebp) && !reg.is(destination_reg)) { __ cmp(reg, MemOperand(esp, 0)); __ Assert(equal, kRegisterWasClobbered); diff --git a/deps/v8/test/cctest/test-code-stubs.cc b/deps/v8/test/cctest/test-code-stubs.cc index c8c48ecc65..273f57ef0e 100644 --- a/deps/v8/test/cctest/test-code-stubs.cc +++ b/deps/v8/test/cctest/test-code-stubs.cc @@ -42,9 +42,18 @@ using namespace v8::internal; int STDCALL ConvertDToICVersion(double d) { +#if defined(V8_TARGET_BIG_ENDIAN) + const int kExponentIndex = 0; + const int kMantissaIndex = 1; +#elif defined(V8_TARGET_LITTLE_ENDIAN) + const int kExponentIndex = 1; + const int kMantissaIndex = 0; +#else +#error Unsupported endianness +#endif union { double d; uint32_t u[2]; } dbl; dbl.d = d; - uint32_t exponent_bits = dbl.u[1]; + uint32_t exponent_bits = dbl.u[kExponentIndex]; int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32); int32_t exponent = (((exponent_bits & shifted_mask) >> (Double::kPhysicalSignificandSize - 32)) - @@ -58,7 +67,8 @@ int STDCALL ConvertDToICVersion(double d) { static_cast<uint32_t>(Double::kPhysicalSignificandSize); if (unsigned_exponent >= max_exponent) { if ((exponent - Double::kPhysicalSignificandSize) < 32) { - result = dbl.u[0] << (exponent - Double::kPhysicalSignificandSize); + result = dbl.u[kMantissaIndex] + << (exponent - Double::kPhysicalSignificandSize); } } else { uint64_t big_result = diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index 32d720e24e..aef10f1f7a 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -32,6 +32,7 @@ #include "src/compiler.h" #include "src/disasm.h" +#include "src/interpreter/interpreter.h" #include "src/parsing/parser.h" #include "test/cctest/cctest.h" @@ -305,7 +306,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { // We shouldn't have deoptimization support. We want to recompile and // verify that our feedback vector preserves information. CHECK(!f->shared()->has_deoptimization_support()); - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); // Verify that we gathered feedback. CHECK(!feedback_vector->is_empty()); @@ -319,8 +320,11 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { // Verify that the feedback is still "gathered" despite a recompilation // of the full code. CHECK(f->IsOptimized()); - CHECK(f->shared()->has_deoptimization_support()); - object = f->shared()->feedback_vector()->Get(slot_for_a); + // If the baseline code is bytecode, then it will not have deoptimization + // support. has_deoptimization_support() check is only required if the + // baseline code is from fullcodegen. + CHECK(f->shared()->has_deoptimization_support() || i::FLAG_ignition); + object = f->feedback_vector()->Get(slot_for_a); CHECK(object->IsWeakCell() && WeakCell::cast(object)->value()->IsJSFunction()); } @@ -355,18 +359,16 @@ 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->shared()->feedback_vector()->is_empty()); + CHECK(f->feedback_vector()->is_empty()); CompileRun("morphing_call();"); // Now a feedback vector is allocated. CHECK(f->shared()->is_compiled()); - CHECK(!f->shared()->feedback_vector()->is_empty()); + CHECK(!f->feedback_vector()->is_empty()); } - -// Test that optimized code for different closures is actually shared -// immediately by the FastNewClosureStub when run in the same context. +// Test that optimized code for different closures is actually shared. TEST(OptimizedCodeSharing1) { FLAG_stress_compaction = false; FLAG_allow_natives_syntax = true; @@ -385,8 +387,8 @@ TEST(OptimizedCodeSharing1) { "%DebugPrint(closure0());" "%OptimizeFunctionOnNextCall(closure0);" "%DebugPrint(closure0());" - "var closure1 = MakeClosure();" - "var closure2 = MakeClosure();"); + "var closure1 = MakeClosure(); closure1();" + "var closure2 = MakeClosure(); closure2();"); Handle<JSFunction> fun1 = Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( env->Global() @@ -403,9 +405,7 @@ TEST(OptimizedCodeSharing1) { } } - -// Test that optimized code for different closures is actually shared -// immediately by the FastNewClosureStub when run different contexts. +// Test that optimized code for different closures is actually shared. TEST(OptimizedCodeSharing2) { if (FLAG_stress_compaction) return; FLAG_allow_natives_syntax = true; @@ -456,8 +456,8 @@ TEST(OptimizedCodeSharing2) { "%DebugPrint(closure0());" "%OptimizeFunctionOnNextCall(closure0);" "%DebugPrint(closure0());" - "var closure1 = MakeClosure();" - "var closure2 = MakeClosure();"); + "var closure1 = MakeClosure(); closure1();" + "var closure2 = MakeClosure(); closure2();"); Handle<JSFunction> fun1 = Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( env->Global() @@ -475,9 +475,7 @@ TEST(OptimizedCodeSharing2) { } } - -// Test that optimized code for different closures is actually shared -// immediately by the FastNewClosureStub without context-dependent entries. +// Test that optimized code for different closures is actually shared. TEST(OptimizedCodeSharing3) { if (FLAG_stress_compaction) return; FLAG_allow_natives_syntax = true; @@ -531,8 +529,8 @@ TEST(OptimizedCodeSharing3) { "%DebugPrint(closure0());" "%OptimizeFunctionOnNextCall(closure0);" "%DebugPrint(closure0());" - "var closure1 = MakeClosure();" - "var closure2 = MakeClosure();"); + "var closure1 = MakeClosure(); closure1();" + "var closure2 = MakeClosure(); closure2();"); Handle<JSFunction> fun1 = Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( env->Global() @@ -763,3 +761,83 @@ TEST(SplitConstantsInFullCompiler) { CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); } #endif + +static void IsBaselineCompiled( + const v8::FunctionCallbackInfo<v8::Value>& args) { + Handle<Object> object = v8::Utils::OpenHandle(*args[0]); + Handle<JSFunction> function = Handle<JSFunction>::cast(object); + bool is_baseline = function->shared()->code()->kind() == Code::FUNCTION; + return args.GetReturnValue().Set(is_baseline); +} + +static void InstallIsBaselineCompiledHelper(v8::Isolate* isolate) { + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + v8::Local<v8::FunctionTemplate> t = + v8::FunctionTemplate::New(isolate, IsBaselineCompiled); + CHECK(context->Global() + ->Set(context, v8_str("IsBaselineCompiled"), + t->GetFunction(context).ToLocalChecked()) + .FromJust()); +} + +TEST(IgnitionBaselineOnReturn) { + // TODO(4280): Remove this entire test once --ignition-preserve-bytecode is + // the default and the flag is removed. This test doesn't provide benefit any + // longer once {InterpreterActivationsFinder} is gone. + if (FLAG_ignition_preserve_bytecode) return; + FLAG_allow_natives_syntax = true; + FLAG_always_opt = false; + CcTest::InitializeVM(); + FLAG_ignition = true; + Isolate* isolate = CcTest::i_isolate(); + isolate->interpreter()->Initialize(); + v8::HandleScope scope(CcTest::isolate()); + InstallIsBaselineCompiledHelper(CcTest::isolate()); + + CompileRun( + "var is_baseline_in_function, is_baseline_after_return;\n" + "var return_val;\n" + "function f() {\n" + " %CompileBaseline(f);\n" + " is_baseline_in_function = IsBaselineCompiled(f);\n" + " return 1234;\n" + "};\n" + "return_val = f();\n" + "is_baseline_after_return = IsBaselineCompiled(f);\n"); + CHECK_EQ(false, GetGlobalProperty("is_baseline_in_function")->BooleanValue()); + CHECK_EQ(true, GetGlobalProperty("is_baseline_after_return")->BooleanValue()); + CHECK_EQ(1234.0, GetGlobalProperty("return_val")->Number()); +} + +TEST(IgnitionEntryTrampolineSelfHealing) { + FLAG_allow_natives_syntax = true; + FLAG_always_opt = false; + CcTest::InitializeVM(); + FLAG_ignition = true; + Isolate* isolate = CcTest::i_isolate(); + isolate->interpreter()->Initialize(); + v8::HandleScope scope(CcTest::isolate()); + + CompileRun( + "function MkFun() {" + " function f() { return 23 }" + " return f" + "}" + "var f1 = MkFun(); f1();" + "var f2 = MkFun(); f2();" + "%BaselineFunctionOnNextCall(f1);"); + Handle<JSFunction> f1 = Handle<JSFunction>::cast(GetGlobalProperty("f1")); + Handle<JSFunction> f2 = Handle<JSFunction>::cast(GetGlobalProperty("f2")); + + // Function {f1} is marked for baseline. + CompileRun("var result1 = f1()"); + CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code()); + CHECK_EQ(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code()); + CHECK_EQ(23.0, GetGlobalProperty("result1")->Number()); + + // Function {f2} will self-heal now. + CompileRun("var result2 = f2()"); + CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code()); + CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code()); + CHECK_EQ(23.0, GetGlobalProperty("result2")->Number()); +} diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc index 463a4abe3f..9569dc8678 100644 --- a/deps/v8/test/cctest/test-conversions.cc +++ b/deps/v8/test/cctest/test-conversions.cc @@ -406,3 +406,30 @@ TEST(SpecialIndexParsing) { CheckNonArrayIndex(false, "-9999999999999999"); CheckNonArrayIndex(false, "42949672964294967296429496729694966"); } + +TEST(NoHandlesForTryNumberToSize) { + i::Isolate* isolate = CcTest::i_isolate(); + size_t result = 0; + { + SealHandleScope no_handles(isolate); + Smi* smi = Smi::FromInt(1); + CHECK(TryNumberToSize(smi, &result)); + CHECK_EQ(result, 1); + } + result = 0; + { + HandleScope scope(isolate); + Handle<HeapNumber> heap_number1 = isolate->factory()->NewHeapNumber(2.0); + { + SealHandleScope no_handles(isolate); + CHECK(TryNumberToSize(*heap_number1, &result)); + CHECK_EQ(result, 2); + } + Handle<HeapNumber> heap_number2 = isolate->factory()->NewHeapNumber( + static_cast<double>(std::numeric_limits<size_t>::max()) + 10000.0); + { + SealHandleScope no_handles(isolate); + CHECK(!TryNumberToSize(*heap_number2, &result)); + } + } +} diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 24c84c3df8..83c4e33c45 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -31,12 +31,13 @@ #include "include/v8-profiler.h" #include "src/base/platform/platform.h" -#include "src/base/smart-pointers.h" #include "src/deoptimizer.h" #include "src/profiler/cpu-profiler-inl.h" +#include "src/profiler/profiler-listener.h" #include "src/utils.h" #include "test/cctest/cctest.h" #include "test/cctest/profiler-extension.h" + using i::CodeEntry; using i::CpuProfile; using i::CpuProfiler; @@ -45,10 +46,9 @@ using i::Heap; using i::ProfileGenerator; using i::ProfileNode; using i::ProfilerEventsProcessor; +using i::ProfilerListener; using i::ScopedVector; using i::Vector; -using v8::base::SmartPointer; - // Helper methods static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, @@ -57,35 +57,31 @@ static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env, env->Global()->Get(env, v8_str(name)).ToLocalChecked()); } - static size_t offset(const char* src, const char* substring) { const char* it = strstr(src, substring); CHECK(it); return static_cast<size_t>(it - src); } - -static const char* reason(const i::Deoptimizer::DeoptReason reason) { - return i::Deoptimizer::GetDeoptReason(reason); +static const char* reason(const i::DeoptimizeReason reason) { + return i::DeoptimizeReasonToString(reason); } - TEST(StartStop) { - i::Isolate* isolate = CcTest::i_isolate(); - CpuProfilesCollection profiles(isolate->heap()); + CpuProfilesCollection profiles(CcTest::i_isolate()); ProfileGenerator generator(&profiles); - SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( - &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); + std::unique_ptr<ProfilerEventsProcessor> processor( + new ProfilerEventsProcessor(CcTest::i_isolate(), &generator, + v8::base::TimeDelta::FromMicroseconds(100))); processor->Start(); processor->StopSynchronously(); } - static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, i::Address frame1, i::Address frame2 = NULL, i::Address frame3 = NULL) { - i::TickSample* sample = proc->StartTickSample(); + v8::TickSample* sample = proc->StartTickSample(); sample->pc = frame1; sample->tos = frame1; sample->frames_count = 0; @@ -157,46 +153,56 @@ TEST(CodeEvents) { i::AbstractCode* args3_code = CreateCode(&env); i::AbstractCode* args4_code = CreateCode(&env); - CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); + CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); + ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfilerEventsProcessor* processor = + new ProfilerEventsProcessor(CcTest::i_isolate(), generator, + v8::base::TimeDelta::FromMicroseconds(100)); + CpuProfiler profiler(isolate, profiles, generator, processor); profiles->StartProfiling("", false); - ProfileGenerator generator(profiles); - SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( - &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); processor->Start(); - CpuProfiler profiler(isolate, profiles, &generator, processor.get()); + ProfilerListener profiler_listener(isolate); + isolate->code_event_dispatcher()->AddListener(&profiler_listener); + profiler_listener.AddObserver(&profiler); // Enqueue code creation events. const char* aaa_str = "aaa"; i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); - profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); - profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); - profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); - profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, "comment2"); - profiler.CodeMoveEvent(comment2_code, moved_code->address()); - profiler.CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); - profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); + profiler_listener.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, + *aaa_name); + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, + "comment"); + profiler_listener.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, + "comment2"); + profiler_listener.CodeMoveEvent(comment2_code, moved_code->address()); + profiler_listener.CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); + profiler_listener.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); // Enqueue a tick event to enable code events processing. - EnqueueTickSampleEvent(processor.get(), aaa_code->address()); + EnqueueTickSampleEvent(processor, aaa_code->address()); + profiler_listener.RemoveObserver(&profiler); + isolate->code_event_dispatcher()->RemoveListener(&profiler_listener); processor->StopSynchronously(); // Check the state of profile generator. - CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); + CodeEntry* aaa = generator->code_map()->FindEntry(aaa_code->address()); CHECK(aaa); CHECK_EQ(0, strcmp(aaa_str, aaa->name())); - CodeEntry* comment = generator.code_map()->FindEntry(comment_code->address()); + CodeEntry* comment = + generator->code_map()->FindEntry(comment_code->address()); CHECK(comment); CHECK_EQ(0, strcmp("comment", comment->name())); - CodeEntry* args5 = generator.code_map()->FindEntry(args5_code->address()); + CodeEntry* args5 = generator->code_map()->FindEntry(args5_code->address()); CHECK(args5); CHECK_EQ(0, strcmp("5", args5->name())); - CHECK(!generator.code_map()->FindEntry(comment2_code->address())); + CHECK(!generator->code_map()->FindEntry(comment2_code->address())); - CodeEntry* comment2 = generator.code_map()->FindEntry(moved_code->address()); + CodeEntry* comment2 = generator->code_map()->FindEntry(moved_code->address()); CHECK(comment2); CHECK_EQ(0, strcmp("comment2", comment2->name())); } @@ -216,29 +222,33 @@ TEST(TickEvents) { i::AbstractCode* frame2_code = CreateCode(&env); i::AbstractCode* frame3_code = CreateCode(&env); - CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); + CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); + ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfilerEventsProcessor* processor = + new ProfilerEventsProcessor(CcTest::i_isolate(), generator, + v8::base::TimeDelta::FromMicroseconds(100)); + CpuProfiler profiler(isolate, profiles, generator, processor); profiles->StartProfiling("", false); - ProfileGenerator generator(profiles); - SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( - &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); processor->Start(); - CpuProfiler profiler(isolate, profiles, &generator, processor.get()); + ProfilerListener profiler_listener(isolate); + isolate->code_event_dispatcher()->AddListener(&profiler_listener); + profiler_listener.AddObserver(&profiler); - profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); - profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); - profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); + profiler_listener.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); - EnqueueTickSampleEvent(processor.get(), frame1_code->instruction_start()); + EnqueueTickSampleEvent(processor, frame1_code->instruction_start()); EnqueueTickSampleEvent( - processor.get(), + processor, frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, - frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); - EnqueueTickSampleEvent( - processor.get(), - frame3_code->instruction_end() - 1, - frame2_code->instruction_end() - 1, - frame1_code->instruction_end() - 1); + frame1_code->instruction_start() + frame1_code->ExecutableSize() / 2); + EnqueueTickSampleEvent(processor, frame3_code->instruction_end() - 1, + frame2_code->instruction_end() - 1, + frame1_code->instruction_end() - 1); + profiler_listener.RemoveObserver(&profiler); + isolate->code_event_dispatcher()->RemoveListener(&profiler_listener); processor->StopSynchronously(); CpuProfile* profile = profiles->StopProfiling(""); CHECK(profile); @@ -259,6 +269,8 @@ TEST(TickEvents) { const i::List<ProfileNode*>* top_down_ddd_children = top_down_stub_children->last()->children(); CHECK_EQ(0, top_down_ddd_children->length()); + + isolate->code_event_dispatcher()->RemoveListener(&profiler_listener); } // http://crbug/51594 @@ -266,7 +278,7 @@ TEST(TickEvents) { TEST(CrashIfStoppingLastNonExistentProfile) { CcTest::InitializeVM(); TestSetup test_setup; - CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler(); + std::unique_ptr<CpuProfiler> profiler(new CpuProfiler(CcTest::i_isolate())); profiler->StartProfiling("1"); profiler->StopProfiling("2"); profiler->StartProfiling("1"); @@ -283,25 +295,31 @@ TEST(Issue1398) { i::AbstractCode* code = CreateCode(&env); - CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); + CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); + ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfilerEventsProcessor* processor = + new ProfilerEventsProcessor(CcTest::i_isolate(), generator, + v8::base::TimeDelta::FromMicroseconds(100)); + CpuProfiler profiler(isolate, profiles, generator, processor); profiles->StartProfiling("", false); - ProfileGenerator generator(profiles); - SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( - &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); processor->Start(); - CpuProfiler profiler(isolate, profiles, &generator, processor.get()); + ProfilerListener profiler_listener(isolate); + isolate->code_event_dispatcher()->AddListener(&profiler_listener); + profiler_listener.AddObserver(&profiler); - profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); + profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); - i::TickSample* sample = processor->StartTickSample(); + v8::TickSample* sample = processor->StartTickSample(); sample->pc = code->address(); sample->tos = 0; - sample->frames_count = i::TickSample::kMaxFramesCount; + sample->frames_count = v8::TickSample::kMaxFramesCount; for (unsigned i = 0; i < sample->frames_count; ++i) { sample->stack[i] = code->address(); } processor->FinishTickSample(); + profiler_listener.RemoveObserver(&profiler); + isolate->code_event_dispatcher()->RemoveListener(&profiler_listener); processor->StopSynchronously(); CpuProfile* profile = profiles->StopProfiling(""); CHECK(profile); @@ -313,13 +331,13 @@ TEST(Issue1398) { ++actual_depth; } - CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth); // +1 for PC. + CHECK_EQ(1 + v8::TickSample::kMaxFramesCount, actual_depth); // +1 for PC. } TEST(DeleteAllCpuProfiles) { CcTest::InitializeVM(); TestSetup test_setup; - CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler(); + std::unique_ptr<CpuProfiler> profiler(new CpuProfiler(CcTest::i_isolate())); CHECK_EQ(0, profiler->GetProfilesCount()); profiler->DeleteAllProfiles(); CHECK_EQ(0, profiler->GetProfilesCount()); @@ -363,7 +381,7 @@ static bool FindCpuProfile(v8::CpuProfiler* v8profiler, TEST(DeleteCpuProfile) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); + v8::CpuProfiler* cpu_profiler = v8::CpuProfiler::New(env->GetIsolate()); i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(cpu_profiler); CHECK_EQ(0, iprofiler->GetProfilesCount()); @@ -396,41 +414,67 @@ TEST(DeleteCpuProfile) { CHECK(FindCpuProfile(cpu_profiler, p3)); p3->Delete(); CHECK_EQ(0, iprofiler->GetProfilesCount()); + cpu_profiler->Dispose(); } TEST(ProfileStartEndTime) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); + v8::CpuProfiler* cpu_profiler = v8::CpuProfiler::New(env->GetIsolate()); v8::Local<v8::String> profile_name = v8_str("test"); cpu_profiler->StartProfiling(profile_name); const v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); CHECK(profile->GetStartTime() <= profile->GetEndTime()); + cpu_profiler->Dispose(); } -static v8::CpuProfile* RunProfiler(v8::Local<v8::Context> env, - v8::Local<v8::Function> function, - v8::Local<v8::Value> argv[], int argc, - unsigned min_js_samples = 0, - unsigned min_external_samples = 0, - bool collect_samples = false) { - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); +class ProfilerHelper { + public: + explicit ProfilerHelper(const v8::Local<v8::Context>& context) + : context_(context), + profiler_(v8::CpuProfiler::New(context->GetIsolate())) { + i::ProfilerExtension::set_profiler(profiler_); + } + ~ProfilerHelper() { + i::ProfilerExtension::set_profiler(static_cast<CpuProfiler*>(nullptr)); + profiler_->Dispose(); + } + + v8::CpuProfile* Run(v8::Local<v8::Function> function, + v8::Local<v8::Value> argv[], int argc, + unsigned min_js_samples = 0, + unsigned min_external_samples = 0, + bool collect_samples = false); + + v8::CpuProfiler* profiler() { return profiler_; } + + private: + v8::Local<v8::Context> context_; + v8::CpuProfiler* profiler_; +}; + +v8::CpuProfile* ProfilerHelper::Run(v8::Local<v8::Function> function, + v8::Local<v8::Value> argv[], int argc, + unsigned min_js_samples, + unsigned min_external_samples, + bool collect_samples) { v8::Local<v8::String> profile_name = v8_str("my_profile"); - cpu_profiler->SetSamplingInterval(100); - cpu_profiler->StartProfiling(profile_name, collect_samples); + profiler_->SetSamplingInterval(100); + profiler_->StartProfiling(profile_name, collect_samples); - i::Sampler* sampler = - reinterpret_cast<i::Isolate*>(env->GetIsolate())->logger()->sampler(); + v8::internal::CpuProfiler* iprofiler = + reinterpret_cast<v8::internal::CpuProfiler*>(profiler_); + v8::sampler::Sampler* sampler = iprofiler->processor()->sampler(); sampler->StartCountingSamples(); do { - function->Call(env, env->Global(), argc, argv).ToLocalChecked(); + function->Call(context_, context_->Global(), argc, argv).ToLocalChecked(); } while (sampler->js_sample_count() < min_js_samples || sampler->external_sample_count() < min_external_samples); - v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); + v8::CpuProfile* profile = profiler_->StopProfiling(profile_name); CHECK(profile); // Dump collected profile to have a better diagnostic in case of failure. @@ -439,7 +483,6 @@ static v8::CpuProfile* RunProfiler(v8::Local<v8::Context> env, return profile; } - static const v8::CpuProfileNode* FindChild(v8::Local<v8::Context> context, const v8::CpuProfileNode* node, const char* name) { @@ -461,8 +504,7 @@ static const v8::CpuProfileNode* GetChild(v8::Local<v8::Context> context, const v8::CpuProfileNode* result = FindChild(context, node, name); if (!result) { char buffer[100]; - i::SNPrintF(Vector<char>(buffer, arraysize(buffer)), - "Failed to GetChild: %s", name); + i::SNPrintF(i::ArrayVector(buffer), "Failed to GetChild: %s", name); FATAL(buffer); } return result; @@ -489,10 +531,6 @@ static const ProfileNode* GetSimpleBranch(v8::Local<v8::Context> context, return reinterpret_cast<const ProfileNode*>(node); } -static void CallCollectSample(const v8::FunctionCallbackInfo<v8::Value>& info) { - info.GetIsolate()->GetCpuProfiler()->CollectSample(); -} - static const char* cpu_profiler_test_source = "%NeverOptimizeFunction(loop);\n" "%NeverOptimizeFunction(delay);\n" @@ -555,8 +593,8 @@ TEST(CollectCpuProfile) { int32_t profiling_interval_ms = 200; v8::Local<v8::Value> args[] = { v8::Integer::New(env->GetIsolate(), profiling_interval_ms)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 1000); + ProfilerHelper helper(env.local()); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); @@ -612,8 +650,8 @@ TEST(HotDeoptNoFrameEntry) { int32_t profiling_interval_ms = 200; v8::Local<v8::Value> args[] = { v8::Integer::New(env->GetIsolate(), profiling_interval_ms)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 1000); + ProfilerHelper helper(env.local()); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 1000); function->Call(env.local(), env->Global(), arraysize(args), args) .ToLocalChecked(); @@ -635,8 +673,9 @@ TEST(CollectCpuProfileSamples) { int32_t profiling_interval_ms = 200; v8::Local<v8::Value> args[] = { v8::Integer::New(env->GetIsolate(), profiling_interval_ms)}; + ProfilerHelper helper(env.local()); v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 1000, 0, true); + helper.Run(function, args, arraysize(args), 1000, 0, true); CHECK_LE(200, profile->GetSamplesCount()); uint64_t end_time = profile->GetEndTime(); @@ -688,8 +727,8 @@ TEST(SampleWhenFrameIsNotSetup) { int32_t duration_ms = 100; v8::Local<v8::Value> args[] = { v8::Integer::New(env->GetIsolate(), duration_ms)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 1000); + ProfilerHelper helper(env.local()); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); @@ -770,8 +809,7 @@ TEST(NativeAccessorUninitializedIC) { func_template->InstanceTemplate(); TestApiCallbacks accessors(100); - v8::Local<v8::External> data = - v8::External::New(isolate, &accessors); + v8::Local<v8::External> data = v8::External::New(isolate, &accessors); instance_template->SetAccessor(v8_str("foo"), &TestApiCallbacks::Getter, &TestApiCallbacks::Setter, data); v8::Local<v8::Function> func = @@ -783,10 +821,10 @@ TEST(NativeAccessorUninitializedIC) { CompileRun(native_accessor_test_source); v8::Local<v8::Function> function = GetFunction(env.local(), "start"); + ProfilerHelper helper(env.local()); int32_t repeat_count = 1; v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 0, 100); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 0, 100); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); @@ -838,8 +876,8 @@ TEST(NativeAccessorMonomorphicIC) { int32_t repeat_count = 100; v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 0, 100); + ProfilerHelper helper(env.local()); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 0, 100); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); @@ -863,12 +901,11 @@ TEST(NativeMethodUninitializedIC) { v8::HandleScope scope(isolate); TestApiCallbacks callbacks(100); - v8::Local<v8::External> data = - v8::External::New(isolate, &callbacks); + v8::Local<v8::External> data = v8::External::New(isolate, &callbacks); v8::Local<v8::FunctionTemplate> func_template = v8::FunctionTemplate::New(isolate); - func_template->SetClassName(v8_str("Test_InstanceCostructor")); + func_template->SetClassName(v8_str("Test_InstanceConstructor")); v8::Local<v8::ObjectTemplate> proto_template = func_template->PrototypeTemplate(); v8::Local<v8::Signature> signature = @@ -887,10 +924,10 @@ TEST(NativeMethodUninitializedIC) { CompileRun(native_method_test_source); v8::Local<v8::Function> function = GetFunction(env.local(), "start"); + ProfilerHelper helper(env.local()); int32_t repeat_count = 1; v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 0, 100); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 0, 100); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); @@ -941,10 +978,10 @@ TEST(NativeMethodMonomorphicIC) { callbacks.set_warming_up(false); } + ProfilerHelper helper(env.local()); int32_t repeat_count = 100; v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 0, 200); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 0, 200); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); GetChild(env.local(), root, "start"); @@ -973,7 +1010,8 @@ TEST(BoundFunctionCall) { CompileRun(bound_function_test_source); v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfile* profile = RunProfiler(env, function, NULL, 0); + ProfilerHelper helper(env); + v8::CpuProfile* profile = helper.Run(function, nullptr, 0); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); @@ -1007,9 +1045,10 @@ static void TickLines(bool optimize) { " n += m * m * m;\n" " }\n" "}\n" + "%s();" "%s(%s);\n" "%s();\n", - func_name, opt_func, func_name, func_name); + func_name, func_name, opt_func, func_name, func_name); CompileRun(script.start()); @@ -1017,36 +1056,44 @@ static void TickLines(bool optimize) { v8::Utils::OpenHandle(*GetFunction(env.local(), func_name))); CHECK(func->shared()); CHECK(func->shared()->abstract_code()); + CHECK(!optimize || func->IsOptimized() || + !CcTest::i_isolate()->use_crankshaft()); i::AbstractCode* code = func->abstract_code(); CHECK(code); i::Address code_address = code->instruction_start(); CHECK(code_address); - CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); + CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); + ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfilerEventsProcessor* processor = + new ProfilerEventsProcessor(CcTest::i_isolate(), generator, + v8::base::TimeDelta::FromMicroseconds(100)); + CpuProfiler profiler(isolate, profiles, generator, processor); profiles->StartProfiling("", false); - ProfileGenerator generator(profiles); - SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( - &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); processor->Start(); - CpuProfiler profiler(isolate, profiles, &generator, processor.get()); + ProfilerListener profiler_listener(isolate); + isolate->code_event_dispatcher()->AddListener(&profiler_listener); + profiler_listener.AddObserver(&profiler); // Enqueue code creation events. i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); int line = 1; int column = 1; - profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), NULL, - *str, line, column); + profiler_listener.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, + func->shared(), *str, line, column); // Enqueue a tick event to enable code events processing. - EnqueueTickSampleEvent(processor.get(), code_address); + EnqueueTickSampleEvent(processor, code_address); + profiler_listener.RemoveObserver(&profiler); + isolate->code_event_dispatcher()->RemoveListener(&profiler_listener); processor->StopSynchronously(); CpuProfile* profile = profiles->StopProfiling(""); CHECK(profile); // Check the state of profile generator. - CodeEntry* func_entry = generator.code_map()->FindEntry(code_address); + CodeEntry* func_entry = generator->code_map()->FindEntry(code_address); CHECK(func_entry); CHECK_EQ(0, strcmp(func_name, func_entry->name())); const i::JITLineInfoTable* line_info = func_entry->line_info(); @@ -1122,18 +1169,18 @@ TEST(FunctionCallSample) { CompileRun(call_function_test_source); v8::Local<v8::Function> function = GetFunction(env.local(), "start"); + ProfilerHelper helper(env.local()); int32_t duration_ms = 100; v8::Local<v8::Value> args[] = { v8::Integer::New(env->GetIsolate(), duration_ms)}; - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 1000); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); GetChild(env.local(), start_node, "bar"); - const v8::CpuProfileNode* unresolved_node = FindChild( - env.local(), root, i::ProfileGenerator::kUnresolvedFunctionName); + const v8::CpuProfileNode* unresolved_node = + FindChild(env.local(), root, i::CodeEntry::kUnresolvedFunctionName); CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "call")); profile->Delete(); @@ -1175,12 +1222,11 @@ TEST(FunctionApplySample) { CompileRun(function_apply_test_source); v8::Local<v8::Function> function = GetFunction(env.local(), "start"); + ProfilerHelper helper(env.local()); int32_t duration_ms = 100; v8::Local<v8::Value> args[] = { v8::Integer::New(env->GetIsolate(), duration_ms)}; - - v8::CpuProfile* profile = - RunProfiler(env.local(), function, args, arraysize(args), 1000); + v8::CpuProfile* profile = helper.Run(function, args, arraysize(args), 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env.local(), root, "start"); @@ -1188,8 +1234,8 @@ TEST(FunctionApplySample) { GetChild(env.local(), start_node, "test"); GetChild(env.local(), test_node, "bar"); - const v8::CpuProfileNode* unresolved_node = FindChild( - env.local(), start_node, ProfileGenerator::kUnresolvedFunctionName); + const v8::CpuProfileNode* unresolved_node = + FindChild(env.local(), start_node, CodeEntry::kUnresolvedFunctionName); CHECK(!unresolved_node || GetChild(env.local(), unresolved_node, "apply")); profile->Delete(); @@ -1221,14 +1267,14 @@ TEST(CpuProfileDeepStack) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); + ProfilerHelper helper(env); CompileRun(cpu_profiler_deep_stack_test_source); v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); v8::Local<v8::String> profile_name = v8_str("my_profile"); function->Call(env, env->Global(), 0, NULL).ToLocalChecked(); - v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); + v8::CpuProfile* profile = helper.profiler()->StopProfiling(profile_name); CHECK(profile); // Dump collected profile to have a better diagnostic in case of failure. reinterpret_cast<i::CpuProfile*>(profile)->Print(); @@ -1290,7 +1336,8 @@ TEST(JsNativeJsSample) { CompileRun(js_native_js_test_source); v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfile* profile = RunProfiler(env, function, NULL, 0, 1000); + ProfilerHelper helper(env); + v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); @@ -1340,8 +1387,9 @@ TEST(JsNativeJsRuntimeJsSample) { env->Global()->Set(env, v8_str("CallJsFunction"), func).FromJust(); CompileRun(js_native_js_runtime_js_test_source); + ProfilerHelper helper(env); v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfile* profile = RunProfiler(env, function, NULL, 0, 1000); + v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); @@ -1403,9 +1451,10 @@ TEST(JsNative1JsNative2JsSample) { env->Global()->Set(env, v8_str("CallJsFunction2"), func2).FromJust(); CompileRun(js_native1_js_native2_js_test_source); - v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfile* profile = RunProfiler(env, function, NULL, 0, 1000); + ProfilerHelper helper(env); + v8::Local<v8::Function> function = GetFunction(env, "start"); + v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 1000); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); @@ -1424,6 +1473,10 @@ static const char* js_force_collect_sample_source = " CallCollectSample();\n" "}"; +static void CallCollectSample(const v8::FunctionCallbackInfo<v8::Value>& info) { + i::ProfilerExtension::profiler()->CollectSample(); +} + TEST(CollectSampleAPI) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); @@ -1437,8 +1490,9 @@ TEST(CollectSampleAPI) { env->Global()->Set(env, v8_str("CallCollectSample"), func).FromJust(); CompileRun(js_force_collect_sample_source); + ProfilerHelper helper(env); v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfile* profile = RunProfiler(env, function, NULL, 0, 0); + v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 0); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); @@ -1490,9 +1544,10 @@ TEST(JsNativeJsRuntimeJsSampleMultiple) { env->Global()->Set(env, v8_str("CallJsFunction"), func).FromJust(); CompileRun(js_native_js_runtime_multiple_test_source); - v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfile* profile = RunProfiler(env, function, NULL, 0, 500, 500); + ProfilerHelper helper(env); + v8::Local<v8::Function> function = GetFunction(env, "start"); + v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 500, 500); const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); @@ -1544,14 +1599,14 @@ TEST(Inlining) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); + ProfilerHelper helper(env); CompileRun(inlining_test_source); v8::Local<v8::Function> function = GetFunction(env, "start"); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); v8::Local<v8::String> profile_name = v8_str("my_profile"); function->Call(env, env->Global(), 0, NULL).ToLocalChecked(); - v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); + v8::CpuProfile* profile = helper.profiler()->StopProfiling(profile_name); CHECK(profile); // Dump collected profile to have a better diagnostic in case of failure. reinterpret_cast<i::CpuProfile*>(profile)->Print(); @@ -1573,13 +1628,14 @@ TEST(Inlining) { TEST(IdleTime) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); + v8::CpuProfiler* cpu_profiler = v8::CpuProfiler::New(env->GetIsolate()); v8::Local<v8::String> profile_name = v8_str("my_profile"); cpu_profiler->StartProfiling(profile_name); i::Isolate* isolate = CcTest::i_isolate(); - i::ProfilerEventsProcessor* processor = isolate->cpu_profiler()->processor(); + i::ProfilerEventsProcessor* processor = + reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->processor(); processor->AddCurrentStack(isolate, true); cpu_profiler->SetIdle(true); @@ -1596,16 +1652,17 @@ TEST(IdleTime) { const v8::CpuProfileNode* root = profile->GetTopDownRoot(); const v8::CpuProfileNode* program_node = - GetChild(env.local(), root, ProfileGenerator::kProgramEntryName); + GetChild(env.local(), root, CodeEntry::kProgramEntryName); CHECK_EQ(0, program_node->GetChildrenCount()); CHECK_GE(program_node->GetHitCount(), 2u); const v8::CpuProfileNode* idle_node = - GetChild(env.local(), root, ProfileGenerator::kIdleEntryName); + GetChild(env.local(), root, CodeEntry::kIdleEntryName); CHECK_EQ(0, idle_node->GetChildrenCount()); CHECK_GE(idle_node->GetHitCount(), 3u); profile->Delete(); + cpu_profiler->Dispose(); } static void CheckFunctionDetails(v8::Isolate* isolate, @@ -1628,6 +1685,7 @@ TEST(FunctionDetails) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); + ProfilerHelper helper(env); v8::Local<v8::Script> script_a = CompileWithOrigin( "%NeverOptimizeFunction(foo);\n" @@ -1674,7 +1732,7 @@ TEST(DontStopOnFinishedProfileDelete) { v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); - v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); + v8::CpuProfiler* profiler = v8::CpuProfiler::New(env->GetIsolate()); i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); CHECK_EQ(0, iprofiler->GetProfilesCount()); @@ -1699,6 +1757,7 @@ TEST(DontStopOnFinishedProfileDelete) { outer_profile->Delete(); outer_profile = NULL; CHECK_EQ(0, iprofiler->GetProfilesCount()); + profiler->Dispose(); } @@ -1720,9 +1779,9 @@ TEST(CollectDeoptEvents) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); - v8::Isolate* isolate = env->GetIsolate(); - v8::CpuProfiler* profiler = isolate->GetCpuProfiler(); - i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); + ProfilerHelper helper(env); + i::CpuProfiler* iprofiler = + reinterpret_cast<i::CpuProfiler*>(helper.profiler()); const char opt_source[] = "function opt_function%d(value, depth) {\n" @@ -1797,21 +1856,21 @@ TEST(CollectDeoptEvents) { { const char* branch[] = {"", "opt_function0", "opt_function0"}; - CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), + CHECK_EQ(reason(i::DeoptimizeReason::kNotAHeapNumber), GetBranchDeoptReason(env, iprofile, branch, arraysize(branch))); } { const char* branch[] = {"", "opt_function1", "opt_function1"}; const char* deopt_reason = GetBranchDeoptReason(env, iprofile, branch, arraysize(branch)); - if (deopt_reason != reason(i::Deoptimizer::kNaN) && - deopt_reason != reason(i::Deoptimizer::kLostPrecisionOrNaN)) { + if (deopt_reason != reason(i::DeoptimizeReason::kNaN) && + deopt_reason != reason(i::DeoptimizeReason::kLostPrecisionOrNaN)) { FATAL(deopt_reason); } } { const char* branch[] = {"", "opt_function2", "opt_function2"}; - CHECK_EQ(reason(i::Deoptimizer::kDivisionByZero), + CHECK_EQ(reason(i::DeoptimizeReason::kDivisionByZero), GetBranchDeoptReason(env, iprofile, branch, arraysize(branch))); } iprofiler->DeleteProfile(iprofile); @@ -1850,9 +1909,9 @@ TEST(DeoptAtFirstLevelInlinedSource) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); - v8::Isolate* isolate = env->GetIsolate(); - v8::CpuProfiler* profiler = isolate->GetCpuProfiler(); - i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); + ProfilerHelper helper(env); + i::CpuProfiler* iprofiler = + reinterpret_cast<i::CpuProfiler*>(helper.profiler()); // 0.........1.........2.........3.........4.........5.........6.........7 const char* source = @@ -1901,7 +1960,7 @@ TEST(DeoptAtFirstLevelInlinedSource) { CHECK_EQ(1U, deopt_infos.size()); const v8::CpuProfileDeoptInfo& info = deopt_infos[0]; - CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason); + CHECK_EQ(reason(i::DeoptimizeReason::kNotAHeapNumber), info.deopt_reason); CHECK_EQ(2U, info.stack.size()); CHECK_EQ(inlined_script_id, info.stack[0].script_id); CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); @@ -1919,9 +1978,9 @@ TEST(DeoptAtSecondLevelInlinedSource) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); - v8::Isolate* isolate = env->GetIsolate(); - v8::CpuProfiler* profiler = isolate->GetCpuProfiler(); - i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); + ProfilerHelper helper(env); + i::CpuProfiler* iprofiler = + reinterpret_cast<i::CpuProfiler*>(helper.profiler()); // 0.........1.........2.........3.........4.........5.........6.........7 const char* source = @@ -1974,7 +2033,7 @@ TEST(DeoptAtSecondLevelInlinedSource) { CHECK_EQ(1U, deopt_infos.size()); const v8::CpuProfileDeoptInfo info = deopt_infos[0]; - CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason); + CHECK_EQ(reason(i::DeoptimizeReason::kNotAHeapNumber), info.deopt_reason); CHECK_EQ(3U, info.stack.size()); CHECK_EQ(inlined_script_id, info.stack[0].script_id); CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); @@ -1993,9 +2052,9 @@ TEST(DeoptUntrackedFunction) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); - v8::Isolate* isolate = env->GetIsolate(); - v8::CpuProfiler* profiler = isolate->GetCpuProfiler(); - i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); + ProfilerHelper helper(env); + i::CpuProfiler* iprofiler = + reinterpret_cast<i::CpuProfiler*>(helper.profiler()); // 0.........1.........2.........3.........4.........5.........6.........7 const char* source = diff --git a/deps/v8/test/cctest/test-date.cc b/deps/v8/test/cctest/test-date.cc index 67b9501592..a745949fbd 100644 --- a/deps/v8/test/cctest/test-date.cc +++ b/deps/v8/test/cctest/test-date.cc @@ -166,3 +166,52 @@ TEST(DaylightSavingsTime) { CheckDST(august_20 + 2 * 3600 - 1000); CheckDST(august_20); } + +namespace { +int legacy_parse_count = 0; +void DateParseLegacyCounterCallback(v8::Isolate* isolate, + v8::Isolate::UseCounterFeature feature) { + if (feature == v8::Isolate::kLegacyDateParser) legacy_parse_count++; +} +} // anonymous namespace + +TEST(DateParseLegacyUseCounter) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + LocalContext context; + CcTest::isolate()->SetUseCounterCallback(DateParseLegacyCounterCallback); + CHECK_EQ(0, legacy_parse_count); + CompileRun("Date.parse('2015-02-31')"); + CHECK_EQ(0, legacy_parse_count); + CompileRun("Date.parse('2015-02-31T11:22:33.444Z01:23')"); + CHECK_EQ(0, legacy_parse_count); + CompileRun("Date.parse('2015-02-31T11:22:33.444')"); + CHECK_EQ(0, legacy_parse_count); + CompileRun("Date.parse('2000 01 01')"); + CHECK_EQ(1, legacy_parse_count); + CompileRun("Date.parse('2015-02-31T11:22:33.444 ')"); + CHECK_EQ(1, legacy_parse_count); +} + +#ifdef V8_I18N_SUPPORT +TEST(DateCacheVersion) { + FLAG_allow_natives_syntax = true; + v8::Isolate* isolate = CcTest::isolate(); + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + v8::Local<v8::Number> date_cache_version = + v8::Local<v8::Number>::Cast(CompileRun("%DateCacheVersion()")); + + CHECK(date_cache_version->IsNumber()); + CHECK_EQ(0.0, date_cache_version->NumberValue(context).FromMaybe(-1.0)); + + v8::Date::DateTimeConfigurationChangeNotification(isolate); + + date_cache_version = + v8::Local<v8::Number>::Cast(CompileRun("%DateCacheVersion()")); + CHECK(date_cache_version->IsNumber()); + CHECK_EQ(1.0, date_cache_version->NumberValue(context).FromMaybe(-1.0)); +} +#endif // V8_I18N_SUPPORT diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 192dce7b9f..925eaf4c27 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -157,29 +157,23 @@ static bool HasDebugInfo(v8::Local<v8::Function> fun) { return shared->HasDebugInfo(); } - -// Set a break point in a function and return the associated break point -// number. -static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { +// Set a break point in a function with a position relative to function start, +// and return the associated break point number. +static int SetBreakPoint(v8::Local<v8::Function> fun, int position) { + i::Handle<i::JSFunction> function = + i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*fun)); + position += function->shared()->start_position(); static int break_point = 0; - v8::internal::Isolate* isolate = fun->GetIsolate(); + v8::internal::Isolate* isolate = function->GetIsolate(); v8::internal::Debug* debug = isolate->debug(); debug->SetBreakPoint( - fun, + function, Handle<Object>(v8::internal::Smi::FromInt(++break_point), isolate), &position); return break_point; } -// Set a break point in a function and return the associated break point -// number. -static int SetBreakPoint(v8::Local<v8::Function> fun, int position) { - return SetBreakPoint( - i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*fun)), position); -} - - // Set a break point in a function using the Debug object and return the // associated break point number. static int SetBreakPointFromJS(v8::Isolate* isolate, @@ -6081,53 +6075,48 @@ class EmptyExternalStringResource : public v8::String::ExternalStringResource { ::v8::internal::EmbeddedVector<uint16_t, 1> empty_; }; - -TEST(DebugGetLoadedScripts) { +TEST(DebugScriptLineEndsAreAscending) { DebugLocalContext env; - v8::HandleScope scope(env->GetIsolate()); + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); env.ExposeDebug(); - v8::Local<v8::Context> context = env.context(); - EmptyExternalStringResource source_ext_str; - v8::Local<v8::String> source = - v8::String::NewExternalTwoByte(env->GetIsolate(), &source_ext_str) - .ToLocalChecked(); - CHECK(v8::Script::Compile(context, source).IsEmpty()); - Handle<i::ExternalTwoByteString> i_source( - i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); - // This situation can happen if source was an external string disposed - // by its owner. - i_source->set_resource(0); - - bool allow_natives_syntax = i::FLAG_allow_natives_syntax; - i::FLAG_allow_natives_syntax = true; - EnableDebugger(env->GetIsolate()); - v8::MaybeLocal<v8::Value> result = - CompileRun(env.context(), - "var scripts = %DebugGetLoadedScripts();" - "var count = scripts.length;" - "for (var i = 0; i < count; ++i) {" - " var lines = scripts[i].lineCount();" - " if (lines < 1) throw 'lineCount';" - " var last = -1;" - " for (var j = 0; j < lines; ++j) {" - " var end = scripts[i].lineEnd(j);" - " if (last >= end) throw 'lineEnd';" - " last = end;" - " }" - "}"); - CHECK(!result.IsEmpty()); - DisableDebugger(env->GetIsolate()); - // Must not crash while accessing line_ends. - i::FLAG_allow_natives_syntax = allow_natives_syntax; + // Compile a test script. + v8::Local<v8::String> script = v8_str(isolate, + "function f() {\n" + " debugger;\n" + "}\n"); - // Some scripts are retrieved - at least the number of native scripts. - CHECK_GT(env->Global() - ->Get(context, v8_str(env->GetIsolate(), "count")) - .ToLocalChecked() - ->Int32Value(context) - .FromJust(), - 8); + v8::ScriptOrigin origin1 = v8::ScriptOrigin(v8_str(isolate, "name")); + v8::Local<v8::Script> script1 = + v8::Script::Compile(env.context(), script, &origin1).ToLocalChecked(); + USE(script1); + + Handle<v8::internal::FixedArray> instances; + { + v8::internal::Debug* debug = CcTest::i_isolate()->debug(); + v8::internal::DebugScope debug_scope(debug); + CHECK(!debug_scope.failed()); + instances = debug->GetLoadedScripts(); + } + + CHECK_GT(instances->length(), 0); + for (int i = 0; i < instances->length(); i++) { + Handle<v8::internal::Script> script = Handle<v8::internal::Script>( + v8::internal::Script::cast(instances->get(i))); + + v8::internal::Script::InitLineEnds(script); + v8::internal::FixedArray* ends = + v8::internal::FixedArray::cast(script->line_ends()); + CHECK_GT(ends->length(), 0); + + int prev_end = -1; + for (int j = 0; j < ends->length(); j++) { + const int curr_end = v8::internal::Smi::cast(ends->get(j))->value(); + CHECK_GT(curr_end, prev_end); + prev_end = curr_end; + } + } } @@ -7185,6 +7174,40 @@ TEST(NoDebugContextWhenDebuggerDisabled) { CHECK(context.IsEmpty()); } +static void DebugEventCheckContext( + const v8::Debug::EventDetails& event_details) { + if (event_details.GetEvent() == v8::Break) { + v8::Isolate* isolate = event_details.GetIsolate(); + CHECK(v8::Debug::GetDebuggedContext(isolate) + .ToLocalChecked() + ->Global() + ->Equals(isolate->GetCurrentContext(), + event_details.GetEventContext()->Global()) + .FromJust()); + } +} + +static void CheckContext(const v8::FunctionCallbackInfo<v8::Value>& args) { + CHECK(v8::Debug::GetDebuggedContext(args.GetIsolate()).IsEmpty()); +} + +TEST(DebuggedContext) { + DebugLocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + + v8::Debug::SetDebugEventListener(isolate, DebugEventCheckContext); + + v8::Local<v8::Function> foo = + CompileFunction(&env, "function foo(){bar=0;}", "foo"); + + SetBreakPoint(foo, 0); + foo->Call(env.context(), env->Global(), 0, nullptr).ToLocalChecked(); + + v8::Local<v8::Function> fun = v8::FunctionTemplate::New(isolate, CheckContext) + ->GetFunction(env.context()) + .ToLocalChecked(); + fun->Call(env.context(), env->Global(), 0, nullptr).ToLocalChecked(); +} static v8::Local<v8::Value> expected_callback_data; static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { @@ -7555,9 +7578,9 @@ static void DebugBreakInlineListener( CHECK_EQ(expected_frame_count, frame_count); for (int i = 0; i < frame_count; i++) { - // The 5. element in the returned array of GetFrameDetails contains the + // The 6. element in the returned array of GetFrameDetails contains the // source position of that frame. - SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i); + SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[6]", break_id, i); v8::Local<v8::Value> result = CompileRun(script); CHECK_EQ(expected_line_number[i], i::Script::GetLineNumber(source_script, @@ -7834,8 +7857,8 @@ TEST(DebugPromiseInterceptedByTryCatch) { CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); CompileRun( "var r;" - "p.chain(function() { r = 'resolved'; }," - " function() { r = 'rejected'; });"); + "p.then(function() { r = 'resolved'; }," + " function() { r = 'rejected'; });"); CHECK(CompileRun("r")->Equals(context, v8_str("resolved")).FromJust()); } @@ -7874,45 +7897,14 @@ TEST(DebugPromiseRejectedByCallback) { CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); CompileRun( "var r;" - "p.chain(function() { r = 'resolved'; }," - " function(e) { r = 'rejected' + e; });"); + "p.then(function() { r = 'resolved'; }," + " function(e) { r = 'rejected' + e; });"); CHECK( CompileRun("r")->Equals(context, v8_str("rejectedrejection")).FromJust()); CHECK_EQ(1, exception_event_counter); } -TEST(DebugBreakOnExceptionInObserveCallback) { - i::FLAG_harmony_object_observe = true; - DebugLocalContext env; - v8::Isolate* isolate = env->GetIsolate(); - v8::HandleScope scope(isolate); - v8::Debug::SetDebugEventListener(isolate, &DebugEventCountException); - v8::Local<v8::Context> context = env.context(); - // Break on uncaught exception - ChangeBreakOnException(false, true); - exception_event_counter = 0; - - v8::Local<v8::FunctionTemplate> fun = - v8::FunctionTemplate::New(isolate, ThrowCallback); - CHECK(env->Global() - ->Set(context, v8_str("fun"), - fun->GetFunction(context).ToLocalChecked()) - .FromJust()); - - CompileRun( - "var obj = {};" - "var callbackRan = false;" - "Object.observe(obj, function() {" - " callbackRan = true;" - " throw Error('foo');" - "});" - "obj.prop = 1"); - CHECK(CompileRun("callbackRan")->BooleanValue(context).FromJust()); - CHECK_EQ(1, exception_event_counter); -} - - static void DebugHarmonyScopingListener( const v8::Debug::EventDetails& event_details) { v8::DebugEvent event = event_details.GetEvent(); @@ -7986,19 +7978,12 @@ static void NoInterruptsOnDebugEvent( --after_compile_handler_depth; } - TEST(NoInterruptsInDebugListener) { DebugLocalContext env; v8::Debug::SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent); CompileRun("void(0);"); } -class TestBreakLocation : public i::BreakLocation { - public: - using i::BreakLocation::GetIterator; - using i::BreakLocation::Iterator; -}; - TEST(BreakLocationIterator) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -8020,53 +8005,40 @@ TEST(BreakLocationIterator) { CHECK(i_isolate->debug()->EnsureDebugInfo(shared, function)); Handle<i::DebugInfo> debug_info(shared->GetDebugInfo()); - int code_size = debug_info->abstract_code()->Size(); - - bool found_return = false; - bool found_call = false; - bool found_debugger = false; - - // Test public interface. - for (int i = 0; i < code_size; i++) { - i::BreakLocation location = i::BreakLocation::FromCodeOffset(debug_info, i); - if (location.IsCall()) found_call = true; - if (location.IsReturn()) found_return = true; - if (location.IsDebuggerStatement()) found_debugger = true; + Handle<i::AbstractCode> abstract_code(shared->abstract_code()); + + { + auto iterator = i::BreakIterator::GetIterator(debug_info, abstract_code, + i::ALL_BREAK_LOCATIONS); + CHECK(iterator->GetBreakLocation().IsDebuggerStatement()); + CHECK_EQ(17, iterator->GetBreakLocation().position()); + iterator->Next(); + CHECK(iterator->GetBreakLocation().IsDebugBreakSlot()); + CHECK_EQ(32, iterator->GetBreakLocation().position()); + iterator->Next(); + CHECK(iterator->GetBreakLocation().IsCall()); + CHECK_EQ(32, iterator->GetBreakLocation().position()); + iterator->Next(); + CHECK(iterator->GetBreakLocation().IsDebuggerStatement()); + CHECK_EQ(47, iterator->GetBreakLocation().position()); + iterator->Next(); + CHECK(iterator->GetBreakLocation().IsReturn()); + CHECK_EQ(60, iterator->GetBreakLocation().position()); + iterator->Next(); + 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()); } - CHECK(found_call); - CHECK(found_return); - CHECK(found_debugger); - - // Test underlying implementation. - TestBreakLocation::Iterator* iterator = - TestBreakLocation::GetIterator(debug_info, i::ALL_BREAK_LOCATIONS); - CHECK(iterator->GetBreakLocation().IsDebuggerStatement()); - CHECK_EQ(7, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->GetBreakLocation().IsDebugBreakSlot()); - CHECK_EQ(22, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->GetBreakLocation().IsCall()); - CHECK_EQ(22, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->GetBreakLocation().IsDebuggerStatement()); - CHECK_EQ(37, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->GetBreakLocation().IsReturn()); - CHECK_EQ(50, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->Done()); - delete iterator; - - iterator = TestBreakLocation::GetIterator(debug_info, i::CALLS_AND_RETURNS); - CHECK(iterator->GetBreakLocation().IsCall()); - CHECK_EQ(22, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->GetBreakLocation().IsReturn()); - CHECK_EQ(50, iterator->GetBreakLocation().position()); - iterator->Next(); - CHECK(iterator->Done()); - delete iterator; DisableDebugger(isolate); } diff --git a/deps/v8/test/cctest/test-decls.cc b/deps/v8/test/cctest/test-decls.cc index 35cb515dc1..e4506aee50 100644 --- a/deps/v8/test/cctest/test-decls.cc +++ b/deps/v8/test/cctest/test-decls.cc @@ -34,6 +34,7 @@ using namespace v8; +namespace { enum Expectations { EXPECT_RESULT, @@ -223,6 +224,7 @@ v8::Local<Integer> DeclarationContext::Query(Local<Name> key) { return v8::Local<Integer>(); } +} // namespace // Test global declaration of a property the interceptor doesn't know // about and doesn't handle. diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc index cc4a7533d8..0756de6c1d 100644 --- a/deps/v8/test/cctest/test-dictionary.cc +++ b/deps/v8/test/cctest/test-dictionary.cc @@ -35,7 +35,7 @@ #include "src/global-handles.h" #include "src/macro-assembler.h" #include "src/objects.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" using namespace v8::internal; @@ -89,7 +89,7 @@ static void TestHashMap(Handle<HashMap> table) { // code should not be found. for (int i = 0; i < 100; i++) { Handle<JSReceiver> key = factory->NewJSArray(7); - CHECK(JSReceiver::GetOrCreateIdentityHash(key)->IsSmi()); + CHECK(JSReceiver::GetOrCreateIdentityHash(isolate, key)->IsSmi()); CHECK_EQ(table->FindEntry(key), HashMap::kNotFound); CHECK_EQ(table->Lookup(key), CcTest::heap()->the_hole_value()); CHECK(JSReceiver::GetIdentityHash(isolate, key)->IsSmi()); @@ -100,8 +100,8 @@ static void TestHashMap(Handle<HashMap> table) { for (int i = 0; i < 100; i++) { Handle<JSReceiver> key = factory->NewJSArray(7); CHECK_EQ(table->Lookup(key), CcTest::heap()->the_hole_value()); - Handle<Object> identity_hash = JSReceiver::GetIdentityHash(isolate, key); - CHECK_EQ(CcTest::heap()->undefined_value(), *identity_hash); + Object* identity_hash = JSReceiver::GetIdentityHash(isolate, key); + CHECK_EQ(CcTest::heap()->undefined_value(), identity_hash); } } @@ -113,6 +113,74 @@ TEST(HashMap) { TestHashMap(ObjectHashTable::New(isolate, 23)); } +template <typename HashSet> +static void TestHashSet(Handle<HashSet> table) { + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + + Handle<JSObject> a = factory->NewJSArray(7); + Handle<JSObject> b = factory->NewJSArray(11); + table = HashSet::Add(table, a); + CHECK_EQ(table->NumberOfElements(), 1); + CHECK(table->Has(isolate, a)); + CHECK(!table->Has(isolate, b)); + + // Keys still have to be valid after objects were moved. + CcTest::heap()->CollectGarbage(NEW_SPACE); + CHECK_EQ(table->NumberOfElements(), 1); + 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(table->Has(isolate, a)); + CHECK(!table->Has(isolate, b)); + + // Keys that have been removed are mapped to the hole. + // TODO(cbruni): not implemented yet. + // bool was_present = false; + // table = HashSet::Remove(table, a, &was_present); + // CHECK(was_present); + // CHECK_EQ(table->NumberOfElements(), 0); + // CHECK(!table->Has(a)); + // CHECK(!table->Has(b)); + + // Keys should map back to their respective values and also should get + // an identity hash code generated. + for (int i = 0; i < 100; i++) { + Handle<JSReceiver> key = factory->NewJSArray(7); + table = HashSet::Add(table, key); + CHECK_EQ(table->NumberOfElements(), i + 2); + CHECK(table->Has(isolate, key)); + CHECK(JSReceiver::GetIdentityHash(isolate, key)->IsSmi()); + } + + // Keys never added to the map which already have an identity hash + // code should not be found. + for (int i = 0; i < 100; i++) { + Handle<JSReceiver> key = factory->NewJSArray(7); + CHECK(JSReceiver::GetOrCreateIdentityHash(isolate, key)->IsSmi()); + CHECK(!table->Has(isolate, key)); + CHECK(JSReceiver::GetIdentityHash(isolate, key)->IsSmi()); + } + + // Keys that don't have an identity hash should not be found and also + // should not get an identity hash code generated. + for (int i = 0; i < 100; i++) { + Handle<JSReceiver> key = factory->NewJSArray(7); + CHECK(!table->Has(isolate, key)); + Object* identity_hash = JSReceiver::GetIdentityHash(isolate, key); + CHECK_EQ(CcTest::heap()->undefined_value(), identity_hash); + } +} + +TEST(HashSet) { + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + TestHashSet(ObjectHashSet::New(isolate, 23)); +} class ObjectHashTableTest: public ObjectHashTable { public: @@ -175,8 +243,8 @@ static void TestHashSetCausesGC(Handle<HashSet> table) { // Simulate a full heap so that generating an identity hash code // in subsequent calls will request GC. - SimulateFullSpace(CcTest::heap()->new_space()); - SimulateFullSpace(CcTest::heap()->old_space()); + heap::SimulateFullSpace(CcTest::heap()->new_space()); + heap::SimulateFullSpace(CcTest::heap()->old_space()); // Calling Contains() should not cause GC ever. int gc_count = isolate->heap()->gc_count(); @@ -206,11 +274,11 @@ static void TestHashMapCausesGC(Handle<HashMap> table) { // Simulate a full heap so that generating an identity hash code // in subsequent calls will request GC. - SimulateFullSpace(CcTest::heap()->new_space()); - SimulateFullSpace(CcTest::heap()->old_space()); + heap::SimulateFullSpace(CcTest::heap()->new_space()); + heap::SimulateFullSpace(CcTest::heap()->old_space()); // Calling Lookup() should not cause GC ever. - CHECK(table->Lookup(key)->IsTheHole()); + CHECK(table->Lookup(key)->IsTheHole(isolate)); // Calling Put() should request GC by returning a failure. int gc_count = isolate->heap()->gc_count(); diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc index 7eea8a171c..d5f594962c 100644 --- a/deps/v8/test/cctest/test-disasm-arm.cc +++ b/deps/v8/test/cctest/test-disasm-arm.cc @@ -399,15 +399,6 @@ TEST(Type3) { COMPARE(bfi(r1, r0, 31, 1), "e7df1f90 bfi r1, r0, #31, #1"); - COMPARE(usat(r0, 1, Operand(r1)), - "e6e10011 usat r0, #1, r1"); - COMPARE(usat(r2, 7, Operand(lr)), - "e6e7201e usat r2, #7, lr"); - COMPARE(usat(r3, 31, Operand(r4, LSL, 31)), - "e6ff3f94 usat r3, #31, r4, lsl #31"); - COMPARE(usat(r8, 0, Operand(r5, ASR, 17)), - "e6e088d5 usat r8, #0, r5, asr #17"); - COMPARE(pkhbt(r3, r4, Operand(r5, LSL, 17)), "e6843895 pkhbt r3, r4, r5, lsl #17"); COMPARE(pkhtb(r3, r4, Operand(r5, ASR, 17)), @@ -443,6 +434,15 @@ TEST(Type3) { COMPARE(rbit(r10, ip), "e6ffaf3c rbit r10, ip"); } + COMPARE(usat(r0, 1, Operand(r1)), + "e6e10011 usat r0, #1, r1"); + COMPARE(usat(r2, 7, Operand(lr)), + "e6e7201e usat r2, #7, lr"); + COMPARE(usat(r3, 31, Operand(r4, LSL, 31)), + "e6ff3f94 usat r3, #31, r4, lsl #31"); + COMPARE(usat(r8, 0, Operand(r5, ASR, 17)), + "e6e088d5 usat r8, #0, r5, asr #17"); + COMPARE(smmla(r0, r1, r2, r3), "e7503211 smmla r0, r1, r2, r3"); COMPARE(smmla(r10, r9, r8, r7), "e75a7819 smmla r10, r9, r8, r7"); @@ -860,6 +860,51 @@ TEST(ARMv8_vrintX_disasm) { } +TEST(ARMv8_vselX_disasm) { + SET_UP(); + + if (CpuFeatures::IsSupported(ARMv8)) { + // Native instructions. + COMPARE(vsel(eq, d0, d1, d2), + "fe010b02 vseleq.f64 d0, d1, d2"); + COMPARE(vsel(eq, s0, s1, s2), + "fe000a81 vseleq.f32 s0, s1, s2"); + COMPARE(vsel(ge, d0, d1, d2), + "fe210b02 vselge.f64 d0, d1, d2"); + COMPARE(vsel(ge, s0, s1, s2), + "fe200a81 vselge.f32 s0, s1, s2"); + COMPARE(vsel(gt, d0, d1, d2), + "fe310b02 vselgt.f64 d0, d1, d2"); + COMPARE(vsel(gt, s0, s1, s2), + "fe300a81 vselgt.f32 s0, s1, s2"); + COMPARE(vsel(vs, d0, d1, d2), + "fe110b02 vselvs.f64 d0, d1, d2"); + COMPARE(vsel(vs, s0, s1, s2), + "fe100a81 vselvs.f32 s0, s1, s2"); + + // Inverted conditions (and swapped inputs). + COMPARE(vsel(ne, d0, d1, d2), + "fe020b01 vseleq.f64 d0, d2, d1"); + COMPARE(vsel(ne, s0, s1, s2), + "fe010a20 vseleq.f32 s0, s2, s1"); + COMPARE(vsel(lt, d0, d1, d2), + "fe220b01 vselge.f64 d0, d2, d1"); + COMPARE(vsel(lt, s0, s1, s2), + "fe210a20 vselge.f32 s0, s2, s1"); + COMPARE(vsel(le, d0, d1, d2), + "fe320b01 vselgt.f64 d0, d2, d1"); + COMPARE(vsel(le, s0, s1, s2), + "fe310a20 vselgt.f32 s0, s2, s1"); + COMPARE(vsel(vc, d0, d1, d2), + "fe120b01 vselvs.f64 d0, d2, d1"); + COMPARE(vsel(vc, s0, s1, s2), + "fe110a20 vselvs.f32 s0, s2, s1"); + } + + VERIFY_RUN(); +} + + TEST(Neon) { SET_UP(); @@ -1126,3 +1171,17 @@ TEST(Barrier) { VERIFY_RUN(); } + + +TEST(LoadStoreExclusive) { + SET_UP(); + + COMPARE(ldrexb(r0, r1), "e1d10f9f ldrexb r0, [r1]"); + COMPARE(strexb(r0, r1, r2), "e1c20f91 strexb r0, r1, [r2]"); + COMPARE(ldrexh(r0, r1), "e1f10f9f ldrexh r0, [r1]"); + COMPARE(strexh(r0, r1, r2), "e1e20f91 strexh r0, r1, [r2]"); + COMPARE(ldrex(r0, r1), "e1910f9f ldrex r0, [r1]"); + COMPARE(strex(r0, r1, r2), "e1820f91 strex r0, r1, [r2]"); + + VERIFY_RUN(); +} diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc index beca93ede2..c3653bd48e 100644 --- a/deps/v8/test/cctest/test-disasm-arm64.cc +++ b/deps/v8/test/cctest/test-disasm-arm64.cc @@ -1259,6 +1259,24 @@ TEST_(load_store_pair) { CLEANUP(); } +TEST_(load_store_acquire_release) { + SET_UP_MASM(); + + COMPARE(ldar(w0, x1), "ldar w0, [x1]"); + COMPARE(ldarb(w2, x3), "ldarb w2, [x3]"); + COMPARE(ldarh(w4, x5), "ldarh w4, [x5]"); + COMPARE(ldaxr(w6, x7), "ldaxr w6, [x7]"); + COMPARE(ldaxrb(w8, x9), "ldaxrb w8, [x9]"); + COMPARE(ldaxrh(w10, x11), "ldaxrh w10, [x11]"); + COMPARE(stlr(w12, x13), "stlr w12, [x13]"); + COMPARE(stlrb(w14, x15), "stlrb w14, [x15]"); + COMPARE(stlrh(w16, x17), "stlrh w16, [x17]"); + COMPARE(stlxr(w18, w19, x20), "stlxr w18, w19, [x20]"); + COMPARE(stlxrb(w21, w22, x23), "stlxrb w21, w22, [x23]"); + COMPARE(stlxrh(w24, w25, x26), "stlxrh w24, w25, [x26]"); + + CLEANUP(); +} #if 0 // TODO(all): enable. TEST_(load_literal) { diff --git a/deps/v8/test/cctest/test-disasm-ia32.cc b/deps/v8/test/cctest/test-disasm-ia32.cc index f96eb00fd1..88471a26c8 100644 --- a/deps/v8/test/cctest/test-disasm-ia32.cc +++ b/deps/v8/test/cctest/test-disasm-ia32.cc @@ -29,11 +29,11 @@ #include "src/v8.h" +#include "src/code-factory.h" #include "src/debug/debug.h" #include "src/disasm.h" #include "src/disassembler.h" #include "src/ia32/frames-ia32.h" -#include "src/ic/ic.h" #include "src/macro-assembler.h" #include "test/cctest/cctest.h" @@ -290,7 +290,7 @@ TEST(DisasmIa320) { __ bind(&L2); __ call(Operand(ebx, ecx, times_4, 10000)); __ nop(); - Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_INSIDE_TYPEOF)); + Handle<Code> ic(CodeFactory::LoadIC(isolate).code()); __ call(ic, RelocInfo::CODE_TARGET); __ nop(); __ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY); @@ -390,6 +390,9 @@ TEST(DisasmIa320) { { // Move operation __ movaps(xmm0, xmm1); + __ movups(xmm0, xmm1); + __ movups(xmm0, Operand(edx, 4)); + __ movups(Operand(edx, 4), xmm0); __ shufps(xmm0, xmm0, 0x0); __ cvtsd2ss(xmm0, xmm1); __ cvtsd2ss(xmm0, Operand(ebx, ecx, times_4, 10000)); @@ -665,12 +668,30 @@ TEST(DisasmIa320) { // xchg. { + __ xchg_b(eax, Operand(eax, 8)); + __ xchg_w(eax, Operand(ebx, 8)); __ xchg(eax, eax); __ xchg(eax, ebx); __ xchg(ebx, ebx); __ xchg(ebx, Operand(esp, 12)); } + // cmpxchg. + { + __ cmpxchg_b(Operand(esp, 12), eax); + __ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax); + __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax); + } + + // lock prefix. + { + __ lock(); + __ cmpxchg(Operand(esp, 12), ebx); + + __ lock(); + __ xchg_w(eax, Operand(ecx, 8)); + } + // Nop instructions for (int i = 0; i < 16; i++) { __ Nop(i); diff --git a/deps/v8/test/cctest/test-disasm-mips.cc b/deps/v8/test/cctest/test-disasm-mips.cc index 9a7d8ae431..b4f81ec3b1 100644 --- a/deps/v8/test/cctest/test-disasm-mips.cc +++ b/deps/v8/test/cctest/test-disasm-mips.cc @@ -97,7 +97,6 @@ if (failure) { \ V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \ } - #define COMPARE_PC_REL_COMPACT(asm_, compare_string, offset) \ { \ int pc_offset = assm.pc_offset(); \ @@ -106,28 +105,28 @@ if (failure) { \ prev_instr_compact_branch = assm.IsPrevInstrCompactBranch(); \ if (prev_instr_compact_branch) { \ snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ - compare_string, progcounter + 8 + (offset * 4)); \ + compare_string, \ + static_cast<void *>(progcounter + 8 + (offset * 4))); \ } else { \ snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ - compare_string, progcounter + 4 + (offset * 4)); \ + compare_string, \ + static_cast<void *>(progcounter + 4 + (offset * 4))); \ } \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } - #define COMPARE_PC_REL(asm_, compare_string, offset) \ { \ int pc_offset = assm.pc_offset(); \ byte *progcounter = &buffer[pc_offset]; \ char str_with_address[100]; \ snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ - compare_string, progcounter + (offset * 4)); \ + compare_string, static_cast<void *>(progcounter + (offset * 4))); \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } - #define COMPARE_PC_JUMP(asm_, compare_string, target) \ { \ int pc_offset = assm.pc_offset(); \ @@ -136,14 +135,13 @@ if (failure) { \ int instr_index = (target >> 2) & kImm26Mask; \ snprintf( \ str_with_address, sizeof(str_with_address), "%s %p -> %p", \ - compare_string, reinterpret_cast<byte *>(target), \ - reinterpret_cast<byte *>(((uint32_t)(progcounter + 4) & ~0xfffffff) | \ + compare_string, reinterpret_cast<void *>(target), \ + reinterpret_cast<void *>(((uint32_t)(progcounter + 4) & ~0xfffffff) | \ (instr_index << 2))); \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } - #define GET_PC_REGION(pc_region) \ { \ int pc_offset = assm.pc_offset(); \ @@ -780,6 +778,20 @@ TEST(Type0) { } if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { + COMPARE(seb(a0, a1), "7c052420 seb a0, a1"); + COMPARE(seb(s6, s7), "7c17b420 seb s6, s7"); + COMPARE(seb(v0, v1), "7c031420 seb v0, v1"); + + COMPARE(seh(a0, a1), "7c052620 seh a0, a1"); + COMPARE(seh(s6, s7), "7c17b620 seh s6, s7"); + COMPARE(seh(v0, v1), "7c031620 seh v0, v1"); + + COMPARE(wsbh(a0, a1), "7c0520a0 wsbh a0, a1"); + COMPARE(wsbh(s6, s7), "7c17b0a0 wsbh s6, s7"); + COMPARE(wsbh(v0, v1), "7c0310a0 wsbh v0, v1"); + } + + if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { COMPARE(ins_(a0, a1, 31, 1), "7ca4ffc4 ins a0, a1, 31, 1"); COMPARE(ins_(s6, s7, 30, 2), diff --git a/deps/v8/test/cctest/test-disasm-mips64.cc b/deps/v8/test/cctest/test-disasm-mips64.cc index 8a1e0e7db0..dc6f34e462 100644 --- a/deps/v8/test/cctest/test-disasm-mips64.cc +++ b/deps/v8/test/cctest/test-disasm-mips64.cc @@ -97,7 +97,6 @@ if (failure) { \ V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \ } - #define COMPARE_PC_REL_COMPACT(asm_, compare_string, offset) \ { \ int pc_offset = assm.pc_offset(); \ @@ -106,28 +105,28 @@ if (failure) { \ prev_instr_compact_branch = assm.IsPrevInstrCompactBranch(); \ if (prev_instr_compact_branch) { \ snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ - compare_string, progcounter + 8 + (offset * 4)); \ + compare_string, \ + static_cast<void *>(progcounter + 8 + (offset * 4))); \ } else { \ snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ - compare_string, progcounter + 4 + (offset * 4)); \ + compare_string, \ + static_cast<void *>(progcounter + 4 + (offset * 4))); \ } \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } - #define COMPARE_PC_REL(asm_, compare_string, offset) \ { \ int pc_offset = assm.pc_offset(); \ byte *progcounter = &buffer[pc_offset]; \ char str_with_address[100]; \ snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ - compare_string, progcounter + (offset * 4)); \ + compare_string, static_cast<void *>(progcounter + (offset * 4))); \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } - #define COMPARE_PC_JUMP(asm_, compare_string, target) \ { \ int pc_offset = assm.pc_offset(); \ @@ -136,14 +135,13 @@ if (failure) { \ int instr_index = (target >> 2) & kImm26Mask; \ snprintf( \ str_with_address, sizeof(str_with_address), "%s %p -> %p", \ - compare_string, reinterpret_cast<byte *>(target), \ - reinterpret_cast<byte *>(((uint64_t)(progcounter + 1) & ~0xfffffff) | \ + compare_string, reinterpret_cast<void *>(target), \ + reinterpret_cast<void *>(((uint64_t)(progcounter + 1) & ~0xfffffff) | \ (instr_index << 2))); \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } - #define GET_PC_REGION(pc_region) \ { \ int pc_offset = assm.pc_offset(); \ @@ -530,41 +528,28 @@ TEST(Type0) { COMPARE(dsrav(v0, v1, fp), "03c31017 dsrav v0, v1, fp"); - if (kArchVariant == kMips64r2) { - COMPARE(rotr(a0, a1, 0), - "00252002 rotr a0, a1, 0"); - COMPARE(rotr(s0, s1, 8), - "00318202 rotr s0, s1, 8"); - COMPARE(rotr(a6, a7, 24), - "002b5602 rotr a6, a7, 24"); - COMPARE(rotr(v0, v1, 31), - "002317c2 rotr v0, v1, 31"); - COMPARE(drotr(a0, a1, 0), - "0025203a drotr a0, a1, 0"); - COMPARE(drotr(s0, s1, 8), - "0031823a drotr s0, s1, 8"); - COMPARE(drotr(a6, a7, 24), - "002b563a drotr a6, a7, 24"); - COMPARE(drotr(v0, v1, 31), - "002317fa drotr v0, v1, 31"); - - COMPARE(rotrv(a0, a1, a2), - "00c52046 rotrv a0, a1, a2"); - COMPARE(rotrv(s0, s1, s2), - "02518046 rotrv s0, s1, s2"); - COMPARE(rotrv(a6, a7, t0), - "018b5046 rotrv a6, a7, t0"); - COMPARE(rotrv(v0, v1, fp), - "03c31046 rotrv v0, v1, fp"); - COMPARE(drotrv(a0, a1, a2), - "00c52056 drotrv a0, a1, a2"); - COMPARE(drotrv(s0, s1, s2), - "02518056 drotrv s0, s1, s2"); - COMPARE(drotrv(a6, a7, t0), - "018b5056 drotrv a6, a7, t0"); - COMPARE(drotrv(v0, v1, fp), - "03c31056 drotrv v0, v1, fp"); - } + COMPARE(rotr(a0, a1, 0), "00252002 rotr a0, a1, 0"); + COMPARE(rotr(s0, s1, 8), "00318202 rotr s0, s1, 8"); + COMPARE(rotr(a6, a7, 24), "002b5602 rotr a6, a7, 24"); + COMPARE(rotr(v0, v1, 31), "002317c2 rotr v0, v1, 31"); + COMPARE(drotr(a0, a1, 0), "0025203a drotr a0, a1, 0"); + COMPARE(drotr(s0, s1, 8), "0031823a drotr s0, s1, 8"); + COMPARE(drotr(a6, a7, 24), "002b563a drotr a6, a7, 24"); + COMPARE(drotr(v0, v1, 31), "002317fa drotr v0, v1, 31"); + + COMPARE(drotr32(a0, a1, 0), "0025203e drotr32 a0, a1, 0"); + COMPARE(drotr32(s0, s1, 8), "0031823e drotr32 s0, s1, 8"); + COMPARE(drotr32(a6, a7, 24), "002b563e drotr32 a6, a7, 24"); + COMPARE(drotr32(v0, v1, 31), "002317fe drotr32 v0, v1, 31"); + + COMPARE(rotrv(a0, a1, a2), "00c52046 rotrv a0, a1, a2"); + COMPARE(rotrv(s0, s1, s2), "02518046 rotrv s0, s1, s2"); + COMPARE(rotrv(a6, a7, t0), "018b5046 rotrv a6, a7, t0"); + COMPARE(rotrv(v0, v1, fp), "03c31046 rotrv v0, v1, fp"); + COMPARE(drotrv(a0, a1, a2), "00c52056 drotrv a0, a1, a2"); + COMPARE(drotrv(s0, s1, s2), "02518056 drotrv s0, s1, s2"); + COMPARE(drotrv(a6, a7, t0), "018b5056 drotrv a6, a7, t0"); + COMPARE(drotrv(v0, v1, fp), "03c31056 drotrv v0, v1, fp"); COMPARE(break_(0), "0000000d break, code: 0x00000 (0)"); @@ -698,6 +683,26 @@ TEST(Type0) { "70621020 clz v0, v1"); } + COMPARE(seb(a0, a1), "7c052420 seb a0, a1"); + COMPARE(seb(s6, s7), "7c17b420 seb s6, s7"); + COMPARE(seb(v0, v1), "7c031420 seb v0, v1"); + + COMPARE(seh(a0, a1), "7c052620 seh a0, a1"); + COMPARE(seh(s6, s7), "7c17b620 seh s6, s7"); + COMPARE(seh(v0, v1), "7c031620 seh v0, v1"); + + COMPARE(wsbh(a0, a1), "7c0520a0 wsbh a0, a1"); + COMPARE(wsbh(s6, s7), "7c17b0a0 wsbh s6, s7"); + COMPARE(wsbh(v0, v1), "7c0310a0 wsbh v0, v1"); + + COMPARE(dsbh(a0, a1), "7c0520a4 dsbh a0, a1"); + COMPARE(dsbh(s6, s7), "7c17b0a4 dsbh s6, s7"); + COMPARE(dsbh(v0, v1), "7c0310a4 dsbh v0, v1"); + + COMPARE(dshd(a0, a1), "7c052164 dshd a0, a1"); + COMPARE(dshd(s6, s7), "7c17b164 dshd s6, s7"); + COMPARE(dshd(v0, v1), "7c031164 dshd v0, v1"); + COMPARE(ins_(a0, a1, 31, 1), "7ca4ffc4 ins a0, a1, 31, 1"); COMPARE(ins_(s6, s7, 30, 2), diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc index 3722c1f800..284ca859be 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -29,10 +29,10 @@ #include "src/v8.h" +#include "src/code-factory.h" #include "src/debug/debug.h" #include "src/disasm.h" #include "src/disassembler.h" -#include "src/ic/ic.h" #include "src/macro-assembler.h" #include "test/cctest/cctest.h" @@ -282,7 +282,7 @@ TEST(DisasmX64) { // TODO(mstarzinger): The following is protected. // __ call(Operand(rbx, rcx, times_4, 10000)); __ nop(); - Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_INSIDE_TYPEOF)); + Handle<Code> ic(CodeFactory::LoadIC(isolate).code()); __ call(ic, RelocInfo::CODE_TARGET); __ nop(); __ nop(); @@ -431,6 +431,8 @@ TEST(DisasmX64) { __ movsd(xmm1, Operand(rbx, rcx, times_4, 10000)); __ movsd(Operand(rbx, rcx, times_4, 10000), xmm1); // 128 bit move instructions. + __ movupd(xmm0, Operand(rbx, rcx, times_4, 10000)); + __ movupd(Operand(rbx, rcx, times_4, 10000), xmm0); __ movdqa(xmm0, Operand(rbx, rcx, times_4, 10000)); __ movdqa(Operand(rbx, rcx, times_4, 10000), xmm0); @@ -449,6 +451,11 @@ TEST(DisasmX64) { __ ucomisd(xmm0, xmm1); __ andpd(xmm0, xmm1); + __ andpd(xmm0, Operand(rbx, rcx, times_4, 10000)); + __ orpd(xmm0, xmm1); + __ orpd(xmm0, Operand(rbx, rcx, times_4, 10000)); + __ xorpd(xmm0, xmm1); + __ xorpd(xmm0, Operand(rbx, rcx, times_4, 10000)); __ pslld(xmm0, 6); __ psrld(xmm0, 6); @@ -458,6 +465,7 @@ TEST(DisasmX64) { __ pcmpeqd(xmm1, xmm0); __ punpckldq(xmm1, xmm11); + __ punpckldq(xmm5, Operand(rdx, 4)); __ punpckhdq(xmm8, xmm15); } @@ -484,11 +492,67 @@ TEST(DisasmX64) { { if (CpuFeatures::IsSupported(SSE4_1)) { CpuFeatureScope scope(&assm, SSE4_1); + __ insertps(xmm5, xmm1, 123); __ extractps(rax, xmm1, 0); __ pextrd(rbx, xmm15, 0); __ pextrd(r12, xmm0, 1); __ pinsrd(xmm9, r9, 0); - __ pinsrd(xmm5, rax, 1); + __ pinsrd(xmm5, Operand(rax, 4), 1); + + __ cmpps(xmm5, xmm1, 1); + __ cmpps(xmm5, Operand(rbx, rcx, times_4, 10000), 1); + __ cmpeqps(xmm5, xmm1); + __ cmpeqps(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpltps(xmm5, xmm1); + __ cmpltps(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpleps(xmm5, xmm1); + __ cmpleps(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpneqps(xmm5, xmm1); + __ cmpneqps(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpnltps(xmm5, xmm1); + __ cmpnltps(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpnleps(xmm5, xmm1); + __ cmpnleps(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmppd(xmm5, xmm1, 1); + __ cmppd(xmm5, Operand(rbx, rcx, times_4, 10000), 1); + __ cmpeqpd(xmm5, xmm1); + __ cmpeqpd(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpltpd(xmm5, xmm1); + __ cmpltpd(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmplepd(xmm5, xmm1); + __ cmplepd(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpneqpd(xmm5, xmm1); + __ cmpneqpd(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpnltpd(xmm5, xmm1); + __ cmpnltpd(xmm5, Operand(rbx, rcx, times_4, 10000)); + __ cmpnlepd(xmm5, xmm1); + __ cmpnlepd(xmm5, Operand(rbx, rcx, times_4, 10000)); + + __ minps(xmm5, xmm1); + __ minps(xmm5, Operand(rdx, 4)); + __ maxps(xmm5, xmm1); + __ maxps(xmm5, Operand(rdx, 4)); + __ rcpps(xmm5, xmm1); + __ rcpps(xmm5, Operand(rdx, 4)); + __ sqrtps(xmm5, xmm1); + __ sqrtps(xmm5, Operand(rdx, 4)); + __ movups(xmm5, xmm1); + __ movups(xmm5, Operand(rdx, 4)); + __ movups(Operand(rdx, 4), xmm5); + __ paddd(xmm5, xmm1); + __ paddd(xmm5, Operand(rdx, 4)); + __ psubd(xmm5, xmm1); + __ psubd(xmm5, Operand(rdx, 4)); + __ pmulld(xmm5, xmm1); + __ pmulld(xmm5, Operand(rdx, 4)); + __ pmuludq(xmm5, xmm1); + __ pmuludq(xmm5, Operand(rdx, 4)); + __ psrldq(xmm5, 123); + __ pshufd(xmm5, xmm1, 3); + __ cvtps2dq(xmm5, xmm1); + __ cvtps2dq(xmm5, Operand(rdx, 4)); + __ cvtdq2ps(xmm5, xmm1); + __ cvtdq2ps(xmm5, Operand(rdx, 4)); } } @@ -561,8 +625,14 @@ TEST(DisasmX64) { __ vmovaps(xmm10, xmm11); __ vmovapd(xmm7, xmm0); + __ vmovupd(xmm0, Operand(rbx, rcx, times_4, 10000)); + __ vmovupd(Operand(rbx, rcx, times_4, 10000), xmm0); __ vmovmskpd(r9, xmm4); + __ vmovups(xmm5, xmm1); + __ vmovups(xmm5, Operand(rdx, 4)); + __ vmovups(Operand(rdx, 4), xmm5); + __ vandps(xmm0, xmm9, xmm2); __ vandps(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000)); __ vxorps(xmm0, xmm1, xmm9); @@ -579,6 +649,35 @@ TEST(DisasmX64) { __ vpcmpeqd(xmm15, xmm0, Operand(rbx, rcx, times_4, 10000)); __ vpsllq(xmm0, xmm15, 21); __ vpsrlq(xmm15, xmm0, 21); + + __ vcmpps(xmm5, xmm4, xmm1, 1); + __ vcmpps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000), 1); + __ vcmpeqps(xmm5, xmm4, xmm1); + __ vcmpeqps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpltps(xmm5, xmm4, xmm1); + __ vcmpltps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpleps(xmm5, xmm4, xmm1); + __ vcmpleps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpneqps(xmm5, xmm4, xmm1); + __ vcmpneqps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpnltps(xmm5, xmm4, xmm1); + __ vcmpnltps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpnleps(xmm5, xmm4, xmm1); + __ vcmpnleps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmppd(xmm5, xmm4, xmm1, 1); + __ vcmppd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000), 1); + __ vcmpeqpd(xmm5, xmm4, xmm1); + __ vcmpeqpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpltpd(xmm5, xmm4, xmm1); + __ vcmpltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmplepd(xmm5, xmm4, xmm1); + __ vcmplepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpneqpd(xmm5, xmm4, xmm1); + __ vcmpneqpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpnltpd(xmm5, xmm4, xmm1); + __ vcmpnltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + __ vcmpnlepd(xmm5, xmm4, xmm1); + __ vcmpnlepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); } } @@ -745,12 +844,31 @@ TEST(DisasmX64) { // xchg. { + __ xchgb(rax, Operand(rax, 8)); + __ xchgw(rax, Operand(rbx, 8)); __ xchgq(rax, rax); __ xchgq(rax, rbx); __ xchgq(rbx, rbx); __ xchgq(rbx, Operand(rsp, 12)); } + // cmpxchg. + { + __ cmpxchgb(Operand(rsp, 12), rax); + __ cmpxchgw(Operand(rbx, rcx, times_4, 10000), rax); + __ cmpxchgl(Operand(rbx, rcx, times_4, 10000), rax); + __ cmpxchgq(Operand(rbx, rcx, times_4, 10000), rax); + } + + // lock prefix. + { + __ lock(); + __ cmpxchgl(Operand(rsp, 12), rbx); + + __ lock(); + __ xchgw(rax, Operand(rcx, 8)); + } + // Nop instructions for (int i = 0; i < 16; i++) { __ Nop(i); diff --git a/deps/v8/test/cctest/test-disasm-x87.cc b/deps/v8/test/cctest/test-disasm-x87.cc index 697a9d3b49..41f425da3c 100644 --- a/deps/v8/test/cctest/test-disasm-x87.cc +++ b/deps/v8/test/cctest/test-disasm-x87.cc @@ -29,10 +29,10 @@ #include "src/v8.h" +#include "src/code-factory.h" #include "src/debug/debug.h" #include "src/disasm.h" #include "src/disassembler.h" -#include "src/ic/ic.h" #include "src/macro-assembler.h" #include "src/x87/frames-x87.h" #include "test/cctest/cctest.h" @@ -290,7 +290,7 @@ TEST(DisasmIa320) { __ bind(&L2); __ call(Operand(ebx, ecx, times_4, 10000)); __ nop(); - Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_INSIDE_TYPEOF)); + Handle<Code> ic(CodeFactory::LoadIC(isolate).code()); __ call(ic, RelocInfo::CODE_TARGET); __ nop(); __ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY); @@ -395,12 +395,30 @@ TEST(DisasmIa320) { // xchg. { + __ xchg_b(eax, Operand(eax, 8)); + __ xchg_w(eax, Operand(ebx, 8)); __ xchg(eax, eax); __ xchg(eax, ebx); __ xchg(ebx, ebx); __ xchg(ebx, Operand(esp, 12)); } + // cmpxchg. + { + __ cmpxchg_b(Operand(esp, 12), eax); + __ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax); + __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax); + } + + // lock prefix. + { + __ lock(); + __ cmpxchg(Operand(esp, 12), ebx); + + __ lock(); + __ xchg_w(eax, Operand(ecx, 8)); + } + // Nop instructions for (int i = 0; i < 16; i++) { __ Nop(i); diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index c06e5b9124..4322e746e2 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -36,7 +36,7 @@ TEST(VectorStructure) { v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone* zone = isolate->runtime_zone(); + Zone zone(isolate->allocator()); // Empty vectors are the empty fixed array. StaticFeedbackVectorSpec empty; @@ -47,7 +47,7 @@ TEST(VectorStructure) { CHECK(vector->is_empty()); { - FeedbackVectorSpec one_slot(zone); + FeedbackVectorSpec one_slot(&zone); one_slot.AddGeneralSlot(); vector = NewTypeFeedbackVector(isolate, &one_slot); FeedbackVectorHelper helper(vector); @@ -55,7 +55,7 @@ TEST(VectorStructure) { } { - FeedbackVectorSpec one_icslot(zone); + FeedbackVectorSpec one_icslot(&zone); one_icslot.AddCallICSlot(); vector = NewTypeFeedbackVector(isolate, &one_icslot); FeedbackVectorHelper helper(vector); @@ -63,7 +63,7 @@ TEST(VectorStructure) { } { - FeedbackVectorSpec spec(zone); + FeedbackVectorSpec spec(&zone); for (int i = 0; i < 3; i++) { spec.AddGeneralSlot(); } @@ -103,9 +103,9 @@ TEST(VectorICMetadata) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); - Zone* zone = isolate->runtime_zone(); + Zone zone(isolate->allocator()); - FeedbackVectorSpec spec(zone); + FeedbackVectorSpec spec(&zone); // Set metadata. for (int i = 0; i < 40; i++) { switch (i % 4) { @@ -158,12 +158,12 @@ TEST(VectorSlotClearing) { v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone* zone = isolate->runtime_zone(); + Zone zone(isolate->allocator()); // We only test clearing FeedbackVectorSlots, not FeedbackVectorSlots. // The reason is that FeedbackVectorSlots need a full code environment // to fully test (See VectorICProfilerStatistics test below). - FeedbackVectorSpec spec(zone); + FeedbackVectorSpec spec(&zone); for (int i = 0; i < 5; i++) { spec.AddGeneralSlot(); } @@ -208,7 +208,7 @@ TEST(VectorCallICStates) { Handle<JSFunction> f = GetFunction("f"); // There should be one IC. Handle<TypeFeedbackVector> feedback_vector = - Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); FeedbackVectorSlot slot(0); CallICNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); @@ -221,18 +221,82 @@ TEST(VectorCallICStates) { // After a collection, state should remain GENERIC. heap->CollectAllGarbage(); CHECK_EQ(GENERIC, nexus.StateFromFeedback()); +} + +TEST(VectorCallFeedbackForArray) { + if (i::FLAG_always_opt) return; + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + + // Make sure function f has a call that uses a type feedback slot. + CompileRun( + "function foo() { return 17; }" + "function f(a) { a(); } f(Array);"); + Handle<JSFunction> f = GetFunction("f"); + // There should be one IC. + Handle<TypeFeedbackVector> feedback_vector = + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); + FeedbackVectorSlot slot(0); + CallICNexus nexus(feedback_vector, slot); // A call to Array is special, it contains an AllocationSite as feedback. - // Clear the IC manually in order to test this case. - nexus.Clear(f->shared()->code()); - CompileRun("f(Array)"); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); CHECK(nexus.GetFeedback()->IsAllocationSite()); heap->CollectAllGarbage(); + // It should stay monomorphic even after a GC. + CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); +} + +TEST(VectorCallCounts) { + if (i::FLAG_always_opt) return; + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + + // Make sure function f has a call that uses a type feedback slot. + CompileRun( + "function foo() { return 17; }" + "function f(a) { a(); } f(foo);"); + Handle<JSFunction> f = GetFunction("f"); + // There should be one IC. + Handle<TypeFeedbackVector> feedback_vector = + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); + FeedbackVectorSlot slot(0); + CallICNexus nexus(feedback_vector, slot); + CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); + + CompileRun("f(foo); f(foo);"); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); + CHECK_EQ(3, nexus.ExtractCallCount()); } +TEST(VectorConstructCounts) { + if (i::FLAG_always_opt) return; + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + + // Make sure function f has a call that uses a type feedback slot. + CompileRun( + "function Foo() {}" + "function f(a) { new a(); } f(Foo);"); + Handle<JSFunction> f = GetFunction("f"); + Handle<TypeFeedbackVector> feedback_vector = + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); + FeedbackVectorSlot slot(0); + CHECK(feedback_vector->Get(slot)->IsWeakCell()); + + CompileRun("f(Foo); f(Foo);"); + FeedbackVectorSlot cslot(1); + CHECK(feedback_vector->Get(cslot)->IsSmi()); + CHECK_EQ(3, Smi::cast(feedback_vector->Get(cslot))->value()); +} TEST(VectorLoadICStates) { if (i::FLAG_always_opt) return; @@ -249,7 +313,7 @@ TEST(VectorLoadICStates) { Handle<JSFunction> f = GetFunction("f"); // There should be one IC. Handle<TypeFeedbackVector> feedback_vector = - Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); FeedbackVectorSlot slot(0); LoadICNexus nexus(feedback_vector, slot); CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback()); @@ -301,18 +365,18 @@ TEST(VectorLoadICSlotSharing) { CompileRun( "o = 10;" "function f() {" - " var x = o + 10;" - " return o + x + o;" + " var x = o || 10;" + " return o , x , o;" "}" "f();"); Handle<JSFunction> f = GetFunction("f"); // There should be one IC slot. Handle<TypeFeedbackVector> feedback_vector = - Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(1, helper.slot_count()); FeedbackVectorSlot slot(0); - LoadICNexus nexus(feedback_vector, slot); + LoadGlobalICNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); } @@ -332,7 +396,7 @@ TEST(VectorLoadICOnSmi) { Handle<JSFunction> f = GetFunction("f"); // There should be one IC. Handle<TypeFeedbackVector> feedback_vector = - Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); + Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); FeedbackVectorSlot slot(0); LoadICNexus nexus(feedback_vector, slot); CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback()); @@ -397,13 +461,13 @@ TEST(ReferenceContextAllocatesNoSlots) { // There should be two LOAD_ICs, one for a and one for y at the end. Handle<TypeFeedbackVector> feedback_vector = - handle(f->shared()->feedback_vector(), isolate); + 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_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_IC); + CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); } { @@ -416,9 +480,11 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<JSFunction> f = GetFunction("testprop"); // There should be one LOAD_IC, for the load of a. - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + Handle<TypeFeedbackVector> 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); } { @@ -432,12 +498,13 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<JSFunction> f = GetFunction("testpropfunc"); - // There should be 2 LOAD_ICs and 2 CALL_ICs. - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + // There should be 1 LOAD_GLOBAL_IC to load x (in both cases), 2 CALL_ICs + // to call x and a LOAD_IC to load blue. + Handle<TypeFeedbackVector> 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_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); @@ -453,12 +520,12 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<JSFunction> f = GetFunction("testkeyedprop"); - // There should be 1 LOAD_ICs for the load of a, and one KEYED_LOAD_IC for - // the load of x[0] in the return statement. - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + // 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<TypeFeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(3, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_IC); + 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); } @@ -473,16 +540,19 @@ TEST(ReferenceContextAllocatesNoSlots) { Handle<JSFunction> f = GetFunction("testcompound"); - // There should be 3 LOAD_ICs, for load of a and load of x.old and x.young. - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + // There should be 1 LOAD_GLOBAL_IC for load of a and 2 LOAD_ICs, for load + // of x.old and x.young. + Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); - CHECK_EQ(6, helper.slot_count()); - CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_IC); + 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); + // Binary operation feedback is a general slot. + CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::GENERAL); } } @@ -504,7 +574,7 @@ TEST(VectorStoreICBasic) { "f(a);"); Handle<JSFunction> f = GetFunction("f"); // There should be one IC slot. - Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); + Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); FeedbackVectorHelper helper(feedback_vector); CHECK_EQ(1, helper.slot_count()); FeedbackVectorSlot slot(0); diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index c7c6f84423..d2f44ce1be 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -10,12 +10,14 @@ #include "src/v8.h" #include "src/compilation-cache.h" +#include "src/compiler.h" #include "src/execution.h" #include "src/factory.h" #include "src/field-type.h" #include "src/global-handles.h" #include "src/ic/stub-cache.h" #include "src/macro-assembler.h" +#include "src/types.h" using namespace v8::internal; @@ -388,16 +390,16 @@ class Expectations { Handle<String> name = MakeName("prop", property_index); - CHECK(!getter->IsNull() || !setter->IsNull()); + CHECK(!getter->IsNull(isolate_) || !setter->IsNull(isolate_)); Factory* factory = isolate_->factory(); - if (!getter->IsNull()) { + if (!getter->IsNull(isolate_)) { Handle<AccessorPair> pair = factory->NewAccessorPair(); pair->SetComponents(*getter, *factory->null_value()); AccessorConstantDescriptor new_desc(name, pair, attributes); map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION); } - if (!setter->IsNull()) { + if (!setter->IsNull(isolate_)) { Handle<AccessorPair> pair = factory->NewAccessorPair(); pair->SetComponents(*getter, *setter); AccessorConstantDescriptor new_desc(name, pair, attributes); @@ -421,15 +423,8 @@ class Expectations { int descriptor = map->instance_descriptors()->SearchWithCache(isolate, *name, *map); - map = Map::TransitionToAccessorProperty( - map, name, descriptor, ACCESSOR_GETTER, getter, attributes); - CHECK(!map->is_deprecated()); - CHECK(!map->is_dictionary_map()); - - descriptor = - map->instance_descriptors()->SearchWithCache(isolate, *name, *map); - map = Map::TransitionToAccessorProperty( - map, name, descriptor, ACCESSOR_SETTER, setter, attributes); + map = Map::TransitionToAccessorProperty(isolate, map, name, descriptor, + getter, setter, attributes); CHECK(!map->is_deprecated()); CHECK(!map->is_dictionary_map()); return map; @@ -493,7 +488,7 @@ TEST(ReconfigureAccessorToNonExistingDataField) { Handle<JSObject> obj = factory->NewJSObjectFromMap(map); JSObject::MigrateToMap(obj, prepared_map); FieldIndex index = FieldIndex::ForDescriptor(*prepared_map, 0); - CHECK(obj->RawFastPropertyAt(index)->IsUninitialized()); + CHECK(obj->RawFastPropertyAt(index)->IsUninitialized(isolate)); #ifdef VERIFY_HEAP obj->ObjectVerify(); #endif @@ -609,7 +604,7 @@ static void TestGeneralizeRepresentation( // Create new maps by generalizing representation of propX field. Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); - CompilationInfo info("testing", isolate, &zone); + CompilationInfo info(ArrayVector("testing"), isolate, &zone); CHECK(!info.dependencies()->HasAborted()); info.dependencies()->AssumeFieldType(field_owner); @@ -651,7 +646,7 @@ static void TestGeneralizeRepresentation( Map* tmp = *new_map; while (true) { Object* back = tmp->GetBackPointer(); - if (back->IsUndefined()) break; + if (back->IsUndefined(isolate)) break; tmp = Map::cast(back); CHECK(!tmp->is_stable()); } @@ -988,7 +983,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); - CompilationInfo info("testing", isolate, &zone); + CompilationInfo info(ArrayVector("testing"), isolate, &zone); CHECK(!info.dependencies()->HasAborted()); info.dependencies()->AssumeFieldType(field_owner); @@ -1073,7 +1068,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); - CompilationInfo info("testing", isolate, &zone); + CompilationInfo info(ArrayVector("testing"), isolate, &zone); CHECK(!info.dependencies()->HasAborted()); info.dependencies()->AssumeFieldType(field_owner); @@ -1249,7 +1244,7 @@ struct CheckCopyGeneralizeAllRepresentations { CHECK(!map->is_deprecated()); CHECK_NE(*map, *new_map); - CHECK(new_map->GetBackPointer()->IsUndefined()); + CHECK(new_map->GetBackPointer()->IsUndefined(map->GetIsolate())); for (int i = 0; i < kPropCount; i++) { expectations.GeneralizeRepresentation(i); } @@ -1604,7 +1599,7 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); - CompilationInfo info("testing", isolate, &zone); + CompilationInfo info(ArrayVector("testing"), isolate, &zone); CHECK(!info.dependencies()->HasAborted()); info.dependencies()->AssumeFieldType(field_owner); @@ -1697,7 +1692,7 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); - CompilationInfo info("testing", isolate, &zone); + CompilationInfo info(ArrayVector("testing"), isolate, &zone); CHECK(!info.dependencies()->HasAborted()); info.dependencies()->AssumeFieldType(field_owner); @@ -1880,7 +1875,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { // Try to update |map|, since there is no place for propX transition at |map2| // |map| should become "copy-generalized". Handle<Map> updated_map = Map::Update(map); - CHECK(updated_map->GetBackPointer()->IsUndefined()); + CHECK(updated_map->GetBackPointer()->IsUndefined(isolate)); for (int i = 0; i < kPropCount; i++) { expectations.SetDataField(i, Representation::Tagged(), any_type); @@ -1980,10 +1975,10 @@ static void TestGeneralizeRepresentationWithSpecialTransition( for (int i = 0; i < kPropCount; i++) { expectations2.GeneralizeRepresentation(i); } - CHECK(new_map2->GetBackPointer()->IsUndefined()); + CHECK(new_map2->GetBackPointer()->IsUndefined(isolate)); CHECK(expectations2.Check(*new_map2)); } else { - CHECK(!new_map2->GetBackPointer()->IsUndefined()); + CHECK(!new_map2->GetBackPointer()->IsUndefined(isolate)); CHECK(expectations2.Check(*new_map2)); } } @@ -2064,63 +2059,6 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) { } -TEST(ForObservedTransitionFromMapOwningDescriptor) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Handle<FieldType> any_type = FieldType::Any(isolate); - Handle<FieldType> value_type = - FieldType::Class(Map::Create(isolate, 0), isolate); - - struct TestConfig { - Handle<Map> Transition(Handle<Map> map, Expectations& expectations) { - return Map::CopyForObserved(map); - } - // TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed. - bool generalizes_representations() const { return false; } - bool is_non_equevalent_transition() const { return true; } - }; - TestConfig config; - TestGeneralizeRepresentationWithSpecialTransition( - config, Representation::Smi(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); -} - - -TEST(ForObservedTransitionFromMapNotOwningDescriptor) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Handle<FieldType> any_type = FieldType::Any(isolate); - Handle<FieldType> value_type = - FieldType::Class(Map::Create(isolate, 0), isolate); - - struct TestConfig { - Handle<Map> Transition(Handle<Map> map, Expectations& expectations) { - Isolate* isolate = CcTest::i_isolate(); - Handle<FieldType> any_type = FieldType::Any(isolate); - - // Add one more transition to |map| in order to prevent descriptors - // ownership. - CHECK(map->owns_descriptors()); - Map::CopyWithField(map, MakeString("foo"), any_type, NONE, - Representation::Smi(), INSERT_TRANSITION) - .ToHandleChecked(); - CHECK(!map->owns_descriptors()); - - return Map::CopyForObserved(map); - } - // TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed. - bool generalizes_representations() const { return false; } - bool is_non_equevalent_transition() const { return true; } - }; - TestConfig config; - TestGeneralizeRepresentationWithSpecialTransition( - config, Representation::Smi(), any_type, Representation::HeapObject(), - value_type, Representation::Tagged(), any_type); -} - - TEST(PrototypeTransitionFromMapOwningDescriptor) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -2473,6 +2411,16 @@ TEST(TransitionAccessorConstantToSameAccessorConstant) { TestTransitionTo(transition_op, transition_op, checker); } +TEST(FieldTypeConvertSimple) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Isolate* isolate = CcTest::i_isolate(); + + Zone zone(isolate->allocator()); + + CHECK_EQ(FieldType::Any()->Convert(&zone), Type::NonInternal()); + CHECK_EQ(FieldType::None()->Convert(&zone), Type::None()); +} // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. // TEST(TransitionAccessorConstantToAnotherAccessorConstant) diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc index 77ba2f2243..4b16c031d9 100644 --- a/deps/v8/test/cctest/test-func-name-inference.cc +++ b/deps/v8/test/cctest/test-func-name-inference.cc @@ -25,6 +25,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include <memory> #include "src/v8.h" @@ -34,7 +35,6 @@ #include "test/cctest/cctest.h" -using ::v8::base::SmartArrayPointer; using ::v8::internal::CStrVector; using ::v8::internal::Factory; using ::v8::internal::Handle; @@ -85,7 +85,7 @@ static void CheckFunctionName(v8::Local<v8::Script> script, isolate->debug()->FindSharedFunctionInfoInScript(i_script, func_pos)); // Verify inferred function name. - SmartArrayPointer<char> inferred_name = + std::unique_ptr<char[]> inferred_name = shared_func_info->inferred_name()->ToCString(); i::PrintF("expected: %s, found: %s\n", ref_inferred_name, inferred_name.get()); @@ -287,7 +287,8 @@ TEST(MultipleFuncsConditional) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Script> script = Compile(CcTest::isolate(), - "fun1 = 0 ?\n" + "var x = 0;\n" + "fun1 = x ?\n" " function() { return 1; } :\n" " function() { return 2; }"); CheckFunctionName(script, "return 1", "fun1"); @@ -301,9 +302,10 @@ TEST(MultipleFuncsInLiteral) { v8::Local<v8::Script> script = Compile(CcTest::isolate(), + "var x = 0;\n" "function MyClass() {}\n" "MyClass.prototype = {\n" - " method1: 0 ? function() { return 1; } :\n" + " method1: x ? function() { return 1; } :\n" " function() { return 2; } }"); CheckFunctionName(script, "return 1", "MyClass.method1"); CheckFunctionName(script, "return 2", "MyClass.method1"); diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc index 22fd785566..06e7466dc6 100644 --- a/deps/v8/test/cctest/test-global-handles.cc +++ b/deps/v8/test/cctest/test-global-handles.cc @@ -417,3 +417,55 @@ TEST(WeakPersistentSmi) { // Should not crash. g.SetWeak<void>(nullptr, &WeakCallback, v8::WeakCallbackType::kParameter); } + +void finalizer(const v8::WeakCallbackInfo<v8::Global<v8::Object>>& data) { + data.GetParameter()->ClearWeak(); + v8::Local<v8::Object> o = + v8::Local<v8::Object>::New(data.GetIsolate(), *data.GetParameter()); + o->Set(data.GetIsolate()->GetCurrentContext(), v8_str("finalizer"), + v8_str("was here")) + .FromJust(); +} + +TEST(FinalizerWeakness) { + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + + v8::Global<v8::Object> g; + int identity; + + { + v8::HandleScope scope(isolate); + v8::Local<v8::Object> o = v8::Object::New(isolate); + identity = o->GetIdentityHash(); + g.Reset(isolate, o); + g.SetWeak(&g, finalizer, v8::WeakCallbackType::kFinalizer); + } + + CcTest::i_isolate()->heap()->CollectAllAvailableGarbage(); + + CHECK(!g.IsEmpty()); + v8::HandleScope scope(isolate); + v8::Local<v8::Object> o = v8::Local<v8::Object>::New(isolate, g); + CHECK_EQ(identity, o->GetIdentityHash()); + CHECK(o->Has(isolate->GetCurrentContext(), v8_str("finalizer")).FromJust()); +} + +TEST(PhatomHandlesWithoutCallbacks) { + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + + v8::Global<v8::Object> g1, g2; + { + v8::HandleScope scope(isolate); + g1.Reset(isolate, v8::Object::New(isolate)); + g1.SetWeak(); + g2.Reset(isolate, v8::Object::New(isolate)); + g2.SetWeak(); + } + + CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall()); + CcTest::i_isolate()->heap()->CollectAllAvailableGarbage(); + CHECK_EQ(2, isolate->NumberOfPhantomHandleResetsSinceLastCall()); + CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall()); +} diff --git a/deps/v8/test/cctest/test-hashmap.cc b/deps/v8/test/cctest/test-hashmap.cc index b45d6c7183..2d423b4543 100644 --- a/deps/v8/test/cctest/test-hashmap.cc +++ b/deps/v8/test/cctest/test-hashmap.cc @@ -30,7 +30,7 @@ #include "src/v8.h" #include "test/cctest/cctest.h" -#include "src/hashmap.h" +#include "src/base/hashmap.h" using namespace v8::internal; @@ -48,7 +48,7 @@ class IntSet { void Insert(int x) { CHECK_NE(0, x); // 0 corresponds to (void*)NULL - illegal key value - HashMap::Entry* p = + v8::base::HashMap::Entry* p = map_.LookupOrInsert(reinterpret_cast<void*>(x), hash_(x)); CHECK(p != NULL); // insert is set! CHECK_EQ(reinterpret_cast<void*>(x), p->key); @@ -61,7 +61,8 @@ class IntSet { } bool Present(int x) { - HashMap::Entry* p = map_.Lookup(reinterpret_cast<void*>(x), hash_(x)); + v8::base::HashMap::Entry* p = + map_.Lookup(reinterpret_cast<void*>(x), hash_(x)); if (p != NULL) { CHECK_EQ(reinterpret_cast<void*>(x), p->key); } @@ -74,7 +75,8 @@ class IntSet { uint32_t occupancy() const { uint32_t count = 0; - for (HashMap::Entry* p = map_.Start(); p != NULL; p = map_.Next(p)) { + for (v8::base::HashMap::Entry* p = map_.Start(); p != NULL; + p = map_.Next(p)) { count++; } CHECK_EQ(map_.occupancy(), static_cast<double>(count)); @@ -83,7 +85,7 @@ class IntSet { private: IntKeyHash hash_; - HashMap map_; + v8::base::HashMap map_; }; diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index dfe591148a..b0a2e00202 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -29,12 +29,14 @@ #include <ctype.h> +#include <memory> + #include "src/v8.h" #include "include/v8-profiler.h" +#include "src/base/hashmap.h" #include "src/collector.h" #include "src/debug/debug.h" -#include "src/hashmap.h" #include "src/profiler/allocation-tracker.h" #include "src/profiler/heap-profiler.h" #include "src/profiler/heap-snapshot-generator-inl.h" @@ -43,7 +45,7 @@ using i::AllocationTraceNode; using i::AllocationTraceTree; using i::AllocationTracker; -using i::HashMap; +using i::ArrayVector; using i::Vector; namespace { @@ -65,7 +67,7 @@ class NamedEntriesDetector { } void CheckAllReachables(i::HeapEntry* root) { - i::HashMap visited(AddressesMatch); + v8::base::HashMap visited(AddressesMatch); i::List<i::HeapEntry*> list(10); list.Add(root); CheckEntry(root); @@ -75,7 +77,7 @@ class NamedEntriesDetector { for (int i = 0; i < children.length(); ++i) { if (children[i]->type() == i::HeapGraphEdge::kShortcut) continue; i::HeapEntry* child = children[i]->to(); - i::HashMap::Entry* entry = visited.LookupOrInsert( + v8::base::HashMap::Entry* entry = visited.LookupOrInsert( reinterpret_cast<void*>(child), static_cast<uint32_t>(reinterpret_cast<uintptr_t>(child))); if (entry->value) @@ -143,10 +145,10 @@ static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth = 3) { i::HeapSnapshot* heap_snapshot = const_cast<i::HeapSnapshot*>( reinterpret_cast<const i::HeapSnapshot*>(snapshot)); - i::HashMap visited(AddressesMatch); + v8::base::HashMap visited(AddressesMatch); i::List<i::HeapGraphEdge>& edges = heap_snapshot->edges(); for (int i = 0; i < edges.length(); ++i) { - i::HashMap::Entry* entry = visited.LookupOrInsert( + v8::base::HashMap::Entry* entry = visited.LookupOrInsert( reinterpret_cast<void*>(edges[i].to()), static_cast<uint32_t>(reinterpret_cast<uintptr_t>(edges[i].to()))); uint32_t ref_count = static_cast<uint32_t>( @@ -156,7 +158,7 @@ static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth = 3) { uint32_t unretained_entries_count = 0; i::List<i::HeapEntry>& entries = heap_snapshot->entries(); for (int i = 0; i < entries.length(); ++i) { - i::HashMap::Entry* entry = visited.Lookup( + v8::base::HashMap::Entry* entry = visited.Lookup( reinterpret_cast<void*>(&entries[i]), static_cast<uint32_t>(reinterpret_cast<uintptr_t>(&entries[i]))); if (!entry && entries[i].id() != 1) { @@ -254,13 +256,13 @@ TEST(BoundFunctionInSnapshot) { CHECK_EQ(v8::HeapGraphNode::kArray, bindings->GetType()); CHECK_EQ(1, bindings->GetChildrenCount()); - const v8::HeapGraphNode* bound_this = GetProperty( - f, v8::HeapGraphEdge::kShortcut, "bound_this"); + const v8::HeapGraphNode* bound_this = + GetProperty(f, v8::HeapGraphEdge::kInternal, "bound_this"); CHECK(bound_this); CHECK_EQ(v8::HeapGraphNode::kObject, bound_this->GetType()); - const v8::HeapGraphNode* bound_function = GetProperty( - f, v8::HeapGraphEdge::kShortcut, "bound_function"); + const v8::HeapGraphNode* bound_function = + GetProperty(f, v8::HeapGraphEdge::kInternal, "bound_function"); CHECK(bound_function); CHECK_EQ(v8::HeapGraphNode::kClosure, bound_function->GetType()); @@ -491,6 +493,16 @@ void CheckSimdSnapshot(const char* program, const char* var_name) { 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::heap()->CollectAllGarbage(); + const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot)); const v8::HeapGraphNode* global = GetGlobalObject(snapshot); @@ -659,6 +671,31 @@ TEST(HeapSnapshotCollection) { CHECK_EQ(s->GetId(), map_s->GetId()); } +TEST(HeapSnapshotMap) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); + + CompileRun( + "function Z() { this.foo = {}; }\n" + "z = new Z();\n"); + const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); + CHECK(ValidateSnapshot(snapshot)); + const v8::HeapGraphNode* global = GetGlobalObject(snapshot); + const v8::HeapGraphNode* z = + GetProperty(global, v8::HeapGraphEdge::kProperty, "z"); + CHECK(z); + const v8::HeapGraphNode* map = + GetProperty(z, v8::HeapGraphEdge::kInternal, "map"); + CHECK(map); + CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "map")); + CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "prototype")); + CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "back_pointer")); + CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "descriptors")); + const v8::HeapGraphNode* weak_cell = + GetProperty(map, v8::HeapGraphEdge::kInternal, "weak_cell_cache"); + CHECK(GetProperty(weak_cell, v8::HeapGraphEdge::kWeak, "value")); +} TEST(HeapSnapshotInternalReferences) { v8::Isolate* isolate = CcTest::isolate(); @@ -1830,7 +1867,7 @@ TEST(GetHeapValueForDeletedObject) { static int StringCmp(const char* ref, i::String* act) { - v8::base::SmartArrayPointer<char> s_act = act->ToCString(); + std::unique_ptr<char[]> s_act = act->ToCString(); int result = strcmp(ref, s_act.get()); if (result != 0) fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, s_act.get()); @@ -2513,8 +2550,7 @@ TEST(ArrayGrowLeftTrim) { // Print for better diagnostics in case of failure. tracker->trace_tree()->Print(tracker); - AllocationTraceNode* node = - FindNode(tracker, Vector<const char*>(names, arraysize(names))); + AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); CHECK(node); CHECK_GE(node->allocation_count(), 2u); CHECK_GE(node->allocation_size(), 4u * 5u); @@ -2540,8 +2576,7 @@ TEST(TrackHeapAllocations) { tracker->trace_tree()->Print(tracker); const char* names[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"}; - AllocationTraceNode* node = - FindNode(tracker, Vector<const char*>(names, arraysize(names))); + AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); CHECK(node); CHECK_GE(node->allocation_count(), 100u); CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); @@ -2590,8 +2625,7 @@ TEST(TrackBumpPointerAllocations) { // Print for better diagnostics in case of failure. tracker->trace_tree()->Print(tracker); - AllocationTraceNode* node = - FindNode(tracker, Vector<const char*>(names, arraysize(names))); + AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); CHECK(node); CHECK_GE(node->allocation_count(), 100u); CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); @@ -2616,8 +2650,7 @@ TEST(TrackBumpPointerAllocations) { // Print for better diagnostics in case of failure. tracker->trace_tree()->Print(tracker); - AllocationTraceNode* node = - FindNode(tracker, Vector<const char*>(names, arraysize(names))); + AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); CHECK(node); CHECK_LT(node->allocation_count(), 100u); @@ -2646,8 +2679,7 @@ TEST(TrackV8ApiAllocation) { // Print for better diagnostics in case of failure. tracker->trace_tree()->Print(tracker); - AllocationTraceNode* node = - FindNode(tracker, Vector<const char*>(names, arraysize(names))); + AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); CHECK(node); CHECK_GE(node->allocation_count(), 2u); CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); @@ -2792,7 +2824,7 @@ TEST(WeakContainers) { CHECK_NE(0, count); for (int i = 0; i < count; ++i) { const v8::HeapGraphEdge* prop = dependent_code->GetChild(i); - CHECK_EQ(v8::HeapGraphEdge::kWeak, prop->GetType()); + CHECK_EQ(v8::HeapGraphEdge::kInternal, prop->GetType()); } } @@ -2875,6 +2907,15 @@ static const v8::AllocationProfile::Node* FindAllocationProfileNode( return node; } +static void CheckNoZeroCountNodes(v8::AllocationProfile::Node* node) { + for (auto alloc : node->allocations) { + CHECK_GT(alloc.count, 0u); + } + for (auto child : node->children) { + CheckNoZeroCountNodes(child); + } +} + TEST(SamplingHeapProfiler) { v8::HandleScope scope(v8::Isolate::GetCurrent()); LocalContext env; @@ -2908,13 +2949,12 @@ TEST(SamplingHeapProfiler) { heap_profiler->StartSamplingHeapProfiler(1024); CompileRun(script_source); - v8::base::SmartPointer<v8::AllocationProfile> profile( + std::unique_ptr<v8::AllocationProfile> profile( heap_profiler->GetAllocationProfile()); - CHECK(!profile.is_empty()); + CHECK(profile); const char* names[] = {"", "foo", "bar"}; - auto node_bar = FindAllocationProfileNode( - *profile, Vector<const char*>(names, arraysize(names))); + auto node_bar = FindAllocationProfileNode(*profile, ArrayVector(names)); CHECK(node_bar); // Count the number of allocations we sampled from bar. @@ -2936,13 +2976,12 @@ TEST(SamplingHeapProfiler) { heap_profiler->StartSamplingHeapProfiler(128); CompileRun(script_source); - v8::base::SmartPointer<v8::AllocationProfile> profile( + std::unique_ptr<v8::AllocationProfile> profile( heap_profiler->GetAllocationProfile()); - CHECK(!profile.is_empty()); + CHECK(profile); const char* names[] = {"", "foo", "bar"}; - auto node_bar = FindAllocationProfileNode( - *profile, Vector<const char*>(names, arraysize(names))); + auto node_bar = FindAllocationProfileNode(*profile, ArrayVector(names)); CHECK(node_bar); // Count the number of allocations we sampled from bar. @@ -2971,18 +3010,16 @@ TEST(SamplingHeapProfiler) { heap_profiler->StartSamplingHeapProfiler(64); CompileRun(record_trace_tree_source); - v8::base::SmartPointer<v8::AllocationProfile> profile( + std::unique_ptr<v8::AllocationProfile> profile( heap_profiler->GetAllocationProfile()); - CHECK(!profile.is_empty()); + CHECK(profile); const char* names1[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"}; - auto node1 = FindAllocationProfileNode( - *profile, Vector<const char*>(names1, arraysize(names1))); + auto node1 = FindAllocationProfileNode(*profile, ArrayVector(names1)); CHECK(node1); const char* names2[] = {"", "generateFunctions"}; - auto node2 = FindAllocationProfileNode( - *profile, Vector<const char*>(names2, arraysize(names2))); + auto node2 = FindAllocationProfileNode(*profile, ArrayVector(names2)); CHECK(node2); heap_profiler->StopSamplingHeapProfiler(); @@ -2998,9 +3035,11 @@ TEST(SamplingHeapProfiler) { CcTest::heap()->CollectAllGarbage(); - v8::base::SmartPointer<v8::AllocationProfile> profile( + std::unique_ptr<v8::AllocationProfile> profile( heap_profiler->GetAllocationProfile()); - CHECK(!profile.is_empty()); + CHECK(profile); + + CheckNoZeroCountNodes(profile->GetRootNode()); heap_profiler->StopSamplingHeapProfiler(); } @@ -3019,12 +3058,11 @@ TEST(SamplingHeapProfilerApiAllocation) { for (int i = 0; i < 8 * 1024; ++i) v8::Object::New(env->GetIsolate()); - v8::base::SmartPointer<v8::AllocationProfile> profile( + std::unique_ptr<v8::AllocationProfile> profile( heap_profiler->GetAllocationProfile()); - CHECK(!profile.is_empty()); + CHECK(profile); const char* names[] = {"(V8 API)"}; - auto node = FindAllocationProfileNode( - *profile, Vector<const char*>(names, arraysize(names))); + auto node = FindAllocationProfileNode(*profile, ArrayVector(names)); CHECK(node); heap_profiler->StopSamplingHeapProfiler(); diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc index 004781ab41..9f33d55938 100644 --- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc +++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc @@ -925,15 +925,14 @@ TEST(SubclassErrorBuiltin) { v8::HandleScope scope(CcTest::isolate()); const int first_field = 2; - TestSubclassBuiltin("A1", JS_OBJECT_TYPE, "Error", "'err'", first_field); - TestSubclassBuiltin("A2", JS_OBJECT_TYPE, "EvalError", "'err'", first_field); - TestSubclassBuiltin("A3", JS_OBJECT_TYPE, "RangeError", "'err'", first_field); - TestSubclassBuiltin("A4", JS_OBJECT_TYPE, "ReferenceError", "'err'", + TestSubclassBuiltin("A1", JS_ERROR_TYPE, "Error", "'err'", first_field); + TestSubclassBuiltin("A2", JS_ERROR_TYPE, "EvalError", "'err'", first_field); + TestSubclassBuiltin("A3", JS_ERROR_TYPE, "RangeError", "'err'", first_field); + TestSubclassBuiltin("A4", JS_ERROR_TYPE, "ReferenceError", "'err'", first_field); - TestSubclassBuiltin("A5", JS_OBJECT_TYPE, "SyntaxError", "'err'", - first_field); - TestSubclassBuiltin("A6", JS_OBJECT_TYPE, "TypeError", "'err'", first_field); - TestSubclassBuiltin("A7", JS_OBJECT_TYPE, "URIError", "'err'", first_field); + TestSubclassBuiltin("A5", JS_ERROR_TYPE, "SyntaxError", "'err'", first_field); + TestSubclassBuiltin("A6", JS_ERROR_TYPE, "TypeError", "'err'", first_field); + TestSubclassBuiltin("A7", JS_ERROR_TYPE, "URIError", "'err'", first_field); } @@ -1100,7 +1099,7 @@ TEST(SubclassPromiseBuiltin) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); - const int first_field = 4; + const int first_field = 5; TestSubclassBuiltin("A1", JS_PROMISE_TYPE, "Promise", "function(resolve, reject) { resolve('ok'); }", first_field); diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc index f12ca87fa6..09546e94f3 100644 --- a/deps/v8/test/cctest/test-lockers.cc +++ b/deps/v8/test/cctest/test-lockers.cc @@ -27,11 +27,12 @@ #include <limits.h> +#include <memory> + #include "src/v8.h" #include "src/api.h" #include "src/base/platform/platform.h" -#include "src/base/smart-pointers.h" #include "src/compilation-cache.h" #include "src/execution.h" #include "src/isolate.h" @@ -100,7 +101,7 @@ TEST(KangarooIsolates) { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); - v8::base::SmartPointer<KangarooThread> thread1; + std::unique_ptr<KangarooThread> thread1; { v8::Locker locker(isolate); v8::Isolate::Scope isolate_scope(isolate); @@ -109,7 +110,7 @@ TEST(KangarooIsolates) { v8::Context::Scope context_scope(context); CHECK_EQ(isolate, v8::Isolate::GetCurrent()); CompileRun("function getValue() { return 30; }"); - thread1.Reset(new KangarooThread(isolate, context)); + thread1.reset(new KangarooThread(isolate, context)); } thread1->Start(); thread1->Join(); @@ -465,8 +466,7 @@ class LockAndUnlockDifferentIsolatesThread : public JoinableThread { } virtual void Run() { - v8::base::SmartPointer<LockIsolateAndCalculateFibSharedContextThread> - thread; + std::unique_ptr<LockIsolateAndCalculateFibSharedContextThread> thread; v8::Locker lock1(isolate1_); CHECK(v8::Locker::IsLocked(isolate1_)); CHECK(!v8::Locker::IsLocked(isolate2_)); @@ -478,8 +478,8 @@ class LockAndUnlockDifferentIsolatesThread : public JoinableThread { v8::Context::Scope context_scope(context1); CalcFibAndCheck(context1); } - thread.Reset(new LockIsolateAndCalculateFibSharedContextThread( - isolate1_, context1)); + thread.reset(new LockIsolateAndCalculateFibSharedContextThread(isolate1_, + context1)); } v8::Locker lock2(isolate2_); CHECK(v8::Locker::IsLocked(isolate1_)); diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc index 05d7103685..a4bd2ed0dd 100644 --- a/deps/v8/test/cctest/test-log-stack-tracer.cc +++ b/deps/v8/test/cctest/test-log-stack-tracer.cc @@ -29,14 +29,13 @@ #include <stdlib.h> -#include "src/v8.h" - +#include "include/v8-profiler.h" #include "src/api.h" #include "src/codegen.h" #include "src/disassembler.h" #include "src/isolate.h" #include "src/log.h" -#include "src/profiler/sampler.h" +#include "src/v8.h" #include "src/vm-state-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/trace-extension.h" @@ -46,6 +45,7 @@ using v8::Local; using v8::Object; using v8::Script; using v8::String; +using v8::TickSample; using v8::Value; using v8::internal::byte; @@ -53,18 +53,15 @@ using v8::internal::Address; using v8::internal::Handle; using v8::internal::Isolate; using v8::internal::JSFunction; -using v8::internal::TickSample; - -static bool IsAddressWithinFuncCode(JSFunction* function, Address addr) { +static bool IsAddressWithinFuncCode(JSFunction* function, void* addr) { + Address address = reinterpret_cast<Address>(addr); i::AbstractCode* code = function->abstract_code(); - return code->contains(addr); + return code->contains(address); } - static bool IsAddressWithinFuncCode(v8::Local<v8::Context> context, - const char* func_name, - Address addr) { + const char* func_name, void* addr) { v8::Local<v8::Value> func = context->Global()->Get(context, v8_str(func_name)).ToLocalChecked(); CHECK(func->IsFunction()); @@ -79,7 +76,8 @@ static bool IsAddressWithinFuncCode(v8::Local<v8::Context> context, static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); i::StackFrameIterator frame_iterator(isolate); - CHECK(frame_iterator.frame()->is_exit()); + CHECK(frame_iterator.frame()->is_exit() || + frame_iterator.frame()->is_builtin_exit()); frame_iterator.Advance(); CHECK(frame_iterator.frame()->is_construct()); frame_iterator.Advance(); diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc index 9c7e63bfed..b6bb2569dd 100644 --- a/deps/v8/test/cctest/test-log.cc +++ b/deps/v8/test/cctest/test-log.cc @@ -375,9 +375,8 @@ TEST(LogCallbacks) { ObjMethod1_entry = *FUNCTION_ENTRYPOINT_ADDRESS(ObjMethod1_entry); #endif i::EmbeddedVector<char, 100> ref_data; - i::SNPrintF(ref_data, - "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"", - reinterpret_cast<intptr_t>(ObjMethod1_entry)); + i::SNPrintF(ref_data, "code-creation,Callback,-2,%p,1,\"method1\"", + static_cast<void*>(ObjMethod1_entry)); CHECK(StrNStr(log.start(), ref_data.start(), log.length())); log.Dispose(); @@ -429,8 +428,8 @@ TEST(LogAccessorCallbacks) { #endif EmbeddedVector<char, 100> prop1_getter_record; i::SNPrintF(prop1_getter_record, - "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop1\"", - reinterpret_cast<intptr_t>(Prop1Getter_entry)); + "code-creation,Callback,-2,%p,1,\"get prop1\"", + static_cast<void*>(Prop1Getter_entry)); CHECK(StrNStr(log.start(), prop1_getter_record.start(), log.length())); Address Prop1Setter_entry = reinterpret_cast<Address>(Prop1Setter); @@ -439,8 +438,8 @@ TEST(LogAccessorCallbacks) { #endif EmbeddedVector<char, 100> prop1_setter_record; i::SNPrintF(prop1_setter_record, - "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"set prop1\"", - reinterpret_cast<intptr_t>(Prop1Setter_entry)); + "code-creation,Callback,-2,%p,1,\"set prop1\"", + static_cast<void*>(Prop1Setter_entry)); CHECK(StrNStr(log.start(), prop1_setter_record.start(), log.length())); Address Prop2Getter_entry = reinterpret_cast<Address>(Prop2Getter); @@ -449,8 +448,8 @@ TEST(LogAccessorCallbacks) { #endif EmbeddedVector<char, 100> prop2_getter_record; i::SNPrintF(prop2_getter_record, - "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"", - reinterpret_cast<intptr_t>(Prop2Getter_entry)); + "code-creation,Callback,-2,%p,1,\"get prop2\"", + static_cast<void*>(Prop2Getter_entry)); CHECK(StrNStr(log.start(), prop2_getter_record.start(), log.length())); log.Dispose(); } diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc index 91ee215315..057c370304 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc @@ -60,6 +60,71 @@ static bool all_zeroes(const byte* beg, const byte* end) { return true; } +TEST(BYTESWAP) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope handles(isolate); + + struct T { + int32_t r1; + int32_t r2; + int32_t r3; + int32_t r4; + int32_t r5; + }; + T t; + + MacroAssembler assembler(isolate, NULL, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assembler; + + __ lw(a2, MemOperand(a0, offsetof(T, r1))); + __ nop(); + __ ByteSwapSigned(a2, a2, 4); + __ sw(a2, MemOperand(a0, offsetof(T, r1))); + + __ lw(a2, MemOperand(a0, offsetof(T, r2))); + __ nop(); + __ ByteSwapSigned(a2, a2, 2); + __ sw(a2, MemOperand(a0, offsetof(T, r2))); + + __ lw(a2, MemOperand(a0, offsetof(T, r3))); + __ nop(); + __ ByteSwapSigned(a2, a2, 1); + __ sw(a2, MemOperand(a0, offsetof(T, r3))); + + __ lw(a2, MemOperand(a0, offsetof(T, r4))); + __ nop(); + __ ByteSwapUnsigned(a2, a2, 1); + __ sw(a2, MemOperand(a0, offsetof(T, r4))); + + __ lw(a2, MemOperand(a0, offsetof(T, r5))); + __ nop(); + __ ByteSwapUnsigned(a2, a2, 2); + __ sw(a2, MemOperand(a0, offsetof(T, r5))); + + __ jr(ra); + __ nop(); + + CodeDesc desc; + masm->GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + ::F3 f = FUNCTION_CAST<::F3>(code->entry()); + t.r1 = 0x781A15C3; + t.r2 = 0x2CDE; + t.r3 = 0x9F; + t.r4 = 0x9F; + t.r5 = 0x2CDE; + Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); + USE(dummy); + + CHECK_EQ(static_cast<int32_t>(0xC3151A78), t.r1); + CHECK_EQ(static_cast<int32_t>(0xDE2C0000), t.r2); + CHECK_EQ(static_cast<int32_t>(0x9FFFFFFF), t.r3); + CHECK_EQ(static_cast<int32_t>(0x9F000000), t.r4); + CHECK_EQ(static_cast<int32_t>(0xDE2C0000), t.r5); +} TEST(CopyBytes) { CcTest::InitializeVM(); @@ -390,14 +455,14 @@ TEST(Lsa) { } } -static const std::vector<uint32_t> uint32_test_values() { +static const std::vector<uint32_t> cvt_trunc_uint32_test_values() { static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00ffff00, 0x7fffffff, 0x80000000, 0x80000001, 0x80ffff00, 0x8fffffff, 0xffffffff}; return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); } -static const std::vector<int32_t> int32_test_values() { +static const std::vector<int32_t> cvt_trunc_int32_test_values() { static const int32_t kValues[] = { static_cast<int32_t>(0x00000000), static_cast<int32_t>(0x00000001), static_cast<int32_t>(0x00ffff00), static_cast<int32_t>(0x7fffffff), @@ -408,13 +473,31 @@ static const std::vector<int32_t> int32_test_values() { } // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } -#define FOR_INPUTS(ctype, itype, var) \ - std::vector<ctype> var##_vec = itype##_test_values(); \ +#define FOR_INPUTS(ctype, itype, var, test_vector) \ + std::vector<ctype> var##_vec = test_vector(); \ for (std::vector<ctype>::iterator var = var##_vec.begin(); \ var != var##_vec.end(); ++var) -#define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) -#define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) +#define FOR_INPUTS2(ctype, itype, var, var2, test_vector) \ + std::vector<ctype> var##_vec = test_vector(); \ + std::vector<ctype>::iterator var; \ + std::vector<ctype>::reverse_iterator var2; \ + for (var = var##_vec.begin(), var2 = var##_vec.rbegin(); \ + var != var##_vec.end(); ++var, ++var2) + +#define FOR_ENUM_INPUTS(var, type, test_vector) \ + FOR_INPUTS(enum type, type, var, test_vector) +#define FOR_STRUCT_INPUTS(var, type, test_vector) \ + FOR_INPUTS(struct type, type, var, test_vector) +#define FOR_UINT32_INPUTS(var, test_vector) \ + FOR_INPUTS(uint32_t, uint32, var, test_vector) +#define FOR_INT32_INPUTS(var, test_vector) \ + FOR_INPUTS(int32_t, int32, var, test_vector) +#define FOR_INT32_INPUTS2(var, var2, test_vector) \ + FOR_INPUTS2(int32_t, int32, var, var2, test_vector) + +#define FOR_UINT64_INPUTS(var, test_vector) \ + FOR_INPUTS(uint64_t, uint32, var, test_vector) template <typename RET_TYPE, typename IN_TYPE, typename Func> RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { @@ -445,7 +528,7 @@ RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { TEST(cvt_s_w_Trunc_uw_s) { CcTest::InitializeVM(); - FOR_UINT32_INPUTS(i) { + FOR_UINT32_INPUTS(i, cvt_trunc_uint32_test_values) { uint32_t input = *i; CHECK_EQ(static_cast<float>(input), run_Cvt<uint32_t>(input, [](MacroAssembler* masm) { @@ -457,7 +540,7 @@ TEST(cvt_s_w_Trunc_uw_s) { TEST(cvt_d_w_Trunc_w_d) { CcTest::InitializeVM(); - FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(i, cvt_trunc_int32_test_values) { int32_t input = *i; CHECK_EQ(static_cast<double>(input), run_Cvt<int32_t>(input, [](MacroAssembler* masm) { @@ -467,6 +550,415 @@ TEST(cvt_d_w_Trunc_w_d) { } } +static const std::vector<int32_t> overflow_int32_test_values() { + static const int32_t kValues[] = { + static_cast<int32_t>(0xf0000000), static_cast<int32_t>(0x00000001), + static_cast<int32_t>(0xff000000), static_cast<int32_t>(0x0000f000), + static_cast<int32_t>(0x0f000000), static_cast<int32_t>(0x991234ab), + static_cast<int32_t>(0xb0ffff01), static_cast<int32_t>(0x00006fff), + static_cast<int32_t>(0xffffffff)}; + return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +enum OverflowBranchType { + kAddBranchOverflow, + kSubBranchOverflow, +}; + +struct OverflowRegisterCombination { + Register dst; + Register left; + Register right; + Register scratch; +}; + +static const std::vector<enum OverflowBranchType> overflow_branch_type() { + static const enum OverflowBranchType kValues[] = {kAddBranchOverflow, + kSubBranchOverflow}; + return std::vector<enum OverflowBranchType>(&kValues[0], + &kValues[arraysize(kValues)]); +} + +static const std::vector<struct OverflowRegisterCombination> +overflow_register_combination() { + static const struct OverflowRegisterCombination kValues[] = { + {t0, t1, t2, t3}, {t0, t0, t2, t3}, {t0, t1, t0, t3}, {t0, t1, t1, t3}}; + return std::vector<struct OverflowRegisterCombination>( + &kValues[0], &kValues[arraysize(kValues)]); +} + +template <typename T> +static bool IsAddOverflow(T x, T y) { + DCHECK(std::numeric_limits<T>::is_integer); + T max = std::numeric_limits<T>::max(); + T min = std::numeric_limits<T>::min(); + + return (x > 0 && y > (max - x)) || (x < 0 && y < (min - x)); +} + +template <typename T> +static bool IsSubOverflow(T x, T y) { + DCHECK(std::numeric_limits<T>::is_integer); + T max = std::numeric_limits<T>::max(); + T min = std::numeric_limits<T>::min(); + + return (y > 0 && x < (min + y)) || (y < 0 && x > (max + y)); +} + +template <typename IN_TYPE, typename Func> +static bool runOverflow(IN_TYPE valLeft, IN_TYPE valRight, + Func GenerateOverflowInstructions) { + typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, nullptr, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assm; + + GenerateOverflowInstructions(masm, valLeft, valRight); + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + + int32_t r = + reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + + DCHECK(r == 0 || r == 1); + return r; +} + +TEST(BranchOverflowInt32BothLabelsTrampoline) { + if (!IsMipsArchVariant(kMips32r6)) return; + static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; + + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + } + + Label done; + size_t nr_calls = + kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; + for (size_t i = 0; i < nr_calls; ++i) { + __ BranchShort(&done, eq, a0, Operand(a1)); + } + __ bind(&done); + + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt32BothLabels) { + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + bool res2 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, &no_overflow, rc.scratch); + break; + } + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt32LeftLabel) { + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, + rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, + rc.scratch); + break; + } + __ li(v0, 0); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ bind(&end); + }); + + bool res2 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, NULL, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, NULL, rc.scratch); + break; + } + __ li(v0, 0); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt32RightLabel) { + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, NULL, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, NULL, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + bool res2 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label no_overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + TEST(min_max_nan) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -577,4 +1069,241 @@ TEST(min_max_nan) { } } +template <typename IN_TYPE, typename Func> +bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, + IN_TYPE value, Func GenerateUnalignedInstructionFunc) { + typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, nullptr, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assm; + IN_TYPE res; + + GenerateUnalignedInstructionFunc(masm, in_offset, out_offset); + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + + MemCopy(memory_buffer + in_offset, &value, sizeof(IN_TYPE)); + CALL_GENERATED_CODE(isolate, f, memory_buffer, 0, 0, 0, 0); + MemCopy(&res, memory_buffer + out_offset, sizeof(IN_TYPE)); + + return res == value; +} + +static const std::vector<uint64_t> unsigned_test_values() { + static const uint64_t kValues[] = { + 0x2180f18a06384414, 0x000a714532102277, 0xbc1acccf180649f0, + 0x8000000080008000, 0x0000000000000001, 0xffffffffffffffff, + }; + return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +static const std::vector<int32_t> unsigned_test_offset() { + static const int32_t kValues[] = {// value, offset + -132 * KB, -21 * KB, 0, 19 * KB, 135 * KB}; + return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +static const std::vector<int32_t> unsigned_test_offset_increment() { + static const int32_t kValues[] = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; + return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +TEST(Ulh) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint16_t value = static_cast<uint64_t>(*i & 0xFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulh(v0, MemOperand(a0, in_offset)); + __ Ush(v0, MemOperand(a0, out_offset), v0); + })); + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulh(a0, MemOperand(a0, in_offset)); + __ Ush(a0, MemOperand(t0, out_offset), v0); + })); + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulhu(a0, MemOperand(a0, in_offset)); + __ Ush(a0, MemOperand(t0, out_offset), t1); + })); + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulhu(v0, MemOperand(a0, in_offset)); + __ Ush(v0, MemOperand(a0, out_offset), t1); + })); + } + } + } +} + +TEST(Ulh_bitextension) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint16_t value = static_cast<uint64_t>(*i & 0xFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + Label success, fail, end, different; + __ Ulh(t0, MemOperand(a0, in_offset)); + __ Ulhu(t1, MemOperand(a0, in_offset)); + __ Branch(&different, ne, t0, Operand(t1)); + + // If signed and unsigned values are same, check + // the upper bits to see if they are zero + __ sra(t0, t0, 15); + __ Branch(&success, eq, t0, Operand(zero_reg)); + __ Branch(&fail); + + // If signed and unsigned values are different, + // check that the upper bits are complementary + __ bind(&different); + __ sra(t1, t1, 15); + __ Branch(&fail, ne, t1, Operand(1)); + __ sra(t0, t0, 15); + __ addiu(t0, t0, 1); + __ Branch(&fail, ne, t0, Operand(zero_reg)); + // Fall through to success + + __ bind(&success); + __ Ulh(t0, MemOperand(a0, in_offset)); + __ Ush(t0, MemOperand(a0, out_offset), v0); + __ Branch(&end); + __ bind(&fail); + __ Ush(zero_reg, MemOperand(a0, out_offset), v0); + __ bind(&end); + })); + } + } + } +} + +TEST(Ulw) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint32_t value = static_cast<uint32_t>(*i & 0xFFFFFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulw(v0, MemOperand(a0, in_offset)); + __ Usw(v0, MemOperand(a0, out_offset)); + })); + CHECK_EQ(true, + run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, (uint32_t)value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulw(a0, MemOperand(a0, in_offset)); + __ Usw(a0, MemOperand(t0, out_offset)); + })); + } + } + } +} + +TEST(Ulwc1) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + float value = static_cast<float>(*i & 0xFFFFFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<float>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulwc1(f0, MemOperand(a0, in_offset), t0); + __ Uswc1(f0, MemOperand(a0, out_offset), t0); + })); + } + } + } +} + +TEST(Uldc1) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + double value = static_cast<double>(*i); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<double>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Uldc1(f0, MemOperand(a0, in_offset), t0); + __ Usdc1(f0, MemOperand(a0, out_offset), t0); + })); + } + } + } +} + #undef __ diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc index e251242dee..5f9451027c 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc @@ -61,6 +61,89 @@ static bool all_zeroes(const byte* beg, const byte* end) { return true; } +TEST(BYTESWAP) { + DCHECK(kArchVariant == kMips64r6 || kArchVariant == kMips64r2); + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + struct T { + int64_t r1; + int64_t r2; + int64_t r3; + int64_t r4; + int64_t r5; + int64_t r6; + int64_t r7; + }; + T t; + + MacroAssembler assembler(isolate, NULL, 0, + v8::internal::CodeObjectRequired::kYes); + + MacroAssembler* masm = &assembler; + + __ ld(a4, MemOperand(a0, offsetof(T, r1))); + __ nop(); + __ ByteSwapSigned(a4, a4, 8); + __ sd(a4, MemOperand(a0, offsetof(T, r1))); + + __ ld(a4, MemOperand(a0, offsetof(T, r2))); + __ nop(); + __ ByteSwapSigned(a4, a4, 4); + __ sd(a4, MemOperand(a0, offsetof(T, r2))); + + __ ld(a4, MemOperand(a0, offsetof(T, r3))); + __ nop(); + __ ByteSwapSigned(a4, a4, 2); + __ sd(a4, MemOperand(a0, offsetof(T, r3))); + + __ ld(a4, MemOperand(a0, offsetof(T, r4))); + __ nop(); + __ ByteSwapSigned(a4, a4, 1); + __ sd(a4, MemOperand(a0, offsetof(T, r4))); + + __ ld(a4, MemOperand(a0, offsetof(T, r5))); + __ nop(); + __ ByteSwapUnsigned(a4, a4, 1); + __ sd(a4, MemOperand(a0, offsetof(T, r5))); + + __ ld(a4, MemOperand(a0, offsetof(T, r6))); + __ nop(); + __ ByteSwapUnsigned(a4, a4, 2); + __ sd(a4, MemOperand(a0, offsetof(T, r6))); + + __ ld(a4, MemOperand(a0, offsetof(T, r7))); + __ nop(); + __ ByteSwapUnsigned(a4, a4, 4); + __ sd(a4, MemOperand(a0, offsetof(T, r7))); + + __ jr(ra); + __ nop(); + + CodeDesc desc; + masm->GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + ::F3 f = FUNCTION_CAST<::F3>(code->entry()); + t.r1 = 0x5612FFCD9D327ACC; + t.r2 = 0x781A15C3; + t.r3 = 0xFCDE; + t.r4 = 0x9F; + t.r5 = 0x9F; + t.r6 = 0xFCDE; + t.r7 = 0xC81A15C3; + Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); + USE(dummy); + + CHECK_EQ(static_cast<int64_t>(0xCC7A329DCDFF1256), t.r1); + CHECK_EQ(static_cast<int64_t>(0xC3151A7800000000), t.r2); + CHECK_EQ(static_cast<int64_t>(0xDEFCFFFFFFFFFFFF), t.r3); + CHECK_EQ(static_cast<int64_t>(0x9FFFFFFFFFFFFFFF), t.r4); + CHECK_EQ(static_cast<int64_t>(0x9F00000000000000), t.r5); + CHECK_EQ(static_cast<int64_t>(0xDEFC000000000000), t.r6); + CHECK_EQ(static_cast<int64_t>(0xC3151AC800000000), t.r7); +} TEST(CopyBytes) { CcTest::InitializeVM(); @@ -523,14 +606,14 @@ TEST(Dlsa) { } } -static const std::vector<uint32_t> uint32_test_values() { +static const std::vector<uint32_t> cvt_trunc_uint32_test_values() { static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00ffff00, 0x7fffffff, 0x80000000, 0x80000001, 0x80ffff00, 0x8fffffff, 0xffffffff}; return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); } -static const std::vector<int32_t> int32_test_values() { +static const std::vector<int32_t> cvt_trunc_int32_test_values() { static const int32_t kValues[] = { static_cast<int32_t>(0x00000000), static_cast<int32_t>(0x00000001), static_cast<int32_t>(0x00ffff00), static_cast<int32_t>(0x7fffffff), @@ -540,7 +623,7 @@ static const std::vector<int32_t> int32_test_values() { return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); } -static const std::vector<uint64_t> uint64_test_values() { +static const std::vector<uint64_t> cvt_trunc_uint64_test_values() { static const uint64_t kValues[] = { 0x0000000000000000, 0x0000000000000001, 0x0000ffffffff0000, 0x7fffffffffffffff, 0x8000000000000000, 0x8000000000000001, @@ -548,7 +631,7 @@ static const std::vector<uint64_t> uint64_test_values() { return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); } -static const std::vector<int64_t> int64_test_values() { +static const std::vector<int64_t> cvt_trunc_int64_test_values() { static const int64_t kValues[] = {static_cast<int64_t>(0x0000000000000000), static_cast<int64_t>(0x0000000000000001), static_cast<int64_t>(0x0000ffffffff0000), @@ -562,15 +645,32 @@ static const std::vector<int64_t> int64_test_values() { } // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } -#define FOR_INPUTS(ctype, itype, var) \ - std::vector<ctype> var##_vec = itype##_test_values(); \ +#define FOR_INPUTS(ctype, itype, var, test_vector) \ + std::vector<ctype> var##_vec = test_vector(); \ for (std::vector<ctype>::iterator var = var##_vec.begin(); \ var != var##_vec.end(); ++var) -#define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) -#define FOR_INT64_INPUTS(var) FOR_INPUTS(int64_t, int64, var) -#define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) -#define FOR_UINT64_INPUTS(var) FOR_INPUTS(uint64_t, uint64, var) +#define FOR_INPUTS2(ctype, itype, var, var2, test_vector) \ + std::vector<ctype> var##_vec = test_vector(); \ + std::vector<ctype>::iterator var; \ + std::vector<ctype>::reverse_iterator var2; \ + for (var = var##_vec.begin(), var2 = var##_vec.rbegin(); \ + var != var##_vec.end(); ++var, ++var2) + +#define FOR_ENUM_INPUTS(var, type, test_vector) \ + FOR_INPUTS(enum type, type, var, test_vector) +#define FOR_STRUCT_INPUTS(var, type, test_vector) \ + FOR_INPUTS(struct type, type, var, test_vector) +#define FOR_INT32_INPUTS(var, test_vector) \ + FOR_INPUTS(int32_t, int32, var, test_vector) +#define FOR_INT32_INPUTS2(var, var2, test_vector) \ + FOR_INPUTS2(int32_t, int32, var, var2, test_vector) +#define FOR_INT64_INPUTS(var, test_vector) \ + FOR_INPUTS(int64_t, int64, var, test_vector) +#define FOR_UINT32_INPUTS(var, test_vector) \ + FOR_INPUTS(uint32_t, uint32, var, test_vector) +#define FOR_UINT64_INPUTS(var, test_vector) \ + FOR_INPUTS(uint64_t, uint64, var, test_vector) template <typename RET_TYPE, typename IN_TYPE, typename Func> RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { @@ -600,7 +700,7 @@ RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { TEST(Cvt_s_uw_Trunc_uw_s) { CcTest::InitializeVM(); - FOR_UINT32_INPUTS(i) { + FOR_UINT32_INPUTS(i, cvt_trunc_uint32_test_values) { uint32_t input = *i; CHECK_EQ(static_cast<float>(input), run_Cvt<uint64_t>(input, [](MacroAssembler* masm) { @@ -613,7 +713,7 @@ TEST(Cvt_s_uw_Trunc_uw_s) { TEST(Cvt_s_ul_Trunc_ul_s) { CcTest::InitializeVM(); - FOR_UINT64_INPUTS(i) { + FOR_UINT64_INPUTS(i, cvt_trunc_uint64_test_values) { uint64_t input = *i; CHECK_EQ(static_cast<float>(input), run_Cvt<uint64_t>(input, [](MacroAssembler* masm) { @@ -625,7 +725,7 @@ TEST(Cvt_s_ul_Trunc_ul_s) { TEST(Cvt_d_ul_Trunc_ul_d) { CcTest::InitializeVM(); - FOR_UINT64_INPUTS(i) { + FOR_UINT64_INPUTS(i, cvt_trunc_uint64_test_values) { uint64_t input = *i; CHECK_EQ(static_cast<double>(input), run_Cvt<uint64_t>(input, [](MacroAssembler* masm) { @@ -637,7 +737,7 @@ TEST(Cvt_d_ul_Trunc_ul_d) { TEST(cvt_d_l_Trunc_l_d) { CcTest::InitializeVM(); - FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(i, cvt_trunc_int64_test_values) { int64_t input = *i; CHECK_EQ(static_cast<double>(input), run_Cvt<int64_t>(input, [](MacroAssembler* masm) { @@ -650,7 +750,7 @@ TEST(cvt_d_l_Trunc_l_d) { TEST(cvt_d_l_Trunc_l_ud) { CcTest::InitializeVM(); - FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(i, cvt_trunc_int64_test_values) { int64_t input = *i; uint64_t abs_input = (input < 0) ? -input : input; CHECK_EQ(static_cast<double>(abs_input), @@ -664,7 +764,7 @@ TEST(cvt_d_l_Trunc_l_ud) { TEST(cvt_d_w_Trunc_w_d) { CcTest::InitializeVM(); - FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(i, cvt_trunc_int32_test_values) { int32_t input = *i; CHECK_EQ(static_cast<double>(input), run_Cvt<int64_t>(input, [](MacroAssembler* masm) { @@ -677,6 +777,680 @@ TEST(cvt_d_w_Trunc_w_d) { } } +static const std::vector<int32_t> overflow_int32_test_values() { + static const int32_t kValues[] = { + static_cast<int32_t>(0xf0000000), static_cast<int32_t>(0x00000001), + static_cast<int32_t>(0xff000000), static_cast<int32_t>(0x0000f000), + static_cast<int32_t>(0x0f000000), static_cast<int32_t>(0x991234ab), + static_cast<int32_t>(0xb0ffff01), static_cast<int32_t>(0x00006fff), + static_cast<int32_t>(0xffffffff)}; + return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +static const std::vector<int64_t> overflow_int64_test_values() { + static const int64_t kValues[] = {static_cast<int64_t>(0xf000000000000000), + static_cast<int64_t>(0x0000000000000001), + static_cast<int64_t>(0xff00000000000000), + static_cast<int64_t>(0x0000f00111111110), + static_cast<int64_t>(0x0f00001000000000), + static_cast<int64_t>(0x991234ab12a96731), + static_cast<int64_t>(0xb0ffff0f0f0f0f01), + static_cast<int64_t>(0x00006fffffffffff), + static_cast<int64_t>(0xffffffffffffffff)}; + return std::vector<int64_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +enum OverflowBranchType { + kAddBranchOverflow, + kSubBranchOverflow, +}; + +struct OverflowRegisterCombination { + Register dst; + Register left; + Register right; + Register scratch; +}; + +static const std::vector<enum OverflowBranchType> overflow_branch_type() { + static const enum OverflowBranchType kValues[] = {kAddBranchOverflow, + kSubBranchOverflow}; + return std::vector<enum OverflowBranchType>(&kValues[0], + &kValues[arraysize(kValues)]); +} + +static const std::vector<struct OverflowRegisterCombination> +overflow_register_combination() { + static const struct OverflowRegisterCombination kValues[] = { + {t0, t1, t2, t3}, {t0, t0, t2, t3}, {t0, t1, t0, t3}, {t0, t1, t1, t3}}; + return std::vector<struct OverflowRegisterCombination>( + &kValues[0], &kValues[arraysize(kValues)]); +} + +template <typename T> +static bool IsAddOverflow(T x, T y) { + DCHECK(std::numeric_limits<T>::is_integer); + T max = std::numeric_limits<T>::max(); + T min = std::numeric_limits<T>::min(); + + return (x > 0 && y > (max - x)) || (x < 0 && y < (min - x)); +} + +template <typename T> +static bool IsSubOverflow(T x, T y) { + DCHECK(std::numeric_limits<T>::is_integer); + T max = std::numeric_limits<T>::max(); + T min = std::numeric_limits<T>::min(); + + return (y > 0 && x < (min + y)) || (y < 0 && x > (max + y)); +} + +template <typename IN_TYPE, typename Func> +static bool runOverflow(IN_TYPE valLeft, IN_TYPE valRight, + Func GenerateOverflowInstructions) { + typedef int64_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, nullptr, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assm; + + GenerateOverflowInstructions(masm, valLeft, valRight); + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + + int64_t r = + reinterpret_cast<int64_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + + DCHECK(r == 0 || r == 1); + return r; +} + +TEST(BranchOverflowInt32BothLabelsTrampoline) { + if (kArchVariant != kMips64r6) return; + static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; + + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + } + + Label done; + size_t nr_calls = + kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; + for (size_t i = 0; i < nr_calls; ++i) { + __ BranchShort(&done, eq, a0, Operand(a1)); + } + __ bind(&done); + + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt32BothLabels) { + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + bool res2 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, &no_overflow, rc.scratch); + break; + } + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt32LeftLabel) { + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, + rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, + rc.scratch); + break; + } + __ li(v0, 0); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ bind(&end); + }); + + bool res2 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, NULL, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, NULL, rc.scratch); + break; + } + __ li(v0, 0); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt32RightLabel) { + FOR_INT32_INPUTS(i, overflow_int32_test_values) { + FOR_INT32_INPUTS(j, overflow_int32_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int32_t ii = *i; + int32_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, rc.right, NULL, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, rc.right, NULL, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + bool res2 = runOverflow<int32_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int32_t valLeft, + int32_t valRight) { + Label no_overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ AddBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ SubBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int32_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int32_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt64BothLabels) { + FOR_INT64_INPUTS(i, overflow_int64_test_values) { + FOR_INT64_INPUTS(j, overflow_int64_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int64_t ii = *i; + int64_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int64_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int64_t valLeft, + int64_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ DaddBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ DsubBranchOvf(rc.dst, rc.left, rc.right, &overflow, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + bool res2 = runOverflow<int64_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int64_t valLeft, + int64_t valRight) { + Label overflow, no_overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ DaddBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ DsubBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, &no_overflow, rc.scratch); + break; + } + __ li(v0, 2); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int64_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int64_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int64_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int64_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt64LeftLabel) { + FOR_INT64_INPUTS(i, overflow_int64_test_values) { + FOR_INT64_INPUTS(j, overflow_int64_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int64_t ii = *i; + int64_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int64_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int64_t valLeft, + int64_t valRight) { + Label overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ DaddBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, + rc.scratch); + break; + case kSubBranchOverflow: + __ DsubBranchOvf(rc.dst, rc.left, rc.right, &overflow, NULL, + rc.scratch); + break; + } + __ li(v0, 0); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ bind(&end); + }); + + bool res2 = runOverflow<int64_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int64_t valLeft, + int64_t valRight) { + Label overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ DaddBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, NULL, rc.scratch); + break; + case kSubBranchOverflow: + __ DsubBranchOvf(rc.dst, rc.left, Operand(valRight), + &overflow, NULL, rc.scratch); + break; + } + __ li(v0, 0); + __ Branch(&end); + __ bind(&overflow); + __ li(v0, 1); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int64_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int64_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int64_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int64_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + +TEST(BranchOverflowInt64RightLabel) { + FOR_INT64_INPUTS(i, overflow_int64_test_values) { + FOR_INT64_INPUTS(j, overflow_int64_test_values) { + FOR_ENUM_INPUTS(br, OverflowBranchType, overflow_branch_type) { + FOR_STRUCT_INPUTS(regComb, OverflowRegisterCombination, + overflow_register_combination) { + int64_t ii = *i; + int64_t jj = *j; + enum OverflowBranchType branchType = *br; + struct OverflowRegisterCombination rc = *regComb; + + // If left and right register are same then left and right + // test values must also be same, otherwise we skip the test + if (rc.left.code() == rc.right.code()) { + if (ii != jj) { + continue; + } + } + + bool res1 = runOverflow<int64_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int64_t valLeft, + int64_t valRight) { + Label no_overflow, end; + __ li(rc.left, valLeft); + __ li(rc.right, valRight); + switch (branchType) { + case kAddBranchOverflow: + __ DaddBranchOvf(rc.dst, rc.left, rc.right, NULL, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ DsubBranchOvf(rc.dst, rc.left, rc.right, NULL, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + bool res2 = runOverflow<int64_t>( + ii, jj, [branchType, rc](MacroAssembler* masm, int64_t valLeft, + int64_t valRight) { + Label no_overflow, end; + __ li(rc.left, valLeft); + switch (branchType) { + case kAddBranchOverflow: + __ DaddBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, + &no_overflow, rc.scratch); + break; + case kSubBranchOverflow: + __ DsubBranchOvf(rc.dst, rc.left, Operand(valRight), NULL, + &no_overflow, rc.scratch); + break; + } + __ li(v0, 1); + __ Branch(&end); + __ bind(&no_overflow); + __ li(v0, 0); + __ bind(&end); + }); + + switch (branchType) { + case kAddBranchOverflow: + CHECK_EQ(IsAddOverflow<int64_t>(ii, jj), res1); + CHECK_EQ(IsAddOverflow<int64_t>(ii, jj), res2); + break; + case kSubBranchOverflow: + CHECK_EQ(IsSubOverflow<int64_t>(ii, jj), res1); + CHECK_EQ(IsSubOverflow<int64_t>(ii, jj), res2); + break; + default: + UNREACHABLE(); + } + } + } + } + } +} + TEST(min_max_nan) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -787,4 +1561,344 @@ TEST(min_max_nan) { } } +template <typename IN_TYPE, typename Func> +bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, + IN_TYPE value, Func GenerateUnalignedInstructionFunc) { + typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, nullptr, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assm; + IN_TYPE res; + + GenerateUnalignedInstructionFunc(masm, in_offset, out_offset); + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + + MemCopy(memory_buffer + in_offset, &value, sizeof(IN_TYPE)); + CALL_GENERATED_CODE(isolate, f, memory_buffer, 0, 0, 0, 0); + MemCopy(&res, memory_buffer + out_offset, sizeof(IN_TYPE)); + + return res == value; +} + +static const std::vector<uint64_t> unsigned_test_values() { + static const uint64_t kValues[] = { + 0x2180f18a06384414, 0x000a714532102277, 0xbc1acccf180649f0, + 0x8000000080008000, 0x0000000000000001, 0xffffffffffffffff, + }; + return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +static const std::vector<int32_t> unsigned_test_offset() { + static const int32_t kValues[] = {// value, offset + -132 * KB, -21 * KB, 0, 19 * KB, 135 * KB}; + return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +static const std::vector<int32_t> unsigned_test_offset_increment() { + static const int32_t kValues[] = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; + return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +TEST(Ulh) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint16_t value = static_cast<uint64_t>(*i & 0xFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulh(v0, MemOperand(a0, in_offset)); + __ Ush(v0, MemOperand(a0, out_offset), v0); + })); + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulh(a0, MemOperand(a0, in_offset)); + __ Ush(a0, MemOperand(t0, out_offset), v0); + })); + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulhu(a0, MemOperand(a0, in_offset)); + __ Ush(a0, MemOperand(t0, out_offset), t1); + })); + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulhu(v0, MemOperand(a0, in_offset)); + __ Ush(v0, MemOperand(a0, out_offset), t1); + })); + } + } + } +} + +TEST(Ulh_bitextension) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint16_t value = static_cast<uint64_t>(*i & 0xFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint16_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + Label success, fail, end, different; + __ Ulh(t0, MemOperand(a0, in_offset)); + __ Ulhu(t1, MemOperand(a0, in_offset)); + __ Branch(&different, ne, t0, Operand(t1)); + + // If signed and unsigned values are same, check + // the upper bits to see if they are zero + __ sra(t0, t0, 15); + __ Branch(&success, eq, t0, Operand(zero_reg)); + __ Branch(&fail); + + // If signed and unsigned values are different, + // check that the upper bits are complementary + __ bind(&different); + __ sra(t1, t1, 15); + __ Branch(&fail, ne, t1, Operand(1)); + __ sra(t0, t0, 15); + __ addiu(t0, t0, 1); + __ Branch(&fail, ne, t0, Operand(zero_reg)); + // Fall through to success + + __ bind(&success); + __ Ulh(t0, MemOperand(a0, in_offset)); + __ Ush(t0, MemOperand(a0, out_offset), v0); + __ Branch(&end); + __ bind(&fail); + __ Ush(zero_reg, MemOperand(a0, out_offset), v0); + __ bind(&end); + })); + } + } + } +} + +TEST(Ulw) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint32_t value = static_cast<uint32_t>(*i & 0xFFFFFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulw(v0, MemOperand(a0, in_offset)); + __ Usw(v0, MemOperand(a0, out_offset)); + })); + CHECK_EQ(true, + run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, (uint32_t)value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulw(a0, MemOperand(a0, in_offset)); + __ Usw(a0, MemOperand(t0, out_offset)); + })); + CHECK_EQ(true, run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulwu(v0, MemOperand(a0, in_offset)); + __ Usw(v0, MemOperand(a0, out_offset)); + })); + CHECK_EQ(true, + run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, (uint32_t)value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Ulwu(a0, MemOperand(a0, in_offset)); + __ Usw(a0, MemOperand(t0, out_offset)); + })); + } + } + } +} + +TEST(Ulw_extension) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint32_t value = static_cast<uint32_t>(*i & 0xFFFFFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint32_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + Label success, fail, end, different; + __ Ulw(t0, MemOperand(a0, in_offset)); + __ Ulwu(t1, MemOperand(a0, in_offset)); + __ Branch(&different, ne, t0, Operand(t1)); + + // If signed and unsigned values are same, check + // the upper bits to see if they are zero + __ dsra(t0, t0, 31); + __ Branch(&success, eq, t0, Operand(zero_reg)); + __ Branch(&fail); + + // If signed and unsigned values are different, + // check that the upper bits are complementary + __ bind(&different); + __ dsra(t1, t1, 31); + __ Branch(&fail, ne, t1, Operand(1)); + __ dsra(t0, t0, 31); + __ daddiu(t0, t0, 1); + __ Branch(&fail, ne, t0, Operand(zero_reg)); + // Fall through to success + + __ bind(&success); + __ Ulw(t0, MemOperand(a0, in_offset)); + __ Usw(t0, MemOperand(a0, out_offset)); + __ Branch(&end); + __ bind(&fail); + __ Usw(zero_reg, MemOperand(a0, out_offset)); + __ bind(&end); + })); + } + } + } +} + +TEST(Uld) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + uint64_t value = *i; + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<uint64_t>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Uld(v0, MemOperand(a0, in_offset)); + __ Usd(v0, MemOperand(a0, out_offset)); + })); + CHECK_EQ(true, + run_Unaligned<uint64_t>( + buffer_middle, in_offset, out_offset, (uint32_t)value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ mov(t0, a0); + __ Uld(a0, MemOperand(a0, in_offset)); + __ Usd(a0, MemOperand(t0, out_offset)); + })); + } + } + } +} + +TEST(Ulwc1) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + float value = static_cast<float>(*i & 0xFFFFFFFF); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<float>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Ulwc1(f0, MemOperand(a0, in_offset), t0); + __ Uswc1(f0, MemOperand(a0, out_offset), t0); + })); + } + } + } +} + +TEST(Uldc1) { + CcTest::InitializeVM(); + + static const int kBufferSize = 300 * KB; + char memory_buffer[kBufferSize]; + char* buffer_middle = memory_buffer + (kBufferSize / 2); + + FOR_UINT64_INPUTS(i, unsigned_test_values) { + FOR_INT32_INPUTS2(j1, j2, unsigned_test_offset) { + FOR_INT32_INPUTS2(k1, k2, unsigned_test_offset_increment) { + double value = static_cast<double>(*i); + int32_t in_offset = *j1 + *k1; + int32_t out_offset = *j2 + *k2; + + CHECK_EQ(true, run_Unaligned<double>( + buffer_middle, in_offset, out_offset, value, + [](MacroAssembler* masm, int32_t in_offset, + int32_t out_offset) { + __ Uldc1(f0, MemOperand(a0, in_offset), t0); + __ Usdc1(f0, MemOperand(a0, out_offset), t0); + })); + } + } + } +} + #undef __ diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc index 612f9e88a3..cfdb75d1e8 100644 --- a/deps/v8/test/cctest/test-macro-assembler-x64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc @@ -55,7 +55,10 @@ using i::carry; using i::greater; using i::greater_equal; using i::kIntSize; +using i::kFloatSize; +using i::kDoubleSize; using i::kPointerSize; +using i::kSimd128Size; using i::kSmiTagMask; using i::kSmiValueSize; using i::less_equal; @@ -79,6 +82,22 @@ using i::rdi; using i::rdx; using i::rsi; using i::rsp; +using i::xmm0; +using i::xmm1; +using i::xmm2; +using i::xmm3; +using i::xmm4; +using i::xmm5; +using i::xmm6; +using i::xmm7; +using i::xmm8; +using i::xmm9; +using i::xmm10; +using i::xmm11; +using i::xmm12; +using i::xmm13; +using i::xmm14; +using i::xmm15; using i::times_pointer_size; // Test the x64 assembler by compiling some simple functions into @@ -2728,5 +2747,159 @@ TEST(LoadAndStoreWithRepresentation) { CHECK_EQ(0, result); } +void TestFloat32x4Abs(MacroAssembler* masm, Label* exit, float x, float y, + float z, float w) { + __ subq(rsp, Immediate(kSimd128Size)); + + __ Move(xmm1, x); + __ Movss(Operand(rsp, 0 * kFloatSize), xmm1); + __ Move(xmm2, y); + __ Movss(Operand(rsp, 1 * kFloatSize), xmm2); + __ Move(xmm3, z); + __ Movss(Operand(rsp, 2 * kFloatSize), xmm3); + __ Move(xmm4, w); + __ Movss(Operand(rsp, 3 * kFloatSize), xmm4); + __ Movups(xmm0, Operand(rsp, 0)); + + __ Absps(xmm0); + __ Movups(Operand(rsp, 0), xmm0); + + __ incq(rax); + __ Move(xmm1, fabsf(x)); + __ Ucomiss(xmm1, Operand(rsp, 0 * kFloatSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm2, fabsf(y)); + __ Ucomiss(xmm2, Operand(rsp, 1 * kFloatSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm3, fabsf(z)); + __ Ucomiss(xmm3, Operand(rsp, 2 * kFloatSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm4, fabsf(w)); + __ Ucomiss(xmm4, Operand(rsp, 3 * kFloatSize)); + __ j(not_equal, exit); + + __ addq(rsp, Immediate(kSimd128Size)); +} + +void TestFloat32x4Neg(MacroAssembler* masm, Label* exit, float x, float y, + float z, float w) { + __ subq(rsp, Immediate(kSimd128Size)); + + __ Move(xmm1, x); + __ Movss(Operand(rsp, 0 * kFloatSize), xmm1); + __ Move(xmm2, y); + __ Movss(Operand(rsp, 1 * kFloatSize), xmm2); + __ Move(xmm3, z); + __ Movss(Operand(rsp, 2 * kFloatSize), xmm3); + __ Move(xmm4, w); + __ Movss(Operand(rsp, 3 * kFloatSize), xmm4); + __ Movups(xmm0, Operand(rsp, 0)); + + __ Negps(xmm0); + __ Movups(Operand(rsp, 0), xmm0); + + __ incq(rax); + __ Move(xmm1, -x); + __ Ucomiss(xmm1, Operand(rsp, 0 * kFloatSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm2, -y); + __ Ucomiss(xmm2, Operand(rsp, 1 * kFloatSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm3, -z); + __ Ucomiss(xmm3, Operand(rsp, 2 * kFloatSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm4, -w); + __ Ucomiss(xmm4, Operand(rsp, 3 * kFloatSize)); + __ j(not_equal, exit); + + __ addq(rsp, Immediate(kSimd128Size)); +} + +void TestFloat64x2Abs(MacroAssembler* masm, Label* exit, double x, double y) { + __ subq(rsp, Immediate(kSimd128Size)); + + __ Move(xmm1, x); + __ Movsd(Operand(rsp, 0 * kDoubleSize), xmm1); + __ Move(xmm2, y); + __ Movsd(Operand(rsp, 1 * kDoubleSize), xmm2); + __ Movupd(xmm0, Operand(rsp, 0)); + + __ Abspd(xmm0); + __ Movupd(Operand(rsp, 0), xmm0); + + __ incq(rax); + __ Move(xmm1, fabs(x)); + __ Ucomisd(xmm1, Operand(rsp, 0 * kDoubleSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm2, fabs(y)); + __ Ucomisd(xmm2, Operand(rsp, 1 * kDoubleSize)); + __ j(not_equal, exit); + + __ addq(rsp, Immediate(kSimd128Size)); +} + +void TestFloat64x2Neg(MacroAssembler* masm, Label* exit, double x, double y) { + __ subq(rsp, Immediate(kSimd128Size)); + + __ Move(xmm1, x); + __ Movsd(Operand(rsp, 0 * kDoubleSize), xmm1); + __ Move(xmm2, y); + __ Movsd(Operand(rsp, 1 * kDoubleSize), xmm2); + __ Movupd(xmm0, Operand(rsp, 0)); + + __ Negpd(xmm0); + __ Movupd(Operand(rsp, 0), xmm0); + + __ incq(rax); + __ Move(xmm1, -x); + __ Ucomisd(xmm1, Operand(rsp, 0 * kDoubleSize)); + __ j(not_equal, exit); + __ incq(rax); + __ Move(xmm2, -y); + __ Ucomisd(xmm2, Operand(rsp, 1 * kDoubleSize)); + __ j(not_equal, exit); + + __ addq(rsp, Immediate(kSimd128Size)); +} + +TEST(SIMDMacros) { + // Allocate an executable page of memory. + size_t actual_size; + byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( + Assembler::kMinimalBufferSize * 2, &actual_size, true)); + CHECK(buffer); + Isolate* isolate = CcTest::i_isolate(); + HandleScope handles(isolate); + MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), + v8::internal::CodeObjectRequired::kYes); + + MacroAssembler* masm = &assembler; + EntryCode(masm); + Label exit; + + __ xorq(rax, rax); + TestFloat32x4Abs(masm, &exit, 1.5, -1.5, 0.5, -0.5); + TestFloat32x4Neg(masm, &exit, 1.5, -1.5, 0.5, -0.5); + TestFloat64x2Abs(masm, &exit, 1.75, -1.75); + TestFloat64x2Neg(masm, &exit, 1.75, -1.75); + + __ xorq(rax, rax); // Success. + __ bind(&exit); + ExitCode(masm); + __ ret(0); + + CodeDesc desc; + masm->GetCode(&desc); + // Call the function from C++. + int result = FUNCTION_CAST<F0>(buffer)(); + CHECK_EQ(0, result); +} #undef __ diff --git a/deps/v8/test/cctest/test-microtask-delivery.cc b/deps/v8/test/cctest/test-microtask-delivery.cc deleted file mode 100644 index 3150ab8872..0000000000 --- a/deps/v8/test/cctest/test-microtask-delivery.cc +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2012 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" - -namespace i = v8::internal; - -namespace { -class HarmonyIsolate { - public: - HarmonyIsolate() { - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); - isolate_ = v8::Isolate::New(create_params); - isolate_->Enter(); - } - - ~HarmonyIsolate() { - isolate_->Exit(); - isolate_->Dispose(); - } - - v8::Isolate* GetIsolate() const { return isolate_; } - - private: - v8::Isolate* isolate_; -}; -} // namespace - - -TEST(MicrotaskDeliverySimple) { - i::FLAG_harmony_object_observe = true; - HarmonyIsolate isolate; - v8::HandleScope scope(isolate.GetIsolate()); - LocalContext context(isolate.GetIsolate()); - CompileRun( - "var ordering = [];" - "var resolver = {};" - "function handler(resolve) { resolver.resolve = resolve; }" - "var obj = {};" - "var observeOrders = [1, 4];" - "function observer() {" - "ordering.push(observeOrders.shift());" - "resolver.resolve();" - "}" - "var p = new Promise(handler);" - "p.then(function() {" - "ordering.push(2);" - "}).then(function() {" - "ordering.push(3);" - "obj.id++;" - "return new Promise(handler);" - "}).then(function() {" - "ordering.push(5);" - "}).then(function() {" - "ordering.push(6);" - "});" - "Object.observe(obj, observer);" - "obj.id = 1;"); - CHECK_EQ( - 6, CompileRun("ordering.length")->Int32Value(context.local()).FromJust()); - CHECK_EQ(1, - CompileRun("ordering[0]")->Int32Value(context.local()).FromJust()); - CHECK_EQ(2, - CompileRun("ordering[1]")->Int32Value(context.local()).FromJust()); - CHECK_EQ(3, - CompileRun("ordering[2]")->Int32Value(context.local()).FromJust()); - CHECK_EQ(4, - CompileRun("ordering[3]")->Int32Value(context.local()).FromJust()); - CHECK_EQ(5, - CompileRun("ordering[4]")->Int32Value(context.local()).FromJust()); - CHECK_EQ(6, - CompileRun("ordering[5]")->Int32Value(context.local()).FromJust()); -} - - -TEST(MicrotaskPerIsolateState) { - i::FLAG_harmony_object_observe = true; - HarmonyIsolate isolate; - v8::HandleScope scope(isolate.GetIsolate()); - LocalContext context1(isolate.GetIsolate()); - isolate.GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit); - CompileRun( - "var obj = { calls: 0 };"); - v8::Local<v8::Value> obj = CompileRun("obj"); - { - LocalContext context2(isolate.GetIsolate()); - context2->Global() - ->Set(context2.local(), - v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", - v8::NewStringType::kNormal) - .ToLocalChecked(), - obj) - .FromJust(); - CompileRun( - "var resolver = {};" - "new Promise(function(resolve) {" - "resolver.resolve = resolve;" - "}).then(function() {" - "obj.calls++;" - "});" - "(function() {" - "resolver.resolve();" - "})();"); - } - { - LocalContext context3(isolate.GetIsolate()); - context3->Global() - ->Set(context3.local(), - v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", - v8::NewStringType::kNormal) - .ToLocalChecked(), - obj) - .FromJust(); - CompileRun( - "var foo = { id: 1 };" - "Object.observe(foo, function() {" - "obj.calls++;" - "});" - "foo.id++;"); - } - { - LocalContext context4(isolate.GetIsolate()); - context4->Global() - ->Set(context4.local(), - v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", - v8::NewStringType::kNormal) - .ToLocalChecked(), - obj) - .FromJust(); - isolate.GetIsolate()->RunMicrotasks(); - CHECK_EQ(2, - CompileRun("obj.calls")->Int32Value(context4.local()).FromJust()); - } -} diff --git a/deps/v8/test/cctest/test-object-observe.cc b/deps/v8/test/cctest/test-object-observe.cc deleted file mode 100644 index f17b8c081e..0000000000 --- a/deps/v8/test/cctest/test-object-observe.cc +++ /dev/null @@ -1,1078 +0,0 @@ -// Copyright 2012 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" - -using namespace v8; -namespace i = v8::internal; - -inline int32_t ToInt32(v8::Local<v8::Value> value) { - return value->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()) - .FromJust(); -} - - -TEST(PerIsolateState) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context1(CcTest::isolate()); - - Local<Value> foo = v8_str("foo"); - context1->SetSecurityToken(foo); - - CompileRun( - "var count = 0;" - "var calls = 0;" - "var observer = function(records) { count = records.length; calls++ };" - "var obj = {};" - "Object.observe(obj, observer);"); - Local<Value> observer = CompileRun("observer"); - Local<Value> obj = CompileRun("obj"); - Local<Value> notify_fun1 = CompileRun("(function() { obj.foo = 'bar'; })"); - Local<Value> notify_fun2; - { - LocalContext context2(CcTest::isolate()); - context2->SetSecurityToken(foo); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - obj) - .FromJust(); - notify_fun2 = CompileRun( - "(function() { obj.foo = 'baz'; })"); - } - Local<Value> notify_fun3; - { - LocalContext context3(CcTest::isolate()); - context3->SetSecurityToken(foo); - context3->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - obj) - .FromJust(); - notify_fun3 = CompileRun("(function() { obj.foo = 'bat'; })"); - } - { - LocalContext context4(CcTest::isolate()); - context4->SetSecurityToken(foo); - context4->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("observer"), observer) - .FromJust(); - context4->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("fun1"), - notify_fun1) - .FromJust(); - context4->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("fun2"), - notify_fun2) - .FromJust(); - context4->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("fun3"), - notify_fun3) - .FromJust(); - CompileRun("fun1(); fun2(); fun3(); Object.deliverChangeRecords(observer)"); - } - CHECK_EQ(1, ToInt32(CompileRun("calls"))); - CHECK_EQ(3, ToInt32(CompileRun("count"))); -} - - -TEST(EndOfMicrotaskDelivery) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj = {};" - "var count = 0;" - "var observer = function(records) { count = records.length };" - "Object.observe(obj, observer);" - "obj.foo = 'bar';"); - CHECK_EQ(1, ToInt32(CompileRun("count"))); -} - - -TEST(DeliveryOrdering) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj1 = {};" - "var obj2 = {};" - "var ordering = [];" - "function observer2() { ordering.push(2); };" - "function observer1() { ordering.push(1); };" - "function observer3() { ordering.push(3); };" - "Object.observe(obj1, observer1);" - "Object.observe(obj1, observer2);" - "Object.observe(obj1, observer3);" - "obj1.foo = 'bar';"); - CHECK_EQ(3, ToInt32(CompileRun("ordering.length"))); - CHECK_EQ(1, ToInt32(CompileRun("ordering[0]"))); - CHECK_EQ(2, ToInt32(CompileRun("ordering[1]"))); - CHECK_EQ(3, ToInt32(CompileRun("ordering[2]"))); - CompileRun( - "ordering = [];" - "Object.observe(obj2, observer3);" - "Object.observe(obj2, observer2);" - "Object.observe(obj2, observer1);" - "obj2.foo = 'baz'"); - CHECK_EQ(3, ToInt32(CompileRun("ordering.length"))); - CHECK_EQ(1, ToInt32(CompileRun("ordering[0]"))); - CHECK_EQ(2, ToInt32(CompileRun("ordering[1]"))); - CHECK_EQ(3, ToInt32(CompileRun("ordering[2]"))); -} - - -TEST(DeliveryCallbackThrows) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj = {};" - "var ordering = [];" - "function observer1() { ordering.push(1); };" - "function observer2() { ordering.push(2); };" - "function observer_throws() {" - " ordering.push(0);" - " throw new Error();" - " ordering.push(-1);" - "};" - "Object.observe(obj, observer_throws.bind());" - "Object.observe(obj, observer1);" - "Object.observe(obj, observer_throws.bind());" - "Object.observe(obj, observer2);" - "Object.observe(obj, observer_throws.bind());" - "obj.foo = 'bar';"); - CHECK_EQ(5, ToInt32(CompileRun("ordering.length"))); - CHECK_EQ(0, ToInt32(CompileRun("ordering[0]"))); - CHECK_EQ(1, ToInt32(CompileRun("ordering[1]"))); - CHECK_EQ(0, ToInt32(CompileRun("ordering[2]"))); - CHECK_EQ(2, ToInt32(CompileRun("ordering[3]"))); - CHECK_EQ(0, ToInt32(CompileRun("ordering[4]"))); -} - - -TEST(DeliveryChangesMutationInCallback) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj = {};" - "var ordering = [];" - "function observer1(records) {" - " ordering.push(100 + records.length);" - " records.push(11);" - " records.push(22);" - "};" - "function observer2(records) {" - " ordering.push(200 + records.length);" - " records.push(33);" - " records.push(44);" - "};" - "Object.observe(obj, observer1);" - "Object.observe(obj, observer2);" - "obj.foo = 'bar';"); - CHECK_EQ(2, ToInt32(CompileRun("ordering.length"))); - CHECK_EQ(101, ToInt32(CompileRun("ordering[0]"))); - CHECK_EQ(201, ToInt32(CompileRun("ordering[1]"))); -} - - -TEST(DeliveryOrderingReentrant) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj = {};" - "var reentered = false;" - "var ordering = [];" - "function observer1() { ordering.push(1); };" - "function observer2() {" - " if (!reentered) {" - " obj.foo = 'baz';" - " reentered = true;" - " }" - " ordering.push(2);" - "};" - "function observer3() { ordering.push(3); };" - "Object.observe(obj, observer1);" - "Object.observe(obj, observer2);" - "Object.observe(obj, observer3);" - "obj.foo = 'bar';"); - CHECK_EQ(5, ToInt32(CompileRun("ordering.length"))); - CHECK_EQ(1, ToInt32(CompileRun("ordering[0]"))); - CHECK_EQ(2, ToInt32(CompileRun("ordering[1]"))); - CHECK_EQ(3, ToInt32(CompileRun("ordering[2]"))); - // Note that we re-deliver to observers 1 and 2, while observer3 - // already received the second record during the first round. - CHECK_EQ(1, ToInt32(CompileRun("ordering[3]"))); - CHECK_EQ(2, ToInt32(CompileRun("ordering[1]"))); -} - - -TEST(DeliveryOrderingDeliverChangeRecords) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj = {};" - "var ordering = [];" - "function observer1() { ordering.push(1); if (!obj.b) obj.b = true };" - "function observer2() { ordering.push(2); };" - "Object.observe(obj, observer1);" - "Object.observe(obj, observer2);" - "obj.a = 1;" - "Object.deliverChangeRecords(observer2);"); - CHECK_EQ(4, ToInt32(CompileRun("ordering.length"))); - // First, observer2 is called due to deliverChangeRecords - CHECK_EQ(2, ToInt32(CompileRun("ordering[0]"))); - // Then, observer1 is called when the stack unwinds - CHECK_EQ(1, ToInt32(CompileRun("ordering[1]"))); - // observer1's mutation causes both 1 and 2 to be reactivated, - // with 1 having priority. - CHECK_EQ(1, ToInt32(CompileRun("ordering[2]"))); - CHECK_EQ(2, ToInt32(CompileRun("ordering[3]"))); -} - - -TEST(ObjectHashTableGrowth) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - // Initializing this context sets up initial hash tables. - LocalContext context(CcTest::isolate()); - Local<Value> obj = CompileRun("obj = {};"); - Local<Value> observer = CompileRun( - "var ran = false;" - "(function() { ran = true })"); - { - // As does initializing this context. - LocalContext context2(CcTest::isolate()); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - obj) - .FromJust(); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("observer"), observer) - .FromJust(); - CompileRun( - "var objArr = [];" - // 100 objects should be enough to make the hash table grow - // (and thus relocate). - "for (var i = 0; i < 100; ++i) {" - " objArr.push({});" - " Object.observe(objArr[objArr.length-1], function(){});" - "}" - "Object.observe(obj, observer);"); - } - // obj is now marked "is_observed", but our map has moved. - CompileRun("obj.foo = 'bar'"); - CHECK(CompileRun("ran") - ->BooleanValue(v8::Isolate::GetCurrent()->GetCurrentContext()) - .FromJust()); -} - - -struct RecordExpectation { - Local<Value> object; - const char* type; - const char* name; - Local<Value> old_value; -}; - - -// TODO(adamk): Use this helper elsewhere in this file. -static void ExpectRecords(v8::Isolate* isolate, Local<Value> records, - const RecordExpectation expectations[], int num) { - CHECK(records->IsArray()); - Local<Array> recordArray = records.As<Array>(); - CHECK_EQ(num, static_cast<int>(recordArray->Length())); - for (int i = 0; i < num; ++i) { - Local<Value> record = - recordArray->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), i) - .ToLocalChecked(); - CHECK(record->IsObject()); - Local<Object> recordObj = record.As<Object>(); - Local<Value> value = - recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("object")) - .ToLocalChecked(); - CHECK(expectations[i].object->StrictEquals(value)); - value = recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("type")) - .ToLocalChecked(); - CHECK(v8_str(expectations[i].type) - ->Equals(v8::Isolate::GetCurrent()->GetCurrentContext(), value) - .FromJust()); - if (strcmp("splice", expectations[i].type) != 0) { - Local<Value> name = - recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("name")) - .ToLocalChecked(); - CHECK(v8_str(expectations[i].name) - ->Equals(v8::Isolate::GetCurrent()->GetCurrentContext(), name) - .FromJust()); - if (!expectations[i].old_value.IsEmpty()) { - Local<Value> old_value = - recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("oldValue")) - .ToLocalChecked(); - CHECK(expectations[i] - .old_value->Equals( - v8::Isolate::GetCurrent()->GetCurrentContext(), - old_value) - .FromJust()); - } - } - } -} - -#define EXPECT_RECORDS(records, expectations) \ - ExpectRecords(CcTest::isolate(), records, expectations, \ - arraysize(expectations)) - -TEST(APITestBasicMutation) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* v8_isolate = CcTest::isolate(); - HandleScope scope(v8_isolate); - LocalContext context(v8_isolate); - Local<Object> obj = Local<Object>::Cast( - CompileRun("var records = [];" - "var obj = {};" - "function observer(r) { [].push.apply(records, r); };" - "Object.observe(obj, observer);" - "obj")); - obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("foo"), - Number::New(v8_isolate, 7)) - .FromJust(); - obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), 1, - Number::New(v8_isolate, 2)) - .FromJust(); - // CreateDataProperty should work just as well as Set - obj->CreateDataProperty(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("foo"), Number::New(v8_isolate, 3)) - .FromJust(); - obj->CreateDataProperty(v8::Isolate::GetCurrent()->GetCurrentContext(), 1, - Number::New(v8_isolate, 4)) - .FromJust(); - // Setting an indexed element via the property setting method - obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), - Number::New(v8_isolate, 1), Number::New(v8_isolate, 5)) - .FromJust(); - // Setting with a non-String, non-uint32 key - obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), - Number::New(v8_isolate, 1.1), Number::New(v8_isolate, 6)) - .FromJust(); - obj->Delete(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("foo")) - .FromJust(); - obj->Delete(v8::Isolate::GetCurrent()->GetCurrentContext(), 1).FromJust(); - obj->Delete(v8::Isolate::GetCurrent()->GetCurrentContext(), - Number::New(v8_isolate, 1.1)) - .FromJust(); - - // Force delivery - // TODO(adamk): Should the above set methods trigger delivery themselves? - CompileRun("void 0"); - CHECK_EQ(9, ToInt32(CompileRun("records.length"))); - const RecordExpectation expected_records[] = { - {obj, "add", "foo", Local<Value>()}, - {obj, "add", "1", Local<Value>()}, - // Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler - // bug - // where instead of 1.0, a garbage value would be passed into Number::New. - {obj, "update", "foo", Number::New(v8_isolate, 7)}, - {obj, "update", "1", Number::New(v8_isolate, 2)}, - {obj, "update", "1", Number::New(v8_isolate, 4)}, - {obj, "add", "1.1", Local<Value>()}, - {obj, "delete", "foo", Number::New(v8_isolate, 3)}, - {obj, "delete", "1", Number::New(v8_isolate, 5)}, - {obj, "delete", "1.1", Number::New(v8_isolate, 6)}}; - EXPECT_RECORDS(CompileRun("records"), expected_records); -} - - -TEST(HiddenPrototypeObservation) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* v8_isolate = CcTest::isolate(); - HandleScope scope(v8_isolate); - LocalContext context(v8_isolate); - Local<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate); - tmpl->SetHiddenPrototype(true); - tmpl->InstanceTemplate()->Set(v8_str("foo"), Number::New(v8_isolate, 75)); - Local<Function> function = - tmpl->GetFunction(v8::Isolate::GetCurrent()->GetCurrentContext()) - .ToLocalChecked(); - Local<Object> proto = - function->NewInstance(v8::Isolate::GetCurrent()->GetCurrentContext()) - .ToLocalChecked(); - Local<Object> obj = Object::New(v8_isolate); - obj->SetPrototype(v8::Isolate::GetCurrent()->GetCurrentContext(), proto) - .FromJust(); - context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), obj) - .FromJust(); - context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("proto"), - proto) - .FromJust(); - CompileRun( - "var records;" - "function observer(r) { records = r; };" - "Object.observe(obj, observer);" - "obj.foo = 41;" // triggers a notification - "proto.foo = 42;"); // does not trigger a notification - const RecordExpectation expected_records[] = { - { obj, "update", "foo", Number::New(v8_isolate, 75) } - }; - EXPECT_RECORDS(CompileRun("records"), expected_records); - obj->SetPrototype(v8::Isolate::GetCurrent()->GetCurrentContext(), - Null(v8_isolate)) - .FromJust(); - CompileRun("obj.foo = 43"); - const RecordExpectation expected_records2[] = { - {obj, "add", "foo", Local<Value>()}}; - EXPECT_RECORDS(CompileRun("records"), expected_records2); - obj->SetPrototype(v8::Isolate::GetCurrent()->GetCurrentContext(), proto) - .FromJust(); - CompileRun( - "Object.observe(proto, observer);" - "proto.bar = 1;" - "Object.unobserve(obj, observer);" - "obj.foo = 44;"); - const RecordExpectation expected_records3[] = { - {proto, "add", "bar", Local<Value>()} - // TODO(adamk): The below record should be emitted since proto is observed - // and has been modified. Not clear if this happens in practice. - // { proto, "update", "foo", Number::New(43) } - }; - EXPECT_RECORDS(CompileRun("records"), expected_records3); -} - - -static int NumberOfElements(i::Handle<i::JSWeakMap> map) { - return i::ObjectHashTable::cast(map->table())->NumberOfElements(); -} - - -TEST(ObservationWeakMap) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun( - "var obj = {};" - "Object.observe(obj, function(){});" - "Object.getNotifier(obj);" - "obj = null;"); - i::Isolate* i_isolate = CcTest::i_isolate(); - i::Handle<i::JSObject> observation_state = - i_isolate->factory()->observation_state(); - i::Handle<i::JSWeakMap> callbackInfoMap = i::Handle<i::JSWeakMap>::cast( - i::JSReceiver::GetProperty(i_isolate, observation_state, - "callbackInfoMap") - .ToHandleChecked()); - i::Handle<i::JSWeakMap> objectInfoMap = i::Handle<i::JSWeakMap>::cast( - i::JSReceiver::GetProperty(i_isolate, observation_state, "objectInfoMap") - .ToHandleChecked()); - i::Handle<i::JSWeakMap> notifierObjectInfoMap = i::Handle<i::JSWeakMap>::cast( - i::JSReceiver::GetProperty(i_isolate, observation_state, - "notifierObjectInfoMap") - .ToHandleChecked()); - CHECK_EQ(1, NumberOfElements(callbackInfoMap)); - CHECK_EQ(1, NumberOfElements(objectInfoMap)); - CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap)); - i_isolate->heap()->CollectAllGarbage(); - CHECK_EQ(0, NumberOfElements(callbackInfoMap)); - CHECK_EQ(0, NumberOfElements(objectInfoMap)); - CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap)); -} - - -static int TestObserveSecurity(Local<Context> observer_context, - Local<Context> object_context, - Local<Context> mutation_context) { - Context::Scope observer_scope(observer_context); - CompileRun("var records = null;" - "var observer = function(r) { records = r };"); - Local<Value> observer = CompileRun("observer"); - { - Context::Scope object_scope(object_context); - object_context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("observer"), observer) - .FromJust(); - CompileRun("var obj = {};" - "obj.length = 0;" - "Object.observe(obj, observer," - "['add', 'update', 'delete','reconfigure','splice']" - ");"); - Local<Value> obj = CompileRun("obj"); - { - Context::Scope mutation_scope(mutation_context); - mutation_context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - obj) - .FromJust(); - CompileRun("obj.foo = 'bar';" - "obj.foo = 'baz';" - "delete obj.foo;" - "Object.defineProperty(obj, 'bar', {value: 'bot'});" - "Array.prototype.push.call(obj, 1, 2, 3);" - "Array.prototype.splice.call(obj, 1, 2, 2, 4);" - "Array.prototype.pop.call(obj);" - "Array.prototype.shift.call(obj);"); - } - } - return ToInt32(CompileRun("records ? records.length : 0")); -} - - -TEST(ObserverSecurityAAA) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA = Context::New(isolate); - CHECK_EQ(8, TestObserveSecurity(contextA, contextA, contextA)); -} - - -TEST(ObserverSecurityA1A2A3) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - - v8::Local<Context> contextA1 = Context::New(isolate); - v8::Local<Context> contextA2 = Context::New(isolate); - v8::Local<Context> contextA3 = Context::New(isolate); - - Local<Value> foo = v8_str("foo"); - contextA1->SetSecurityToken(foo); - contextA2->SetSecurityToken(foo); - contextA3->SetSecurityToken(foo); - - CHECK_EQ(8, TestObserveSecurity(contextA1, contextA2, contextA3)); -} - - -TEST(ObserverSecurityAAB) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - CHECK_EQ(0, TestObserveSecurity(contextA, contextA, contextB)); -} - - -TEST(ObserverSecurityA1A2B) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - - v8::Local<Context> contextA1 = Context::New(isolate); - v8::Local<Context> contextA2 = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - - Local<Value> foo = v8_str("foo"); - contextA1->SetSecurityToken(foo); - contextA2->SetSecurityToken(foo); - - CHECK_EQ(0, TestObserveSecurity(contextA1, contextA2, contextB)); -} - - -TEST(ObserverSecurityABA) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - CHECK_EQ(0, TestObserveSecurity(contextA, contextB, contextA)); -} - - -TEST(ObserverSecurityA1BA2) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA1 = Context::New(isolate); - v8::Local<Context> contextA2 = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - - Local<Value> foo = v8_str("foo"); - contextA1->SetSecurityToken(foo); - contextA2->SetSecurityToken(foo); - - CHECK_EQ(0, TestObserveSecurity(contextA1, contextB, contextA2)); -} - - -TEST(ObserverSecurityBAA) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - CHECK_EQ(0, TestObserveSecurity(contextB, contextA, contextA)); -} - - -TEST(ObserverSecurityBA1A2) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA1 = Context::New(isolate); - v8::Local<Context> contextA2 = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - - Local<Value> foo = v8_str("foo"); - contextA1->SetSecurityToken(foo); - contextA2->SetSecurityToken(foo); - - CHECK_EQ(0, TestObserveSecurity(contextB, contextA1, contextA2)); -} - - -TEST(ObserverSecurityNotify) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - v8::Local<Context> contextA = Context::New(isolate); - v8::Local<Context> contextB = Context::New(isolate); - - Context::Scope scopeA(contextA); - CompileRun("var obj = {};" - "var recordsA = null;" - "var observerA = function(r) { recordsA = r };" - "Object.observe(obj, observerA);"); - Local<Value> obj = CompileRun("obj"); - - { - Context::Scope scopeB(contextB); - contextB->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - obj) - .FromJust(); - CompileRun("var recordsB = null;" - "var observerB = function(r) { recordsB = r };" - "Object.observe(obj, observerB);"); - } - - CompileRun("var notifier = Object.getNotifier(obj);" - "notifier.notify({ type: 'update' });"); - CHECK_EQ(1, ToInt32(CompileRun("recordsA ? recordsA.length : 0"))); - - { - Context::Scope scopeB(contextB); - CHECK_EQ(0, ToInt32(CompileRun("recordsB ? recordsB.length : 0"))); - } -} - - -TEST(HiddenPropertiesLeakage) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun("var obj = {};" - "var records = null;" - "var observer = function(r) { records = r };" - "Object.observe(obj, observer);"); - Local<Value> obj = - context->Global() - ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj")) - .ToLocalChecked(); - Local<Object>::Cast(obj) - ->SetPrivate(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8::Private::New(CcTest::isolate(), v8_str("foo")), - Null(CcTest::isolate())) - .FromJust(); - CompileRun(""); // trigger delivery - CHECK(CompileRun("records")->IsNull()); -} - - -TEST(GetNotifierFromOtherContext) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - LocalContext context(CcTest::isolate()); - CompileRun("var obj = {};"); - Local<Value> instance = CompileRun("obj"); - { - LocalContext context2(CcTest::isolate()); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - instance) - .FromJust(); - CHECK(CompileRun("Object.getNotifier(obj)")->IsNull()); - } -} - - -TEST(GetNotifierFromOtherOrigin) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - Local<Value> foo = v8_str("foo"); - Local<Value> bar = v8_str("bar"); - LocalContext context(CcTest::isolate()); - context->SetSecurityToken(foo); - CompileRun("var obj = {};"); - Local<Value> instance = CompileRun("obj"); - { - LocalContext context2(CcTest::isolate()); - context2->SetSecurityToken(bar); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - instance) - .FromJust(); - CHECK(CompileRun("Object.getNotifier(obj)")->IsNull()); - } -} - - -TEST(GetNotifierFromSameOrigin) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - Local<Value> foo = v8_str("foo"); - LocalContext context(CcTest::isolate()); - context->SetSecurityToken(foo); - CompileRun("var obj = {};"); - Local<Value> instance = CompileRun("obj"); - { - LocalContext context2(CcTest::isolate()); - context2->SetSecurityToken(foo); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - instance) - .FromJust(); - CHECK(CompileRun("Object.getNotifier(obj)")->IsObject()); - } -} - - -static int GetGlobalObjectsCount() { - int count = 0; - i::HeapIterator it(CcTest::heap()); - for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) - if (object->IsJSGlobalObject()) { - i::JSGlobalObject* g = i::JSGlobalObject::cast(object); - // Skip dummy global object. - if (i::GlobalDictionary::cast(g->properties())->NumberOfElements() != 0) { - count++; - } - } - // Subtract one to compensate for the code stub context that is always present - return count - 1; -} - - -static void CheckSurvivingGlobalObjectsCount(int expected) { - // We need to collect all garbage twice to be sure that everything - // has been collected. This is because inline caches are cleared in - // the first garbage collection but some of the maps have already - // been marked at that point. Therefore some of the maps are not - // collected until the second garbage collection. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); - int count = GetGlobalObjectsCount(); -#ifdef DEBUG - if (count != expected) CcTest::heap()->TracePathToGlobal(); -#endif - CHECK_EQ(expected, count); -} - - -TEST(DontLeakContextOnObserve) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - Local<Value> foo = v8_str("foo"); - LocalContext context(CcTest::isolate()); - context->SetSecurityToken(foo); - CompileRun("var obj = {};"); - Local<Value> object = CompileRun("obj"); - { - HandleScope scope(CcTest::isolate()); - LocalContext context2(CcTest::isolate()); - context2->SetSecurityToken(foo); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - object) - .FromJust(); - CompileRun("function observer() {};" - "Object.observe(obj, observer, ['foo', 'bar', 'baz']);" - "Object.unobserve(obj, observer);"); - } - - CcTest::isolate()->ContextDisposedNotification(); - CheckSurvivingGlobalObjectsCount(0); -} - - -TEST(DontLeakContextOnGetNotifier) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - Local<Value> foo = v8_str("foo"); - LocalContext context(CcTest::isolate()); - context->SetSecurityToken(foo); - CompileRun("var obj = {};"); - Local<Value> object = CompileRun("obj"); - { - HandleScope scope(CcTest::isolate()); - LocalContext context2(CcTest::isolate()); - context2->SetSecurityToken(foo); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - object) - .FromJust(); - CompileRun("Object.getNotifier(obj);"); - } - - CcTest::isolate()->ContextDisposedNotification(); - CheckSurvivingGlobalObjectsCount(0); -} - - -TEST(DontLeakContextOnNotifierPerformChange) { - i::FLAG_harmony_object_observe = true; - HandleScope scope(CcTest::isolate()); - Local<Value> foo = v8_str("foo"); - LocalContext context(CcTest::isolate()); - context->SetSecurityToken(foo); - CompileRun("var obj = {};"); - Local<Value> object = CompileRun("obj"); - Local<Value> notifier = CompileRun("Object.getNotifier(obj)"); - { - HandleScope scope(CcTest::isolate()); - LocalContext context2(CcTest::isolate()); - context2->SetSecurityToken(foo); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - object) - .FromJust(); - context2->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("notifier"), notifier) - .FromJust(); - CompileRun("var obj2 = {};" - "var notifier2 = Object.getNotifier(obj2);" - "notifier2.performChange.call(" - "notifier, 'foo', function(){})"); - } - - CcTest::isolate()->ContextDisposedNotification(); - CheckSurvivingGlobalObjectsCount(0); -} - - -static void ObserverCallback(const FunctionCallbackInfo<Value>& args) { - *static_cast<int*>(Local<External>::Cast(args.Data())->Value()) = - Local<Array>::Cast(args[0])->Length(); -} - - -TEST(ObjectObserveCallsCppFunction) { - i::FLAG_harmony_object_observe = true; - Isolate* isolate = CcTest::isolate(); - HandleScope scope(isolate); - LocalContext context(isolate); - int numRecordsSent = 0; - Local<Function> observer = - Function::New(CcTest::isolate()->GetCurrentContext(), ObserverCallback, - External::New(isolate, &numRecordsSent)) - .ToLocalChecked(); - context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("observer"), - observer) - .FromJust(); - CompileRun( - "var obj = {};" - "Object.observe(obj, observer);" - "obj.foo = 1;" - "obj.bar = 2;"); - CHECK_EQ(2, numRecordsSent); -} - - -TEST(ObjectObserveCallsFunctionTemplateInstance) { - i::FLAG_harmony_object_observe = true; - Isolate* isolate = CcTest::isolate(); - HandleScope scope(isolate); - LocalContext context(isolate); - int numRecordsSent = 0; - Local<FunctionTemplate> tmpl = FunctionTemplate::New( - isolate, ObserverCallback, External::New(isolate, &numRecordsSent)); - Local<Function> function = - tmpl->GetFunction(v8::Isolate::GetCurrent()->GetCurrentContext()) - .ToLocalChecked(); - context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("observer"), - function) - .FromJust(); - CompileRun( - "var obj = {};" - "Object.observe(obj, observer);" - "obj.foo = 1;" - "obj.bar = 2;"); - CHECK_EQ(2, numRecordsSent); -} - - -static void AccessorGetter(Local<Name> property, - const PropertyCallbackInfo<Value>& info) { - info.GetReturnValue().Set(Integer::New(info.GetIsolate(), 42)); -} - - -static void AccessorSetter(Local<Name> property, Local<Value> value, - const PropertyCallbackInfo<void>& info) { - info.GetReturnValue().SetUndefined(); -} - - -TEST(APIAccessorsShouldNotNotify) { - i::FLAG_harmony_object_observe = true; - Isolate* isolate = CcTest::isolate(); - HandleScope handle_scope(isolate); - LocalContext context(isolate); - Local<Object> object = Object::New(isolate); - object->SetAccessor(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str("accessor"), &AccessorGetter, &AccessorSetter) - .FromJust(); - context->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - object) - .FromJust(); - CompileRun( - "var records = null;" - "Object.observe(obj, function(r) { records = r });" - "obj.accessor = 43;"); - CHECK(CompileRun("records")->IsNull()); - CompileRun("Object.defineProperty(obj, 'accessor', { value: 44 });"); - CHECK(CompileRun("records")->IsNull()); -} - - -namespace { - -int* global_use_counts = NULL; - -void MockUseCounterCallback(v8::Isolate* isolate, - v8::Isolate::UseCounterFeature feature) { - ++global_use_counts[feature]; -} -} - - -TEST(UseCountObjectObserve) { - i::FLAG_harmony_object_observe = true; - i::Isolate* isolate = CcTest::i_isolate(); - i::HandleScope scope(isolate); - LocalContext env; - int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; - global_use_counts = use_counts; - CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); - CompileRun( - "var obj = {};" - "Object.observe(obj, function(){})"); - CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); - CompileRun( - "var obj2 = {};" - "Object.observe(obj2, function(){})"); - // Only counts the first use of observe in a given context. - CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); - { - LocalContext env2; - CompileRun( - "var obj = {};" - "Object.observe(obj, function(){})"); - } - // Counts different contexts separately. - CHECK_EQ(2, use_counts[v8::Isolate::kObjectObserve]); -} - - -TEST(UseCountObjectGetNotifier) { - i::FLAG_harmony_object_observe = true; - i::Isolate* isolate = CcTest::i_isolate(); - i::HandleScope scope(isolate); - LocalContext env; - int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; - global_use_counts = use_counts; - CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); - CompileRun("var obj = {}"); - CompileRun("Object.getNotifier(obj)"); - CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); -} - -static bool NamedAccessCheckAlwaysAllow(Local<v8::Context> accessing_context, - Local<v8::Object> accessed_object, - Local<v8::Value> data) { - return true; -} - - -TEST(DisallowObserveAccessCheckedObject) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - LocalContext env; - v8::Local<v8::ObjectTemplate> object_template = - v8::ObjectTemplate::New(isolate); - object_template->SetAccessCheckCallback(NamedAccessCheckAlwaysAllow); - Local<Object> new_instance = - object_template->NewInstance( - v8::Isolate::GetCurrent()->GetCurrentContext()) - .ToLocalChecked(); - env->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - new_instance) - .FromJust(); - v8::TryCatch try_catch(isolate); - CompileRun("Object.observe(obj, function(){})"); - CHECK(try_catch.HasCaught()); -} - - -TEST(DisallowGetNotifierAccessCheckedObject) { - i::FLAG_harmony_object_observe = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - LocalContext env; - v8::Local<v8::ObjectTemplate> object_template = - v8::ObjectTemplate::New(isolate); - object_template->SetAccessCheckCallback(NamedAccessCheckAlwaysAllow); - Local<Object> new_instance = - object_template->NewInstance( - v8::Isolate::GetCurrent()->GetCurrentContext()) - .ToLocalChecked(); - env->Global() - ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), - new_instance) - .FromJust(); - v8::TryCatch try_catch(isolate); - CompileRun("Object.getNotifier(obj)"); - CHECK(try_catch.HasCaught()); -} diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc new file mode 100644 index 0000000000..e078bfcdb0 --- /dev/null +++ b/deps/v8/test/cctest/test-object.cc @@ -0,0 +1,71 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/v8.h" + +#include "test/cctest/cctest.h" + +using namespace v8::internal; + +static void CheckObject(Isolate* isolate, Handle<Object> obj, + const char* string) { + Object* print_string = *Object::NoSideEffectsToString(isolate, obj); + CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string))); +} + +static void CheckSmi(Isolate* isolate, int value, const char* string) { + Handle<Object> handle(Smi::FromInt(value), isolate); + CheckObject(isolate, handle, string); +} + +static void CheckString(Isolate* isolate, const char* value, + const char* string) { + Handle<String> handle(isolate->factory()->NewStringFromAsciiChecked(value)); + CheckObject(isolate, handle, string); +} + +static void CheckNumber(Isolate* isolate, double value, const char* string) { + Handle<Object> number = isolate->factory()->NewNumber(value); + CHECK(number->IsNumber()); + CheckObject(isolate, number, string); +} + +static void CheckBoolean(Isolate* isolate, bool value, const char* string) { + CheckObject(isolate, value ? isolate->factory()->true_value() + : isolate->factory()->false_value(), + string); +} + +TEST(NoSideEffectsToString) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + + HandleScope scope(isolate); + + CheckString(isolate, "fisk hest", "fisk hest"); + CheckNumber(isolate, 42.3, "42.3"); + CheckSmi(isolate, 42, "42"); + CheckBoolean(isolate, true, "true"); + CheckBoolean(isolate, false, "false"); + CheckBoolean(isolate, false, "false"); + 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)"); + CheckObject(isolate, factory->NewError(isolate->error_function(), + factory->empty_string()), + "Error"); + CheckObject(isolate, factory->NewError( + isolate->error_function(), + factory->NewStringFromAsciiChecked("fisk hest")), + "Error: fisk hest"); + CheckObject(isolate, factory->NewJSObject(isolate->object_function()), + "#<Object>"); +} diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index ae278d8338..658e73ca84 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -29,15 +29,18 @@ #include <stdlib.h> #include <string.h> +#include <memory> + #include "src/v8.h" -#include "src/ast/ast.h" #include "src/ast/ast-numbering.h" #include "src/ast/ast-value-factory.h" +#include "src/ast/ast.h" #include "src/compiler.h" #include "src/execution.h" #include "src/isolate.h" #include "src/objects.h" +#include "src/parsing/parse-info.h" #include "src/parsing/parser.h" #include "src/parsing/preparser.h" #include "src/parsing/rewriter.h" @@ -62,14 +65,13 @@ TEST(ScanKeywords) { KeywordToken key_token; i::UnicodeCache unicode_cache; - i::byte buffer[32]; + char buffer[32]; for (int i = 0; (key_token = keywords[i]).keyword != NULL; i++) { - const i::byte* keyword = - reinterpret_cast<const i::byte*>(key_token.keyword); - int length = i::StrLength(key_token.keyword); + const char* keyword = key_token.keyword; + size_t length = strlen(key_token.keyword); CHECK(static_cast<int>(sizeof(buffer)) >= length); { - i::Utf8ToUtf16CharacterStream stream(keyword, length); + i::ExternalOneByteStringUtf16CharacterStream stream(keyword, length); i::Scanner scanner(&unicode_cache); scanner.Initialize(&stream); CHECK_EQ(key_token.token, scanner.Next()); @@ -77,7 +79,7 @@ TEST(ScanKeywords) { } // Removing characters will make keyword matching fail. { - i::Utf8ToUtf16CharacterStream stream(keyword, length - 1); + i::ExternalOneByteStringUtf16CharacterStream stream(keyword, length - 1); i::Scanner scanner(&unicode_cache); scanner.Initialize(&stream); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); @@ -88,7 +90,7 @@ TEST(ScanKeywords) { for (int j = 0; j < static_cast<int>(arraysize(chars_to_append)); ++j) { i::MemMove(buffer, keyword, length); buffer[length] = chars_to_append[j]; - i::Utf8ToUtf16CharacterStream stream(buffer, length + 1); + i::ExternalOneByteStringUtf16CharacterStream stream(buffer, length + 1); i::Scanner scanner(&unicode_cache); scanner.Initialize(&stream); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); @@ -98,7 +100,7 @@ TEST(ScanKeywords) { { i::MemMove(buffer, keyword, length); buffer[length - 1] = '_'; - i::Utf8ToUtf16CharacterStream stream(buffer, length); + i::ExternalOneByteStringUtf16CharacterStream stream(buffer, length); i::Scanner scanner(&unicode_cache); scanner.Initialize(&stream); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); @@ -120,15 +122,32 @@ TEST(ScanHTMLEndComments) { // whitespace, even a multiline-comment containing a newline). // This was not the case if it occurred before the first real token // in the input. + // clang-format off const char* tests[] = { // Before first real token. + "-->", + "--> is eol-comment", "--> is eol-comment\nvar y = 37;\n", "\n --> is eol-comment\nvar y = 37;\n", + "\n-->is eol-comment\nvar y = 37;\n", + "\n-->\nvar y = 37;\n", "/* precomment */ --> is eol-comment\nvar y = 37;\n", + "/* precomment */-->eol-comment\nvar y = 37;\n", "\n/* precomment */ --> is eol-comment\nvar y = 37;\n", + "\n/*precomment*/-->eol-comment\nvar y = 37;\n", // After first real token. "var x = 42;\n--> is eol-comment\nvar y = 37;\n", "var x = 42;\n/* precomment */ --> is eol-comment\nvar y = 37;\n", + "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n", + "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n", + "var x = 42;/*\n*/-->is eol-comment\nvar y = 37;\n", + // With multiple comments preceding HTMLEndComment + "/* MLC \n */ /* SLDC */ --> is eol-comment\nvar y = 37;\n", + "/* MLC \n */ /* SLDC1 */ /* SLDC2 */ --> is eol-comment\nvar y = 37;\n", + "/* MLC1 \n */ /* MLC2 \n */ --> is eol-comment\nvar y = 37;\n", + "/* SLDC */ /* MLC \n */ --> is eol-comment\nvar y = 37;\n", + "/* MLC1 \n */ /* SLDC1 */ /* MLC2 \n */ /* SLDC2 */ --> is eol-comment\n" + "var y = 37;\n", NULL }; @@ -136,20 +155,18 @@ TEST(ScanHTMLEndComments) { "x --> is eol-comment\nvar y = 37;\n", "\"\\n\" --> is eol-comment\nvar y = 37;\n", "x/* precomment */ --> is eol-comment\nvar y = 37;\n", - "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n", "var x = 42; --> is eol-comment\nvar y = 37;\n", - "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n", NULL }; + // clang-format on // Parser/Scanner needs a stack limit. CcTest::i_isolate()->stack_guard()->SetStackLimit( i::GetCurrentStackPosition() - 128 * 1024); uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; tests[i]; i++) { - const i::byte* source = - reinterpret_cast<const i::byte*>(tests[i]); - i::Utf8ToUtf16CharacterStream stream(source, i::StrLength(tests[i])); + const char* source = tests[i]; + i::ExternalOneByteStringUtf16CharacterStream stream(source); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); @@ -165,9 +182,8 @@ TEST(ScanHTMLEndComments) { } for (int i = 0; fail_tests[i]; i++) { - const i::byte* source = - reinterpret_cast<const i::byte*>(fail_tests[i]); - i::Utf8ToUtf16CharacterStream stream(source, i::StrLength(fail_tests[i])); + const char* source = fail_tests[i]; + i::ExternalOneByteStringUtf16CharacterStream stream(source); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); @@ -325,9 +341,7 @@ TEST(StandAlonePreParser) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { const char* program = programs[i]; - i::Utf8ToUtf16CharacterStream stream( - reinterpret_cast<const i::byte*>(program), - static_cast<unsigned>(strlen(program))); + i::ExternalOneByteStringUtf16CharacterStream stream(program); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); @@ -361,9 +375,7 @@ TEST(StandAlonePreParserNoNatives) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { const char* program = programs[i]; - i::Utf8ToUtf16CharacterStream stream( - reinterpret_cast<const i::byte*>(program), - static_cast<unsigned>(strlen(program))); + i::ExternalOneByteStringUtf16CharacterStream stream(program); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); @@ -432,9 +444,7 @@ TEST(RegressChromium62639) { // and then used the invalid currently scanned literal. This always // failed in debug mode, and sometimes crashed in release mode. - i::Utf8ToUtf16CharacterStream stream( - reinterpret_cast<const i::byte*>(program), - static_cast<unsigned>(strlen(program))); + i::ExternalOneByteStringUtf16CharacterStream stream(program); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); @@ -512,16 +522,14 @@ TEST(PreParseOverflow) { i::GetCurrentStackPosition() - 128 * 1024); size_t kProgramSize = 1024 * 1024; - v8::base::SmartArrayPointer<char> program( - i::NewArray<char>(kProgramSize + 1)); + std::unique_ptr<char[]> program(i::NewArray<char>(kProgramSize + 1)); memset(program.get(), '(', kProgramSize); program[kProgramSize] = '\0'; uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); - i::Utf8ToUtf16CharacterStream stream( - reinterpret_cast<const i::byte*>(program.get()), - static_cast<unsigned>(kProgramSize)); + i::ExternalOneByteStringUtf16CharacterStream stream(program.get(), + kProgramSize); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); @@ -566,7 +574,7 @@ void TestCharacterStream(const char* one_byte_source, unsigned length, i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); i::HandleScope test_scope(isolate); - v8::base::SmartArrayPointer<i::uc16> uc16_buffer(new i::uc16[length]); + std::unique_ptr<i::uc16[]> uc16_buffer(new i::uc16[length]); for (unsigned i = 0; i < length; i++) { uc16_buffer[i] = static_cast<i::uc16>(one_byte_source[i]); } @@ -577,13 +585,20 @@ void TestCharacterStream(const char* one_byte_source, unsigned length, TestExternalResource resource(uc16_buffer.get(), length); i::Handle<i::String> uc16_string( factory->NewExternalStringFromTwoByte(&resource).ToHandleChecked()); + ScriptResource one_byte_resource(one_byte_source, length); + i::Handle<i::String> ext_one_byte_string( + factory->NewExternalStringFromOneByte(&one_byte_resource) + .ToHandleChecked()); i::ExternalTwoByteStringUtf16CharacterStream uc16_stream( i::Handle<i::ExternalTwoByteString>::cast(uc16_string), start, end); + i::ExternalOneByteStringUtf16CharacterStream one_byte_stream( + i::Handle<i::ExternalOneByteString>::cast(ext_one_byte_string), start, + end); i::GenericStringUtf16CharacterStream string_stream(one_byte_string, start, end); - i::Utf8ToUtf16CharacterStream utf8_stream( - reinterpret_cast<const i::byte*>(one_byte_source), end); + i::ExternalOneByteStringUtf16CharacterStream utf8_stream(one_byte_source, + end); utf8_stream.SeekForward(start); unsigned i = start; @@ -592,17 +607,21 @@ void TestCharacterStream(const char* one_byte_source, unsigned length, CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); int32_t c0 = one_byte_source[i]; int32_t c1 = uc16_stream.Advance(); int32_t c2 = string_stream.Advance(); int32_t c3 = utf8_stream.Advance(); + int32_t c4 = one_byte_stream.Advance(); i++; CHECK_EQ(c0, c1); CHECK_EQ(c0, c2); CHECK_EQ(c0, c3); + CHECK_EQ(c0, c4); CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); } while (i > start + sub_length / 4) { // Pushback, re-read, pushback again. @@ -610,66 +629,83 @@ void TestCharacterStream(const char* one_byte_source, unsigned length, CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); uc16_stream.PushBack(c0); string_stream.PushBack(c0); utf8_stream.PushBack(c0); + one_byte_stream.PushBack(c0); i--; CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); int32_t c1 = uc16_stream.Advance(); int32_t c2 = string_stream.Advance(); int32_t c3 = utf8_stream.Advance(); + int32_t c4 = one_byte_stream.Advance(); i++; CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); CHECK_EQ(c0, c1); CHECK_EQ(c0, c2); CHECK_EQ(c0, c3); + CHECK_EQ(c0, c4); uc16_stream.PushBack(c0); string_stream.PushBack(c0); utf8_stream.PushBack(c0); + one_byte_stream.PushBack(c0); i--; CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); } unsigned halfway = start + sub_length / 2; uc16_stream.SeekForward(halfway - i); string_stream.SeekForward(halfway - i); utf8_stream.SeekForward(halfway - i); + one_byte_stream.SeekForward(halfway - i); i = halfway; CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); while (i < end) { // Read streams one char at a time CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); int32_t c0 = one_byte_source[i]; int32_t c1 = uc16_stream.Advance(); int32_t c2 = string_stream.Advance(); int32_t c3 = utf8_stream.Advance(); + int32_t c4 = one_byte_stream.Advance(); i++; CHECK_EQ(c0, c1); CHECK_EQ(c0, c2); CHECK_EQ(c0, c3); + CHECK_EQ(c0, c4); CHECK_EQU(i, uc16_stream.pos()); CHECK_EQU(i, string_stream.pos()); CHECK_EQU(i, utf8_stream.pos()); + CHECK_EQU(i, one_byte_stream.pos()); } int32_t c1 = uc16_stream.Advance(); int32_t c2 = string_stream.Advance(); int32_t c3 = utf8_stream.Advance(); + int32_t c4 = one_byte_stream.Advance(); CHECK_LT(c1, 0); CHECK_LT(c2, 0); CHECK_LT(c3, 0); + CHECK_LT(c4, 0); } +#undef CHECK_EQU TEST(CharacterStreams) { v8::Isolate* isolate = CcTest::isolate(); @@ -692,63 +728,6 @@ TEST(CharacterStreams) { } -TEST(Utf8CharacterStream) { - static const unsigned kMaxUC16CharU = unibrow::Utf8::kMaxThreeByteChar; - static const int kMaxUC16Char = static_cast<int>(kMaxUC16CharU); - - static const int kAllUtf8CharsSize = - (unibrow::Utf8::kMaxOneByteChar + 1) + - (unibrow::Utf8::kMaxTwoByteChar - unibrow::Utf8::kMaxOneByteChar) * 2 + - (unibrow::Utf8::kMaxThreeByteChar - unibrow::Utf8::kMaxTwoByteChar) * 3; - static const unsigned kAllUtf8CharsSizeU = - static_cast<unsigned>(kAllUtf8CharsSize); - - char buffer[kAllUtf8CharsSizeU]; - unsigned cursor = 0; - for (int i = 0; i <= kMaxUC16Char; i++) { - cursor += unibrow::Utf8::Encode(buffer + cursor, i, - unibrow::Utf16::kNoPreviousCharacter, true); - } - CHECK(cursor == kAllUtf8CharsSizeU); - - i::Utf8ToUtf16CharacterStream stream(reinterpret_cast<const i::byte*>(buffer), - kAllUtf8CharsSizeU); - int32_t bad = unibrow::Utf8::kBadChar; - for (int i = 0; i <= kMaxUC16Char; i++) { - CHECK_EQU(i, stream.pos()); - int32_t c = stream.Advance(); - if (i >= 0xd800 && i <= 0xdfff) { - CHECK_EQ(bad, c); - } else { - CHECK_EQ(i, c); - } - CHECK_EQU(i + 1, stream.pos()); - } - for (int i = kMaxUC16Char; i >= 0; i--) { - CHECK_EQU(i + 1, stream.pos()); - stream.PushBack(i); - CHECK_EQU(i, stream.pos()); - } - int i = 0; - while (stream.pos() < kMaxUC16CharU) { - CHECK_EQU(i, stream.pos()); - int progress = static_cast<int>(stream.SeekForward(12)); - i += progress; - int32_t c = stream.Advance(); - if (i >= 0xd800 && i <= 0xdfff) { - CHECK_EQ(bad, c); - } else if (i <= kMaxUC16Char) { - CHECK_EQ(i, c); - } else { - CHECK_EQ(-1, c); - } - i += 1; - CHECK_EQU(i, stream.pos()); - } -} - -#undef CHECK_EQU - void TestStreamScanner(i::Utf16CharacterStream* stream, i::Token::Value* expected_tokens, int skip_pos = 0, // Zero means not skipping. @@ -773,8 +752,7 @@ TEST(StreamScanner) { v8::V8::Initialize(); const char* str1 = "{ foo get for : */ <- \n\n /*foo*/ bib"; - i::Utf8ToUtf16CharacterStream stream1(reinterpret_cast<const i::byte*>(str1), - static_cast<unsigned>(strlen(str1))); + i::ExternalOneByteStringUtf16CharacterStream stream1(str1); i::Token::Value expectations1[] = { i::Token::LBRACE, i::Token::IDENTIFIER, @@ -792,8 +770,7 @@ TEST(StreamScanner) { TestStreamScanner(&stream1, expectations1, 0, 0); const char* str2 = "case default const {THIS\nPART\nSKIPPED} do"; - i::Utf8ToUtf16CharacterStream stream2(reinterpret_cast<const i::byte*>(str2), - static_cast<unsigned>(strlen(str2))); + i::ExternalOneByteStringUtf16CharacterStream stream2(str2); i::Token::Value expectations2[] = { i::Token::CASE, i::Token::DEFAULT, @@ -823,25 +800,21 @@ TEST(StreamScanner) { for (int i = 0; i <= 4; i++) { expectations3[6 - i] = i::Token::ILLEGAL; expectations3[5 - i] = i::Token::EOS; - i::Utf8ToUtf16CharacterStream stream3( - reinterpret_cast<const i::byte*>(str3), - static_cast<unsigned>(strlen(str3))); + i::ExternalOneByteStringUtf16CharacterStream stream3(str3); TestStreamScanner(&stream3, expectations3, 1, 1 + i); } } void TestScanRegExp(const char* re_source, const char* expected) { - i::Utf8ToUtf16CharacterStream stream( - reinterpret_cast<const i::byte*>(re_source), - static_cast<unsigned>(strlen(re_source))); + i::ExternalOneByteStringUtf16CharacterStream stream(re_source); i::HandleScope scope(CcTest::i_isolate()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(&stream); i::Token::Value start = scanner.peek(); CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); - CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); + CHECK(scanner.ScanRegExpPattern()); scanner.Next(); // Current token is now the regexp literal. i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory(&zone, @@ -1070,27 +1043,31 @@ TEST(ScopeUsesArgumentsSuperThis) { i::Zone zone(CcTest::i_isolate()->allocator()); i::ParseInfo info(&zone, script); i::Parser parser(&info); - parser.set_allow_harmony_sloppy(true); info.set_global(); CHECK(parser.Parse(&info)); CHECK(i::Rewriter::Rewrite(&info)); - CHECK(i::Scope::Analyze(&info)); + i::Scope::Analyze(&info); CHECK(info.literal() != NULL); - i::Scope* script_scope = info.literal()->scope(); + i::DeclarationScope* script_scope = info.literal()->scope(); CHECK(script_scope->is_script_scope()); - CHECK_EQ(1, script_scope->inner_scopes()->length()); - i::Scope* scope = script_scope->inner_scopes()->at(0); + i::Scope* scope = script_scope->inner_scope(); + DCHECK_NOT_NULL(scope); + DCHECK_NULL(scope->sibling()); // Adjust for constructor scope. if (j == 2) { - CHECK_EQ(1, scope->inner_scopes()->length()); - scope = scope->inner_scopes()->at(0); + scope = scope->inner_scope(); + DCHECK_NOT_NULL(scope); + DCHECK_NULL(scope->sibling()); + } + // Arrows themselves never get an arguments object. + if ((source_data[i].expected & ARGUMENTS) != 0 && + !scope->AsDeclarationScope()->is_arrow_scope()) { + CHECK_NOT_NULL(scope->AsDeclarationScope()->arguments()); } - CHECK_EQ((source_data[i].expected & ARGUMENTS) != 0, - scope->uses_arguments()); CHECK_EQ((source_data[i].expected & SUPER_PROPERTY) != 0, - scope->uses_super_property()); + scope->AsDeclarationScope()->uses_super_property()); if ((source_data[i].expected & THIS) != 0) { // Currently the is_used() flag is conservative; all variables in a // script scope are marked as used. @@ -1122,13 +1099,11 @@ static void CheckParsesToNumber(const char* source, bool with_dot) { i::ParseInfo info(handles.main_zone(), script); i::Parser parser(&info); - parser.set_allow_harmony_sloppy(true); info.set_global(); info.set_lazy(false); info.set_allow_lazy_parsing(false); info.set_toplevel(true); - i::CompilationInfo compilation_info(&info); CHECK(i::Compiler::ParseAndAnalyze(&info)); CHECK(info.scope()->declarations()->length() == 1); @@ -1399,9 +1374,10 @@ TEST(ScopePositions) { CHECK(scope->is_script_scope()); CHECK_EQ(scope->start_position(), 0); CHECK_EQ(scope->end_position(), kProgramSize); - CHECK_EQ(scope->inner_scopes()->length(), 1); - i::Scope* inner_scope = scope->inner_scopes()->at(0); + i::Scope* inner_scope = scope->inner_scope(); + DCHECK_NOT_NULL(inner_scope); + DCHECK_NULL(inner_scope->sibling()); CHECK_EQ(inner_scope->scope_type(), source_data[i].scope_type); CHECK_EQ(inner_scope->start_position(), kPrefixLen); // The end position of a token is one position after the last @@ -1438,7 +1414,6 @@ TEST(DiscardFunctionBody) { i::ParseInfo info(&zone, script); info.set_allow_lazy_parsing(); i::Parser parser(&info); - parser.set_allow_harmony_sloppy(true); parser.Parse(&info); function = info.literal(); CHECK_NOT_NULL(function); @@ -1449,8 +1424,8 @@ TEST(DiscardFunctionBody) { AsCall()->expression()->AsFunctionLiteral(); i::Scope* inner_scope = inner->scope(); i::FunctionLiteral* fun = nullptr; - if (inner_scope->declarations()->length() > 1) { - fun = inner_scope->declarations()->at(1)->AsFunctionDeclaration()->fun(); + if (inner_scope->declarations()->length() > 0) { + fun = inner_scope->declarations()->at(0)->AsFunctionDeclaration()->fun(); } else { // TODO(conradw): This path won't be hit until the other test cases can be // uncommented. @@ -1509,12 +1484,12 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) { enum ParserFlag { kAllowLazy, kAllowNatives, - kAllowHarmonySloppy, - kAllowHarmonySloppyLet, - kAllowHarmonyNewTarget, kAllowHarmonyFunctionSent, kAllowHarmonyRestrictiveDeclarations, - kAllowHarmonyExponentiationOperator + kAllowHarmonyForIn, + kAllowHarmonyAsyncAwait, + kAllowHarmonyRestrictiveGenerators, + kAllowHarmonyTrailingCommas, }; enum ParserSyncTestResult { @@ -1528,28 +1503,31 @@ void SetParserFlags(i::ParserBase<Traits>* parser, i::EnumSet<ParserFlag> flags) { parser->set_allow_lazy(flags.Contains(kAllowLazy)); parser->set_allow_natives(flags.Contains(kAllowNatives)); - parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); - parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet)); parser->set_allow_harmony_function_sent( flags.Contains(kAllowHarmonyFunctionSent)); parser->set_allow_harmony_restrictive_declarations( flags.Contains(kAllowHarmonyRestrictiveDeclarations)); - parser->set_allow_harmony_exponentiation_operator( - flags.Contains(kAllowHarmonyExponentiationOperator)); + parser->set_allow_harmony_for_in(flags.Contains(kAllowHarmonyForIn)); + parser->set_allow_harmony_async_await( + flags.Contains(kAllowHarmonyAsyncAwait)); + parser->set_allow_harmony_restrictive_generators( + flags.Contains(kAllowHarmonyRestrictiveGenerators)); + parser->set_allow_harmony_trailing_commas( + flags.Contains(kAllowHarmonyTrailingCommas)); } void TestParserSyncWithFlags(i::Handle<i::String> source, i::EnumSet<ParserFlag> flags, ParserSyncTestResult result, - bool is_module = false) { + bool is_module = false, + bool test_preparser = true) { 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; - bool test_preparser = !is_module; // Preparse the data. i::CompleteParserRecorder log; @@ -1563,8 +1541,8 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, stack_limit); SetParserFlags(&preparser, flags); scanner.Initialize(&stream); - i::PreParser::PreParseResult result = preparser.PreParseProgram( - &preparser_materialized_literals); + i::PreParser::PreParseResult result = + preparser.PreParseProgram(&preparser_materialized_literals, is_module); CHECK_EQ(i::PreParser::kPreParseSuccess, result); } bool preparse_error = log.HasError(); @@ -1598,6 +1576,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, i::Handle<i::String> message_string = i::Handle<i::String>::cast( i::JSReceiver::GetProperty(isolate, exception_handle, "message") .ToHandleChecked()); + isolate->clear_pending_exception(); if (result == kSuccess) { v8::base::OS::Print( @@ -1674,7 +1653,7 @@ 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 is_module = false, bool test_preparser = true) { i::Handle<i::String> str = CcTest::i_isolate()->factory()->NewStringFromAsciiChecked(source); for (int bits = 0; bits < (1 << varying_flags_length); bits++) { @@ -1691,7 +1670,7 @@ void TestParserSync(const char* source, const ParserFlag* varying_flags, ++flag_index) { flags.Remove(always_false_flags[flag_index]); } - TestParserSyncWithFlags(str, flags, result, is_module); + TestParserSyncWithFlags(str, flags, result, is_module, test_preparser); } } @@ -1839,7 +1818,8 @@ void RunParserSyncTest(const char* context_data[][2], 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) { + int always_false_len = 0, bool is_module = false, + bool test_preparser = true) { v8::HandleScope handles(CcTest::isolate()); v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); @@ -1894,7 +1874,7 @@ 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); + always_false_len, is_module, test_preparser); } } delete[] generated_flags; @@ -1908,10 +1888,11 @@ void RunModuleParserSyncTest(const char* context_data[][2], const ParserFlag* always_true_flags = NULL, int always_true_len = 0, const ParserFlag* always_false_flags = NULL, - int always_false_len = 0) { + int always_false_len = 0, + bool test_preparser = true) { RunParserSyncTest(context_data, statement_data, result, flags, flags_len, always_true_flags, always_true_len, always_false_flags, - always_false_len, true); + always_false_len, true, test_preparser); } @@ -2017,25 +1998,28 @@ TEST(NoErrorsEvalAndArgumentsStrict) { RunParserSyncTest(context_data, statement_data, kSuccess); } +#define FUTURE_STRICT_RESERVED_WORDS_NO_LET(V) \ + V(implements) \ + V(interface) \ + V(package) \ + V(private) \ + V(protected) \ + V(public) \ + V(static) \ + V(yield) #define FUTURE_STRICT_RESERVED_WORDS(V) \ - V(implements) \ - V(interface) \ V(let) \ - V(package) \ - V(private) \ - V(protected) \ - V(public) \ - V(static) \ - V(yield) + FUTURE_STRICT_RESERVED_WORDS_NO_LET(V) +#define LIMITED_FUTURE_STRICT_RESERVED_WORDS_NO_LET(V) \ + V(implements) \ + V(static) \ + V(yield) #define LIMITED_FUTURE_STRICT_RESERVED_WORDS(V) \ - V(implements) \ V(let) \ - V(static) \ - V(yield) - + LIMITED_FUTURE_STRICT_RESERVED_WORDS_NO_LET(V) #define FUTURE_STRICT_RESERVED_STATEMENTS(NAME) \ "var " #NAME ";", \ @@ -2051,25 +2035,52 @@ TEST(NoErrorsEvalAndArgumentsStrict) { "++" #NAME ";", \ #NAME " ++;", +// clang-format off +#define FUTURE_STRICT_RESERVED_LEX_BINDINGS(NAME) \ + "let " #NAME ";", \ + "for (let " #NAME "; false; ) {}", \ + "for (let " #NAME " in {}) {}", \ + "for (let " #NAME " of []) {}", \ + "const " #NAME " = null;", \ + "for (const " #NAME " = null; false; ) {}", \ + "for (const " #NAME " in {}) {}", \ + "for (const " #NAME " of []) {}", +// clang-format on TEST(ErrorsFutureStrictReservedWords) { // Tests that both preparsing and parsing produce the right kind of errors for // using future strict reserved words as identifiers. Without the strict mode, // it's ok to use future strict reserved words as identifiers. With the strict // mode, it isn't. - const char* context_data[][2] = { + const char* strict_contexts[][2] = { {"function test_func() {\"use strict\"; ", "}"}, {"() => { \"use strict\"; ", "}"}, {NULL, NULL}}; + // clang-format off const char* statement_data[] { LIMITED_FUTURE_STRICT_RESERVED_WORDS(FUTURE_STRICT_RESERVED_STATEMENTS) + LIMITED_FUTURE_STRICT_RESERVED_WORDS(FUTURE_STRICT_RESERVED_LEX_BINDINGS) NULL }; + // clang-format on - RunParserSyncTest(context_data, statement_data, kError); -} + RunParserSyncTest(strict_contexts, statement_data, kError); + // From ES2015, 13.3.1.1 Static Semantics: Early Errors: + // + // > LexicalDeclaration : LetOrConst BindingList ; + // > + // > - It is a Syntax Error if the BoundNames of BindingList contains "let". + const char* non_strict_contexts[][2] = {{"", ""}, + {"function test_func() {", "}"}, + {"() => {", "}"}, + {NULL, NULL}}; + const char* invalid_statements[] = {FUTURE_STRICT_RESERVED_LEX_BINDINGS("let") + NULL}; + + RunParserSyncTest(non_strict_contexts, invalid_statements, kError); +} #undef LIMITED_FUTURE_STRICT_RESERVED_WORDS @@ -2082,10 +2093,13 @@ TEST(NoErrorsFutureStrictReservedWords) { { NULL, NULL } }; + // clang-format off const char* statement_data[] = { FUTURE_STRICT_RESERVED_WORDS(FUTURE_STRICT_RESERVED_STATEMENTS) + FUTURE_STRICT_RESERVED_WORDS_NO_LET(FUTURE_STRICT_RESERVED_LEX_BINDINGS) NULL }; + // clang-format on RunParserSyncTest(context_data, statement_data, kSuccess); } @@ -2349,9 +2363,7 @@ TEST(NoErrorsGenerator) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, statement_data, kSuccess); } @@ -2407,6 +2419,10 @@ TEST(ErrorsYieldGenerator) { "var {foo: yield 24} = {a: 42};", "[yield 24] = [42];", "({a: yield 24} = {a: 42});", + "for (yield 'x' in {});", + "for (yield 'x' of {});", + "for (yield 'x' in {} in {});", + "for (yield 'x' in {} of {});", "class C extends yield { }", NULL }; @@ -3305,11 +3321,10 @@ TEST(SerializationOfMaybeAssignmentFlag) { const i::AstRawString* name = avf.GetOneByteString("result"); i::Handle<i::String> str = name->string(); CHECK(str->IsInternalizedString()); - i::Scope* script_scope = - new (&zone) i::Scope(&zone, NULL, i::SCRIPT_SCOPE, &avf); - script_scope->Initialize(); - i::Scope* s = - i::Scope::DeserializeScopeChain(isolate, &zone, context, script_scope); + i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); + i::Scope* s = i::Scope::DeserializeScopeChain( + isolate, &zone, context, script_scope, &avf, + i::Scope::DeserializationMode::kKeepScopeInfo); CHECK(s != script_scope); CHECK(name != NULL); @@ -3353,11 +3368,10 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); avf.Internalize(isolate); - i::Scope* script_scope = - new (&zone) i::Scope(&zone, NULL, i::SCRIPT_SCOPE, &avf); - script_scope->Initialize(); - i::Scope* s = - i::Scope::DeserializeScopeChain(isolate, &zone, context, script_scope); + i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); + i::Scope* s = i::Scope::DeserializeScopeChain( + isolate, &zone, context, script_scope, &avf, + i::Scope::DeserializationMode::kKeepScopeInfo); CHECK(s != script_scope); const i::AstRawString* name_x = avf.GetOneByteString("x"); @@ -3497,8 +3511,9 @@ TEST(InnerAssignment) { CHECK(info.literal() != NULL); i::Scope* scope = info.literal()->scope(); - CHECK_EQ(scope->inner_scopes()->length(), 1); - i::Scope* inner_scope = scope->inner_scopes()->at(0); + i::Scope* inner_scope = scope->inner_scope(); + DCHECK_NOT_NULL(inner_scope); + DCHECK_NULL(inner_scope->sibling()); const i::AstRawString* var_name = info.ast_value_factory()->GetOneByteString("x"); i::Variable* var = inner_scope->Lookup(var_name); @@ -3533,10 +3548,8 @@ TEST(UseAsmUseCount) { CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); CompileRun("\"use asm\";\n" "var foo = 1;\n" - "\"use asm\";\n" // Only the first one counts. "function bar() { \"use asm\"; var baz = 1; }"); - // Optimizing will double-count because the source is parsed twice. - CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]); + CHECK_LT(0, use_counts[v8::Isolate::kUseAsm]); } @@ -3949,11 +3962,7 @@ TEST(SuperNoErrors) { NULL }; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, statement_data, kSuccess); } @@ -3980,9 +3989,7 @@ TEST(SuperErrors) { NULL }; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, expression_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, expression_data, kError); } @@ -3996,9 +4003,7 @@ TEST(SuperCall) { NULL }; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, success_data, kSuccess); const char* error_data[] = { "class C { constructor() { super(); } }", @@ -4020,8 +4025,7 @@ TEST(SuperCall) { NULL }; - RunParserSyncTest(context_data, error_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, error_data, kError); } @@ -4046,9 +4050,7 @@ TEST(SuperNewNoErrors) { NULL }; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, expression_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, expression_data, kSuccess); } @@ -4079,9 +4081,7 @@ TEST(SuperNewErrors) { NULL }; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, statement_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, statement_data, kError); } @@ -4119,11 +4119,7 @@ TEST(SuperErrorsNonMethods) { NULL }; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, statement_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, statement_data, kError); } @@ -4336,9 +4332,7 @@ TEST(ClassExpressionNoErrors) { "class name extends class base {} {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, class_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_data, kSuccess); } @@ -4412,11 +4406,7 @@ TEST(ClassBodyNoErrors) { NULL}; // clang-format on - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kSuccess); } @@ -4469,11 +4459,7 @@ TEST(ClassPropertyNameNoErrors) { "finally", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, name_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, name_data, kSuccess); } @@ -4499,11 +4485,7 @@ TEST(ClassExpressionErrors) { "class { m() {}, n() {} }", // No commas allowed. NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_data, kError); } @@ -4535,11 +4517,7 @@ TEST(ClassDeclarationErrors) { "class name { *static m() {} }", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_data, kError); } @@ -4564,11 +4542,7 @@ TEST(ClassNameErrors) { "yield", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_name, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_name, kError); } @@ -4596,11 +4570,7 @@ TEST(ClassGetterParamNameErrors) { "yield", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_name, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_name, kError); } @@ -4623,11 +4593,7 @@ TEST(ClassStaticPrototypeErrors) { "static *'prot\\u006ftype'() {}", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kError); } @@ -4649,11 +4615,7 @@ TEST(ClassSpecialConstructorErrors) { "*'c\\u006fnstructor'() {}", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kError); } @@ -4670,11 +4632,7 @@ TEST(ClassConstructorNoErrors) { "static *constructor() {}", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kSuccess); } @@ -4687,11 +4645,7 @@ TEST(ClassMultipleConstructorErrors) { "constructor() {}; constructor() {}", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kError); } @@ -4708,11 +4662,7 @@ TEST(ClassMultiplePropertyNamesNoErrors) { "get m() {}; set m(_) {}; get m() {}; set m(_) {};", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kSuccess); } @@ -4727,11 +4677,7 @@ TEST(ClassesAreStrictErrors) { "class C { *method() { with ({}) {} } }", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy - }; - RunParserSyncTest(context_data, class_body_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, class_body_data, kError); } @@ -4869,10 +4815,7 @@ TEST(StatementParsingInForIn) { "for(let x in {}, {}) {}", "for(const x in {}, {}) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } @@ -4980,9 +4923,7 @@ TEST(ForInMultipleDeclarationsError) { "for (const i, j = 1 in {}) {}", "for (const i, j = void 0 in [1, 2, 3]) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } @@ -5009,9 +4950,7 @@ TEST(ForOfMultipleDeclarationsError) { "for (const i, j = 1 of {}) {}", "for (const i, j = void 0 of [1, 2, 3]) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } @@ -5026,9 +4965,7 @@ TEST(ForInNoDeclarationsError) { "for (var in {}) {}", "for (const in {}) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } @@ -5043,9 +4980,7 @@ TEST(ForOfNoDeclarationsError) { "for (var of [1, 2, 3]) {}", "for (const of [1, 2, 3]) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } @@ -5059,10 +4994,7 @@ TEST(ForOfInOperator) { "for(x of 'foo' in {}) {}", "for(var x of 'foo' in {}) {}", "for(let x of 'foo' in {}) {}", "for(const x of 'foo' in {}) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } @@ -5073,10 +5005,7 @@ TEST(ForOfYieldIdentifier) { "for(let x of yield) {}", "for(const x of yield) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } @@ -5091,10 +5020,7 @@ TEST(ForOfYieldExpression) { "function* g() { for(let x of yield) {} }", "function* g() { for(const x of yield) {} }", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } @@ -5112,10 +5038,7 @@ TEST(ForOfExpressionError) { "for(x of { y = 23 }) {}", "for(var x of { y = 23 }) {}", "for(let x of { y = 23 }) {}", "for(const x of { y = 23 }) {}", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } @@ -5205,7 +5128,7 @@ TEST(ScanTemplateLiterals) { "`foo${\r a}`", "`foo${'a' in a}`", NULL}; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, data, kSuccess); } @@ -5240,7 +5163,7 @@ TEST(ScanTaggedTemplateLiterals) { "tag`foo${\r a}`", "tag`foo${'a' in a}`", NULL}; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, data, kSuccess); } @@ -5267,7 +5190,7 @@ TEST(TemplateMaterializedLiterals) { NULL }; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, data, kSuccess); } @@ -5301,7 +5224,7 @@ TEST(ScanUnterminatedTemplateLiterals) { "`foo${fn(}`", "`foo${1 if}`", NULL}; - RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, data, kError); } @@ -5321,7 +5244,7 @@ TEST(TemplateLiteralsIllegalTokens) { "`hello${1}\\x\n${2}`", NULL}; - RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, data, kError); } @@ -5396,13 +5319,12 @@ TEST(RestParameterInSetterMethodError) { {nullptr, nullptr}}; const char* data[] = {"...a", "...arguments", "...eval", nullptr}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } TEST(RestParametersEvalArguments) { + // clang-format off const char* strict_context_data[][2] = {{"'use strict';(function(", "){ return;})(1, [], /regexp/, 'str',function(){});"}, @@ -5416,8 +5338,10 @@ TEST(RestParametersEvalArguments) { "...eval", "eval, ...args", "...arguments", - "arguments, ...args", + // See https://bugs.chromium.org/p/v8/issues/detail?id=4577 + // "arguments, ...args", NULL}; + // clang-format on // Fail in strict mode RunParserSyncTest(strict_context_data, data, kError); @@ -5484,7 +5408,7 @@ TEST(BadRestSpread) { "var [...x,] = [1,2,3];", "var [...x, y] = [1,2,3];", "var {...x} = [1,2,3];", "var { x } = {x: ...[1,2,3]}", NULL}; - RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, data, kError); } @@ -5494,28 +5418,12 @@ TEST(LexicalScopingSloppyMode) { {"function f() {", "}"}, {"{", "}"}, {NULL, NULL}}; - const char* bad_data[] = { - "let x = 1;", - "for(let x = 1;;){}", - "for(let x of []){}", - "for(let x in []){}", - "class C {}", - "class C extends D {}", - "(class {})", - "(class extends D {})", - "(class C {})", - "(class C extends D {})", - NULL}; - static const ParserFlag always_false_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, bad_data, kError, NULL, 0, NULL, 0, - always_false_flags, arraysize(always_false_flags)); const char* good_data[] = { "let = 1;", "for(let = 1;;){}", NULL}; - RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0, NULL, 0, - always_false_flags, arraysize(always_false_flags)); + RunParserSyncTest(context_data, good_data, kSuccess); } @@ -5535,11 +5443,7 @@ TEST(ComputedPropertyName) { "var name", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy, - }; - RunParserSyncTest(context_data, error_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, error_data, kError); const char* name_data[] = { "1", @@ -5550,8 +5454,7 @@ TEST(ComputedPropertyName) { "{}", NULL}; - RunParserSyncTest(context_data, name_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, name_data, kSuccess); } @@ -5563,11 +5466,7 @@ TEST(ComputedPropertyNameShorthandError) { "[1], a: 1", NULL}; - static const ParserFlag always_flags[] = { - kAllowHarmonySloppy, - }; - RunParserSyncTest(context_data, error_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, error_data, kError); } @@ -5587,8 +5486,8 @@ TEST(BasicImportExportParsing) { "export default function() {}", "export default function*() {}", "export default class C {}", - "export default class {}" - "export default class extends C {}" + "export default class {}", + "export default class extends C {}", "export default 42", "var x; export default x = 7", "export { Q } from 'somemodule.js';", @@ -5600,6 +5499,8 @@ TEST(BasicImportExportParsing) { "export { static } from 'm.js'", "export { let } from 'm.js'", "var a; export { a as b, a as c };", + "var a; export { a as await };", + "var a; export { a as enum };", "import 'somemodule.js';", "import { } from 'm.js';", @@ -5614,6 +5515,13 @@ TEST(BasicImportExportParsing) { "import { yield as y } from 'm.js';", "import { static as s } from 'm.js';", "import { let as l } from 'm.js';", + + "import thing from 'a.js'; export {thing};", + "export {thing}; import thing from 'a.js';", + "import {thing} from 'a.js'; export {thing};", + "export {thing}; import {thing} from 'a.js';", + "import * as thing from 'a.js'; export {thing};", + "export {thing}; import * as thing from 'a.js';", }; // clang-format on @@ -5644,6 +5552,7 @@ TEST(BasicImportExportParsing) { i::Handle<i::String> message_string = i::Handle<i::String>::cast( i::JSReceiver::GetProperty(isolate, exception_handle, "message") .ToHandleChecked()); + isolate->clear_pending_exception(); v8::base::OS::Print( "Parser failed on:\n" @@ -5664,6 +5573,7 @@ TEST(BasicImportExportParsing) { i::Parser parser(&info); info.set_global(); CHECK(!parser.Parse(&info)); + isolate->clear_pending_exception(); } } } @@ -5725,6 +5635,8 @@ TEST(ImportExportParsingErrors) { "import { y as yield } from 'm.js'", "import { s as static } from 'm.js'", "import { l as let } from 'm.js'", + "import { a as await } from 'm.js';", + "import { a as enum } from 'm.js';", "import { x }, def from 'm.js';", "import def, def2 from 'm.js';", "import * as x, def from 'm.js';", @@ -5754,9 +5666,210 @@ TEST(ImportExportParsingErrors) { i::Parser parser(&info); info.set_module(); CHECK(!parser.Parse(&info)); + isolate->clear_pending_exception(); } } +TEST(ModuleTopLevelFunctionDecl) { + // clang-format off + const char* kErrorSources[] = { + "function f() {} function f() {}", + "var f; function f() {}", + "function f() {} var f;", + "function* f() {} function* f() {}", + "var f; function* f() {}", + "function* f() {} var f;", + "function f() {} function* f() {}", + "function* f() {} function f() {}", + }; + // clang-format on + + i::Isolate* isolate = CcTest::i_isolate(); + i::Factory* factory = isolate->factory(); + + v8::HandleScope handles(CcTest::isolate()); + v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); + v8::Context::Scope context_scope(context); + + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - + 128 * 1024); + + for (unsigned i = 0; i < arraysize(kErrorSources); ++i) { + i::Handle<i::String> source = + factory->NewStringFromAsciiChecked(kErrorSources[i]); + + i::Handle<i::Script> script = factory->NewScript(source); + i::Zone zone(CcTest::i_isolate()->allocator()); + i::ParseInfo info(&zone, script); + i::Parser parser(&info); + info.set_module(); + CHECK(!parser.Parse(&info)); + isolate->clear_pending_exception(); + } +} + +TEST(ModuleAwaitReserved) { + // clang-format off + const char* kErrorSources[] = { + "await;", + "await: ;", + "var await;", + "var [await] = [];", + "var { await } = {};", + "var { x: await } = {};", + "{ var await; }", + "let await;", + "let [await] = [];", + "let { await } = {};", + "let { x: await } = {};", + "{ let await; }", + "const await = null;", + "const [await] = [];", + "const { await } = {};", + "const { x: await } = {};", + "{ const await = null; }", + "function await() {}", + "function f(await) {}", + "function* await() {}", + "function* g(await) {}", + "(function await() {});", + "(function (await) {});", + "(function* await() {});", + "(function* (await) {});", + "(await) => {};", + "await => {};", + "class await {}", + "class C { constructor(await) {} }", + "class C { m(await) {} }", + "class C { static m(await) {} }", + "class C { *m(await) {} }", + "class C { static *m(await) {} }", + "(class await {})", + "(class { constructor(await) {} });", + "(class { m(await) {} });", + "(class { static m(await) {} });", + "(class { *m(await) {} });", + "(class { static *m(await) {} });", + "({ m(await) {} });", + "({ *m(await) {} });", + "({ set p(await) {} });", + "try {} catch (await) {}", + "try {} catch (await) {} finally {}", + NULL + }; + // clang-format on + const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; + + RunModuleParserSyncTest(context_data, kErrorSources, kError); +} + +TEST(ModuleAwaitReservedPreParse) { + const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; + const char* error_data[] = {"function f() { var await = 0; }", NULL}; + + RunModuleParserSyncTest(context_data, error_data, kError); +} + +TEST(ModuleAwaitPermitted) { + // clang-format off + const char* kValidSources[] = { + "({}).await;", + "({ await: null });", + "({ await() {} });", + "({ get await() {} });", + "({ set await(x) {} });", + "(class { await() {} });", + "(class { static await() {} });", + "(class { *await() {} });", + "(class { static *await() {} });", + NULL + }; + // clang-format on + const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; + + RunModuleParserSyncTest(context_data, kValidSources, kSuccess); +} + +TEST(EnumReserved) { + // clang-format off + const char* kErrorSources[] = { + "enum;", + "enum: ;", + "var enum;", + "var [enum] = [];", + "var { enum } = {};", + "var { x: enum } = {};", + "{ var enum; }", + "let enum;", + "let [enum] = [];", + "let { enum } = {};", + "let { x: enum } = {};", + "{ let enum; }", + "const enum = null;", + "const [enum] = [];", + "const { enum } = {};", + "const { x: enum } = {};", + "{ const enum = null; }", + "function enum() {}", + "function f(enum) {}", + "function* enum() {}", + "function* g(enum) {}", + "(function enum() {});", + "(function (enum) {});", + "(function* enum() {});", + "(function* (enum) {});", + "(enum) => {};", + "enum => {};", + "class enum {}", + "class C { constructor(enum) {} }", + "class C { m(enum) {} }", + "class C { static m(enum) {} }", + "class C { *m(enum) {} }", + "class C { static *m(enum) {} }", + "(class enum {})", + "(class { constructor(enum) {} });", + "(class { m(enum) {} });", + "(class { static m(enum) {} });", + "(class { *m(enum) {} });", + "(class { static *m(enum) {} });", + "({ m(enum) {} });", + "({ *m(enum) {} });", + "({ set p(enum) {} });", + "try {} catch (enum) {}", + "try {} catch (enum) {} finally {}", + NULL + }; + // clang-format on + const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; + + RunModuleParserSyncTest(context_data, kErrorSources, kError); +} + +static void CheckModuleEntry(const i::ModuleDescriptor::ModuleEntry* entry, + const char* export_name, const char* local_name, const char* import_name, + const char* module_request) { + CHECK_NOT_NULL(entry); + if (export_name == nullptr) { + CHECK_NULL(entry->export_name); + } else { + entry->export_name->IsOneByteEqualTo(export_name); + } + if (local_name == nullptr) { + CHECK_NULL(entry->local_name); + } else { + entry->local_name->IsOneByteEqualTo(local_name); + } + if (import_name == nullptr) { + CHECK_NULL(entry->import_name); + } else { + entry->import_name->IsOneByteEqualTo(import_name); + } + if (module_request == nullptr) { + CHECK_NULL(entry->module_request); + } else { + entry->module_request->IsOneByteEqualTo(module_request); + } +} TEST(ModuleParsingInternals) { i::Isolate* isolate = CcTest::i_isolate(); @@ -5774,7 +5887,19 @@ TEST(ModuleParsingInternals) { "import n from 'n.js';" "export { a as b } from 'm.js';" "export * from 'p.js';" - "import 'q.js'"; + "export var foo;" + "export function goo() {};" + "export let hoo;" + "export const joo = 42;" + "export default (function koo() {});" + "import 'q.js';" + "let nonexport = 42;" + "import {m as mm} from 'm.js';" + "import {aa} from 'm.js';" + "export {aa as bb, x};" + "import * as loo from 'bar.js';" + "import * as foob from 'bar.js';" + "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()); @@ -5784,41 +5909,142 @@ TEST(ModuleParsingInternals) { CHECK(parser.Parse(&info)); CHECK(i::Compiler::Analyze(&info)); i::FunctionLiteral* func = info.literal(); - i::Scope* module_scope = func->scope(); + i::ModuleScope* module_scope = func->scope()->AsModuleScope(); i::Scope* outer_scope = module_scope->outer_scope(); CHECK(outer_scope->is_script_scope()); CHECK_NULL(outer_scope->outer_scope()); CHECK(module_scope->is_module_scope()); - i::ModuleDescriptor* descriptor = module_scope->module(); - CHECK_NOT_NULL(descriptor); - CHECK_EQ(1, descriptor->Length()); - const i::AstRawString* export_name = - info.ast_value_factory()->GetOneByteString("y"); - const i::AstRawString* local_name = - descriptor->LookupLocalExport(export_name, &zone); - CHECK_NOT_NULL(local_name); - CHECK(local_name->IsOneByteEqualTo("x")); i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); - CHECK_EQ(3, declarations->length()); + CHECK_EQ(13, declarations->length()); + CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); - i::ImportDeclaration* import_decl = - declarations->at(1)->AsImportDeclaration(); - CHECK(import_decl->import_name()->IsOneByteEqualTo("q")); - CHECK(import_decl->proxy()->raw_name()->IsOneByteEqualTo("z")); - CHECK(import_decl->module_specifier()->IsOneByteEqualTo("m.js")); - import_decl = declarations->at(2)->AsImportDeclaration(); - CHECK(import_decl->import_name()->IsOneByteEqualTo("default")); - CHECK(import_decl->proxy()->raw_name()->IsOneByteEqualTo("n")); - CHECK(import_decl->module_specifier()->IsOneByteEqualTo("n.js")); - // TODO(adamk): Add test for indirect exports once they're fully implemented. - // TODO(adamk): Add test for star exports once they're fully implemented. - const i::ZoneList<const i::AstRawString*>& requested_modules = - descriptor->requested_modules(); - CHECK_EQ(4, requested_modules.length()); - CHECK(requested_modules[0]->IsOneByteEqualTo("m.js")); - CHECK(requested_modules[1]->IsOneByteEqualTo("n.js")); - CHECK(requested_modules[2]->IsOneByteEqualTo("p.js")); - CHECK(requested_modules[3]->IsOneByteEqualTo("q.js")); + CHECK(declarations->at(0)->proxy()->var()->mode() == i::LET); + CHECK(declarations->at(0)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(0)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(1)->proxy()->raw_name()->IsOneByteEqualTo("z")); + CHECK(declarations->at(1)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->at(1)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(1)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(2)->proxy()->raw_name()->IsOneByteEqualTo("n")); + CHECK(declarations->at(2)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->at(2)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(2)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(3)->proxy()->raw_name()->IsOneByteEqualTo("foo")); + CHECK(declarations->at(3)->proxy()->var()->mode() == i::VAR); + CHECK(!declarations->at(3)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(3)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(4)->proxy()->raw_name()->IsOneByteEqualTo("goo")); + CHECK(declarations->at(4)->proxy()->var()->mode() == i::LET); + CHECK(!declarations->at(4)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(4)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo")); + CHECK(declarations->at(5)->proxy()->var()->mode() == i::LET); + CHECK(declarations->at(5)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(5)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(6)->proxy()->raw_name()->IsOneByteEqualTo("joo")); + CHECK(declarations->at(6)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->at(6)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(6)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK( + declarations->at(7)->proxy()->raw_name()->IsOneByteEqualTo("*default*")); + CHECK(declarations->at(7)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->at(7)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(7)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK( + declarations->at(8)->proxy()->raw_name()->IsOneByteEqualTo("nonexport")); + CHECK(declarations->at(8)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(8)->proxy()->var()->location() != + i::VariableLocation::MODULE); + + CHECK(declarations->at(9)->proxy()->raw_name()->IsOneByteEqualTo("mm")); + CHECK(declarations->at(9)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->at(9)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(9)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(10)->proxy()->raw_name()->IsOneByteEqualTo("aa")); + CHECK(declarations->at(10)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->at(10)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(10)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + CHECK(declarations->at(11)->proxy()->raw_name()->IsOneByteEqualTo("loo")); + CHECK(declarations->at(11)->proxy()->var()->mode() == i::CONST); + CHECK(!declarations->at(11)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(11)->proxy()->var()->location() != + i::VariableLocation::MODULE); + + CHECK(declarations->at(12)->proxy()->raw_name()->IsOneByteEqualTo("foob")); + CHECK(declarations->at(12)->proxy()->var()->mode() == i::CONST); + CHECK(!declarations->at(12)->proxy()->var()->binding_needs_init()); + CHECK(declarations->at(12)->proxy()->var()->location() == + i::VariableLocation::MODULE); + + i::ModuleDescriptor* descriptor = module_scope->module(); + CHECK_NOT_NULL(descriptor); + + CHECK_EQ(11, descriptor->exports().length()); + CheckModuleEntry( + descriptor->exports().at(0), "y", "x", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(1), "b", nullptr, "a", "m.js"); + CheckModuleEntry( + descriptor->exports().at(2), nullptr, nullptr, nullptr, "p.js"); + CheckModuleEntry( + descriptor->exports().at(3), "foo", "foo", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(4), "goo", "goo", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(5), "hoo", "hoo", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(6), "joo", "joo", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(7), "default", "*default*", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(8), "bb", nullptr, "aa", "m.js"); // !!! + CheckModuleEntry( + descriptor->exports().at(9), "x", "x", nullptr, nullptr); + CheckModuleEntry( + descriptor->exports().at(10), "foob", "foob", nullptr, nullptr); + + CHECK_EQ(3, descriptor->special_imports().length()); + CheckModuleEntry( + descriptor->special_imports().at(0), nullptr, nullptr, nullptr, "q.js"); + CheckModuleEntry( + descriptor->special_imports().at(1), nullptr, "loo", nullptr, "bar.js"); + CheckModuleEntry( + descriptor->special_imports().at(2), nullptr, "foob", nullptr, "bar.js"); + + CHECK_EQ(4, descriptor->regular_imports().size()); + const i::ModuleDescriptor::ModuleEntry* entry; + entry = descriptor->regular_imports().find( + declarations->at(1)->proxy()->raw_name())->second; + CheckModuleEntry(entry, nullptr, "z", "q", "m.js"); + entry = descriptor->regular_imports().find( + declarations->at(2)->proxy()->raw_name())->second; + CheckModuleEntry(entry, nullptr, "n", "default", "n.js"); + entry = descriptor->regular_imports().find( + declarations->at(9)->proxy()->raw_name())->second; + CheckModuleEntry(entry, nullptr, "mm", "m", "m.js"); + entry = descriptor->regular_imports().find( + declarations->at(10)->proxy()->raw_name())->second; + CheckModuleEntry(entry, nullptr, "aa", "aa", "m.js"); } @@ -6043,9 +6269,47 @@ TEST(DestructuringPositiveTests) { "[...rest]", "[a,b,...rest]", "[a,,...rest]", + "{ __proto__: x, __proto__: y}", + "{arguments: x}", + "{eval: x}", NULL}; // clang-format on RunParserSyncTest(context_data, data, kSuccess); + + // v8:5201 + // TODO(lpy): The two test sets below should be merged once + // we fix https://bugs.chromium.org/p/v8/issues/detail?id=4577 + { + const char* sloppy_context_data1[][2] = { + {"var ", " = {};"}, + {"function f(", ") {}"}, + {"function f(argument1, ", ") {}"}, + {"var f = (", ") => {};"}, + {"var f = (argument1,", ") => {};"}, + {"try {} catch(", ") {}"}, + {NULL, NULL} + }; + const char* data1[] = { + "{eval}", + "{x: eval}", + "{eval = false}", + NULL + }; + RunParserSyncTest(sloppy_context_data1, data1, kSuccess); + + const char* sloppy_context_data2[][2] = { + {"var ", " = {};"}, + {"try {} catch(", ") {}"}, + {NULL, NULL} + }; + const char* data2[] = { + "{arguments}", + "{x: arguments}", + "{arguments = false}", + NULL, + }; + RunParserSyncTest(sloppy_context_data2, data2, kSuccess); + } } @@ -6158,6 +6422,7 @@ TEST(DestructuringNegativeTests) { { // Strict mode. const char* context_data[][2] = { + {"'use strict'; var ", " = {};"}, {"'use strict'; let ", " = {};"}, {"'use strict'; const ", " = {};"}, {"'use strict'; function f(", ") {}"}, @@ -6166,10 +6431,18 @@ TEST(DestructuringNegativeTests) { // clang-format off const char* data[] = { + "[arguments]", "[eval]", "{ a : arguments }", + "{ a : eval }", "[public]", "{ x : private }", + "{ x : arguments }", + "{ x : eval }", + "{ arguments }", + "{ eval }", + "{ arguments = false }" + "{ eval = false }", NULL}; // clang-format on RunParserSyncTest(context_data, data, kError); @@ -6213,9 +6486,7 @@ TEST(DestructuringNegativeTests) { "[ a ]", NULL}; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } } @@ -6286,6 +6557,7 @@ TEST(DestructuringAssignmentPositiveTests) { "{ x : [ foo()[y] = 10 ] = {} }", "{ x : [ y.z = 10 ] = {} }", "{ x : [ y[z] = 10 ] = {} }", + "{ z : { __proto__: x, __proto__: y } = z }" "[ x ]", "[ foo().x ]", @@ -6405,6 +6677,8 @@ TEST(DestructuringAssignmentPositiveTests) { "var x; (true ? { x = true } = {} : { x = false } = {})", "var q, x; (q, { x = 10 } = {});", "var { x = 10 } = { x = 20 } = {};", + "var { __proto__: x, __proto__: y } = {}", + "({ __proto__: x, __proto__: y } = {})", "var { x = 10 } = (o = { x = 20 } = {});", "var x; (({ x = 10 } = { x = 20 } = {}) => x)({})", NULL, @@ -6472,6 +6746,11 @@ TEST(DestructuringAssignmentNegativeTests) { "[x, y, ...[z] = [1]]", "[...[z] = [1]]", + "[...++x]", + "[...x--]", + "[...!x]", + "[...x + y]", + // v8:4657 "({ x: x4, x: (x+=1e4) })", "(({ x: x4, x: (x+=1e4) }))", @@ -6684,6 +6963,9 @@ TEST(DefaultParametersYieldInInitializers) { // Arrow function within generator has the same rules. {"'use strict'; (function *g() { (", ") => {} });"}, {"(function *g() { (", ") => {} });"}, + // And similarly for arrow functions in the parameter list. + {"'use strict'; (function *g(z = (", ") => {}) { });"}, + {"(function *g(z = (", ") => {}) { });"}, {NULL, NULL} }; @@ -6819,16 +7101,10 @@ TEST(NewTarget) { NULL }; - static const ParserFlag always_flags[] = { - kAllowHarmonyNewTarget, - kAllowHarmonySloppy, - }; // clang-format on - RunParserSyncTest(good_context_data, data, kSuccess, NULL, 0, always_flags, - arraysize(always_flags)); - RunParserSyncTest(bad_context_data, data, kError, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(good_context_data, data, kSuccess); + RunParserSyncTest(bad_context_data, data, kError); } @@ -6848,9 +7124,7 @@ TEST(ConstSloppy) { NULL }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } @@ -6873,10 +7147,7 @@ TEST(LetSloppy) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } @@ -6922,9 +7193,7 @@ TEST(LanguageModeDirectivesNonSimpleParameterListErrors) { "{ initializedBindingPattern } = { initializedBindingPattern: true }", NULL}; - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } @@ -6952,10 +7221,7 @@ TEST(LetSloppyOnly) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); // Some things should be rejected even in sloppy mode // This addresses BUG(v8:4403). @@ -6989,10 +7255,7 @@ TEST(LetSloppyOnly) { }; // clang-format on - static const ParserFlag fail_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, - arraysize(fail_flags)); + RunParserSyncTest(context_data, fail_data, kError); } @@ -7092,13 +7355,9 @@ TEST(EscapedKeywords) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; - RunParserSyncTest(sloppy_context_data, fail_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); - RunParserSyncTest(strict_context_data, fail_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); - RunModuleParserSyncTest(sloppy_context_data, fail_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(sloppy_context_data, fail_data, kError); + RunParserSyncTest(strict_context_data, fail_data, kError); + RunModuleParserSyncTest(sloppy_context_data, fail_data, kError); // clang-format off const char* let_data[] = { @@ -7109,15 +7368,8 @@ TEST(EscapedKeywords) { }; // clang-format on - RunParserSyncTest(sloppy_context_data, let_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); - RunParserSyncTest(strict_context_data, let_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); - - static const ParserFlag sloppy_let_flags[] = {kAllowHarmonySloppy, - kAllowHarmonySloppyLet}; - RunParserSyncTest(sloppy_context_data, let_data, kSuccess, NULL, 0, - sloppy_let_flags, arraysize(sloppy_let_flags)); + RunParserSyncTest(sloppy_context_data, let_data, kSuccess); + RunParserSyncTest(strict_context_data, let_data, kError); // Non-errors in sloppy mode const char* valid_data[] = {"(\\u0069mplements = 1);", @@ -7142,12 +7394,9 @@ TEST(EscapedKeywords) { "var st\\u0061tic = 1;", "var { st\\u0061tic } = {};", NULL}; - RunParserSyncTest(sloppy_context_data, valid_data, kSuccess, NULL, 0, - always_flags, arraysize(always_flags)); - RunParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); - RunModuleParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(sloppy_context_data, valid_data, kSuccess); + RunParserSyncTest(strict_context_data, valid_data, kError); + RunModuleParserSyncTest(strict_context_data, valid_data, kError); } @@ -7167,7 +7416,7 @@ TEST(MiscSyntaxErrors) { }; // clang-format on - RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, error_data, kError); } @@ -7196,7 +7445,7 @@ TEST(EscapeSequenceErrors) { }; // clang-format on - RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); + RunParserSyncTest(context_data, error_data, kError); } @@ -7281,6 +7530,13 @@ TEST(FunctionDeclarationError) { "with ({}) label: function f() { };", "if (true) label: function f() {}", "if (true) {} else label: function f() {}", + "if (true) function* f() { }", + "label: function* f() { }", + // TODO(littledan, v8:4806): Ban duplicate generator declarations in + // a block, maybe by tracking whether a Variable is a generator declaration + // "{ function* f() {} function* f() {} }", + // "{ function f() {} function* f() {} }", + // "{ function* f() {} function f() {} }", NULL }; // Valid only in sloppy mode, with or without @@ -7357,10 +7613,7 @@ TEST(ExponentiationOperator) { }; // clang-format on - static const ParserFlag always_flags[] = { - kAllowHarmonyExponentiationOperator}; - RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kSuccess); } TEST(ExponentiationOperatorErrors) { @@ -7407,8 +7660,493 @@ TEST(ExponentiationOperatorErrors) { }; // clang-format on - static const ParserFlag always_flags[] = { - kAllowHarmonyExponentiationOperator}; + RunParserSyncTest(context_data, error_data, kError); +} + +TEST(AsyncAwait) { + // clang-format off + const char* context_data[][2] = { + { "'use strict';", "" }, + { "", "" }, + { NULL, NULL } + }; + + const char* data[] = { + "var asyncFn = async function() { await 1; };", + "var asyncFn = async function withName() { await 1; };", + "var asyncFn = async () => await 'test';", + "var asyncFn = async x => await x + 'test';", + "async function asyncFn() { await 1; }", + "var O = { async method() { await 1; } }", + "var O = { async ['meth' + 'od']() { await 1; } }", + "var O = { async 'method'() { await 1; } }", + "var O = { async 0() { await 1; } }", + "async function await() {}", + + "var asyncFn = async({ foo = 1 }) => foo;", + "var asyncFn = async({ foo = 1 } = {}) => foo;", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); + + // clang-format off + const char* async_body_context_data[][2] = { + { "async function f() {", "}" }, + { "var f = async function() {", "}" }, + { "var f = async() => {", "}" }, + { "var O = { async method() {", "} }" }, + { "'use strict'; async function f() {", "}" }, + { "'use strict'; var f = async function() {", "}" }, + { "'use strict'; var f = async() => {", "}" }, + { "'use strict'; var O = { async method() {", "} }" }, + { NULL, NULL } + }; + + const char* body_context_data[][2] = { + { "function f() {", "}" }, + { "function* g() {", "}" }, + { "var f = function() {", "}" }, + { "var g = function*() {", "}" }, + { "var O = { method() {", "} }" }, + { "var O = { *method() {", "} }" }, + { "var f = () => {", "}" }, + { "'use strict'; function f() {", "}" }, + { "'use strict'; function* g() {", "}" }, + { "'use strict'; var f = function() {", "}" }, + { "'use strict'; var g = function*() {", "}" }, + { "'use strict'; var O = { method() {", "} }" }, + { "'use strict'; var O = { *method() {", "} }" }, + { "'use strict'; var f = () => {", "}" }, + { NULL, NULL } + }; + + const char* body_data[] = { + "var async = 1; return async;", + "let async = 1; return async;", + "const async = 1; return async;", + "function async() {} return async();", + "var async = async => async; return async();", + "function foo() { var await = 1; return await; }", + "function foo(await) { return await; }", + "function* foo() { var await = 1; return await; }", + "function* foo(await) { return await; }", + "var f = () => { var await = 1; return await; }", + "var O = { method() { var await = 1; return await; } };", + "var O = { method(await) { return await; } };", + "var O = { *method() { var await = 1; return await; } };", + "var O = { *method(await) { return await; } };", + + "(function await() {})", + NULL + }; + // clang-format on + + RunParserSyncTest(async_body_context_data, body_data, kSuccess, NULL, 0, + always_flags, arraysize(always_flags)); + RunParserSyncTest(body_context_data, body_data, kSuccess, NULL, 0, + always_flags, arraysize(always_flags)); +} + +TEST(AsyncAwaitErrors) { + // clang-format off + const char* context_data[][2] = { + { "'use strict';", "" }, + { "", "" }, + { NULL, NULL } + }; + + const char* strict_context_data[][2] = { + { "'use strict';", "" }, + { NULL, NULL } + }; + + const char* error_data[] = { + "var asyncFn = async function await() {};", + "var asyncFn = async () => var await = 'test';", + "var asyncFn = async await => await + 'test';", + "var asyncFn = async function(await) {};", + "var asyncFn = async (await) => 'test';", + "async function f(await) {}", + + "var O = { async method(a, a) {} }", + "var O = { async ['meth' + 'od'](a, a) {} }", + "var O = { async 'method'(a, a) {} }", + "var O = { async 0(a, a) {} }", + + "var f = async() => await;", + + "var asyncFn = async function*() {}", + "async function* f() {}", + "var O = { *async method() {} };", + "var O = { async *method() {} };", + "var O = { async method*() {} };", + + "var asyncFn = async function(x = await 1) { return x; }", + "async function f(x = await 1) { return x; }", + "var f = async(x = await 1) => x;", + "var O = { async method(x = await 1) { return x; } };", + + "var f = async(x = await) => 1;", + + "class C { async constructor() {} }", + "class C {}; class C2 extends C { async constructor() {} }", + "class C { static async prototype() {} }", + "class C {}; class C2 extends C { static async prototype() {} }", + + "var f = async() => ((async(x = await 1) => x)();", + + // Henrique Ferreiro's bug (tm) + "(async function foo1() { } foo2 => 1)", + "(async function foo3() { } () => 1)", + "(async function foo4() { } => 1)", + "(async function() { } foo5 => 1)", + "(async function() { } () => 1)", + "(async function() { } => 1)", + "(async.foo6 => 1)", + "(async.foo7 foo8 => 1)", + "(async.foo9 () => 1)", + "(async().foo10 => 1)", + "(async().foo11 foo12 => 1)", + "(async().foo13 () => 1)", + "(async['foo14'] => 1)", + "(async['foo15'] foo16 => 1)", + "(async['foo17'] () => 1)", + "(async()['foo18'] => 1)", + "(async()['foo19'] foo20 => 1)", + "(async()['foo21'] () => 1)", + "(async`foo22` => 1)", + "(async`foo23` foo24 => 1)", + "(async`foo25` () => 1)", + "(async`foo26`.bar27 => 1)", + "(async`foo28`.bar29 foo30 => 1)", + "(async`foo31`.bar32 () => 1)", + + // v8:5148 assert that errors are still thrown for calls that may have been + // async functions + "async({ foo33 = 1 })", + NULL + }; + + const char* strict_error_data[] = { + "var O = { async method(eval) {} }", + "var O = { async ['meth' + 'od'](eval) {} }", + "var O = { async 'method'(eval) {} }", + "var O = { async 0(eval) {} }", + + "var O = { async method(arguments) {} }", + "var O = { async ['meth' + 'od'](arguments) {} }", + "var O = { async 'method'(arguments) {} }", + "var O = { async 0(arguments) {} }", + + "var O = { async method(dupe, dupe) {} }", + + // TODO(caitp): preparser needs to report duplicate parameter errors, too. + // "var f = async(dupe, dupe) => {}", + + NULL + }; + + const char* formal_parameters_data[] = { + "var f = async({ await }) => 1;", + "var f = async({ await = 1 }) => 1;", + "var f = async({ await } = {}) => 1;", + "var f = async({ await = 1 } = {}) => 1;", + "var f = async([await]) => 1;", + "var f = async([await] = []) => 1;", + "var f = async([await = 1]) => 1;", + "var f = async([await = 1] = []) => 1;", + "var f = async(...await) => 1;", + "var f = async(await) => 1;", + "var f = async(await = 1) => 1;", + "var f = async(...[await]) => 1;", + + // v8:5190 + "var f = async(1) => 1", + "var f = async('str') => 1", + "var f = async(/foo/) => 1", + "var f = async({ foo = async(1) => 1 }) => 1", + "var f = async({ foo = async(a) => 1 })", + + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, arraysize(always_flags)); + RunParserSyncTest(strict_context_data, strict_error_data, kError, NULL, 0, + always_flags, arraysize(always_flags)); + + RunParserSyncTest(context_data, formal_parameters_data, kError, NULL, 0, + always_flags, arraysize(always_flags)); + + // clang-format off + const char* async_body_context_data[][2] = { + { "async function f() {", "}" }, + { "var f = async function() {", "}" }, + { "var f = async() => {", "}" }, + { "var O = { async method() {", "} }" }, + { "'use strict'; async function f() {", "}" }, + { "'use strict'; var f = async function() {", "}" }, + { "'use strict'; var f = async() => {", "}" }, + { "'use strict'; var O = { async method() {", "} }" }, + { NULL, NULL } + }; + + const char* async_body_error_data[] = { + "var await = 1;", + "var { await } = 1;", + "var [ await ] = 1;", + "return async (await) => {};", + "var O = { async [await](a, a) {} }", + "await;", + + "function await() {}", + + "var f = await => 42;", + "var f = (await) => 42;", + "var f = (await, a) => 42;", + "var f = (...await) => 42;", + + "var e = (await);", + "var e = (await, f);", + "var e = (await = 42)", + + "var e = [await];", + "var e = {await};", + + NULL + }; + // clang-format on + + RunParserSyncTest(async_body_context_data, async_body_error_data, kError, + NULL, 0, always_flags, arraysize(always_flags)); +} + +TEST(AsyncAwaitModule) { + // clang-format off + const char* context_data[][2] = { + { "", "" }, + { NULL, NULL } + }; + + const char* data[] = { + "export default async function() { await 1; }", + "export default async function async() { await 1; }", + "export async function async() { await 1; }", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunModuleParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags), NULL, 0, false); +} + +TEST(AsyncAwaitModuleErrors) { + // clang-format off + const char* context_data[][2] = { + { "", "" }, + { NULL, NULL } + }; + + const char* error_data[] = { + "export default (async function await() {})", + "export default async function await() {}", + "export async function await() {}", + "export async function() {}", + "export async", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunModuleParserSyncTest(context_data, error_data, kError, NULL, 0, + always_flags, arraysize(always_flags), NULL, 0, + false); +} + +TEST(RestrictiveForInErrors) { + // clang-format off + const char* context_data[][2] = { + { "'use strict'", "" }, + { "", "" }, + { NULL, NULL } + }; + const char* error_data[] = { + "for (var x = 0 in {});", + "for (const x = 0 in {});", + "for (let x = 0 in {});", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyForIn}; + RunParserSyncTest(context_data, error_data, kError, nullptr, 0, always_flags, + arraysize(always_flags)); +} + +TEST(NoDuplicateGeneratorsInBlock) { + const char* block_context_data[][2] = { + {"'use strict'; {", "}"}, + {"{", "}"}, + {"(function() { {", "} })()"}, + {"(function() {'use strict'; {", "} })()"}, + {NULL, NULL}}; + const char* top_level_context_data[][2] = { + {"'use strict';", ""}, + {"", ""}, + {"(function() {", "})()"}, + {"(function() {'use strict';", "})()"}, + {NULL, NULL}}; + const char* error_data[] = {"function* x() {} function* x() {}", + "function x() {} function* x() {}", + "function* x() {} function x() {}", NULL}; + static const ParserFlag always_flags[] = {kAllowHarmonyRestrictiveGenerators}; + // The preparser doesn't enforce the restriction, so turn it off. + bool test_preparser = false; + RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, + always_flags, arraysize(always_flags), NULL, 0, false, + test_preparser); + RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, + always_flags, arraysize(always_flags)); +} + +TEST(NoDuplicateAsyncFunctionInBlock) { + const char* block_context_data[][2] = { + {"'use strict'; {", "}"}, + {"{", "}"}, + {"(function() { {", "} })()"}, + {"(function() {'use strict'; {", "} })()"}, + {NULL, NULL}}; + const char* top_level_context_data[][2] = { + {"'use strict';", ""}, + {"", ""}, + {"(function() {", "})()"}, + {"(function() {'use strict';", "})()"}, + {NULL, NULL}}; + const char* error_data[] = {"async function x() {} async function x() {}", + "function x() {} async function x() {}", + "async function x() {} function x() {}", + "function* x() {} async function x() {}", + "function* x() {} async function x() {}", + "async function x() {} function* x() {}", + "function* x() {} async function x() {}", + NULL}; + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + // The preparser doesn't enforce the restriction, so turn it off. + bool test_preparser = false; + RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, + always_flags, arraysize(always_flags), NULL, 0, false, + test_preparser); + RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, + always_flags, arraysize(always_flags)); +} + +TEST(TrailingCommasInParameters) { + // clang-format off + const char* context_data[][2] = { + { "", "" }, + { "'use strict';", "" }, + { "function foo() {", "}" }, + { "function foo() {'use strict';", "}" }, + { NULL, NULL } + }; + + const char* data[] = { + " function a(b,) {}", + " function* a(b,) {}", + "(function a(b,) {});", + "(function* a(b,) {});", + "(function (b,) {});", + "(function* (b,) {});", + " function a(b,c,d,) {}", + " function* a(b,c,d,) {}", + "(function a(b,c,d,) {});", + "(function* a(b,c,d,) {});", + "(function (b,c,d,) {});", + "(function* (b,c,d,) {});", + "(b,) => {};", + "(b,c,d,) => {};", + "a(1,);", + "a(1,2,3,);", + "a(...[],);", + "a(1, 2, ...[],);", + "a(...[], 2, ...[],);", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; + RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); +} + +TEST(TrailingCommasInParametersErrors) { + // clang-format off + const char* context_data[][2] = { + { "", "" }, + { "'use strict';", "" }, + { "function foo() {", "}" }, + { "function foo() {'use strict';", "}" }, + { NULL, NULL } + }; + + const char* data[] = { + // too many trailing commas + " function a(b,,) {}", + " function* a(b,,) {}", + "(function a(b,,) {});", + "(function* a(b,,) {});", + "(function (b,,) {});", + "(function* (b,,) {});", + " function a(b,c,d,,) {}", + " function* a(b,c,d,,) {}", + "(function a(b,c,d,,) {});", + "(function* a(b,c,d,,) {});", + "(function (b,c,d,,) {});", + "(function* (b,c,d,,) {});", + "(b,,) => {};", + "(b,c,d,,) => {};", + "a(1,,);", + "a(1,2,3,,);", + // only a trailing comma and no parameters + " function a1(,) {}", + " function* a2(,) {}", + "(function a3(,) {});", + "(function* a4(,) {});", + "(function (,) {});", + "(function* (,) {});", + "(,) => {};", + "a1(,);", + // no trailing commas after rest parameter declaration + " function a(...b,) {}", + " function* a(...b,) {}", + "(function a(...b,) {});", + "(function* a(...b,) {});", + "(function (...b,) {});", + "(function* (...b,) {});", + " function a(b, c, ...d,) {}", + " function* a(b, c, ...d,) {}", + "(function a(b, c, ...d,) {});", + "(function* a(b, c, ...d,) {});", + "(function (b, c, ...d,) {});", + "(function* (b, c, ...d,) {});", + "(...b,) => {};", + "(b, c, ...d,) => {};", + // parenthesized trailing comma without arrow is still an error + "(,);", + "(a,);", + "(a,b,c,);", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; + RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, + arraysize(always_flags)); } diff --git a/deps/v8/test/cctest/test-platform.cc b/deps/v8/test/cctest/test-platform.cc index 48eda3dbaa..a0fbc21f46 100644 --- a/deps/v8/test/cctest/test-platform.cc +++ b/deps/v8/test/cctest/test-platform.cc @@ -17,7 +17,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) { #elif V8_HOST_ARCH_IA32 __asm__ __volatile__("mov %%esp, %0" : "=g"(sp_addr)); #elif V8_HOST_ARCH_ARM - __asm__ __volatile__("str %%sp, %0" : "=g"(sp_addr)); + __asm__ __volatile__("str sp, %0" : "=g"(sp_addr)); #elif V8_HOST_ARCH_ARM64 __asm__ __volatile__("mov x16, sp; str x16, %0" : "=g"(sp_addr)); #elif V8_HOST_ARCH_MIPS diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc index 48633f5da1..2a133bf1f8 100644 --- a/deps/v8/test/cctest/test-profile-generator.cc +++ b/deps/v8/test/cctest/test-profile-generator.cc @@ -51,17 +51,17 @@ TEST(ProfileNodeFindOrAddChild) { CcTest::InitializeVM(); ProfileTree tree(CcTest::i_isolate()); ProfileNode* node = tree.root(); - CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); + CodeEntry entry1(i::CodeEventListener::FUNCTION_TAG, "aaa"); ProfileNode* childNode1 = node->FindOrAddChild(&entry1); CHECK(childNode1); CHECK_EQ(childNode1, node->FindOrAddChild(&entry1)); - CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); + CodeEntry entry2(i::CodeEventListener::FUNCTION_TAG, "bbb"); ProfileNode* childNode2 = node->FindOrAddChild(&entry2); CHECK(childNode2); CHECK_NE(childNode1, childNode2); CHECK_EQ(childNode1, node->FindOrAddChild(&entry1)); CHECK_EQ(childNode2, node->FindOrAddChild(&entry2)); - CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); + CodeEntry entry3(i::CodeEventListener::FUNCTION_TAG, "ccc"); ProfileNode* childNode3 = node->FindOrAddChild(&entry3); CHECK(childNode3); CHECK_NE(childNode1, childNode3); @@ -77,15 +77,15 @@ TEST(ProfileNodeFindOrAddChildForSameFunction) { const char* aaa = "aaa"; ProfileTree tree(CcTest::i_isolate()); ProfileNode* node = tree.root(); - CodeEntry entry1(i::Logger::FUNCTION_TAG, aaa); + CodeEntry entry1(i::CodeEventListener::FUNCTION_TAG, aaa); ProfileNode* childNode1 = node->FindOrAddChild(&entry1); CHECK(childNode1); CHECK_EQ(childNode1, node->FindOrAddChild(&entry1)); // The same function again. - CodeEntry entry2(i::Logger::FUNCTION_TAG, aaa); + CodeEntry entry2(i::CodeEventListener::FUNCTION_TAG, aaa); CHECK_EQ(childNode1, node->FindOrAddChild(&entry2)); // Now with a different security token. - CodeEntry entry3(i::Logger::FUNCTION_TAG, aaa); + CodeEntry entry3(i::CodeEventListener::FUNCTION_TAG, aaa); CHECK_EQ(childNode1, node->FindOrAddChild(&entry3)); } @@ -122,9 +122,9 @@ class ProfileTreeTestHelper { TEST(ProfileTreeAddPathFromEnd) { CcTest::InitializeVM(); - CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); - CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); - CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); + CodeEntry entry1(i::CodeEventListener::FUNCTION_TAG, "aaa"); + CodeEntry entry2(i::CodeEventListener::FUNCTION_TAG, "bbb"); + CodeEntry entry3(i::CodeEventListener::FUNCTION_TAG, "ccc"); ProfileTree tree(CcTest::i_isolate()); ProfileTreeTestHelper helper(&tree); CHECK(!helper.Walk(&entry1)); @@ -187,7 +187,7 @@ TEST(ProfileTreeCalculateTotalTicks) { empty_tree.root()->IncrementSelfTicks(); CHECK_EQ(1u, empty_tree.root()->self_ticks()); - CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); + CodeEntry entry1(i::CodeEventListener::FUNCTION_TAG, "aaa"); CodeEntry* e1_path[] = {&entry1}; std::vector<CodeEntry*> e1_path_vec(e1_path, e1_path + arraysize(e1_path)); @@ -201,7 +201,7 @@ TEST(ProfileTreeCalculateTotalTicks) { CHECK_EQ(1u, single_child_tree.root()->self_ticks()); CHECK_EQ(1u, node1->self_ticks()); - CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); + CodeEntry entry2(i::CodeEventListener::FUNCTION_TAG, "bbb"); CodeEntry* e2_e1_path[] = {&entry2, &entry1}; std::vector<CodeEntry*> e2_e1_path_vec(e2_e1_path, e2_e1_path + arraysize(e2_e1_path)); @@ -227,7 +227,7 @@ TEST(ProfileTreeCalculateTotalTicks) { CodeEntry* e2_path[] = {&entry2}; std::vector<CodeEntry*> e2_path_vec(e2_path, e2_path + arraysize(e2_path)); - CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); + CodeEntry entry3(i::CodeEventListener::FUNCTION_TAG, "ccc"); CodeEntry* e3_path[] = {&entry3}; std::vector<CodeEntry*> e3_path_vec(e3_path, e3_path + arraysize(e3_path)); @@ -277,10 +277,10 @@ static inline i::Address ToAddress(int n) { TEST(CodeMapAddCode) { CodeMap code_map; - CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); - CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); - CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); - CodeEntry entry4(i::Logger::FUNCTION_TAG, "ddd"); + CodeEntry entry1(i::CodeEventListener::FUNCTION_TAG, "aaa"); + CodeEntry entry2(i::CodeEventListener::FUNCTION_TAG, "bbb"); + CodeEntry entry3(i::CodeEventListener::FUNCTION_TAG, "ccc"); + CodeEntry entry4(i::CodeEventListener::FUNCTION_TAG, "ddd"); code_map.AddCode(ToAddress(0x1500), &entry1, 0x200); code_map.AddCode(ToAddress(0x1700), &entry2, 0x100); code_map.AddCode(ToAddress(0x1900), &entry3, 0x50); @@ -307,8 +307,8 @@ TEST(CodeMapAddCode) { TEST(CodeMapMoveAndDeleteCode) { CodeMap code_map; - CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); - CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); + CodeEntry entry1(i::CodeEventListener::FUNCTION_TAG, "aaa"); + CodeEntry entry2(i::CodeEventListener::FUNCTION_TAG, "bbb"); code_map.AddCode(ToAddress(0x1500), &entry1, 0x200); code_map.AddCode(ToAddress(0x1700), &entry2, 0x100); CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500))); @@ -316,7 +316,7 @@ TEST(CodeMapMoveAndDeleteCode) { code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb. CHECK(!code_map.FindEntry(ToAddress(0x1500))); CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700))); - CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); + CodeEntry entry3(i::CodeEventListener::FUNCTION_TAG, "ccc"); code_map.AddCode(ToAddress(0x1750), &entry3, 0x100); CHECK(!code_map.FindEntry(ToAddress(0x1700))); CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750))); @@ -344,12 +344,14 @@ class TestSetup { TEST(RecordTickSample) { TestSetup test_setup; - CpuProfilesCollection profiles(CcTest::heap()); + CpuProfilesCollection profiles(CcTest::i_isolate()); + CpuProfiler profiler(CcTest::i_isolate()); + profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", false); ProfileGenerator generator(&profiles); - CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); - CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); - CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); + 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"); generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); @@ -397,6 +399,10 @@ TEST(RecordTickSample) { ProfileNode* node4 = top_down_test_helper.Walk(entry1, entry3, entry1); CHECK(node4); CHECK_EQ(entry1, node4->entry()); + + delete entry1; + delete entry2; + delete entry3; } @@ -410,12 +416,14 @@ static void CheckNodeIds(ProfileNode* node, unsigned* expectedId) { TEST(SampleIds) { TestSetup test_setup; - CpuProfilesCollection profiles(CcTest::heap()); + CpuProfilesCollection profiles(CcTest::i_isolate()); + CpuProfiler profiler(CcTest::i_isolate()); + profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", true); ProfileGenerator generator(&profiles); - CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); - CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); - CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); + 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"); generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); @@ -456,15 +464,21 @@ TEST(SampleIds) { for (int i = 0; i < 3; i++) { CHECK_EQ(expected_id[i], profile->sample(i)->id()); } + + delete entry1; + delete entry2; + delete entry3; } TEST(NoSamples) { TestSetup test_setup; - CpuProfilesCollection profiles(CcTest::heap()); + CpuProfilesCollection profiles(CcTest::i_isolate()); + CpuProfiler profiler(CcTest::i_isolate()); + profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", false); ProfileGenerator generator(&profiles); - CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); + CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); // We are building the following calls tree: @@ -481,6 +495,8 @@ TEST(NoSamples) { CHECK_EQ(3u, nodeId - 1); CHECK_EQ(0, profile->samples_count()); + + delete entry1; } @@ -503,17 +519,18 @@ TEST(RecordStackTraceAtStartProfiling) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); + std::unique_ptr<i::CpuProfiler> iprofiler( + new i::CpuProfiler(CcTest::i_isolate())); + i::ProfilerExtension::set_profiler(iprofiler.get()); - CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler(); - CHECK_EQ(0, profiler->GetProfilesCount()); CompileRun( "function c() { startProfiling(); }\n" "function b() { c(); }\n" "function a() { b(); }\n" "a();\n" "stopProfiling();"); - CHECK_EQ(1, profiler->GetProfilesCount()); - CpuProfile* profile = profiler->GetProfile(0); + CHECK_EQ(1, iprofiler->GetProfilesCount()); + CpuProfile* profile = iprofiler->GetProfile(0); const ProfileTree* topDown = profile->top_down(); const ProfileNode* current = topDown->root(); const_cast<ProfileNode*>(current)->Print(0); @@ -544,7 +561,9 @@ TEST(RecordStackTraceAtStartProfiling) { TEST(Issue51919) { - CpuProfilesCollection collection(CcTest::heap()); + CpuProfilesCollection collection(CcTest::i_isolate()); + CpuProfiler profiler(CcTest::i_isolate()); + collection.set_cpu_profiler(&profiler); i::EmbeddedVector<char*, CpuProfilesCollection::kMaxSimultaneousProfiles> titles; for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) { @@ -579,10 +598,9 @@ TEST(ProfileNodeScriptId) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); + std::unique_ptr<CpuProfiler> iprofiler(new CpuProfiler(CcTest::i_isolate())); + i::ProfilerExtension::set_profiler(iprofiler.get()); - v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); - i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); - CHECK_EQ(0, iprofiler->GetProfilesCount()); v8::Local<v8::Script> script_a = v8_compile(v8_str("function a() { startProfiling(); }\n")); script_a->Run(v8::Isolate::GetCurrent()->GetCurrentContext()) @@ -618,16 +636,12 @@ TEST(ProfileNodeScriptId) { CHECK_EQ(script_a->GetUnboundScript()->GetId(), current->GetScriptId()); } - - - static const char* line_number_test_source_existing_functions = "function foo_at_the_first_line() {\n" "}\n" "foo_at_the_first_line();\n" "function lazy_func_at_forth_line() {}\n"; - static const char* line_number_test_source_profile_time_functions = "// Empty first line\n" "function bar_at_the_second_line() {\n" @@ -636,23 +650,18 @@ static const char* line_number_test_source_profile_time_functions = "bar_at_the_second_line();\n" "function lazy_func_at_6th_line() {}"; -int GetFunctionLineNumber(LocalContext* env, const char* name) { - CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler(); - CodeMap* code_map = profiler->generator()->code_map(); +int GetFunctionLineNumber(CpuProfiler& profiler, LocalContext& env, + const char* name) { + CodeMap* code_map = profiler.generator()->code_map(); i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - (*(*env)) - ->Global() - ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), - v8_str(name)) - .ToLocalChecked()))); + env->Global()->Get(env.local(), v8_str(name)).ToLocalChecked()))); CodeEntry* func_entry = code_map->FindEntry(func->abstract_code()->address()); if (!func_entry) FATAL(name); return func_entry->line_number(); } - TEST(LineNumber) { i::FLAG_use_inlining = false; @@ -665,45 +674,38 @@ TEST(LineNumber) { CompileRun(line_number_test_source_existing_functions); - CpuProfiler* profiler = isolate->cpu_profiler(); - profiler->StartProfiling("LineNumber"); + CpuProfiler profiler(isolate); + profiler.StartProfiling("LineNumber"); CompileRun(line_number_test_source_profile_time_functions); - profiler->processor()->StopSynchronously(); + profiler.processor()->StopSynchronously(); bool is_lazy = i::FLAG_lazy && !(i::FLAG_ignition && i::FLAG_ignition_eager); - CHECK_EQ(1, GetFunctionLineNumber(&env, "foo_at_the_first_line")); + CHECK_EQ(1, GetFunctionLineNumber(profiler, env, "foo_at_the_first_line")); CHECK_EQ(is_lazy ? 0 : 4, - GetFunctionLineNumber(&env, "lazy_func_at_forth_line")); - CHECK_EQ(2, GetFunctionLineNumber(&env, "bar_at_the_second_line")); + GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line")); + CHECK_EQ(2, GetFunctionLineNumber(profiler, env, "bar_at_the_second_line")); CHECK_EQ(is_lazy ? 0 : 6, - GetFunctionLineNumber(&env, "lazy_func_at_6th_line")); + GetFunctionLineNumber(profiler, env, "lazy_func_at_6th_line")); - profiler->StopProfiling("LineNumber"); + profiler.StopProfiling("LineNumber"); } - - TEST(BailoutReason) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Context::Scope context_scope(env); + std::unique_ptr<CpuProfiler> iprofiler(new CpuProfiler(CcTest::i_isolate())); + i::ProfilerExtension::set_profiler(iprofiler.get()); - v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); - i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler); CHECK_EQ(0, iprofiler->GetProfilesCount()); v8::Local<v8::Script> script = v8_compile(v8_str("function Debugger() {\n" " debugger;\n" " startProfiling();\n" "}\n" - "function TryFinally() {\n" - " try {\n" - " Debugger();\n" - " } finally { };\n" - "}\n" - "TryFinally();\n" + "Debugger();\n" "stopProfiling();")); script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked(); CHECK_EQ(1, iprofiler->GetProfilesCount()); @@ -715,15 +717,10 @@ TEST(BailoutReason) { // The tree should look like this: // (root) // "" - // kTryFinallyStatement - // kDebuggerStatement + // kDebuggerStatement current = PickChild(current, ""); CHECK(const_cast<v8::CpuProfileNode*>(current)); - current = PickChild(current, "TryFinally"); - CHECK(const_cast<v8::CpuProfileNode*>(current)); - CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); - current = PickChild(current, "Debugger"); CHECK(const_cast<v8::CpuProfileNode*>(current)); CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index 0a153b78e0..504a52bc28 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -26,6 +26,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <cstdlib> +#include <memory> #include <sstream> #include "include/v8.h" @@ -171,7 +172,6 @@ static MinMaxPair CheckMinMaxMatch(const char* input) { void TestRegExpParser(bool lookbehind) { FLAG_harmony_regexp_lookbehind = lookbehind; - FLAG_harmony_unicode_regexps = true; CHECK_PARSE_ERROR("?"); @@ -438,6 +438,23 @@ void TestRegExpParser(bool lookbehind) { CHECK_MIN_MAX("a(?=b)c", 2, 2); CHECK_MIN_MAX("a(?=bbb|bb)c", 2, 2); CHECK_MIN_MAX("a(?!bbb|bb)c", 2, 2); + + FLAG_harmony_regexp_named_captures = true; + CheckParseEq("(?<a>x)(?<b>x)(?<c>x)\\k<a>", + "(: (^ 'x') (^ 'x') (^ 'x') (<- 1))", true); + CheckParseEq("(?<a>x)(?<b>x)(?<c>x)\\k<b>", + "(: (^ 'x') (^ 'x') (^ 'x') (<- 2))", true); + CheckParseEq("(?<a>x)(?<b>x)(?<c>x)\\k<c>", + "(: (^ 'x') (^ 'x') (^ 'x') (<- 3))", true); + CheckParseEq("(?<a>a)\\k<a>", "(: (^ 'a') (<- 1))", true); + CheckParseEq("(?<a>a\\k<a>)", "(^ 'a')", true); + CheckParseEq("(?<a>\\k<a>a)", "(^ 'a')", true); + CheckParseEq("(?<a>\\k<b>)(?<b>\\k<a>)", "(: (^ (<- 2)) (^ (<- 1)))", true); + CheckParseEq("\\k<a>(?<a>a)", "(: (<- 1) (^ 'a'))", true); + + CheckParseEq("(?<\\u{03C0}>a)", "(^ 'a')", true); + CheckParseEq("(?<\\u03C0>a)", "(^ 'a')", true); + FLAG_harmony_regexp_named_captures = false; } @@ -450,7 +467,6 @@ TEST(ParserWithoutLookbehind) { TestRegExpParser(true); // Lookbehind enabled. } - TEST(ParserRegression) { CheckParseEq("[A-Z$-][x]", "(! [A-Z $ -] [x])"); CheckParseEq("a{3,4*}", "(: 'a{3,' (# 0 - g '4') '}')"); @@ -458,17 +474,19 @@ TEST(ParserRegression) { CheckParseEq("a|", "(| 'a' %)"); } -static void ExpectError(const char* input, - const char* expected) { +static void ExpectError(const char* input, const char* expected, + bool unicode = false) { v8::HandleScope scope(CcTest::isolate()); Zone zone(CcTest::i_isolate()->allocator()); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); RegExpCompileData result; - CHECK(!v8::internal::RegExpParser::ParseRegExp( - CcTest::i_isolate(), &zone, &reader, JSRegExp::kNone, &result)); + JSRegExp::Flags flags = JSRegExp::kNone; + if (unicode) flags |= JSRegExp::kUnicode; + CHECK(!v8::internal::RegExpParser::ParseRegExp(CcTest::i_isolate(), &zone, + &reader, flags, &result)); CHECK(result.tree == NULL); CHECK(!result.error.is_null()); - v8::base::SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); + std::unique_ptr<char[]> str = result.error->ToCString(ALLOW_NULLS); CHECK_EQ(0, strcmp(expected, str.get())); } @@ -499,6 +517,23 @@ TEST(Errors) { os << "()"; } ExpectError(os.str().c_str(), kTooManyCaptures); + + FLAG_harmony_regexp_named_captures = true; + const char* kInvalidCaptureName = "Invalid capture group name"; + ExpectError("(?<>.)", kInvalidCaptureName, true); + ExpectError("(?<1>.)", kInvalidCaptureName, true); + ExpectError("(?<_%>.)", kInvalidCaptureName, true); + ExpectError("\\k<a", kInvalidCaptureName, true); + const char* kDuplicateCaptureName = "Duplicate capture group name"; + ExpectError("(?<a>.)(?<a>.)", kDuplicateCaptureName, true); + const char* kInvalidUnicodeEscape = "Invalid Unicode escape sequence"; + ExpectError("(?<\\u{FISK}", kInvalidUnicodeEscape, true); + const char* kInvalidCaptureReferenced = "Invalid named capture referenced"; + ExpectError("\\k<a>", kInvalidCaptureReferenced, true); + ExpectError("(?<b>)\\k<a>", kInvalidCaptureReferenced, true); + const char* kInvalidNamedReference = "Invalid named reference"; + ExpectError("\\ka", kInvalidNamedReference, true); + FLAG_harmony_regexp_named_captures = false; } diff --git a/deps/v8/test/cctest/test-reloc-info.cc b/deps/v8/test/cctest/test-reloc-info.cc deleted file mode 100644 index 4346f0083e..0000000000 --- a/deps/v8/test/cctest/test-reloc-info.cc +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2011 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/assembler.h" -#include "src/macro-assembler.h" -#include "test/cctest/cctest.h" - -namespace v8 { -namespace internal { - -static void WriteRinfo(RelocInfoWriter* writer, - byte* pc, RelocInfo::Mode mode, intptr_t data) { - RelocInfo rinfo(CcTest::i_isolate(), pc, mode, data, NULL); - writer->Write(&rinfo); -} - - -// Tests that writing both types of positions and then reading either -// or both works as expected. -TEST(Positions) { - CcTest::InitializeVM(); - const int code_size = 10 * KB; - int relocation_info_size = 10 * KB; - const int buffer_size = code_size + relocation_info_size; - v8::base::SmartArrayPointer<byte> buffer(new byte[buffer_size]); - - byte* pc = buffer.get(); - byte* buffer_end = buffer.get() + buffer_size; - - RelocInfoWriter writer(buffer_end, pc); - byte* relocation_info_end = buffer_end - relocation_info_size; - for (int i = 0, pos = 0; i < 100; i++, pc += i, pos += i) { - RelocInfo::Mode mode = (i % 2 == 0) ? - RelocInfo::STATEMENT_POSITION : RelocInfo::POSITION; - if (mode == RelocInfo::STATEMENT_POSITION) { - printf("TEST WRITING STATEMENT %p %d\n", pc, pos); - } else { - printf("TEST WRITING POSITION %p %d\n", pc, pos); - } - WriteRinfo(&writer, pc, mode, pos); - CHECK(writer.pos() - RelocInfoWriter::kMaxSize >= relocation_info_end); - } - - writer.Finish(); - relocation_info_size = static_cast<int>(buffer_end - writer.pos()); - MacroAssembler assm(CcTest::i_isolate(), nullptr, 0, CodeObjectRequired::kNo); - CodeDesc desc = {buffer.get(), buffer_size, code_size, - relocation_info_size, 0, &assm}; - - // Read only (non-statement) positions. - { - RelocIterator it(desc, RelocInfo::ModeMask(RelocInfo::POSITION)); - pc = buffer.get(); - for (int i = 0, pos = 0; i < 100; i++, pc += i, pos += i) { - printf("TESTING 1: %d\n", i); - RelocInfo::Mode mode = (i % 2 == 0) ? - RelocInfo::STATEMENT_POSITION : RelocInfo::POSITION; - if (mode == RelocInfo::POSITION) { - CHECK_EQ(pc, it.rinfo()->pc()); - CHECK_EQ(mode, it.rinfo()->rmode()); - CHECK_EQ(pos, static_cast<int>(it.rinfo()->data())); - it.next(); - } - } - CHECK(it.done()); - } - - // Read only statement positions. - { - RelocIterator it(desc, RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION)); - pc = buffer.get(); - for (int i = 0, pos = 0; i < 100; i++, pc += i, pos += i) { - RelocInfo::Mode mode = (i % 2 == 0) ? - RelocInfo::STATEMENT_POSITION : RelocInfo::POSITION; - if (mode == RelocInfo::STATEMENT_POSITION) { - CHECK_EQ(pc, it.rinfo()->pc()); - CHECK_EQ(mode, it.rinfo()->rmode()); - CHECK_EQ(pos, static_cast<int>(it.rinfo()->data())); - it.next(); - } - } - CHECK(it.done()); - } - - // Read both types of positions. - { - RelocIterator it(desc, RelocInfo::kPositionMask); - pc = buffer.get(); - for (int i = 0, pos = 0; i < 100; i++, pc += i, pos += i) { - RelocInfo::Mode mode = (i % 2 == 0) ? - RelocInfo::STATEMENT_POSITION : RelocInfo::POSITION; - CHECK_EQ(pc, it.rinfo()->pc()); - CHECK_EQ(mode, it.rinfo()->rmode()); - CHECK_EQ(pos, static_cast<int>(it.rinfo()->data())); - it.next(); - } - CHECK(it.done()); - } -} - -} // namespace internal -} // namespace v8 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 adfeb28b2f..b2e6ec3a3b 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc @@ -23,8 +23,7 @@ using namespace v8::internal::compiler; static int32_t DummyStaticFunction(Object* result) { return 1; } -TEST(WasmRelocationArm) { - CcTest::InitializeVM(); +TEST(WasmRelocationArmMemoryReference) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); v8::internal::byte buffer[4096]; @@ -77,4 +76,59 @@ TEST(WasmRelocationArm) { #endif } +TEST(WasmRelocationArmMemorySizeReference) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + v8::internal::byte buffer[4096]; + DummyStaticFunction(NULL); + int32_t size = 512; + Label fail; + + Assembler assm(isolate, buffer, sizeof buffer); + + __ mov(r0, Operand(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ cmp(r0, Operand(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ b(ne, &fail); + __ mov(pc, Operand(lr)); + __ bind(&fail); + __ mov(r0, Operand(0xdeadbeef)); + __ mov(pc, Operand(lr)); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + CSignature0<int32_t> csig; + CodeRunner<int32_t> runnable(isolate, code, &csig); + int32_t ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); + ::printf("f() = %d\n\n", ret_value); +#endif + size_t diff = 512; + + 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); + } + } + + ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef DEBUG + code->Print(os); + ::printf("f() = %d\n\n", ret_value); +#endif +} #undef __ 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 48f9e85ba1..3b49f00afc 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc @@ -24,8 +24,7 @@ using namespace v8::internal::compiler; static int64_t DummyStaticFunction(Object* result) { return 1; } -TEST(WasmRelocationArm64) { - CcTest::InitializeVM(); +TEST(WasmRelocationArm64MemoryReference) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); v8::internal::byte buffer[4096]; @@ -51,7 +50,7 @@ TEST(WasmRelocationArm64) { #ifdef DEBUG OFStream os(stdout); code->Print(os); - ::printf("f() = %ld\n\n", ret_value); + ::printf("f() = %" PRIx64 "\n\n", ret_value); #endif size_t offset = 1234; @@ -75,7 +74,64 @@ TEST(WasmRelocationArm64) { #ifdef DEBUG code->Print(os); - ::printf("f() = %ld\n\n", ret_value); + ::printf("f() = %" PRIx64 "\n\n", ret_value); +#endif +} + +TEST(WasmRelocationArm64MemorySizeReference) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + v8::internal::byte buffer[4096]; + DummyStaticFunction(NULL); + Immediate size = Immediate(512, RelocInfo::WASM_MEMORY_SIZE_REFERENCE); + Label fail; + + MacroAssembler masm(isolate, buffer, sizeof buffer, + v8::internal::CodeObjectRequired::kYes); + + __ Mov(x0, size); + __ Cmp(x0, size); + __ B(ne, &fail); + __ Ret(); + __ Bind(&fail); + __ Mov(x0, Immediate(0xdeadbeef)); + __ Ret(); + + CodeDesc desc; + masm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + CSignature0<int64_t> csig; + CodeRunner<int64_t> runnable(isolate, code, &csig); + int64_t ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); + ::printf("f() = %" PRIx64 "\n\n", ret_value); +#endif + int32_t diff = 512; + + 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); + } + } + + ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef DEBUG + code->Print(os); + ::printf("f() = %" PRIx64 "\n\n", ret_value); #endif } 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 135b522df5..305d0089c3 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc @@ -23,8 +23,7 @@ using namespace v8::internal::compiler; static int32_t DummyStaticFunction(Object* result) { return 1; } -TEST(WasmRelocationIa32) { - CcTest::InitializeVM(); +TEST(WasmRelocationIa32MemoryReference) { Isolate* isolate = CcTest::i_isolate(); Zone zone(isolate->allocator()); HandleScope scope(isolate); @@ -78,7 +77,6 @@ TEST(WasmRelocationIa32) { CHECK_EQ(ret_value, imm + offset); #ifdef OBJECT_PRINT - // OFStream os(stdout); code->Print(os); begin = code->instruction_start(); end = begin + code->instruction_size(); @@ -86,4 +84,67 @@ TEST(WasmRelocationIa32) { #endif } +TEST(WasmRelocationIa32MemorySizeReference) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Zone zone(isolate->allocator()); + HandleScope scope(isolate); + v8::internal::byte buffer[4096]; + Assembler assm(isolate, buffer, sizeof buffer); + DummyStaticFunction(NULL); + int32_t size = 80; + Label fail; + + __ mov(eax, Immediate(reinterpret_cast<Address>(size), + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ cmp(eax, Immediate(reinterpret_cast<Address>(size), + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ j(not_equal, &fail); + __ ret(0); + __ bind(&fail); + __ mov(eax, 0xdeadbeef); + __ ret(0); + + CSignature0<int32_t> csig; + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + USE(code); + + CodeRunner<int32_t> runnable(isolate, code, &csig); + int32_t ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef OBJECT_PRINT + OFStream os(stdout); + code->Print(os); + byte* begin = code->instruction_start(); + byte* end = begin + code->instruction_size(); + disasm::Disassembler::Disassemble(stdout, begin, end); +#endif + + size_t offset = 10; + + 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); + } + } + + ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef OBJECT_PRINT + code->Print(os); + begin = code->instruction_start(); + end = begin + code->instruction_size(); + disasm::Disassembler::Disassemble(stdout, begin, end); +#endif +} #undef __ 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 f1b6d96b8c..11fa45164e 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc @@ -21,8 +21,8 @@ using namespace v8::internal::compiler; #define __ assm. static int32_t DummyStaticFunction(Object* result) { return 1; } -TEST(WasmRelocationX64movq64) { - CcTest::InitializeVM(); + +TEST(WasmRelocationX64MemoryReference) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); v8::internal::byte buffer[4096]; @@ -80,4 +80,63 @@ TEST(WasmRelocationX64movq64) { #endif } +TEST(WasmRelocationX64WasmMemorySizeReference) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + v8::internal::byte buffer[4096]; + Assembler assm(isolate, buffer, sizeof buffer); + DummyStaticFunction(NULL); + int32_t size = 512; + Label fail; + + __ movl(rax, Immediate(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ cmpl(rax, Immediate(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ j(not_equal, &fail); + __ ret(0); + __ bind(&fail); + __ movl(rax, Immediate(0xdeadbeef)); + __ ret(0); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + USE(code); + + CSignature0<int64_t> csig; + CodeRunner<int64_t> runnable(isolate, code, &csig); + int64_t ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef OBJECT_PRINT + OFStream os(stdout); + code->Print(os); + byte* begin = code->instruction_start(); + byte* end = begin + code->instruction_size(); + disasm::Disassembler::Disassemble(stdout, begin, end); +#endif + int32_t diff = 512; + + 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); + } + } + + ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef OBJECT_PRINT + code->Print(os); + begin = code->instruction_start(); + end = begin + code->instruction_size(); + disasm::Disassembler::Disassemble(stdout, begin, end); +#endif +} #undef __ 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 6cbd065c1b..2156e96ecb 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc @@ -23,8 +23,7 @@ using namespace v8::internal::compiler; static int32_t DummyStaticFunction(Object* result) { return 1; } -TEST(WasmRelocationIa32) { - CcTest::InitializeVM(); +TEST(WasmRelocationX87MemoryReference) { Isolate* isolate = CcTest::i_isolate(); Zone zone(isolate->allocator()); HandleScope scope(isolate); @@ -78,7 +77,6 @@ TEST(WasmRelocationIa32) { CHECK_EQ(ret_value, imm + offset); #ifdef OBJECT_PRINT - // OFStream os(stdout); code->Print(os); begin = code->instruction_start(); end = begin + code->instruction_size(); @@ -86,4 +84,67 @@ TEST(WasmRelocationIa32) { #endif } +TEST(WasmRelocationX87MemorySizeReference) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Zone zone(isolate->allocator()); + HandleScope scope(isolate); + v8::internal::byte buffer[4096]; + Assembler assm(isolate, buffer, sizeof buffer); + DummyStaticFunction(NULL); + int32_t size = 80; + Label fail; + + __ mov(eax, Immediate(reinterpret_cast<Address>(size), + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ cmp(eax, Immediate(reinterpret_cast<Address>(size), + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + __ j(not_equal, &fail); + __ ret(0); + __ bind(&fail); + __ mov(eax, 0xdeadbeef); + __ ret(0); + + CSignature0<int32_t> csig; + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + USE(code); + + CodeRunner<int32_t> runnable(isolate, code, &csig); + int32_t ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef OBJECT_PRINT + OFStream os(stdout); + code->Print(os); + byte* begin = code->instruction_start(); + byte* end = begin + code->instruction_size(); + disasm::Disassembler::Disassemble(stdout, begin, end); +#endif + + size_t offset = 10; + + 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); + } + } + + ret_value = runnable.Call(); + CHECK_NE(ret_value, 0xdeadbeef); + +#ifdef OBJECT_PRINT + code->Print(os); + begin = code->instruction_start(); + end = begin + code->instruction_size(); + disasm::Disassembler::Disassemble(stdout, begin, end); +#endif +} #undef __ diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index cd349f9d73..b2bf51b1c6 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -31,11 +31,12 @@ #include "src/v8.h" -#include "src/ast/scopeinfo.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/parsing/parser.h" #include "src/runtime/runtime.h" @@ -46,7 +47,7 @@ #include "src/snapshot/snapshot.h" #include "src/snapshot/startup-serializer.h" #include "test/cctest/cctest.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" using namespace v8::internal; @@ -91,11 +92,11 @@ static Vector<const byte> Serialize(v8::Isolate* isolate) { Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate); internal_isolate->heap()->CollectAllAvailableGarbage("serialize"); - SnapshotByteSink sink; - StartupSerializer ser(internal_isolate, &sink); + StartupSerializer ser(internal_isolate, + v8::SnapshotCreator::FunctionCodeHandling::kClear); ser.SerializeStrongReferences(); ser.SerializeWeakReferencesAndDeferred(); - SnapshotData snapshot_data(ser); + SnapshotData snapshot_data(&ser); return WritePayload(snapshot_data.RawData()); } @@ -280,19 +281,17 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out, } env.Reset(); - SnapshotByteSink startup_sink; - StartupSerializer startup_serializer(isolate, &startup_sink); + StartupSerializer startup_serializer( + isolate, v8::SnapshotCreator::FunctionCodeHandling::kClear); startup_serializer.SerializeStrongReferences(); - SnapshotByteSink partial_sink; - PartialSerializer partial_serializer(isolate, &startup_serializer, - &partial_sink); + PartialSerializer partial_serializer(isolate, &startup_serializer); partial_serializer.Serialize(&raw_foo); startup_serializer.SerializeWeakReferencesAndDeferred(); - SnapshotData startup_snapshot(startup_serializer); - SnapshotData partial_snapshot(partial_serializer); + SnapshotData startup_snapshot(&startup_serializer); + SnapshotData partial_snapshot(&partial_serializer); *partial_blob_out = WritePayload(partial_snapshot.RawData()); *startup_blob_out = WritePayload(startup_snapshot.RawData()); @@ -380,17 +379,17 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, env.Reset(); SnapshotByteSink startup_sink; - StartupSerializer startup_serializer(isolate, &startup_sink); + StartupSerializer startup_serializer( + isolate, v8::SnapshotCreator::FunctionCodeHandling::kClear); startup_serializer.SerializeStrongReferences(); SnapshotByteSink partial_sink; - PartialSerializer partial_serializer(isolate, &startup_serializer, - &partial_sink); + PartialSerializer partial_serializer(isolate, &startup_serializer); partial_serializer.Serialize(&raw_context); startup_serializer.SerializeWeakReferencesAndDeferred(); - SnapshotData startup_snapshot(startup_serializer); - SnapshotData partial_snapshot(partial_serializer); + SnapshotData startup_snapshot(&startup_serializer); + SnapshotData partial_snapshot(&partial_serializer); *partial_blob_out = WritePayload(partial_snapshot.RawData()); *startup_blob_out = WritePayload(startup_snapshot.RawData()); @@ -498,17 +497,17 @@ static void PartiallySerializeCustomContext( env.Reset(); SnapshotByteSink startup_sink; - StartupSerializer startup_serializer(isolate, &startup_sink); + StartupSerializer startup_serializer( + isolate, v8::SnapshotCreator::FunctionCodeHandling::kClear); startup_serializer.SerializeStrongReferences(); SnapshotByteSink partial_sink; - PartialSerializer partial_serializer(isolate, &startup_serializer, - &partial_sink); + PartialSerializer partial_serializer(isolate, &startup_serializer); partial_serializer.Serialize(&raw_context); startup_serializer.SerializeWeakReferencesAndDeferred(); - SnapshotData startup_snapshot(startup_serializer); - SnapshotData partial_snapshot(partial_serializer); + SnapshotData startup_snapshot(&startup_serializer); + SnapshotData partial_snapshot(&partial_serializer); *partial_blob_out = WritePayload(partial_snapshot.RawData()); *startup_blob_out = WritePayload(startup_snapshot.RawData()); @@ -792,7 +791,7 @@ bool IsCompiled(const char* name) { TEST(SnapshotDataBlobWithWarmup) { DisableTurbofan(); - const char* warmup = "Math.tan(1); Math.sin = 1;"; + const char* warmup = "Math.abs(1); Math.random = 1;"; v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(); v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup); @@ -811,9 +810,9 @@ TEST(SnapshotDataBlobWithWarmup) { v8::Context::Scope c_scope(context); // Running the warmup script has effect on whether functions are // pre-compiled, but does not pollute the context. - CHECK(IsCompiled("Math.tan")); - CHECK(!IsCompiled("Math.cos")); - CHECK(CompileRun("Math.sin")->IsFunction()); + CHECK(IsCompiled("Math.abs")); + CHECK(!IsCompiled("Number.isFinite")); + CHECK(CompileRun("Math.random")->IsFunction()); } isolate->Dispose(); } @@ -821,9 +820,9 @@ TEST(SnapshotDataBlobWithWarmup) { TEST(CustomSnapshotDataBlobWithWarmup) { DisableTurbofan(); const char* source = - "function f() { return Math.sin(1); }\n" - "function g() { return Math.cos(1); }\n" - "Math.tan(1);" + "function f() { return Math.abs(1); }\n" + "function g() { return Number.isFinite(1); }\n" + "Number.isNaN(1);" "var a = 5"; const char* warmup = "a = f()"; @@ -845,10 +844,10 @@ TEST(CustomSnapshotDataBlobWithWarmup) { // Running the warmup script has effect on whether functions are // pre-compiled, but does not pollute the context. CHECK(IsCompiled("f")); - CHECK(IsCompiled("Math.sin")); + CHECK(IsCompiled("Math.abs")); CHECK(!IsCompiled("g")); - CHECK(!IsCompiled("Math.cos")); - CHECK(!IsCompiled("Math.tan")); + CHECK(!IsCompiled("Number.isFinite")); + CHECK(!IsCompiled("Number.isNaN")); CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); } isolate->Dispose(); @@ -1062,10 +1061,14 @@ TEST(CodeSerializerLargeCodeObject) { v8::HandleScope scope(CcTest::isolate()); + // The serializer only tests the shared code, which is always the unoptimized + // code. Don't even bother generating optimized code to avoid timeouts. + FLAG_always_opt = false; + Vector<const uint8_t> source = - ConstructSource(STATIC_CHAR_VECTOR("var j=1; try { if (j) throw 1;"), - STATIC_CHAR_VECTOR("for(var i=0;i<1;i++)j++;"), - STATIC_CHAR_VECTOR("} catch (e) { j=7; } j"), 10000); + ConstructSource(STATIC_CHAR_VECTOR("var j=1; if (!j) {"), + STATIC_CHAR_VECTOR("for (let i of Object.prototype);"), + STATIC_CHAR_VECTOR("} j=7; j"), 2000); Handle<String> source_str = isolate->factory()->NewStringFromOneByte(source).ToHandleChecked(); @@ -1076,7 +1079,7 @@ TEST(CodeSerializerLargeCodeObject) { CompileScript(isolate, source_str, Handle<String>(), &cache, v8::ScriptCompiler::kProduceCodeCache); - CHECK(isolate->heap()->InSpace(orig->code(), LO_SPACE)); + CHECK(isolate->heap()->InSpace(orig->abstract_code(), LO_SPACE)); Handle<SharedFunctionInfo> copy; { @@ -1827,12 +1830,351 @@ TEST(Regress503552) { false); delete script_data; - SimulateIncrementalMarking(isolate->heap()); + heap::SimulateIncrementalMarking(isolate->heap()); script_data = CodeSerializer::Serialize(isolate, shared, source); delete script_data; } +#if V8_TARGET_ARCH_X64 +TEST(CodeSerializerCell) { + FLAG_serialize_toplevel = true; + LocalContext context; + Isolate* isolate = CcTest::i_isolate(); + isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + + v8::HandleScope scope(CcTest::isolate()); + + size_t actual_size; + byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( + Assembler::kMinimalBufferSize, &actual_size, true)); + CHECK(buffer); + HandleScope handles(isolate); + + MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), + v8::internal::CodeObjectRequired::kYes); + assembler.enable_serializer(); + Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(0.3); + CHECK(isolate->heap()->InNewSpace(*number)); + Handle<Code> code; + { + MacroAssembler* masm = &assembler; + Handle<Cell> cell = isolate->factory()->NewCell(number); + masm->Move(rax, cell, RelocInfo::CELL); + masm->movp(rax, Operand(rax, 0)); + masm->ret(0); + CodeDesc desc; + masm->GetCode(&desc); + code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION), + masm->CodeObject()); + code->set_has_reloc_info_for_serialization(true); + } + RelocIterator rit1(*code, 1 << RelocInfo::CELL); + CHECK_EQ(*number, rit1.rinfo()->target_cell()->value()); + + Handle<String> source = isolate->factory()->empty_string(); + Handle<SharedFunctionInfo> sfi = + isolate->factory()->NewSharedFunctionInfo(source, code, false); + ScriptData* script_data = CodeSerializer::Serialize(isolate, sfi, source); + + Handle<SharedFunctionInfo> copy = + CodeSerializer::Deserialize(isolate, script_data, source) + .ToHandleChecked(); + RelocIterator rit2(copy->code(), 1 << RelocInfo::CELL); + CHECK(rit2.rinfo()->target_cell()->IsCell()); + Handle<Cell> cell(rit2.rinfo()->target_cell()); + CHECK(cell->value()->IsHeapNumber()); + CHECK_EQ(0.3, HeapNumber::cast(cell->value())->value()); + + delete script_data; +} +#endif // V8_TARGET_ARCH_X64 + +TEST(CodeSerializerEmbeddedObject) { + FLAG_serialize_toplevel = true; + LocalContext context; + Isolate* isolate = CcTest::i_isolate(); + isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + Heap* heap = isolate->heap(); + v8::HandleScope scope(CcTest::isolate()); + + size_t actual_size; + byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( + Assembler::kMinimalBufferSize, &actual_size, true)); + CHECK(buffer); + HandleScope handles(isolate); + + MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), + v8::internal::CodeObjectRequired::kYes); + assembler.enable_serializer(); + Handle<Object> number = isolate->factory()->NewHeapNumber(0.3); + CHECK(isolate->heap()->InNewSpace(*number)); + Handle<Code> code; + { + MacroAssembler* masm = &assembler; + masm->Push(number); + CodeDesc desc; + masm->GetCode(&desc); + code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION), + masm->CodeObject()); + code->set_has_reloc_info_for_serialization(true); + } + RelocIterator rit1(*code, RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); + CHECK_EQ(*number, rit1.rinfo()->target_object()); + + Handle<String> source = isolate->factory()->empty_string(); + Handle<SharedFunctionInfo> sfi = + isolate->factory()->NewSharedFunctionInfo(source, code, false); + ScriptData* script_data = CodeSerializer::Serialize(isolate, sfi, source); + + Handle<SharedFunctionInfo> copy = + CodeSerializer::Deserialize(isolate, script_data, source) + .ToHandleChecked(); + RelocIterator rit2(copy->code(), + RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); + CHECK(rit2.rinfo()->target_object()->IsHeapNumber()); + CHECK_EQ(0.3, HeapNumber::cast(rit2.rinfo()->target_object())->value()); + + heap->CollectAllAvailableGarbage(); + + RelocIterator rit3(copy->code(), + RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); + CHECK(rit3.rinfo()->target_object()->IsHeapNumber()); + CHECK_EQ(0.3, HeapNumber::cast(rit3.rinfo()->target_object())->value()); + + delete script_data; +} + +TEST(SnapshotCreatorMultipleContexts) { + DisableTurbofan(); + v8::StartupData blob; + { + v8::SnapshotCreator creator; + v8::Isolate* isolate = creator.GetIsolate(); + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + CompileRun("var f = function() { return 1; }"); + CHECK_EQ(0, creator.AddContext(context)); + } + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + CompileRun("var f = function() { return 2; }"); + CHECK_EQ(1, creator.AddContext(context)); + } + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + CHECK_EQ(2, creator.AddContext(context)); + } + blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + } + + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + v8::Isolate* isolate = v8::Isolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectInt32("f()", 1); + } + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 1).ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectInt32("f()", 2); + } + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 2).ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectUndefined("this.f"); + } + } + + isolate->Dispose(); + delete[] blob.data; +} + +static void SerializedCallback( + const v8::FunctionCallbackInfo<v8::Value>& args) { + args.GetReturnValue().Set(v8_num(42)); +} + +static void SerializedCallbackReplacement( + const v8::FunctionCallbackInfo<v8::Value>& args) { + args.GetReturnValue().Set(v8_num(1337)); +} + +intptr_t original_external_references[] = { + reinterpret_cast<intptr_t>(SerializedCallback), 0}; + +intptr_t replaced_external_references[] = { + reinterpret_cast<intptr_t>(SerializedCallbackReplacement), 0}; + +TEST(SnapshotCreatorExternalReferences) { + DisableTurbofan(); + v8::StartupData blob; + { + v8::SnapshotCreator creator(original_external_references); + v8::Isolate* isolate = creator.GetIsolate(); + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + v8::Local<v8::FunctionTemplate> callback = + v8::FunctionTemplate::New(isolate, SerializedCallback); + v8::Local<v8::Value> function = + callback->GetFunction(context).ToLocalChecked(); + CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust()); + ExpectInt32("f()", 42); + CHECK_EQ(0, creator.AddContext(context)); + } + blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + } + + // Deserialize with the original external reference. + { + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + params.external_references = original_external_references; + v8::Isolate* isolate = v8::Isolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectInt32("f()", 42); + } + isolate->Dispose(); + } + + // Deserialize with the some other external reference. + { + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + params.external_references = replaced_external_references; + v8::Isolate* isolate = v8::Isolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectInt32("f()", 1337); + } + isolate->Dispose(); + } + delete[] blob.data; +} + +TEST(SnapshotCreatorTemplates) { + DisableTurbofan(); + v8::StartupData blob; + { + v8::SnapshotCreator creator(original_external_references); + v8::Isolate* isolate = creator.GetIsolate(); + { + v8::HandleScope handle_scope(isolate); + v8::ExtensionConfiguration* no_extension = nullptr; + v8::Local<v8::ObjectTemplate> global_template = + v8::ObjectTemplate::New(isolate); + v8::Local<v8::FunctionTemplate> callback = + v8::FunctionTemplate::New(isolate, SerializedCallback); + global_template->Set(v8_str("f"), callback); + v8::Local<v8::Context> context = + v8::Context::New(isolate, no_extension, global_template); + v8::Context::Scope context_scope(context); + ExpectInt32("f()", 42); + CHECK_EQ(0, creator.AddContext(context)); + CHECK_EQ(0, creator.AddTemplate(callback)); + CHECK_EQ(1, creator.AddTemplate(global_template)); + } + blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + } + + { + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + params.external_references = original_external_references; + v8::Isolate* isolate = v8::Isolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + { + // Create a new context without a new object template. + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectInt32("f()", 42); + + // Retrieve the snapshotted object template. + v8::Local<v8::ObjectTemplate> obj_template = + v8::ObjectTemplate::FromSnapshot(isolate, 1).ToLocalChecked(); + CHECK(!obj_template.IsEmpty()); + v8::Local<v8::Object> object = + obj_template->NewInstance(context).ToLocalChecked(); + CHECK(context->Global()->Set(context, v8_str("o"), object).FromJust()); + ExpectInt32("o.f()", 42); + // Check that it instantiates to the same prototype. + ExpectTrue("o.f.prototype === f.prototype"); + + // Retrieve the snapshotted function template. + v8::Local<v8::FunctionTemplate> fun_template = + v8::FunctionTemplate::FromSnapshot(isolate, 0).ToLocalChecked(); + CHECK(!fun_template.IsEmpty()); + v8::Local<v8::Function> fun = + fun_template->GetFunction(context).ToLocalChecked(); + CHECK(context->Global()->Set(context, v8_str("g"), fun).FromJust()); + ExpectInt32("g()", 42); + // Check that it instantiates to the same prototype. + ExpectTrue("g.prototype === f.prototype"); + + // Accessing out of bound returns empty MaybeHandle. + CHECK(v8::ObjectTemplate::FromSnapshot(isolate, 2).IsEmpty()); + CHECK(v8::FunctionTemplate::FromSnapshot(isolate, 2).IsEmpty()); + CHECK(v8::Context::FromSnapshot(isolate, 2).IsEmpty()); + } + + { + // Create a context with a new object template. It is merged into the + // deserialized global object. + v8::HandleScope handle_scope(isolate); + v8::ExtensionConfiguration* no_extension = nullptr; + v8::Local<v8::ObjectTemplate> global_template = + v8::ObjectTemplate::New(isolate); + global_template->Set( + v8_str("g"), + v8::FunctionTemplate::New(isolate, SerializedCallbackReplacement)); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 0, no_extension, global_template) + .ToLocalChecked(); + v8::Context::Scope context_scope(context); + ExpectInt32("g()", 1337); + ExpectInt32("f()", 42); + } + } + isolate->Dispose(); + } + delete[] blob.data; +} TEST(SerializationMemoryStats) { FLAG_profile_deserialization = true; diff --git a/deps/v8/test/cctest/test-slots-buffer.cc b/deps/v8/test/cctest/test-slots-buffer.cc index 07b70f5217..4b8aeb7931 100644 --- a/deps/v8/test/cctest/test-slots-buffer.cc +++ b/deps/v8/test/cctest/test-slots-buffer.cc @@ -4,7 +4,7 @@ #include "src/heap/slots-buffer.h" #include "test/cctest/cctest.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" namespace v8 { namespace internal { @@ -101,7 +101,7 @@ TEST(FilterInvalidSlotsBufferEntries) { // Write an old space reference into field 4 which points to an object on an // evacuation candidate. - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); Handle<FixedArray> valid_object = isolate->factory()->NewFixedArray(23, TENURED); Page* page = Page::FromAddress(valid_object->address()); diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index 770042d814..afa8ecb7ec 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -1110,7 +1110,8 @@ TEST(CachedHashOverflow) { .ToLocalChecked() ->Run(context) .ToLocalChecked(); - CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined()); + CHECK_EQ(results[i]->IsUndefined(CcTest::i_isolate()), + result->IsUndefined()); CHECK_EQ(results[i]->IsNumber(), result->IsNumber()); if (result->IsNumber()) { int32_t value = 0; diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc index 85dfd13b60..06e6fb00cd 100644 --- a/deps/v8/test/cctest/test-thread-termination.cc +++ b/deps/v8/test/cctest/test-thread-termination.cc @@ -204,6 +204,31 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) { semaphore = NULL; } +// Test that execution can be terminated from within JSON.stringify. +TEST(TerminateJsonStringify) { + semaphore = new v8::base::Semaphore(0); + TerminatorThread thread(CcTest::i_isolate()); + thread.Start(); + + v8::HandleScope scope(CcTest::isolate()); + v8::Local<v8::ObjectTemplate> global = + CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop); + v8::Local<v8::Context> context = + v8::Context::New(CcTest::isolate(), NULL, global); + v8::Context::Scope context_scope(context); + CHECK(!CcTest::isolate()->IsExecutionTerminating()); + v8::MaybeLocal<v8::Value> result = + CompileRun(CcTest::isolate()->GetCurrentContext(), + "var x = [];" + "x[2**31]=1;" + "terminate();" + "JSON.stringify(x);" + "fail();"); + CHECK(result.IsEmpty()); + thread.Join(); + delete semaphore; + semaphore = NULL; +} int call_count = 0; @@ -492,8 +517,7 @@ TEST(ErrorObjectAfterTermination) { v8::Context::Scope context_scope(context); isolate->TerminateExecution(); v8::Local<v8::Value> error = v8::Exception::Error(v8_str("error")); - // TODO(yangguo): crbug/403509. Check for empty handle instead. - CHECK(error->IsUndefined()); + CHECK(error->IsNativeError()); } diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc index 4678147931..190cb40782 100644 --- a/deps/v8/test/cctest/test-trace-event.cc +++ b/deps/v8/test/cctest/test-trace-event.cc @@ -72,7 +72,7 @@ class MockTracingPlatform : public v8::Platform { void PerformDelayedTask() {} uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, - const char* name, uint64_t id, + const char* name, const char* scope, uint64_t id, uint64_t bind_id, int num_args, const char** arg_names, const uint8_t* arg_types, const uint64_t* arg_values, unsigned int flags) override { diff --git a/deps/v8/test/cctest/test-typing-reset.cc b/deps/v8/test/cctest/test-typing-reset.cc deleted file mode 100644 index 4e9413ac3a..0000000000 --- a/deps/v8/test/cctest/test-typing-reset.cc +++ /dev/null @@ -1,298 +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 <stdlib.h> - -#include "src/v8.h" - -#include "src/ast/ast.h" -#include "src/ast/ast-expression-visitor.h" -#include "src/ast/scopes.h" -#include "src/parsing/parser.h" -#include "src/parsing/rewriter.h" -#include "src/typing-reset.h" -#include "test/cctest/cctest.h" -#include "test/cctest/compiler/function-tester.h" -#include "test/cctest/expression-type-collector.h" -#include "test/cctest/expression-type-collector-macros.h" - -#define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32()) - -using namespace v8::internal; - -namespace { - -class TypeSetter : public AstExpressionVisitor { - public: - TypeSetter(Isolate* isolate, FunctionLiteral* root) - : AstExpressionVisitor(isolate, root) {} - - protected: - void VisitExpression(Expression* expression) { - expression->set_bounds(INT32_TYPE); - } -}; - - -void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types, - Bounds expected_type) { - CHECK_TYPES_BEGIN { - // function logSum - CHECK_EXPR(FunctionLiteral, expected_type) { - CHECK_EXPR(FunctionLiteral, expected_type) { - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(start, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(start, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(end, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(end, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(sum, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(p, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(q, expected_type); - CHECK_EXPR(Literal, expected_type); - } - // for (p = start << 3, q = end << 3; - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(p, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(start, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(q, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(end, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - } - // (p|0) < (q|0); - CHECK_EXPR(CompareOperation, expected_type) { - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(p, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(q, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - // p = (p + 8)|0) {\n" - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(p, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(p, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(Literal, expected_type); - } - } - // sum = sum + +log(values[p>>3]); - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(sum, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(sum, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(Call, expected_type) { - CHECK_VAR(log, expected_type); - CHECK_EXPR(Property, expected_type) { - CHECK_VAR(values, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(p, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - } - CHECK_EXPR(Literal, expected_type); - } - } - } - // return +sum; - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(sum, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - // function geometricMean - CHECK_EXPR(FunctionLiteral, expected_type) { - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(start, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(start, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(end, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(end, expected_type); - CHECK_EXPR(Literal, expected_type); - } - } - // return +exp(+logSum(start, end) / +((end - start)|0)); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(Call, expected_type) { - CHECK_VAR(exp, expected_type); - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(Call, expected_type) { - CHECK_VAR(logSum, expected_type); - CHECK_VAR(start, expected_type); - CHECK_VAR(end, expected_type); - } - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_EXPR(BinaryOperation, expected_type) { - CHECK_VAR(end, expected_type); - CHECK_VAR(start, expected_type); - } - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(Literal, expected_type); - } - } - } - CHECK_EXPR(Literal, expected_type); - } - } - // "use asm"; - CHECK_EXPR(Literal, expected_type); - // var exp = stdlib.Math.exp; - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(exp, expected_type); - CHECK_EXPR(Property, expected_type) { - CHECK_EXPR(Property, expected_type) { - CHECK_VAR(stdlib, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(Literal, expected_type); - } - } - // var log = stdlib.Math.log; - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(log, expected_type); - CHECK_EXPR(Property, expected_type) { - CHECK_EXPR(Property, expected_type) { - CHECK_VAR(stdlib, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_EXPR(Literal, expected_type); - } - } - // var values = new stdlib.Float64Array(buffer); - CHECK_EXPR(Assignment, expected_type) { - CHECK_VAR(values, expected_type); - CHECK_EXPR(CallNew, expected_type) { - CHECK_EXPR(Property, expected_type) { - CHECK_VAR(stdlib, expected_type); - CHECK_EXPR(Literal, expected_type); - } - CHECK_VAR(buffer, expected_type); - } - } - // return { geometricMean: geometricMean }; - CHECK_EXPR(ObjectLiteral, expected_type) { - CHECK_VAR(geometricMean, expected_type); - } - } - } - CHECK_TYPES_END -} - -} // namespace - - -TEST(ResetTypingInfo) { - const char test_function[] = - "function GeometricMean(stdlib, foreign, buffer) {\n" - " \"use asm\";\n" - "\n" - " var exp = stdlib.Math.exp;\n" - " var log = stdlib.Math.log;\n" - " var values = new stdlib.Float64Array(buffer);\n" - "\n" - " function logSum(start, end) {\n" - " start = start|0;\n" - " end = end|0;\n" - "\n" - " var sum = 0.0, p = 0, q = 0;\n" - "\n" - " // asm.js forces byte addressing of the heap by requiring shifting " - "by 3\n" - " for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {\n" - " sum = sum + +log(values[p>>3]);\n" - " }\n" - "\n" - " return +sum;\n" - " }\n" - "\n" - " function geometricMean(start, end) {\n" - " start = start|0;\n" - " end = end|0;\n" - "\n" - " return +exp(+logSum(start, end) / +((end - start)|0));\n" - " }\n" - "\n" - " return { geometricMean: geometricMean };\n" - "}\n"; - - v8::V8::Initialize(); - HandleAndZoneScope handles; - - i::Isolate* isolate = CcTest::i_isolate(); - i::Factory* factory = isolate->factory(); - - i::Handle<i::String> source_code = - factory->NewStringFromUtf8(i::CStrVector(test_function)) - .ToHandleChecked(); - - i::Handle<i::Script> script = factory->NewScript(source_code); - - i::ParseInfo info(handles.main_zone(), script); - i::Parser parser(&info); - parser.set_allow_harmony_sloppy(true); - info.set_global(); - info.set_lazy(false); - info.set_allow_lazy_parsing(false); - info.set_toplevel(true); - - CHECK(i::Compiler::ParseAndAnalyze(&info)); - FunctionLiteral* root = - info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); - - // Core of the test. - ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); - ExpressionTypeCollector(isolate, root, &types).Run(); - CheckAllSame(types, Bounds::Unbounded()); - - TypeSetter(isolate, root).Run(); - - ExpressionTypeCollector(isolate, root, &types).Run(); - CheckAllSame(types, INT32_TYPE); - - TypingReseter(isolate, root).Run(); - - ExpressionTypeCollector(isolate, root, &types).Run(); - CheckAllSame(types, Bounds::Unbounded()); -} diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc index 7fc9b5beec..6a1d87015b 100644 --- a/deps/v8/test/cctest/test-unboxed-doubles.cc +++ b/deps/v8/test/cctest/test-unboxed-doubles.cc @@ -15,7 +15,7 @@ #include "src/ic/ic.h" #include "src/macro-assembler.h" #include "test/cctest/cctest.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" using namespace v8::base; using namespace v8::internal; @@ -1112,7 +1112,7 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { { AlwaysAllocateScope always_allocate(isolate); // Make sure |obj_value| is placed on an old-space evacuation candidate. - SimulateFullSpace(old_space); + heap::SimulateFullSpace(old_space); obj_value = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED); ec_page = Page::FromAddress(obj_value->address()); } @@ -1142,7 +1142,7 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { FLAG_stress_compaction = true; FLAG_manual_evacuation_candidates_selection = true; ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); // Disable stress compaction mode in order to let GC do scavenge. FLAG_stress_compaction = false; @@ -1151,7 +1151,7 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { // in compacting mode and |obj_value|'s page is an evacuation candidate). IncrementalMarking* marking = heap->incremental_marking(); CHECK(marking->IsCompacting()); - CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj))); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*obj))); CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); // Trigger GCs so that |obj| moves to old gen. @@ -1451,7 +1451,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, CHECK(old_space->Contains(*obj)); // Make sure |obj_value| is placed on an old-space evacuation candidate. - SimulateFullSpace(old_space); + heap::SimulateFullSpace(old_space); obj_value = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED); ec_page = Page::FromAddress(obj_value->address()); CHECK_NE(ec_page, Page::FromAddress(obj->address())); @@ -1460,15 +1460,15 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, // Heap is ready, force |ec_page| to become an evacuation candidate and // simulate incremental marking. ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); // Check that everything is ready for triggering incremental write barrier // (i.e. that both |obj| and |obj_value| are black and the marking phase is // still active and |obj_value|'s page is indeed an evacuation candidate). IncrementalMarking* marking = heap->incremental_marking(); CHECK(marking->IsMarking()); - CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj))); - CHECK(Marking::IsBlack(Marking::MarkBitFrom(*obj_value))); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*obj))); + CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*obj_value))); CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); // Trigger incremental write barrier, which should add a slot to remembered @@ -1504,10 +1504,12 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, CHECK_EQ(boom_value, obj->RawFastDoublePropertyAt(double_field_index)); } - -enum WriteBarrierKind { OLD_TO_OLD_WRITE_BARRIER, OLD_TO_NEW_WRITE_BARRIER }; +enum OldToWriteBarrierKind { + OLD_TO_OLD_WRITE_BARRIER, + OLD_TO_NEW_WRITE_BARRIER +}; static void TestWriteBarrierObjectShiftFieldsRight( - WriteBarrierKind write_barrier_kind) { + OldToWriteBarrierKind write_barrier_kind) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); v8::HandleScope scope(CcTest::isolate()); diff --git a/deps/v8/test/cctest/test-usecounters.cc b/deps/v8/test/cctest/test-usecounters.cc new file mode 100644 index 0000000000..8d4628c9f7 --- /dev/null +++ b/deps/v8/test/cctest/test-usecounters.cc @@ -0,0 +1,73 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/v8.h" + +#include "test/cctest/cctest.h" + +namespace { + +int* global_use_counts = NULL; + +void MockUseCounterCallback(v8::Isolate* isolate, + v8::Isolate::UseCounterFeature feature) { + ++global_use_counts[feature]; +} +} + +TEST(DefineGetterSetterThrowUseCount) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + LocalContext env; + int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; + global_use_counts = use_counts; + CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); + + // __defineGetter__ and __defineSetter__ do not increment + // kDefineGetterOrSetterWouldThrow on success + CompileRun( + "var a = {};" + "Object.defineProperty(a, 'b', { value: 0, configurable: true });" + "a.__defineGetter__('b', ()=>{});"); + CHECK_EQ(0, use_counts[v8::Isolate::kDefineGetterOrSetterWouldThrow]); + CompileRun( + "var a = {};" + "Object.defineProperty(a, 'b', { value: 0, configurable: true });" + "a.__defineSetter__('b', ()=>{});"); + CHECK_EQ(0, use_counts[v8::Isolate::kDefineGetterOrSetterWouldThrow]); + + // __defineGetter__ and __defineSetter__ do not increment + // kDefineGetterOrSetterWouldThrow on other errors + v8::Local<v8::Value> resultProxyThrow = CompileRun( + "var exception;" + "try {" + "var a = new Proxy({}, { defineProperty: ()=>{throw new Error;} });" + "a.__defineGetter__('b', ()=>{});" + "} catch (e) { exception = e; }" + "exception"); + CHECK_EQ(0, use_counts[v8::Isolate::kDefineGetterOrSetterWouldThrow]); + CHECK(resultProxyThrow->IsObject()); + resultProxyThrow = CompileRun( + "var exception;" + "try {" + "var a = new Proxy({}, { defineProperty: ()=>{throw new Error;} });" + "a.__defineSetter__('b', ()=>{});" + "} catch (e) { exception = e; }" + "exception"); + CHECK_EQ(0, use_counts[v8::Isolate::kDefineGetterOrSetterWouldThrow]); + CHECK(resultProxyThrow->IsObject()); + + // __defineGetter__ and __defineSetter__ increment + // kDefineGetterOrSetterWouldThrow when they would throw per spec (B.2.2.2) + CompileRun( + "var a = {};" + "Object.defineProperty(a, 'b', { value: 0, configurable: false });" + "a.__defineGetter__('b', ()=>{});"); + CHECK_EQ(1, use_counts[v8::Isolate::kDefineGetterOrSetterWouldThrow]); + CompileRun( + "var a = {};" + "Object.defineProperty(a, 'b', { value: 0, configurable: false });" + "a.__defineSetter__('b', ()=>{});"); + CHECK_EQ(2, use_counts[v8::Isolate::kDefineGetterOrSetterWouldThrow]); +} diff --git a/deps/v8/test/cctest/test-utils-arm64.cc b/deps/v8/test/cctest/test-utils-arm64.cc index bd1ff998b9..938328925e 100644 --- a/deps/v8/test/cctest/test-utils-arm64.cc +++ b/deps/v8/test/cctest/test-utils-arm64.cc @@ -32,7 +32,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/test-utils-arm64.h" -using namespace v8::internal; +namespace v8 { +namespace internal { #define __ masm-> @@ -423,3 +424,6 @@ void RegisterDump::Dump(MacroAssembler* masm) { completed_ = true; } + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-utils-arm64.h b/deps/v8/test/cctest/test-utils-arm64.h index 3ecae23d4b..e34365d4c3 100644 --- a/deps/v8/test/cctest/test-utils-arm64.h +++ b/deps/v8/test/cctest/test-utils-arm64.h @@ -36,7 +36,8 @@ #include "src/macro-assembler.h" -using namespace v8::internal; +namespace v8 { +namespace internal { // RegisterDump: Object allowing integer, floating point and flags registers @@ -230,4 +231,7 @@ void ClobberFP(MacroAssembler* masm, RegList reg_list, // Clobber or ClobberFP functions. void Clobber(MacroAssembler* masm, CPURegList reg_list); +} // namespace internal +} // namespace v8 + #endif // V8_ARM64_TEST_UTILS_ARM64_H_ diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc index 781ad1f69f..2d0e620d7d 100644 --- a/deps/v8/test/cctest/test-weakmaps.cc +++ b/deps/v8/test/cctest/test-weakmaps.cc @@ -31,7 +31,7 @@ #include "src/global-handles.h" #include "test/cctest/cctest.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" using namespace v8::internal; @@ -52,8 +52,7 @@ static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) { } static int NumberOfWeakCalls = 0; -static void WeakPointerCallback( - const v8::WeakCallbackData<v8::Value, void>& data) { +static void WeakPointerCallback(const v8::WeakCallbackInfo<void>& data) { std::pair<v8::Persistent<v8::Value>*, int>* p = reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( data.GetParameter()); @@ -107,20 +106,12 @@ TEST(Weakness) { { HandleScope scope(isolate); std::pair<Handle<Object>*, int> handle_and_id(&key, 1234); - GlobalHandles::MakeWeak(key.location(), - reinterpret_cast<void*>(&handle_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + key.location(), reinterpret_cast<void*>(&handle_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); } CHECK(global_handles->IsWeak(key.location())); - // Force a full GC. - // Perform two consecutive GCs because the first one will only clear - // weak references whereas the second one will also clear weak maps. - heap->CollectAllGarbage(false); - CHECK_EQ(1, NumberOfWeakCalls); - CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); - CHECK_EQ( - 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements()); heap->CollectAllGarbage(false); CHECK_EQ(1, NumberOfWeakCalls); CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); @@ -186,7 +177,7 @@ TEST(Regress2060a) { // Start second old-space page so that values land on evacuation candidate. Page* first_page = heap->old_space()->anchor()->next_page(); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); // Fill up weak map with values on an evacuation candidate. { @@ -225,7 +216,7 @@ TEST(Regress2060b) { // Start second old-space page so that keys land on evacuation candidate. Page* first_page = heap->old_space()->anchor()->next_page(); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); // Fill up weak map with keys on an evacuation candidate. Handle<JSObject> keys[32]; @@ -258,7 +249,7 @@ TEST(Regress399527) { { HandleScope scope(isolate); AllocateJSWeakMap(isolate); - SimulateIncrementalMarking(heap); + heap::SimulateIncrementalMarking(heap); } // The weak map is marked black here but leaving the handle scope will make // the object unreachable. Aborting incremental marking will clear all the diff --git a/deps/v8/test/cctest/test-weaksets.cc b/deps/v8/test/cctest/test-weaksets.cc index 643bb48ab1..ec6945aec7 100644 --- a/deps/v8/test/cctest/test-weaksets.cc +++ b/deps/v8/test/cctest/test-weaksets.cc @@ -31,7 +31,7 @@ #include "src/global-handles.h" #include "test/cctest/cctest.h" -#include "test/cctest/heap/utils-inl.h" +#include "test/cctest/heap/heap-utils.h" using namespace v8::internal; @@ -55,8 +55,7 @@ static Handle<JSWeakSet> AllocateJSWeakSet(Isolate* isolate) { } static int NumberOfWeakCalls = 0; -static void WeakPointerCallback( - const v8::WeakCallbackData<v8::Value, void>& data) { +static void WeakPointerCallback(const v8::WeakCallbackInfo<void>& data) { std::pair<v8::Persistent<v8::Value>*, int>* p = reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>( data.GetParameter()); @@ -106,20 +105,12 @@ TEST(WeakSet_Weakness) { { HandleScope scope(isolate); std::pair<Handle<Object>*, int> handle_and_id(&key, 1234); - GlobalHandles::MakeWeak(key.location(), - reinterpret_cast<void*>(&handle_and_id), - &WeakPointerCallback); + GlobalHandles::MakeWeak( + key.location(), reinterpret_cast<void*>(&handle_and_id), + &WeakPointerCallback, v8::WeakCallbackType::kParameter); } CHECK(global_handles->IsWeak(key.location())); - // Force a full GC. - // Perform two consecutive GCs because the first one will only clear - // weak references whereas the second one will also clear weak sets. - heap->CollectAllGarbage(false); - CHECK_EQ(1, NumberOfWeakCalls); - CHECK_EQ(1, ObjectHashTable::cast(weakset->table())->NumberOfElements()); - CHECK_EQ( - 0, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements()); heap->CollectAllGarbage(false); CHECK_EQ(1, NumberOfWeakCalls); CHECK_EQ(0, ObjectHashTable::cast(weakset->table())->NumberOfElements()); @@ -185,7 +176,7 @@ TEST(WeakSet_Regress2060a) { // Start second old-space page so that values land on evacuation candidate. Page* first_page = heap->old_space()->anchor()->next_page(); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); // Fill up weak set with values on an evacuation candidate. { @@ -224,7 +215,7 @@ TEST(WeakSet_Regress2060b) { // Start second old-space page so that keys land on evacuation candidate. Page* first_page = heap->old_space()->anchor()->next_page(); - SimulateFullSpace(heap->old_space()); + heap::SimulateFullSpace(heap->old_space()); // Fill up weak set with keys on an evacuation candidate. Handle<JSObject> keys[32]; diff --git a/deps/v8/test/cctest/trace-extension.cc b/deps/v8/test/cctest/trace-extension.cc index 77a29e990b..f0cc3cc2cc 100644 --- a/deps/v8/test/cctest/trace-extension.cc +++ b/deps/v8/test/cctest/trace-extension.cc @@ -27,7 +27,7 @@ #include "test/cctest/trace-extension.h" -#include "src/profiler/sampler.h" +#include "include/v8-profiler.h" #include "src/vm-state-inl.h" #include "test/cctest/cctest.h" @@ -86,17 +86,13 @@ Address TraceExtension::GetFP(const v8::FunctionCallbackInfo<v8::Value>& args) { #else #error Host architecture is neither 32-bit nor 64-bit. #endif - printf("Trace: %p\n", fp); + printf("Trace: %p\n", static_cast<void*>(fp)); return fp; } +static struct { v8::TickSample* sample; } trace_env = {nullptr}; -static struct { - TickSample* sample; -} trace_env = { NULL }; - - -void TraceExtension::InitTraceEnv(TickSample* sample) { +void TraceExtension::InitTraceEnv(v8::TickSample* sample) { trace_env.sample = sample; } @@ -107,8 +103,8 @@ void TraceExtension::DoTrace(Address fp) { // sp is only used to define stack high bound regs.sp = reinterpret_cast<Address>(trace_env.sample) - 10240; - trace_env.sample->Init(CcTest::i_isolate(), regs, - TickSample::kSkipCEntryFrame, true); + trace_env.sample->Init(CcTest::isolate(), regs, + v8::TickSample::kSkipCEntryFrame, true); } diff --git a/deps/v8/test/cctest/trace-extension.h b/deps/v8/test/cctest/trace-extension.h index 53e178b3ba..b20c4ae9df 100644 --- a/deps/v8/test/cctest/trace-extension.h +++ b/deps/v8/test/cctest/trace-extension.h @@ -31,9 +31,8 @@ #include "src/v8.h" namespace v8 { -namespace internal { - struct TickSample; +namespace internal { class TraceExtension : public v8::Extension { public: @@ -45,7 +44,7 @@ class TraceExtension : public v8::Extension { static void JSEntrySP(const v8::FunctionCallbackInfo<v8::Value>& args); static void JSEntrySPLevel2(const v8::FunctionCallbackInfo<v8::Value>& args); static Address GetJsEntrySp(); - static void InitTraceEnv(TickSample* sample); + static void InitTraceEnv(v8::TickSample* sample); static void DoTrace(Address fp); private: static Address GetFP(const v8::FunctionCallbackInfo<v8::Value>& args); diff --git a/deps/v8/test/cctest/types-fuzz.h b/deps/v8/test/cctest/types-fuzz.h index 79e460856c..7bf9700b40 100644 --- a/deps/v8/test/cctest/types-fuzz.h +++ b/deps/v8/test/cctest/types-fuzz.h @@ -208,8 +208,6 @@ class Types { Type* Representation(Type* t) { return Type::Representation(t, zone_); } - // Type* Semantic(Type* t) { return Intersect(t, - // MaskSemanticForTesting); } Type* Semantic(Type* t) { return Type::Semantic(t, zone_); } Type* Random() { diff --git a/deps/v8/test/cctest/wasm/OWNERS b/deps/v8/test/cctest/wasm/OWNERS index c2abc8a6ad..eda8deabfd 100644 --- a/deps/v8/test/cctest/wasm/OWNERS +++ b/deps/v8/test/cctest/wasm/OWNERS @@ -1,3 +1,5 @@ -titzer@chromium.org -bradnelson@chromium.org ahaas@chromium.org +bradnelson@chromium.org +mtrofin@chromium.org +rossberg@chromium.org +titzer@chromium.org 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 784f21a050..a978bdf1f7 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -14,6 +14,13 @@ #include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +// If the target architecture is 64-bit, enable all tests. +#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 +#define WASM_64 1 +#else +#define WASM_64 0 +#endif + #define CHECK_TRAP32(x) \ CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) #define CHECK_TRAP64(x) \ @@ -24,20 +31,14 @@ #define asu64(x) static_cast<uint64_t>(x) -#define B2(a, b) kExprBlock, 2, a, b -#define B1(a) kExprBlock, 1, a +#define B2(a, b) kExprBlock, a, b, kExprEnd +#define B1(a) kExprBlock, a, kExprEnd // Can't bridge macro land with nested macros. -#if V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_X87 -#define MIPS_OR_X87 true +#if V8_TARGET_ARCH_MIPS +#define MIPS true #else -#define MIPS_OR_X87 false -#endif - -#if V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_X87 || V8_TARGET_ARCH_ARM -#define MIPS_OR_ARM_OR_X87 true -#else -#define MIPS_OR_ARM_OR_X87 false +#define MIPS false #endif #define FOREACH_I64_OPERATOR(V) \ @@ -47,9 +48,9 @@ V(I64Return, true) \ V(I64Param, true) \ V(I64LoadStore, true) \ - V(I64Add, !MIPS_OR_X87) \ - V(I64Sub, !MIPS_OR_X87) \ - V(I64Mul, !MIPS_OR_X87) \ + V(I64Add, true) \ + V(I64Sub, true) \ + V(I64Mul, !MIPS) \ V(I64DivS, true) \ V(I64DivU, true) \ V(I64RemS, true) \ @@ -57,9 +58,9 @@ V(I64And, true) \ V(I64Ior, true) \ V(I64Xor, true) \ - V(I64Shl, !MIPS_OR_X87) \ - V(I64ShrU, !MIPS_OR_X87) \ - V(I64ShrS, !MIPS_OR_X87) \ + V(I64Shl, true) \ + V(I64ShrU, true) \ + V(I64ShrS, true) \ V(I64Eq, true) \ V(I64Ne, true) \ V(I64LtS, true) \ @@ -72,7 +73,7 @@ V(I64GeU, true) \ V(I64Ctz, true) \ V(I64Clz, true) \ - V(I64Popcnt, !MIPS_OR_X87) \ + V(I64Popcnt, true) \ V(I32ConvertI64, true) \ V(I64SConvertF32, true) \ V(I64SConvertF64, true) \ @@ -96,20 +97,20 @@ FOREACH_I64_OPERATOR(DECLARE_CONST) #define REQUIRE(name) \ if (!WASM_64 && !kSupported_##name) return -TEST(Run_Wasm_I64Const) { +WASM_EXEC_TEST(I64Const) { REQUIRE(I64Const); - WasmRunner<int64_t> r; + WasmRunner<int64_t> r(execution_mode); const int64_t kExpectedValue = 0x1122334455667788LL; // return(kExpectedValue) BUILD(r, WASM_I64V_9(kExpectedValue)); CHECK_EQ(kExpectedValue, r.Call()); } -TEST(Run_Wasm_I64Const_many) { +WASM_EXEC_TEST(I64Const_many) { REQUIRE(I64Const); int cntr = 0; FOR_INT32_INPUTS(i) { - WasmRunner<int64_t> r; + WasmRunner<int64_t> r(execution_mode); const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr; // return(kExpectedValue) BUILD(r, WASM_I64V(kExpectedValue)); @@ -118,41 +119,39 @@ TEST(Run_Wasm_I64Const_many) { } } -TEST(Run_Wasm_Return_I64) { +WASM_EXEC_TEST(Return_I64) { REQUIRE(I64Return); - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); - BUILD(r, WASM_RETURN(WASM_GET_LOCAL(0))); + BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0))); FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } -// todo(ahaas): I added a list of missing instructions here to make merging -// easier when I do them one by one. -// kExprI64Add: -TEST(Run_WasmI64Add) { +WASM_EXEC_TEST(I64Add) { REQUIRE(I64Add); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); } } } -// kExprI64Sub: -TEST(Run_Wasm_I64Sub) { + +WASM_EXEC_TEST(I64Sub) { REQUIRE(I64Sub); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); } } } -// kExprI64Mul: -// kExprI64DivS: -TEST(Run_WasmI64DivS) { +WASM_EXEC_TEST(I64DivS) { REQUIRE(I64DivS); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { @@ -167,9 +166,10 @@ TEST(Run_WasmI64DivS) { } } -TEST(Run_WasmI64DivS_Trap) { +WASM_EXEC_TEST(I64DivS_Trap) { REQUIRE(I64DivS); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(0, r.Call(asi64(0), asi64(100))); CHECK_TRAP64(r.Call(asi64(100), asi64(0))); @@ -178,10 +178,10 @@ TEST(Run_WasmI64DivS_Trap) { CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0))); } -TEST(Run_WasmI64DivS_Byzero_Const) { +WASM_EXEC_TEST(I64DivS_Byzero_Const) { REQUIRE(I64DivS); for (int8_t denom = -2; denom < 8; denom++) { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); for (int64_t val = -7; val < 8; val++) { if (denom == 0) { @@ -192,11 +192,11 @@ TEST(Run_WasmI64DivS_Byzero_Const) { } } } -// kExprI64DivU: -TEST(Run_WasmI64DivU) { +WASM_EXEC_TEST(I64DivU) { REQUIRE(I64DivU); - WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), + MachineType::Uint64()); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { @@ -209,9 +209,10 @@ TEST(Run_WasmI64DivU) { } } -TEST(Run_WasmI64DivU_Trap) { +WASM_EXEC_TEST(I64DivU_Trap) { REQUIRE(I64DivU); - WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), + MachineType::Uint64()); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(0, r.Call(asu64(0), asu64(100))); CHECK_TRAP64(r.Call(asu64(100), asu64(0))); @@ -219,10 +220,10 @@ TEST(Run_WasmI64DivU_Trap) { CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); } -TEST(Run_WasmI64DivU_Byzero_Const) { +WASM_EXEC_TEST(I64DivU_Byzero_Const) { REQUIRE(I64DivU); for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) { - WasmRunner<uint64_t> r(MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); for (uint64_t val = 0xfffffffffffffff0; val < 8; val++) { @@ -234,10 +235,11 @@ TEST(Run_WasmI64DivU_Byzero_Const) { } } } -// kExprI64RemS: -TEST(Run_WasmI64RemS) { + +WASM_EXEC_TEST(I64RemS) { REQUIRE(I64RemS); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { @@ -250,9 +252,10 @@ TEST(Run_WasmI64RemS) { } } -TEST(Run_WasmI64RemS_Trap) { +WASM_EXEC_TEST(I64RemS_Trap) { REQUIRE(I64RemS); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(33, r.Call(asi64(133), asi64(100))); CHECK_EQ(0, r.Call(std::numeric_limits<int64_t>::min(), asi64(-1))); @@ -261,10 +264,10 @@ TEST(Run_WasmI64RemS_Trap) { CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0))); } -// kExprI64RemU: -TEST(Run_WasmI64RemU) { +WASM_EXEC_TEST(I64RemU) { REQUIRE(I64RemU); - WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), + MachineType::Uint64()); BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { @@ -277,9 +280,10 @@ TEST(Run_WasmI64RemU) { } } -TEST(Run_Wasm_I64RemU_Trap) { +WASM_EXEC_TEST(I64RemU_Trap) { REQUIRE(I64RemU); - WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), + MachineType::Uint64()); BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(17, r.Call(asu64(217), asu64(100))); CHECK_TRAP64(r.Call(asu64(100), asu64(0))); @@ -287,38 +291,41 @@ TEST(Run_Wasm_I64RemU_Trap) { CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); } -// kExprI64And: -TEST(Run_Wasm_I64And) { +WASM_EXEC_TEST(I64And) { REQUIRE(I64And); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); } } } -// kExprI64Ior: -TEST(Run_Wasm_I64Ior) { + +WASM_EXEC_TEST(I64Ior) { REQUIRE(I64Ior); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); } } } -// kExprI64Xor: -TEST(Run_Wasm_I64Xor) { + +WASM_EXEC_TEST(I64Xor) { REQUIRE(I64Xor); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); } } } -// kExprI64Shl: -TEST(Run_Wasm_I64Shl) { + +WASM_EXEC_TEST(I64Shl) { REQUIRE(I64Shl); { - WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), + MachineType::Uint64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { @@ -329,31 +336,32 @@ TEST(Run_Wasm_I64Shl) { } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } } } -// kExprI64ShrU: -TEST(Run_Wasm_I64ShrU) { + +WASM_EXEC_TEST(I64ShrU) { REQUIRE(I64ShrU); { - WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), + MachineType::Uint64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { @@ -364,31 +372,32 @@ TEST(Run_Wasm_I64ShrU) { } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } } } -// kExprI64ShrS: -TEST(Run_Wasm_I64ShrS) { + +WASM_EXEC_TEST(I64ShrS) { REQUIRE(I64ShrS); { - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { @@ -399,143 +408,151 @@ TEST(Run_Wasm_I64ShrS) { } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(0))); FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(32))); FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } } } -// kExprI64Eq: -TEST(Run_Wasm_I64Eq) { + +WASM_EXEC_TEST(I64Eq) { REQUIRE(I64Eq); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } } } -// kExprI64Ne: -TEST(Run_Wasm_I64Ne) { + +WASM_EXEC_TEST(I64Ne) { REQUIRE(I64Ne); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); } } } -// kExprI64LtS: -TEST(Run_Wasm_I64LtS) { + +WASM_EXEC_TEST(I64LtS) { REQUIRE(I64LtS); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64LeS) { + +WASM_EXEC_TEST(I64LeS) { REQUIRE(I64LeS); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64LtU) { + +WASM_EXEC_TEST(I64LtU) { REQUIRE(I64LtU); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64LeU) { + +WASM_EXEC_TEST(I64LeU) { REQUIRE(I64LeU); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64GtS) { + +WASM_EXEC_TEST(I64GtS) { REQUIRE(I64GtS); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64GeS) { + +WASM_EXEC_TEST(I64GeS) { REQUIRE(I64GeS); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64GtU) { +WASM_EXEC_TEST(I64GtU) { REQUIRE(I64GtU); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } } } -TEST(Run_Wasm_I64GeU) { +WASM_EXEC_TEST(I64GeU) { REQUIRE(I64GeU); - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } } } -// kExprI32ConvertI64: -TEST(Run_Wasm_I32ConvertI64) { + +WASM_EXEC_TEST(I32ConvertI64) { REQUIRE(I32ConvertI64); FOR_INT64_INPUTS(i) { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i))); CHECK_EQ(static_cast<int32_t>(*i), r.Call()); } } -// kExprI64SConvertI32: -TEST(Run_Wasm_I64SConvertI32) { + +WASM_EXEC_TEST(I64SConvertI32) { REQUIRE(I64SConvertI32); - WasmRunner<int64_t> r(MachineType::Int32()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int32()); BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); } } -// kExprI64UConvertI32: -TEST(Run_Wasm_I64UConvertI32) { +WASM_EXEC_TEST(I64UConvertI32) { REQUIRE(I64UConvertI32); - WasmRunner<int64_t> r(MachineType::Uint32()); + WasmRunner<int64_t> r(execution_mode, MachineType::Uint32()); BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } } -// kExprF64ReinterpretI64: -// kExprI64ReinterpretF64: - -// kExprI64Clz: -// kExprI64Ctz: -// kExprI64Popcnt: -TEST(Run_WasmI64Popcnt) { +WASM_EXEC_TEST(I64Popcnt) { struct { int64_t expected; uint64_t input; @@ -545,22 +562,21 @@ TEST(Run_WasmI64Popcnt) { {26, 0x1123456782345678}, {38, 0xffedcba09edcba09}}; - WasmRunner<int64_t> r(MachineType::Uint64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { CHECK_EQ(values[i].expected, r.Call(values[i].input)); } } -// kExprF32SConvertI64: -TEST(Run_WasmF32SConvertI64) { +WASM_EXEC_TEST(F32SConvertI64) { REQUIRE(F32SConvertI64); - WasmRunner<float> r(MachineType::Int64()); + WasmRunner<float> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); } } -// kExprF32UConvertI64: -TEST(Run_WasmF32UConvertI64) { + +WASM_EXEC_TEST(F32UConvertI64) { REQUIRE(F32UConvertI64); struct { uint64_t input; @@ -641,21 +657,21 @@ TEST(Run_WasmF32UConvertI64) { {0x8000008000000001, 0x5f000001}, {0x8000000000000400, 0x5f000000}, {0x8000000000000401, 0x5f000000}}; - WasmRunner<float> r(MachineType::Uint64()); + WasmRunner<float> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); } } -// kExprF64SConvertI64: -TEST(Run_WasmF64SConvertI64) { + +WASM_EXEC_TEST(F64SConvertI64) { REQUIRE(F64SConvertI64); - WasmRunner<double> r(MachineType::Int64()); + WasmRunner<double> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); } } -// kExprF64UConvertI64: -TEST(Run_Wasm_F64UConvertI64) { + +WASM_EXEC_TEST(F64UConvertI64) { REQUIRE(F64UConvertI64); struct { uint64_t input; @@ -735,16 +751,15 @@ TEST(Run_Wasm_F64UConvertI64) { {0x8000008000000001, 0x43e0000010000000}, {0x8000000000000400, 0x43e0000000000000}, {0x8000000000000401, 0x43e0000000000001}}; - WasmRunner<double> r(MachineType::Uint64()); + WasmRunner<double> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input)); } } -// kExprI64SConvertF32: -TEST(Run_Wasm_I64SConvertF32a) { - WasmRunner<int64_t> r(MachineType::Float32()); +WASM_EXEC_TEST(I64SConvertF32a) { + WasmRunner<int64_t> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -756,9 +771,9 @@ TEST(Run_Wasm_I64SConvertF32a) { } } } -// kExprI64SConvertF64: -TEST(Run_Wasm_I64SConvertF64a) { - WasmRunner<int64_t> r(MachineType::Float64()); + +WASM_EXEC_TEST(I64SConvertF64a) { + WasmRunner<int64_t> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -771,9 +786,8 @@ TEST(Run_Wasm_I64SConvertF64a) { } } -// kExprI64UConvertF32: -TEST(Run_Wasm_I64UConvertF32a) { - WasmRunner<uint64_t> r(MachineType::Float32()); +WASM_EXEC_TEST(I64UConvertF32a) { + WasmRunner<uint64_t> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -786,9 +800,8 @@ TEST(Run_Wasm_I64UConvertF32a) { } } -// kExprI64UConvertF64: -TEST(Run_Wasm_I64UConvertF64a) { - WasmRunner<uint64_t> r(MachineType::Float64()); +WASM_EXEC_TEST(I64UConvertF64a) { + WasmRunner<uint64_t> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -801,7 +814,7 @@ TEST(Run_Wasm_I64UConvertF64a) { } } -TEST(Run_WasmCallI64Parameter) { +WASM_EXEC_TEST(CallI64Parameter) { // Build the target function. LocalType param_types[20]; for (int i = 0; i < 20; i++) param_types[i] = kAstI64; @@ -809,7 +822,7 @@ TEST(Run_WasmCallI64Parameter) { param_types[4] = kAstI32; FunctionSig sig(1, 19, param_types); for (int i = 0; i < 19; i++) { - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(&sig, &module); if (i == 2 || i == 3) { continue; @@ -822,8 +835,8 @@ TEST(Run_WasmCallI64Parameter) { WasmRunner<int32_t> r(&module); BUILD( r, - WASM_I32_CONVERT_I64(WASM_CALL_FUNCTION( - index, WASM_I64V_9(0xbcd12340000000b), + WASM_I32_CONVERT_I64(WASM_CALL_FUNCTIONN( + 19, index, WASM_I64V_9(0xbcd12340000000b), WASM_I64V_9(0xbcd12340000000c), WASM_I32V_1(0xd), WASM_I32_CONVERT_I64(WASM_I64V_9(0xbcd12340000000e)), WASM_I64V_9(0xbcd12340000000f), WASM_I64V_10(0xbcd1234000000010), @@ -839,43 +852,47 @@ TEST(Run_WasmCallI64Parameter) { } } -void TestI64Binop(WasmOpcode opcode, int64_t expected, int64_t a, int64_t b) { +void TestI64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, + int64_t expected, int64_t a, int64_t b) { { - WasmRunner<int64_t> r; + WasmRunner<int64_t> r(execution_mode); // return K op K BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); // return a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } -void TestI64Cmp(WasmOpcode opcode, int64_t expected, int64_t a, int64_t b) { +void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode, + int64_t expected, int64_t a, int64_t b) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return K op K BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); // return a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } -#define TEST_I64_BINOP(name, expected, a, b) \ - do { \ - if (WASM_64 || kSupported_##name) \ - TestI64Binop(kExpr##name, expected, a, b); \ +#define TEST_I64_BINOP(name, expected, a, b) \ + do { \ + if (WASM_64 || kSupported_##name) \ + TestI64Binop(execution_mode, kExpr##name, expected, a, b); \ } while (false) -TEST(Run_Wasm_I64Binops) { +WASM_EXEC_TEST(I64Binops) { TEST_I64_BINOP(I64Add, -5586332274295447011, 0x501b72ebabc26847, 0x625de9793d8f79d6); TEST_I64_BINOP(I64Sub, 9001903251710731490, 0xf24fe6474640002e, @@ -907,12 +924,13 @@ TEST(Run_Wasm_I64Binops) { TEST_I64_BINOP(I64Rol, 8728493013947314237, 0xe07af243ac4d219d, 15); } -#define TEST_I64_CMP(name, expected, a, b) \ - do { \ - if (WASM_64 || kSupported_##name) TestI64Cmp(kExpr##name, expected, a, b); \ +#define TEST_I64_CMP(name, expected, a, b) \ + do { \ + if (WASM_64 || kSupported_##name) \ + TestI64Cmp(execution_mode, kExpr##name, expected, a, b); \ } while (false) -TEST(Run_Wasm_I64Compare) { +WASM_EXEC_TEST(I64Compare) { TEST_I64_CMP(I64Eq, 0, 0xB915D8FA494064F0, 0x04D700B2536019A3); TEST_I64_CMP(I64Ne, 1, 0xC2FAFAAAB0446CDC, 0x52A3328F780C97A3); TEST_I64_CMP(I64LtS, 0, 0x673636E6306B0578, 0x028EC9ECA78F7227); @@ -925,7 +943,7 @@ TEST(Run_Wasm_I64Compare) { TEST_I64_CMP(I64GeU, 0, 0x0886A0C58C7AA224, 0x5DDBE5A81FD7EE47); } -TEST(Run_Wasm_I64Clz) { +WASM_EXEC_TEST(I64Clz) { REQUIRE(I64Clz); struct { int64_t expected; @@ -964,14 +982,14 @@ TEST(Run_Wasm_I64Clz) { {62, 0x0000000000000002}, {63, 0x0000000000000001}, {64, 0x0000000000000000}}; - WasmRunner<int64_t> r(MachineType::Uint64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_I64_CLZ(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { CHECK_EQ(values[i].expected, r.Call(values[i].input)); } } -TEST(Run_Wasm_I64Ctz) { +WASM_EXEC_TEST(I64Ctz) { REQUIRE(I64Ctz); struct { int64_t expected; @@ -1010,14 +1028,14 @@ TEST(Run_Wasm_I64Ctz) { {2, 0x000000009afdbc84}, {1, 0x000000009afdbc82}, {0, 0x000000009afdbc81}}; - WasmRunner<int64_t> r(MachineType::Uint64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { CHECK_EQ(values[i].expected, r.Call(values[i].input)); } } -TEST(Run_Wasm_I64Popcnt) { +WASM_EXEC_TEST(I64Popcnt2) { REQUIRE(I64Popcnt); struct { int64_t expected; @@ -1028,7 +1046,7 @@ TEST(Run_Wasm_I64Popcnt) { {26, 0x1123456782345678}, {38, 0xffedcba09edcba09}}; - WasmRunner<int64_t> r(MachineType::Uint64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64()); BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { CHECK_EQ(values[i].expected, r.Call(values[i].input)); @@ -1037,29 +1055,30 @@ TEST(Run_Wasm_I64Popcnt) { // Test the WasmRunner with an Int64 return value and different numbers of // Int64 parameters. -TEST(Run_TestI64WasmRunner) { +WASM_EXEC_TEST(I64WasmRunner) { REQUIRE(I64Param); REQUIRE(I64Xor); - {FOR_INT64_INPUTS(i){WasmRunner<int64_t> r; + {FOR_INT64_INPUTS(i){WasmRunner<int64_t> r(execution_mode); BUILD(r, WASM_I64V(*i)); CHECK_EQ(*i, r.Call()); } } { - WasmRunner<int64_t> r(MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_GET_LOCAL(0)); FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } { - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { CHECK_EQ(*i ^ *j, r.Call(*i, *j)); } } } { - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64(), - MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64(), MachineType::Int64()); BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)))); FOR_INT64_INPUTS(i) { @@ -1071,8 +1090,9 @@ TEST(Run_TestI64WasmRunner) { } } { - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64(), - MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64(), MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_I64_XOR(WASM_GET_LOCAL(2), @@ -1088,18 +1108,18 @@ TEST(Run_TestI64WasmRunner) { } } -TEST(Run_WasmCall_Int64Sub) { +WASM_EXEC_TEST(Call_Int64Sub) { REQUIRE(I64Sub); // Build the target function. TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(sigs.l_ll(), &module); BUILD(t, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); uint32_t index = t.CompileAndAdd(); // Build the caller function. WasmRunner<int64_t> r(&module, MachineType::Int64(), MachineType::Int64()); - BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { @@ -1115,23 +1135,27 @@ TEST(Run_WasmCall_Int64Sub) { } } -TEST(Run_Wasm_LoadStoreI64_sx) { +WASM_EXEC_TEST(LoadStoreI64_sx) { REQUIRE(I64LoadStore); REQUIRE(DepthFirst); byte loads[] = {kExprI64LoadMem8S, kExprI64LoadMem16S, kExprI64LoadMem32S, kExprI64LoadMem}; for (size_t m = 0; m < arraysize(loads); m++) { - TestingModule module; + TestingModule module(execution_mode); byte* memory = module.AddMemoryElems<byte>(16); WasmRunner<int64_t> r(&module); - byte code[] = {kExprI64StoreMem, ZERO_ALIGNMENT, - ZERO_OFFSET, // -- - kExprI8Const, 8, // -- - loads[m], ZERO_ALIGNMENT, - ZERO_OFFSET, // -- - kExprI8Const, 0}; // -- + byte code[] = { + kExprI8Const, 8, // -- + kExprI8Const, 0, // -- + loads[m], // -- + ZERO_ALIGNMENT, // -- + ZERO_OFFSET, // -- + kExprI64StoreMem, // -- + ZERO_ALIGNMENT, // -- + ZERO_OFFSET // -- + }; r.Build(code, code + arraysize(code)); @@ -1152,9 +1176,9 @@ TEST(Run_Wasm_LoadStoreI64_sx) { } } -TEST(Run_Wasm_I64SConvertF32b) { +WASM_EXEC_TEST(I64SConvertF32b) { REQUIRE(I64SConvertF32); - WasmRunner<int64_t> r(MachineType::Float32()); + WasmRunner<int64_t> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -1167,9 +1191,9 @@ TEST(Run_Wasm_I64SConvertF32b) { } } -TEST(Run_Wasm_I64SConvertF64b) { +WASM_EXEC_TEST(I64SConvertF64b) { REQUIRE(I64SConvertF64); - WasmRunner<int64_t> r(MachineType::Float64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -1182,9 +1206,9 @@ TEST(Run_Wasm_I64SConvertF64b) { } } -TEST(Run_Wasm_I64UConvertF32b) { +WASM_EXEC_TEST(I64UConvertF32b) { REQUIRE(I64UConvertF32); - WasmRunner<uint64_t> r(MachineType::Float32()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -1196,9 +1220,9 @@ TEST(Run_Wasm_I64UConvertF32b) { } } -TEST(Run_Wasm_I64UConvertF64b) { +WASM_EXEC_TEST(I64UConvertF64b) { REQUIRE(I64UConvertF64); - WasmRunner<uint64_t> r(MachineType::Float64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -1210,9 +1234,9 @@ TEST(Run_Wasm_I64UConvertF64b) { } } -TEST(Run_Wasm_I64ReinterpretF64) { +WASM_EXEC_TEST(I64ReinterpretF64) { REQUIRE(I64ReinterpretF64); - TestingModule module; + TestingModule module(execution_mode); int64_t* memory = module.AddMemoryElems<int64_t>(8); WasmRunner<int64_t> r(&module); @@ -1221,99 +1245,138 @@ TEST(Run_Wasm_I64ReinterpretF64) { FOR_INT32_INPUTS(i) { int64_t expected = static_cast<int64_t>(*i) * 0x300010001; - memory[0] = expected; + module.WriteMemory(&memory[0], expected); CHECK_EQ(expected, r.Call()); } } -TEST(Run_Wasm_F64ReinterpretI64) { +WASM_EXEC_TEST(F64ReinterpretI64) { REQUIRE(F64ReinterpretI64); - TestingModule module; + TestingModule module(execution_mode); int64_t* memory = module.AddMemoryElems<int64_t>(8); WasmRunner<int64_t> r(&module, MachineType::Int64()); - BUILD(r, WASM_BLOCK( - 2, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, - WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), - WASM_GET_LOCAL(0))); + BUILD(r, + WASM_BLOCK(WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, + WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), + WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { int64_t expected = static_cast<int64_t>(*i) * 0x300010001; CHECK_EQ(expected, r.Call(expected)); - CHECK_EQ(expected, memory[0]); + CHECK_EQ(expected, module.ReadMemory<int64_t>(&memory[0])); } } -TEST(Run_Wasm_LoadMemI64) { +WASM_EXEC_TEST(LoadMemI64) { REQUIRE(I64LoadStore); - TestingModule module; + TestingModule module(execution_mode); int64_t* memory = module.AddMemoryElems<int64_t>(8); module.RandomizeMemory(1111); WasmRunner<int64_t> r(&module); BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_I8(0))); - memory[0] = 0xaabbccdd00112233LL; + module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL); CHECK_EQ(0xaabbccdd00112233LL, r.Call()); - memory[0] = 0x33aabbccdd001122LL; + module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); CHECK_EQ(0x33aabbccdd001122LL, r.Call()); - memory[0] = 77777777; + module.WriteMemory<int64_t>(&memory[0], 77777777); CHECK_EQ(77777777, r.Call()); } -TEST(Run_Wasm_MemI64_Sum) { +WASM_EXEC_TEST(LoadMemI64_alignment) { + REQUIRE(I64LoadStore); + TestingModule module(execution_mode); + int64_t* memory = module.AddMemoryElems<int64_t>(8); + for (byte alignment = 0; alignment <= 3; alignment++) { + module.RandomizeMemory(1111); + WasmRunner<int64_t> r(&module); + + BUILD(r, + WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment)); + + module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL); + CHECK_EQ(0xaabbccdd00112233LL, r.Call()); + + module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); + CHECK_EQ(0x33aabbccdd001122LL, r.Call()); + + module.WriteMemory<int64_t>(&memory[0], 77777777); + CHECK_EQ(77777777, r.Call()); + } +} + +WASM_EXEC_TEST(MemI64_Sum) { REQUIRE(I64LoadStore); REQUIRE(I64Add); REQUIRE(I64Sub); REQUIRE(I64Phi); const int kNumElems = 20; - TestingModule module; + TestingModule module(execution_mode); uint64_t* memory = module.AddMemoryElems<uint64_t>(kNumElems); WasmRunner<uint64_t> r(&module, MachineType::Int32()); const byte kSum = r.AllocateLocal(kAstI64); - BUILD(r, WASM_BLOCK( - 2, WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - 2, WASM_SET_LOCAL( - kSum, WASM_I64_ADD( - WASM_GET_LOCAL(kSum), + BUILD(r, + WASM_BLOCK( + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL( + kSum, WASM_I64_ADD(WASM_GET_LOCAL(kSum), WASM_LOAD_MEM(MachineType::Int64(), WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), - WASM_GET_LOCAL(1))); + WASM_SET_LOCAL( + 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), + WASM_GET_LOCAL(1))); // Run 4 trials. for (int i = 0; i < 3; i++) { module.RandomizeMemory(i * 33); uint64_t expected = 0; for (size_t j = kNumElems - 1; j > 0; j--) { - expected += memory[j]; + expected += module.ReadMemory(&memory[j]); } uint64_t result = r.Call(8 * (kNumElems - 1)); CHECK_EQ(expected, result); } } -TEST(Run_Wasm_I64Global) { +WASM_EXEC_TEST(StoreMemI64_alignment) { + TestingModule module(execution_mode); + int64_t* memory = module.AddMemoryElems<int64_t>(4); + const int64_t kWritten = 0x12345678abcd0011ll; + + for (byte i = 0; i <= 3; i++) { + WasmRunner<int64_t> r(&module, MachineType::Int64()); + BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i, + WASM_GET_LOCAL(0))); + module.RandomizeMemory(1111); + module.WriteMemory<int64_t>(&memory[0], 0); + + CHECK_EQ(kWritten, r.Call(kWritten)); + CHECK_EQ(kWritten, module.ReadMemory(&memory[0])); + } +} + +WASM_EXEC_TEST(I64Global) { REQUIRE(I64LoadStore); REQUIRE(I64SConvertI32); REQUIRE(I64And); REQUIRE(DepthFirst); - TestingModule module; - int64_t* global = module.AddGlobal<int64_t>(MachineType::Int64()); + TestingModule module(execution_mode); + int64_t* global = module.AddGlobal<int64_t>(kAstI64); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, B2(WASM_STORE_GLOBAL( - 0, WASM_I64_AND(WASM_LOAD_GLOBAL(0), + BUILD(r, B2(WASM_SET_GLOBAL( + 0, WASM_I64_AND(WASM_GET_GLOBAL(0), WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), WASM_ZERO)); - *global = 0xFFFFFFFFFFFFFFFFLL; + module.WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL); for (int i = 9; i < 444444; i += 111111) { int64_t expected = *global & i; r.Call(i); @@ -1321,10 +1384,10 @@ TEST(Run_Wasm_I64Global) { } } -TEST(Run_Wasm_I64Eqz) { +WASM_EXEC_TEST(I64Eqz) { REQUIRE(I64Eq); - WasmRunner<int32_t> r(MachineType::Int64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); FOR_INT64_INPUTS(i) { @@ -1333,9 +1396,10 @@ TEST(Run_Wasm_I64Eqz) { } } -TEST(Run_Wasm_I64Ror) { +WASM_EXEC_TEST(I64Ror) { REQUIRE(I64Ror); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { @@ -1346,9 +1410,10 @@ TEST(Run_Wasm_I64Ror) { } } -TEST(Run_Wasm_I64Rol) { +WASM_EXEC_TEST(I64Rol) { REQUIRE(I64Rol); - WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT64_INPUTS(i) { @@ -1358,3 +1423,153 @@ TEST(Run_Wasm_I64Rol) { } } } + +WASM_EXEC_TEST(StoreMem_offset_oob_i64) { + TestingModule module(execution_mode); + byte* memory = module.AddMemoryElems<byte>(32); + + static const MachineType machineTypes[] = { + MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), + MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(), + MachineType::Int64(), MachineType::Uint64(), MachineType::Float32(), + MachineType::Float64()}; + + for (size_t m = 0; m < arraysize(machineTypes); m++) { + module.RandomizeMemory(1119 + static_cast<int>(m)); + WasmRunner<int32_t> r(&module, MachineType::Uint32()); + + BUILD(r, WASM_STORE_MEM_OFFSET(machineTypes[m], 8, WASM_GET_LOCAL(0), + WASM_LOAD_MEM(machineTypes[m], WASM_ZERO)), + WASM_ZERO); + + byte memsize = WasmOpcodes::MemSize(machineTypes[m]); + uint32_t boundary = 24 - memsize; + CHECK_EQ(0, r.Call(boundary)); // in bounds. + CHECK_EQ(0, memcmp(&memory[0], &memory[8 + boundary], memsize)); + + for (uint32_t offset = boundary + 1; offset < boundary + 19; offset++) { + CHECK_TRAP(r.Call(offset)); // out of bounds. + } + } +} + +#define ADD_CODE(vec, ...) \ + do { \ + byte __buf[] = {__VA_ARGS__}; \ + for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ + } while (false) + +static void CompileCallIndirectMany(LocalType param) { + // Make sure we don't run out of registers when compiling indirect calls + // with many many parameters. + TestSignatures sigs; + for (byte num_params = 0; num_params < 40; num_params++) { + v8::base::AccountingAllocator allocator; + Zone zone(&allocator); + HandleScope scope(CcTest::InitIsolateOnce()); + TestingModule module(kExecuteCompiled); + FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); + + module.AddSignature(sig); + module.AddSignature(sig); + module.AddIndirectFunctionTable(nullptr, 0); + + WasmFunctionCompiler t(sig, &module); + + std::vector<byte> code; + ADD_CODE(code, kExprI8Const, 0); + for (byte p = 0; p < num_params; p++) { + ADD_CODE(code, kExprGetLocal, p); + } + ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1); + + t.Build(&code[0], &code[0] + code.size()); + t.Compile(); + } +} + +TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } + +static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { + const int kExpected = 6333; + const int kElemSize = 8; + TestSignatures sigs; + + static MachineType mixed[] = { + MachineType::Int32(), MachineType::Float32(), MachineType::Int64(), + MachineType::Float64(), MachineType::Float32(), MachineType::Int64(), + MachineType::Int32(), MachineType::Float64(), MachineType::Float32(), + MachineType::Float64(), MachineType::Int32(), MachineType::Int64(), + MachineType::Int32(), MachineType::Int32()}; + + int num_params = static_cast<int>(arraysize(mixed)) - start; + for (int which = 0; which < num_params; which++) { + v8::base::AccountingAllocator allocator; + Zone zone(&allocator); + TestingModule module(execution_mode); + module.AddMemory(1024); + MachineType* memtypes = &mixed[start]; + MachineType result = memtypes[which]; + + // ========================================================================= + // Build the selector function. + // ========================================================================= + uint32_t index; + FunctionSig::Builder b(&zone, 1, num_params); + b.AddReturn(WasmOpcodes::LocalTypeFor(result)); + for (int i = 0; i < num_params; i++) { + b.AddParam(WasmOpcodes::LocalTypeFor(memtypes[i])); + } + WasmFunctionCompiler t(b.Build(), &module); + BUILD(t, WASM_GET_LOCAL(which)); + index = t.CompileAndAdd(); + + // ========================================================================= + // Build the calling function. + // ========================================================================= + WasmRunner<int32_t> r(&module); + std::vector<byte> code; + + // Load the offset for the store. + ADD_CODE(code, WASM_ZERO); + + // Load the arguments. + for (int i = 0; i < num_params; i++) { + int offset = (i + 1) * kElemSize; + ADD_CODE(code, WASM_LOAD_MEM(memtypes[i], WASM_I8(offset))); + } + + // Call the selector function. + ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), + static_cast<byte>(index)); + + // Store the result in memory. + ADD_CODE(code, + static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)), + ZERO_ALIGNMENT, ZERO_OFFSET); + + // Return the expected value. + ADD_CODE(code, WASM_I32V_2(kExpected)); + + r.Build(&code[0], &code[0] + code.size()); + + // Run the code. + for (int t = 0; t < 10; t++) { + module.RandomizeMemory(); + CHECK_EQ(kExpected, r.Call()); + + int size = WasmOpcodes::MemSize(result); + for (int i = 0; i < size; i++) { + int base = (which + 1) * kElemSize; + byte expected = module.raw_mem_at<byte>(base + i); + byte result = module.raw_mem_at<byte>(i); + CHECK_EQ(expected, result); + } + } + } +} + +WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } +WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); } +WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); } +WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc new file mode 100644 index 0000000000..4d39dd6ff7 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc @@ -0,0 +1,297 @@ +// 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/base/platform/elapsed-timer.h" + +#include "src/wasm/wasm-macro-gen.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/test-signatures.h" +#include "test/cctest/wasm/wasm-run-utils.h" + +using namespace v8::base; +using namespace v8::internal; +using namespace v8::internal::compiler; +using namespace v8::internal::wasm; + +// for even shorter tests. +#define B2(a, b) kExprBlock, a, b, kExprEnd +#define B1(a) kExprBlock, a, kExprEnd +#define RET(x) x, kExprReturn, 1 +#define RET_I8(x) kExprI8Const, x, kExprReturn, 1 + +namespace { +uint32_t GetMatchingRelocInfoCount(Handle<Code> code, RelocInfo::Mode rmode) { + int filter = 1 << rmode; + uint32_t ret = 0; + for (RelocIterator it(*code, filter); !it.done(); it.next()) { + ++ret; + } + return ret; +} +} + +WASM_EXEC_TEST(Int32AsmjsDivS) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + const int32_t kMin = std::numeric_limits<int32_t>::min(); + CHECK_EQ(0, r.Call(0, 100)); + CHECK_EQ(0, r.Call(100, 0)); + CHECK_EQ(0, r.Call(-1001, 0)); + CHECK_EQ(kMin, r.Call(kMin, -1)); + CHECK_EQ(0, r.Call(kMin, 0)); +} + +WASM_EXEC_TEST(Int32AsmjsRemS) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + const int32_t kMin = std::numeric_limits<int32_t>::min(); + CHECK_EQ(33, r.Call(133, 100)); + CHECK_EQ(0, r.Call(kMin, -1)); + CHECK_EQ(0, r.Call(100, 0)); + CHECK_EQ(0, r.Call(-1001, 0)); + CHECK_EQ(0, r.Call(kMin, 0)); +} + +WASM_EXEC_TEST(Int32AsmjsDivU) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + const int32_t kMin = std::numeric_limits<int32_t>::min(); + CHECK_EQ(0, r.Call(0, 100)); + CHECK_EQ(0, r.Call(kMin, -1)); + CHECK_EQ(0, r.Call(100, 0)); + CHECK_EQ(0, r.Call(-1001, 0)); + CHECK_EQ(0, r.Call(kMin, 0)); +} + +WASM_EXEC_TEST(Int32AsmjsRemU) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + const int32_t kMin = std::numeric_limits<int32_t>::min(); + CHECK_EQ(17, r.Call(217, 100)); + CHECK_EQ(0, r.Call(100, 0)); + CHECK_EQ(0, r.Call(-1001, 0)); + CHECK_EQ(0, r.Call(kMin, 0)); + CHECK_EQ(kMin, r.Call(kMin, -1)); +} + +WASM_EXEC_TEST(I32AsmjsSConvertF32) { + WasmRunner<int32_t> r(execution_mode, MachineType::Float32()); + BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0))); + + FOR_FLOAT32_INPUTS(i) { + int32_t expected = DoubleToInt32(*i); + CHECK_EQ(expected, r.Call(*i)); + } +} + +WASM_EXEC_TEST(I32AsmjsSConvertF64) { + WasmRunner<int32_t> r(execution_mode, MachineType::Float64()); + BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0))); + + FOR_FLOAT64_INPUTS(i) { + int32_t expected = DoubleToInt32(*i); + CHECK_EQ(expected, r.Call(*i)); + } +} + +WASM_EXEC_TEST(I32AsmjsUConvertF32) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Float32()); + BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0))); + + FOR_FLOAT32_INPUTS(i) { + uint32_t expected = DoubleToUint32(*i); + CHECK_EQ(expected, r.Call(*i)); + } +} + +WASM_EXEC_TEST(I32AsmjsUConvertF64) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Float64()); + BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0))); + + FOR_FLOAT64_INPUTS(i) { + uint32_t expected = DoubleToUint32(*i); + CHECK_EQ(expected, r.Call(*i)); + } +} + +WASM_EXEC_TEST(LoadMemI32_oob_asm) { + TestingModule module(execution_mode); + int32_t* memory = module.AddMemoryElems<int32_t>(8); + WasmRunner<int32_t> r(&module, MachineType::Uint32()); + module.RandomizeMemory(1112); + + BUILD(r, WASM_UNOP(kExprI32AsmjsLoadMem, WASM_GET_LOCAL(0))); + + memory[0] = 999999; + CHECK_EQ(999999, r.Call(0u)); + // TODO(titzer): offset 29-31 should also be OOB. + for (uint32_t offset = 32; offset < 40; offset++) { + CHECK_EQ(0, r.Call(offset)); + } + + for (uint32_t offset = 0x80000000; offset < 0x80000010; offset++) { + CHECK_EQ(0, r.Call(offset)); + } +} + +WASM_EXEC_TEST(LoadMemF32_oob_asm) { + TestingModule module(execution_mode); + float* memory = module.AddMemoryElems<float>(8); + WasmRunner<float> r(&module, MachineType::Uint32()); + module.RandomizeMemory(1112); + + BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); + + memory[0] = 9999.5f; + CHECK_EQ(9999.5f, r.Call(0u)); + // TODO(titzer): offset 29-31 should also be OOB. + for (uint32_t offset = 32; offset < 40; offset++) { + CHECK(std::isnan(r.Call(offset))); + } + + for (uint32_t offset = 0x80000000; offset < 0x80000010; offset++) { + CHECK(std::isnan(r.Call(offset))); + } +} + +WASM_EXEC_TEST(LoadMemF64_oob_asm) { + TestingModule module(execution_mode); + double* memory = module.AddMemoryElems<double>(8); + WasmRunner<double> r(&module, MachineType::Uint32()); + module.RandomizeMemory(1112); + + BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); + + memory[0] = 9799.5; + CHECK_EQ(9799.5, r.Call(0u)); + memory[1] = 11799.25; + CHECK_EQ(11799.25, r.Call(8u)); + // TODO(titzer): offset 57-63 should also be OOB. + for (uint32_t offset = 64; offset < 80; offset++) { + CHECK(std::isnan(r.Call(offset))); + } + + for (uint32_t offset = 0x80000000; offset < 0x80000010; offset++) { + CHECK(std::isnan(r.Call(offset))); + } +} + +WASM_EXEC_TEST(StoreMemI32_oob_asm) { + TestingModule module(execution_mode); + int32_t* memory = module.AddMemoryElems<int32_t>(8); + WasmRunner<int32_t> r(&module, MachineType::Uint32(), MachineType::Uint32()); + module.RandomizeMemory(1112); + + BUILD(r, WASM_BINOP(kExprI32AsmjsStoreMem, WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1))); + + memory[0] = 7777; + CHECK_EQ(999999, r.Call(0u, 999999)); + CHECK_EQ(999999, memory[0]); + // TODO(titzer): offset 29-31 should also be OOB. + for (uint32_t offset = 32; offset < 40; offset++) { + CHECK_EQ(8888, r.Call(offset, 8888)); + } + + for (uint32_t offset = 0x10000000; offset < 0xF0000000; offset += 0x1000000) { + CHECK_EQ(7777, r.Call(offset, 7777)); + } +} + +#define FOREACH_INT_CHECKED_LOAD_OP(TEST_BODY) \ + TEST_BODY(kExprI32AsmjsLoadMem8S) \ + TEST_BODY(kExprI32AsmjsLoadMem8U) \ + TEST_BODY(kExprI32AsmjsLoadMem16S) \ + TEST_BODY(kExprI32AsmjsLoadMem16U) \ + TEST_BODY(kExprI32AsmjsLoadMem) + +#define FOREACH_INT_CHECKED_STORE_OP(TEST_BODY) \ + TEST_BODY(kExprI32AsmjsStoreMem8) \ + TEST_BODY(kExprI32AsmjsStoreMem16) \ + TEST_BODY(kExprI32AsmjsStoreMem) + +#define INT_LOAD_TEST(OP_TYPE) \ + TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ + TestingModule module(kExecuteCompiled); \ + WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ + BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_REFERENCE)); \ + CHECK_NE( \ + 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ + } + +FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) + +#define INT_STORE_TEST(OP_TYPE) \ + TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ + TestingModule module(kExecuteCompiled); \ + WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ + MachineType::Uint32()); \ + BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_REFERENCE)); \ + CHECK_NE( \ + 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ + } + +FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) + +TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { + TestingModule module(kExecuteCompiled); + WasmRunner<float> r(&module, MachineType::Uint32()); + BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); + + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); +} + +TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { + TestingModule module(kExecuteCompiled); + WasmRunner<float> r(&module, MachineType::Uint32(), MachineType::Float32()); + BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1))); + + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); +} + +TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { + TestingModule module(kExecuteCompiled); + WasmRunner<double> r(&module, MachineType::Uint32()); + BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); + + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); +} + +TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { + TestingModule module(kExecuteCompiled); + WasmRunner<double> r(&module, MachineType::Uint32(), MachineType::Float64()); + BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1))); + + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); +} diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc new file mode 100644 index 0000000000..c4e03b50d6 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc @@ -0,0 +1,291 @@ +// 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 <memory> + +#include "src/wasm/wasm-macro-gen.h" + +#include "src/wasm/wasm-interpreter.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/test-signatures.h" +#include "test/cctest/wasm/wasm-run-utils.h" + +using namespace v8::base; +using namespace v8::internal; +using namespace v8::internal::compiler; +using namespace v8::internal::wasm; + +namespace v8 { +namespace internal { +namespace wasm { + +TEST(Run_WasmInt8Const_i) { + WasmRunner<int32_t> r(kExecuteInterpreted); + const byte kExpectedValue = 109; + // return(kExpectedValue) + BUILD(r, WASM_I8(kExpectedValue)); + CHECK_EQ(kExpectedValue, r.Call()); +} + +TEST(Run_WasmIfElse) { + WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32()); + BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(10))); + CHECK_EQ(10, r.Call(0)); + CHECK_EQ(9, r.Call(1)); +} + +TEST(Run_WasmIfReturn) { + WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32()); + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_RETURN1(WASM_I8(77))), WASM_I8(65)); + CHECK_EQ(65, r.Call(0)); + CHECK_EQ(77, r.Call(1)); +} + +TEST(Run_WasmNopsN) { + const int kMaxNops = 10; + byte code[kMaxNops + 2]; + for (int nops = 0; nops < kMaxNops; nops++) { + byte expected = static_cast<byte>(20 + nops); + memset(code, kExprNop, sizeof(code)); + code[nops] = kExprI8Const; + code[nops + 1] = expected; + + WasmRunner<int32_t> r(kExecuteInterpreted); + r.Build(code, code + nops + 2); + CHECK_EQ(expected, r.Call()); + } +} + +TEST(Run_WasmConstsN) { + const int kMaxConsts = 10; + byte code[kMaxConsts * 2]; + for (int count = 1; count < kMaxConsts; count++) { + for (int i = 0; i < count; i++) { + code[i * 2] = kExprI8Const; + code[i * 2 + 1] = static_cast<byte>(count * 10 + i); + } + byte expected = static_cast<byte>(count * 11 - 1); + + WasmRunner<int32_t> r(kExecuteInterpreted); + r.Build(code, code + (count * 2)); + CHECK_EQ(expected, r.Call()); + } +} + +TEST(Run_WasmBlocksN) { + const int kMaxNops = 10; + const int kExtra = 4; + byte code[kMaxNops + kExtra]; + for (int nops = 0; nops < kMaxNops; nops++) { + byte expected = static_cast<byte>(30 + nops); + memset(code, kExprNop, sizeof(code)); + code[0] = kExprBlock; + code[1 + nops] = kExprI8Const; + code[1 + nops + 1] = expected; + code[1 + nops + 2] = kExprEnd; + + WasmRunner<int32_t> r(kExecuteInterpreted); + r.Build(code, code + nops + kExtra); + CHECK_EQ(expected, r.Call()); + } +} + +TEST(Run_WasmBlockBreakN) { + const int kMaxNops = 10; + const int kExtra = 6; + byte code[kMaxNops + kExtra]; + for (int nops = 0; nops < kMaxNops; nops++) { + // Place the break anywhere within the block. + for (int index = 0; index < nops; index++) { + memset(code, kExprNop, sizeof(code)); + code[0] = kExprBlock; + code[sizeof(code) - 1] = kExprEnd; + + int expected = nops * 11 + index; + code[1 + index + 0] = kExprI8Const; + code[1 + index + 1] = static_cast<byte>(expected); + code[1 + index + 2] = kExprBr; + code[1 + index + 3] = ARITY_1; + code[1 + index + 4] = 0; + + WasmRunner<int32_t> r(kExecuteInterpreted); + r.Build(code, code + kMaxNops + kExtra); + CHECK_EQ(expected, r.Call()); + } + } +} + +TEST(Run_Wasm_nested_ifs_i) { + WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32(), + MachineType::Int32()); + + BUILD(r, WASM_IF_ELSE( + WASM_GET_LOCAL(0), + WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), + WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); + + CHECK_EQ(11, r.Call(1, 1)); + CHECK_EQ(12, r.Call(1, 0)); + CHECK_EQ(13, r.Call(0, 1)); + CHECK_EQ(14, r.Call(0, 0)); +} + +// Make tests more robust by not hard-coding offsets of various operations. +// The {Find} method finds the offsets for the given bytecodes, returning +// the offsets in an array. +std::unique_ptr<int[]> Find(byte* code, size_t code_size, int n, ...) { + va_list vl; + va_start(vl, n); + + std::unique_ptr<int[]> offsets(new int[n]); + + for (int i = 0; i < n; i++) { + offsets[i] = -1; + } + + int pos = 0; + WasmOpcode current = static_cast<WasmOpcode>(va_arg(vl, int)); + for (size_t i = 0; i < code_size; i++) { + if (code[i] == current) { + offsets[pos++] = static_cast<int>(i); + if (pos == n) break; + current = static_cast<WasmOpcode>(va_arg(vl, int)); + } + } + va_end(vl); + + return offsets; +} + +TEST(Breakpoint_I32Add) { + static const int kLocalsDeclSize = 1; + static const int kNumBreakpoints = 3; + byte code[] = {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; + std::unique_ptr<int[]> offsets = + Find(code, sizeof(code), kNumBreakpoints, kExprGetLocal, kExprGetLocal, + kExprI32Add); + + WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Uint32(), + MachineType::Uint32()); + + r.Build(code, code + arraysize(code)); + + WasmInterpreter* interpreter = r.interpreter(); + WasmInterpreter::Thread* thread = interpreter->GetThread(0); + for (int i = 0; i < kNumBreakpoints; i++) { + interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[i], + true); + } + + FOR_UINT32_INPUTS(a) { + for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) { + thread->Reset(); + WasmVal args[] = {WasmVal(*a), WasmVal(b)}; + thread->PushFrame(r.function(), args); + + for (int i = 0; i < kNumBreakpoints; i++) { + thread->Run(); // run to next breakpoint + // Check the thread stopped at the right pc. + CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); + CHECK_EQ(kLocalsDeclSize + offsets[i], thread->GetBreakpointPc()); + } + + thread->Run(); // run to completion + + // Check the thread finished with the right value. + CHECK_EQ(WasmInterpreter::FINISHED, thread->state()); + uint32_t expected = (*a) + (b); + CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>()); + } + } +} + +TEST(Step_I32Mul) { + static const int kTraceLength = 4; + byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; + + WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Uint32(), + MachineType::Uint32()); + + r.Build(code, code + arraysize(code)); + + WasmInterpreter* interpreter = r.interpreter(); + WasmInterpreter::Thread* thread = interpreter->GetThread(0); + + FOR_UINT32_INPUTS(a) { + for (uint32_t b = 33; b < 3000000000u; b += 1000000000u) { + thread->Reset(); + WasmVal args[] = {WasmVal(*a), WasmVal(b)}; + thread->PushFrame(r.function(), args); + + // Run instructions one by one. + for (int i = 0; i < kTraceLength - 1; i++) { + thread->Step(); + // Check the thread stopped. + CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); + } + + // Run last instruction. + thread->Step(); + + // Check the thread finished with the right value. + CHECK_EQ(WasmInterpreter::FINISHED, thread->state()); + uint32_t expected = (*a) * (b); + CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>()); + } + } +} + +TEST(Breakpoint_I32And_disable) { + static const int kLocalsDeclSize = 1; + static const int kNumBreakpoints = 1; + byte code[] = {WASM_I32_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; + std::unique_ptr<int[]> offsets = + Find(code, sizeof(code), kNumBreakpoints, kExprI32And); + + WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Uint32(), + MachineType::Uint32()); + + r.Build(code, code + arraysize(code)); + + WasmInterpreter* interpreter = r.interpreter(); + WasmInterpreter::Thread* thread = interpreter->GetThread(0); + + FOR_UINT32_INPUTS(a) { + for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) { + // Run with and without breakpoints. + for (int do_break = 0; do_break < 2; do_break++) { + interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[0], + do_break); + thread->Reset(); + WasmVal args[] = {WasmVal(*a), WasmVal(b)}; + thread->PushFrame(r.function(), args); + + if (do_break) { + thread->Run(); // run to next breakpoint + // Check the thread stopped at the right pc. + CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); + CHECK_EQ(kLocalsDeclSize + offsets[0], thread->GetBreakpointPc()); + } + + thread->Run(); // run to completion + + // Check the thread finished with the right value. + CHECK_EQ(WasmInterpreter::FINISHED, thread->state()); + uint32_t expected = (*a) & (b); + CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>()); + } + } + } +} + +} // namespace wasm +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc index 6d95d6e0fc..9dfba74ecc 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc @@ -25,14 +25,12 @@ using namespace v8::internal::wasm; r.Build(code, code + arraysize(code)); \ } while (false) - #define ADD_CODE(vec, ...) \ do { \ byte __buf[] = {__VA_ARGS__}; \ for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ } while (false) - namespace { // A helper for generating predictable but unique argument values that // are easy to debug (e.g. with misaligned stacks). @@ -48,23 +46,6 @@ class PredictableInputValues { } }; - -uint32_t AddJsFunction(TestingModule* module, FunctionSig* sig, - const char* source) { - Handle<JSFunction> jsfunc = Handle<JSFunction>::cast(v8::Utils::OpenHandle( - *v8::Local<v8::Function>::Cast(CompileRun(source)))); - module->AddFunction(sig, Handle<Code>::null()); - uint32_t index = static_cast<uint32_t>(module->module->functions.size() - 1); - Isolate* isolate = CcTest::InitIsolateOnce(); - WasmName module_name = {"test", 4}; - WasmName function_name = {nullptr, 0}; - Handle<Code> code = CompileWasmToJSWrapper(isolate, module, jsfunc, sig, - module_name, function_name); - module->instance->function_code[index] = code; - return index; -} - - uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) { const int kMaxParams = 11; static const char* formals[kMaxParams] = {"", @@ -86,22 +67,9 @@ uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) { SNPrintF(source, "(function(%s) { return %c; })", formals[sig->parameter_count()], param); - return AddJsFunction(module, sig, source.start()); -} - - -Handle<JSFunction> WrapCode(ModuleEnv* module, uint32_t index) { - Isolate* isolate = module->module->shared_isolate; - // Wrap the code so it can be called as a JS function. - Handle<String> name = isolate->factory()->NewStringFromStaticChars("main"); - Handle<JSObject> module_object = Handle<JSObject>(0, isolate); - Handle<Code> code = module->instance->function_code[index]; - WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); - return compiler::CompileJSToWasmWrapper(isolate, module, name, code, - module_object, index); + return module->AddJsFunction(sig, source.start()); } - void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, Handle<Object>* buffer, int count) { Isolate* isolate = jsfunc->GetIsolate(); @@ -119,7 +87,6 @@ void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, } } - void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a, double b) { Isolate* isolate = jsfunc->GetIsolate(); @@ -130,72 +97,70 @@ void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a, } // namespace TEST(Run_Int32Sub_jswrapped) { + CcTest::InitializeVM(); TestSignatures sigs; TestingModule module; WasmFunctionCompiler t(sigs.i_ii(), &module); BUILD(t, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); EXPECT_CALL(33, jsfunc, 44, 11); EXPECT_CALL(-8723487, jsfunc, -8000000, 723487); } - TEST(Run_Float32Div_jswrapped) { + CcTest::InitializeVM(); TestSignatures sigs; TestingModule module; WasmFunctionCompiler t(sigs.f_ff(), &module); BUILD(t, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); EXPECT_CALL(92, jsfunc, 46, 0.5); EXPECT_CALL(64, jsfunc, -16, -0.25); } - TEST(Run_Float64Add_jswrapped) { + CcTest::InitializeVM(); TestSignatures sigs; TestingModule module; WasmFunctionCompiler t(sigs.d_dd(), &module); BUILD(t, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); EXPECT_CALL(3, jsfunc, 2, 1); EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25); } - TEST(Run_I32Popcount_jswrapped) { + CcTest::InitializeVM(); TestSignatures sigs; TestingModule module; WasmFunctionCompiler t(sigs.i_i(), &module); BUILD(t, WASM_I32_POPCNT(WASM_GET_LOCAL(0))); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); EXPECT_CALL(2, jsfunc, 9, 0); EXPECT_CALL(3, jsfunc, 11, 0); EXPECT_CALL(6, jsfunc, 0x3F, 0); - - USE(AddJsFunction); } - TEST(Run_CallJS_Add_jswrapped) { + CcTest::InitializeVM(); TestSignatures sigs; TestingModule module; WasmFunctionCompiler t(sigs.i_i(), &module); uint32_t js_index = - AddJsFunction(&module, sigs.i_i(), "(function(a) { return a + 99; })"); - BUILD(t, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0))); + module.AddJsFunction(sigs.i_i(), "(function(a) { return a + 99; })"); + BUILD(t, WASM_CALL_FUNCTION1(js_index, WASM_GET_LOCAL(0))); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); EXPECT_CALL(101, jsfunc, 2, -8); EXPECT_CALL(199, jsfunc, 100, -1); EXPECT_CALL(-666666801, jsfunc, -666666900, -1); } - void RunJSSelectTest(int which) { const int kMaxParams = 8; PredictableInputValues inputs(0x100); @@ -212,40 +177,64 @@ void RunJSSelectTest(int which) { { std::vector<byte> code; - ADD_CODE(code, kExprCallFunction, static_cast<byte>(js_index)); for (int i = 0; i < num_params; i++) { ADD_CODE(code, WASM_F64(inputs.arg_d(i))); } + ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), + static_cast<byte>(js_index)); + size_t end = code.size(); code.push_back(0); t.Build(&code[0], &code[end]); } - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); double expected = inputs.arg_d(which); EXPECT_CALL(expected, jsfunc, 0.0, 0.0); } } +TEST(Run_JSSelect_0) { + CcTest::InitializeVM(); + RunJSSelectTest(0); +} -TEST(Run_JSSelect_0) { RunJSSelectTest(0); } - -TEST(Run_JSSelect_1) { RunJSSelectTest(1); } - -TEST(Run_JSSelect_2) { RunJSSelectTest(2); } +TEST(Run_JSSelect_1) { + CcTest::InitializeVM(); + RunJSSelectTest(1); +} -TEST(Run_JSSelect_3) { RunJSSelectTest(3); } +TEST(Run_JSSelect_2) { + CcTest::InitializeVM(); + RunJSSelectTest(2); +} -TEST(Run_JSSelect_4) { RunJSSelectTest(4); } +TEST(Run_JSSelect_3) { + CcTest::InitializeVM(); + RunJSSelectTest(3); +} -TEST(Run_JSSelect_5) { RunJSSelectTest(5); } +TEST(Run_JSSelect_4) { + CcTest::InitializeVM(); + RunJSSelectTest(4); +} -TEST(Run_JSSelect_6) { RunJSSelectTest(6); } +TEST(Run_JSSelect_5) { + CcTest::InitializeVM(); + RunJSSelectTest(5); +} -TEST(Run_JSSelect_7) { RunJSSelectTest(7); } +TEST(Run_JSSelect_6) { + CcTest::InitializeVM(); + RunJSSelectTest(6); +} +TEST(Run_JSSelect_7) { + CcTest::InitializeVM(); + RunJSSelectTest(7); +} void RunWASMSelectTest(int which) { PredictableInputValues inputs(0x200); @@ -260,7 +249,7 @@ void RunWASMSelectTest(int which) { TestingModule module; WasmFunctionCompiler t(&sig, &module); BUILD(t, WASM_GET_LOCAL(which)); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); Handle<Object> args[] = { isolate->factory()->NewNumber(inputs.arg_d(0)), @@ -278,23 +267,45 @@ void RunWASMSelectTest(int which) { } } +TEST(Run_WASMSelect_0) { + CcTest::InitializeVM(); + RunWASMSelectTest(0); +} -TEST(Run_WASMSelect_0) { RunWASMSelectTest(0); } - -TEST(Run_WASMSelect_1) { RunWASMSelectTest(1); } - -TEST(Run_WASMSelect_2) { RunWASMSelectTest(2); } +TEST(Run_WASMSelect_1) { + CcTest::InitializeVM(); + RunWASMSelectTest(1); +} -TEST(Run_WASMSelect_3) { RunWASMSelectTest(3); } +TEST(Run_WASMSelect_2) { + CcTest::InitializeVM(); + RunWASMSelectTest(2); +} -TEST(Run_WASMSelect_4) { RunWASMSelectTest(4); } +TEST(Run_WASMSelect_3) { + CcTest::InitializeVM(); + RunWASMSelectTest(3); +} -TEST(Run_WASMSelect_5) { RunWASMSelectTest(5); } +TEST(Run_WASMSelect_4) { + CcTest::InitializeVM(); + RunWASMSelectTest(4); +} -TEST(Run_WASMSelect_6) { RunWASMSelectTest(6); } +TEST(Run_WASMSelect_5) { + CcTest::InitializeVM(); + RunWASMSelectTest(5); +} -TEST(Run_WASMSelect_7) { RunWASMSelectTest(7); } +TEST(Run_WASMSelect_6) { + CcTest::InitializeVM(); + RunWASMSelectTest(6); +} +TEST(Run_WASMSelect_7) { + CcTest::InitializeVM(); + RunWASMSelectTest(7); +} void RunWASMSelectAlignTest(int num_args, int num_params) { PredictableInputValues inputs(0x300); @@ -310,7 +321,7 @@ void RunWASMSelectAlignTest(int num_args, int num_params) { TestingModule module; WasmFunctionCompiler t(&sig, &module); BUILD(t, WASM_GET_LOCAL(which)); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)), isolate->factory()->NewNumber(inputs.arg_d(1)), @@ -329,43 +340,45 @@ void RunWASMSelectAlignTest(int num_args, int num_params) { } } - TEST(Run_WASMSelectAlign_0) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(0, 1); RunWASMSelectAlignTest(0, 2); } - TEST(Run_WASMSelectAlign_1) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(1, 2); RunWASMSelectAlignTest(1, 3); } - TEST(Run_WASMSelectAlign_2) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(2, 3); RunWASMSelectAlignTest(2, 4); } - TEST(Run_WASMSelectAlign_3) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(3, 3); RunWASMSelectAlignTest(3, 4); } - TEST(Run_WASMSelectAlign_4) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(4, 3); RunWASMSelectAlignTest(4, 4); } TEST(Run_WASMSelectAlign_7) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(7, 5); RunWASMSelectAlignTest(7, 6); RunWASMSelectAlignTest(7, 7); } TEST(Run_WASMSelectAlign_8) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(8, 5); RunWASMSelectAlignTest(8, 6); RunWASMSelectAlignTest(8, 7); @@ -373,6 +386,7 @@ TEST(Run_WASMSelectAlign_8) { } TEST(Run_WASMSelectAlign_9) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(9, 6); RunWASMSelectAlignTest(9, 7); RunWASMSelectAlignTest(9, 8); @@ -380,6 +394,7 @@ TEST(Run_WASMSelectAlign_9) { } TEST(Run_WASMSelectAlign_10) { + CcTest::InitializeVM(); RunWASMSelectAlignTest(10, 7); RunWASMSelectAlignTest(10, 8); RunWASMSelectAlignTest(10, 9); @@ -400,12 +415,13 @@ void RunJSSelectAlignTest(int num_args, int num_params) { // Build the calling code. std::vector<byte> code; - ADD_CODE(code, kExprCallFunction, 0); for (int i = 0; i < num_params; i++) { ADD_CODE(code, WASM_GET_LOCAL(i)); } + ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), 0); + size_t end = code.size(); code.push_back(0); @@ -418,7 +434,7 @@ void RunJSSelectAlignTest(int num_args, int num_params) { WasmFunctionCompiler t(&sig, &module); t.Build(&code[0], &code[end]); - Handle<JSFunction> jsfunc = WrapCode(&module, t.CompileAndAdd()); + Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); Handle<Object> args[] = { factory->NewNumber(inputs.arg_d(0)), @@ -439,33 +455,38 @@ void RunJSSelectAlignTest(int num_args, int num_params) { } } - TEST(Run_JSSelectAlign_0) { + CcTest::InitializeVM(); RunJSSelectAlignTest(0, 1); RunJSSelectAlignTest(0, 2); } TEST(Run_JSSelectAlign_1) { + CcTest::InitializeVM(); RunJSSelectAlignTest(1, 2); RunJSSelectAlignTest(1, 3); } TEST(Run_JSSelectAlign_2) { + CcTest::InitializeVM(); RunJSSelectAlignTest(2, 3); RunJSSelectAlignTest(2, 4); } TEST(Run_JSSelectAlign_3) { + CcTest::InitializeVM(); RunJSSelectAlignTest(3, 3); RunJSSelectAlignTest(3, 4); } TEST(Run_JSSelectAlign_4) { + CcTest::InitializeVM(); RunJSSelectAlignTest(4, 3); RunJSSelectAlignTest(4, 4); } TEST(Run_JSSelectAlign_7) { + CcTest::InitializeVM(); RunJSSelectAlignTest(7, 3); RunJSSelectAlignTest(7, 4); RunJSSelectAlignTest(7, 4); @@ -473,6 +494,7 @@ TEST(Run_JSSelectAlign_7) { } TEST(Run_JSSelectAlign_8) { + CcTest::InitializeVM(); RunJSSelectAlignTest(8, 5); RunJSSelectAlignTest(8, 6); RunJSSelectAlignTest(8, 7); @@ -480,6 +502,7 @@ TEST(Run_JSSelectAlign_8) { } TEST(Run_JSSelectAlign_9) { + CcTest::InitializeVM(); RunJSSelectAlignTest(9, 6); RunJSSelectAlignTest(9, 7); RunJSSelectAlignTest(9, 8); @@ -487,6 +510,7 @@ TEST(Run_JSSelectAlign_9) { } TEST(Run_JSSelectAlign_10) { + CcTest::InitializeVM(); RunJSSelectAlignTest(10, 7); RunJSSelectAlignTest(10, 8); RunJSSelectAlignTest(10, 9); 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 118a91f3e9..8449a52ff3 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -6,190 +6,253 @@ #include <string.h> #include "src/wasm/encoder.h" +#include "src/wasm/module-decoder.h" #include "src/wasm/wasm-js.h" #include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-opcodes.h" #include "test/cctest/cctest.h" +#include "test/cctest/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; using namespace v8::internal::compiler; using namespace v8::internal::wasm; - -// TODO(titzer): fix arm64 frame alignment. namespace { -void TestModule(WasmModuleIndex* module, int32_t expected_result) { +void TestModule(Zone* zone, WasmModuleBuilder* builder, + int32_t expected_result) { + ZoneBuffer buffer(zone); + builder->WriteTo(buffer); + Isolate* isolate = CcTest::InitIsolateOnce(); HandleScope scope(isolate); WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); int32_t result = - CompileAndRunWasmModule(isolate, module->Begin(), module->End()); + testing::CompileAndRunWasmModule(isolate, buffer.begin(), buffer.end()); CHECK_EQ(expected_result, result); } -} // namespace +void ExportAs(WasmFunctionBuilder* f, const char* name) { + f->SetExported(); + f->SetName(name, static_cast<int>(strlen(name))); +} -// A raw test that skips the WasmModuleBuilder. -TEST(Run_WasmModule_CallAdd_rev) { - static const byte data[] = { - WASM_MODULE_HEADER, - // sig#0 ------------------------------------------ - WASM_SECTION_SIGNATURES_SIZE + 7, // Section size. - WASM_SECTION_SIGNATURES, 2, 0, kLocalI32, // void -> int - 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int - // func#0 (main) ---------------------------------- - WASM_SECTION_FUNCTIONS_SIZE + 24, WASM_SECTION_FUNCTIONS, 2, - kDeclFunctionExport, 0, 0, // sig index - 7, 0, // body size - 0, // locals - kExprCallFunction, 1, // -- - kExprI8Const, 77, // -- - kExprI8Const, 22, // -- - // func#1 ----------------------------------------- - 0, // no name, not exported - 1, 0, // sig index - 6, 0, // body size - 0, // locals - kExprI32Add, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- - }; - - Isolate* isolate = CcTest::InitIsolateOnce(); - HandleScope scope(isolate); - WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); - int32_t result = - CompileAndRunWasmModule(isolate, data, data + arraysize(data)); - CHECK_EQ(99, result); +void ExportAsMain(WasmFunctionBuilder* f) { + static const char kMainName[] = "main"; + ExportAs(f, kMainName); } +} // namespace TEST(Run_WasmModule_Return114) { static const int32_t kReturnValue = 114; + TestSignatures sigs; v8::base::AccountingAllocator allocator; Zone zone(&allocator); + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); uint16_t f_index = builder->AddFunction(); WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->ReturnType(kAstI32); - f->Exported(1); + f->SetSignature(sigs.i_v()); + ExportAsMain(f); byte code[] = {WASM_I8(kReturnValue)}; f->EmitCode(code, sizeof(code)); - WasmModuleWriter* writer = builder->Build(&zone); - TestModule(writer->WriteTo(&zone), kReturnValue); + TestModule(&zone, builder, kReturnValue); } - TEST(Run_WasmModule_CallAdd) { v8::base::AccountingAllocator allocator; Zone zone(&allocator); + TestSignatures sigs; + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + uint16_t f1_index = builder->AddFunction(); WasmFunctionBuilder* f = builder->FunctionAt(f1_index); - f->ReturnType(kAstI32); - uint16_t param1 = f->AddParam(kAstI32); - uint16_t param2 = f->AddParam(kAstI32); + f->SetSignature(sigs.i_ii()); + uint16_t param1 = 0; + uint16_t param2 = 1; byte code1[] = {WASM_I32_ADD(WASM_GET_LOCAL(param1), WASM_GET_LOCAL(param2))}; - uint32_t local_indices1[] = {2, 4}; - f->EmitCode(code1, sizeof(code1), local_indices1, sizeof(local_indices1) / 4); + f->EmitCode(code1, sizeof(code1)); + uint16_t f2_index = builder->AddFunction(); f = builder->FunctionAt(f2_index); - f->ReturnType(kAstI32); - f->Exported(1); - byte code2[] = {WASM_CALL_FUNCTION(f1_index, WASM_I8(77), WASM_I8(22))}; + f->SetSignature(sigs.i_v()); + + ExportAsMain(f); + byte code2[] = {WASM_CALL_FUNCTION2(f1_index, WASM_I8(77), WASM_I8(22))}; f->EmitCode(code2, sizeof(code2)); - WasmModuleWriter* writer = builder->Build(&zone); - TestModule(writer->WriteTo(&zone), 99); + TestModule(&zone, builder, 99); } - TEST(Run_WasmModule_ReadLoadedDataSegment) { static const byte kDataSegmentDest0 = 12; v8::base::AccountingAllocator allocator; Zone zone(&allocator); + TestSignatures sigs; + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); uint16_t f_index = builder->AddFunction(); WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->ReturnType(kAstI32); - f->Exported(1); + f->SetSignature(sigs.i_v()); + + ExportAsMain(f); byte code[] = { WASM_LOAD_MEM(MachineType::Int32(), WASM_I8(kDataSegmentDest0))}; f->EmitCode(code, sizeof(code)); byte data[] = {0xaa, 0xbb, 0xcc, 0xdd}; builder->AddDataSegment(new (&zone) WasmDataSegmentEncoder( &zone, data, sizeof(data), kDataSegmentDest0)); - WasmModuleWriter* writer = builder->Build(&zone); - TestModule(writer->WriteTo(&zone), 0xddccbbaa); + TestModule(&zone, builder, 0xddccbbaa); } TEST(Run_WasmModule_CheckMemoryIsZero) { static const int kCheckSize = 16 * 1024; v8::base::AccountingAllocator allocator; Zone zone(&allocator); + TestSignatures sigs; + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); uint16_t f_index = builder->AddFunction(); WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->ReturnType(kAstI32); + f->SetSignature(sigs.i_v()); + uint16_t localIndex = f->AddLocal(kAstI32); - f->Exported(1); + ExportAsMain(f); byte code[] = {WASM_BLOCK( - 2, WASM_WHILE( WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32V_3(kCheckSize)), WASM_IF_ELSE( WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(localIndex)), WASM_BRV(2, WASM_I8(-1)), WASM_INC_LOCAL_BY(localIndex, 4))), WASM_I8(11))}; - f->EmitCode(code, sizeof(code), nullptr, 0); - WasmModuleWriter* writer = builder->Build(&zone); - TestModule(writer->WriteTo(&zone), 11); + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, 11); } TEST(Run_WasmModule_CallMain_recursive) { v8::base::AccountingAllocator allocator; Zone zone(&allocator); + TestSignatures sigs; + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); uint16_t f_index = builder->AddFunction(); WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->ReturnType(kAstI32); + f->SetSignature(sigs.i_v()); + uint16_t localIndex = f->AddLocal(kAstI32); - f->Exported(1); + ExportAsMain(f); byte code[] = {WASM_BLOCK( - 2, WASM_SET_LOCAL(localIndex, - WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), + WASM_SET_LOCAL(localIndex, + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), WASM_IF_ELSE(WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I8(5)), - WASM_BLOCK(2, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, - WASM_INC_LOCAL(localIndex)), + WASM_BLOCK(WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, + WASM_INC_LOCAL(localIndex)), WASM_BRV(1, WASM_CALL_FUNCTION0(0))), WASM_BRV(0, WASM_I8(55))))}; - f->EmitCode(code, sizeof(code), nullptr, 0); - WasmModuleWriter* writer = builder->Build(&zone); - TestModule(writer->WriteTo(&zone), 55); + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, 55); } TEST(Run_WasmModule_Global) { v8::base::AccountingAllocator allocator; Zone zone(&allocator); + TestSignatures sigs; + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint32_t global1 = builder->AddGlobal(MachineType::Int32(), 0); - uint32_t global2 = builder->AddGlobal(MachineType::Int32(), 0); + uint32_t global1 = builder->AddGlobal(kAstI32, 0); + uint32_t global2 = builder->AddGlobal(kAstI32, 0); uint16_t f1_index = builder->AddFunction(); WasmFunctionBuilder* f = builder->FunctionAt(f1_index); - f->ReturnType(kAstI32); + f->SetSignature(sigs.i_v()); byte code1[] = { - WASM_I32_ADD(WASM_LOAD_GLOBAL(global1), WASM_LOAD_GLOBAL(global2))}; + WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; f->EmitCode(code1, sizeof(code1)); uint16_t f2_index = builder->AddFunction(); f = builder->FunctionAt(f2_index); - f->ReturnType(kAstI32); - f->Exported(1); - byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), - WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), - WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; + f->SetSignature(sigs.i_v()); + ExportAsMain(f); + byte code2[] = {WASM_SET_GLOBAL(global1, WASM_I32V_1(56)), + WASM_SET_GLOBAL(global2, WASM_I32V_1(41)), + WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))}; f->EmitCode(code2, sizeof(code2)); - WasmModuleWriter* writer = builder->Build(&zone); - TestModule(writer->WriteTo(&zone), 97); + TestModule(&zone, builder, 97); +} + +TEST(Run_WasmModule_Serialization) { + FLAG_expose_wasm = true; + static const char* kFunctionName = "increment"; + v8::base::AccountingAllocator allocator; + Zone zone(&allocator); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + uint16_t f_index = builder->AddFunction(); + TestSignatures sigs; + + WasmFunctionBuilder* f = builder->FunctionAt(f_index); + f->SetSignature(sigs.i_i()); + byte code[] = {WASM_GET_LOCAL(0), kExprI32Const, 1, kExprI32Add}; + f->EmitCode(code, sizeof(code)); + ExportAs(f, kFunctionName); + + ZoneBuffer buffer(&zone); + builder->WriteTo(buffer); + + Isolate* isolate = CcTest::InitIsolateOnce(); + ErrorThrower thrower(isolate, ""); + + v8::WasmCompiledModule::SerializedModule data; + { + HandleScope scope(isolate); + + ModuleResult decoding_result = DecodeWasmModule( + isolate, &zone, buffer.begin(), buffer.end(), false, kWasmOrigin); + std::unique_ptr<const WasmModule> module(decoding_result.val); + CHECK(!decoding_result.failed()); + + MaybeHandle<FixedArray> compiled_module = + module->CompileFunctions(isolate, &thrower); + CHECK(!compiled_module.is_null()); + Handle<JSObject> module_obj = + CreateCompiledModuleObject(isolate, compiled_module.ToHandleChecked()); + v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); + CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); + + v8::Local<v8::WasmCompiledModule> v8_compiled_module = + v8_module_obj.As<v8::WasmCompiledModule>(); + data = v8_compiled_module->Serialize(); + } + + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = isolate->array_buffer_allocator(); + + v8::Isolate* v8_isolate = v8::Isolate::New(create_params); + isolate = reinterpret_cast<Isolate*>(v8_isolate); + { + v8::Isolate::Scope isolate_scope(v8_isolate); + v8::HandleScope new_scope(v8_isolate); + v8::Local<v8::Context> new_ctx = v8::Context::New(v8_isolate); + new_ctx->Enter(); + + v8::MaybeLocal<v8::WasmCompiledModule> deserialized = + v8::WasmCompiledModule::Deserialize(v8_isolate, data); + v8::Local<v8::WasmCompiledModule> compiled_module; + CHECK(deserialized.ToLocal(&compiled_module)); + Handle<JSObject> module_object = + Handle<JSObject>::cast(v8::Utils::OpenHandle(*compiled_module)); + Handle<FixedArray> compiled_part = + handle(FixedArray::cast(module_object->GetInternalField(0))); + Handle<JSObject> instance = + WasmModule::Instantiate(isolate, compiled_part, + Handle<JSReceiver>::null(), + Handle<JSArrayBuffer>::null()) + .ToHandleChecked(); + Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(41), isolate)}; + int32_t result = testing::CallFunction(isolate, instance, &thrower, + kFunctionName, 1, params); + CHECK(result == 42); + new_ctx->Exit(); + } } diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc b/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc new file mode 100644 index 0000000000..65b1d57bc1 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc @@ -0,0 +1,60 @@ +// 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 <stdlib.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" + +using namespace v8::internal; +using namespace v8::internal::compiler; + +#define FOREACH_TYPE(TEST_BODY) \ + TEST_BODY(int32_t, I32, WASM_I32_ADD) \ + TEST_BODY(int64_t, I64, WASM_I64_ADD) \ + TEST_BODY(float, F32, WASM_F32_ADD) \ + TEST_BODY(double, F64, WASM_F64_ADD) + +#define LOAD_SET_GLOBAL_TEST_BODY(C_TYPE, MACHINE_TYPE, ADD) \ + TEST(WasmRelocateGlobal##MACHINE_TYPE) { \ + TestingModule module(kExecuteCompiled); \ + module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \ + module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \ + \ + WasmRunner<C_TYPE> r(&module, \ + WasmOpcodes::MachineTypeFor(kAst##MACHINE_TYPE)); \ + \ + /* global = global + p0 */ \ + BUILD(r, WASM_SET_GLOBAL(1, ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0)))); \ + CHECK_EQ(1, module.instance->function_code.size()); \ + \ + int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \ + \ + Handle<Code> code = module.instance->function_code[0]; \ + \ + Address old_start = module.instance->globals_start; \ + Address new_start = old_start + 1; \ + \ + Address old_addresses[2]; \ + uint32_t address_index = 0U; \ + for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ + old_addresses[address_index] = it.rinfo()->wasm_global_reference(); \ + it.rinfo()->update_wasm_global_reference(old_start, new_start); \ + ++address_index; \ + } \ + CHECK_EQ(2U, address_index); \ + \ + address_index = 0U; \ + for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ + CHECK_EQ(old_addresses[address_index] + 1, \ + it.rinfo()->wasm_global_reference()); \ + ++address_index; \ + } \ + CHECK_EQ(2U, address_index); \ + } + +FOREACH_TYPE(LOAD_SET_GLOBAL_TEST_BODY) diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index 70d461b627..42ca816655 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -6,6 +6,8 @@ #include <stdlib.h> #include <string.h> +#include "src/base/platform/elapsed-timer.h" +#include "src/utils.h" #include "src/wasm/wasm-macro-gen.h" #include "test/cctest/cctest.h" @@ -19,41 +21,38 @@ using namespace v8::internal::compiler; using namespace v8::internal::wasm; // for even shorter tests. -#define B2(a, b) kExprBlock, 2, a, b -#define B1(a) kExprBlock, 1, a -#define RET(x) kExprReturn, x -#define RET_I8(x) kExprReturn, kExprI8Const, x +#define B2(a, b) kExprBlock, a, b, kExprEnd +#define B1(a) kExprBlock, a, kExprEnd +#define RET(x) x, kExprReturn, 1 +#define RET_I8(x) kExprI8Const, x, kExprReturn, 1 -TEST(Run_WasmInt8Const) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Int8Const) { + WasmRunner<int32_t> r(execution_mode); const byte kExpectedValue = 121; // return(kExpectedValue) BUILD(r, WASM_I8(kExpectedValue)); CHECK_EQ(kExpectedValue, r.Call()); } - -TEST(Run_WasmInt8Const_fallthru1) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Int8Const_fallthru1) { + WasmRunner<int32_t> r(execution_mode); const byte kExpectedValue = 122; // kExpectedValue BUILD(r, WASM_I8(kExpectedValue)); CHECK_EQ(kExpectedValue, r.Call()); } - -TEST(Run_WasmInt8Const_fallthru2) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Int8Const_fallthru2) { + WasmRunner<int32_t> r(execution_mode); const byte kExpectedValue = 123; // -99 kExpectedValue BUILD(r, WASM_I8(-99), WASM_I8(kExpectedValue)); CHECK_EQ(kExpectedValue, r.Call()); } - -TEST(Run_WasmInt8Const_all) { - for (int value = -128; value <= 127; value++) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Int8Const_all) { + for (int value = -128; value <= 127; ++value) { + WasmRunner<int32_t> r(execution_mode); // return(value) BUILD(r, WASM_I8(value)); int32_t result = r.Call(); @@ -61,19 +60,17 @@ TEST(Run_WasmInt8Const_all) { } } - -TEST(Run_WasmInt32Const) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Int32Const) { + WasmRunner<int32_t> r(execution_mode); const int32_t kExpectedValue = 0x11223344; // return(kExpectedValue) BUILD(r, WASM_I32V_5(kExpectedValue)); CHECK_EQ(kExpectedValue, r.Call()); } - -TEST(Run_WasmInt32Const_many) { +WASM_EXEC_TEST(Int32Const_many) { FOR_INT32_INPUTS(i) { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); const int32_t kExpectedValue = *i; // return(kExpectedValue) BUILD(r, WASM_I32V(kExpectedValue)); @@ -81,66 +78,60 @@ TEST(Run_WasmInt32Const_many) { } } - -TEST(Run_WasmMemorySize) { - TestingModule module; +WASM_EXEC_TEST(MemorySize) { + TestingModule module(execution_mode); WasmRunner<int32_t> r(&module); module.AddMemory(1024); BUILD(r, kExprMemorySize); CHECK_EQ(1024, r.Call()); } - -TEST(Run_WasmInt32Param0) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Int32Param0) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // return(local[0]) BUILD(r, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } - -TEST(Run_WasmInt32Param0_fallthru) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Int32Param0_fallthru) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // local[0] BUILD(r, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } - -TEST(Run_WasmInt32Param1) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32Param1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); // local[1] BUILD(r, WASM_GET_LOCAL(1)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); } } - -TEST(Run_WasmInt32Add) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Int32Add) { + WasmRunner<int32_t> r(execution_mode); // 11 + 44 BUILD(r, WASM_I32_ADD(WASM_I8(11), WASM_I8(44))); CHECK_EQ(55, r.Call()); } - -TEST(Run_WasmInt32Add_P) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Int32Add_P) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // p0 + 13 BUILD(r, WASM_I32_ADD(WASM_I8(13), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } } - -TEST(Run_WasmInt32Add_P_fallthru) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Int32Add_P_fallthru) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // p0 + 13 BUILD(r, WASM_I32_ADD(WASM_I8(13), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } } - -TEST(Run_WasmInt32Add_P2) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32Add_P2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); // p0 + p1 BUILD(r, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { @@ -152,180 +143,178 @@ TEST(Run_WasmInt32Add_P2) { } } - -TEST(Run_WasmFloat32Add) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Float32Add) { + WasmRunner<int32_t> r(execution_mode); // int(11.5f + 44.5f) BUILD(r, WASM_I32_SCONVERT_F32(WASM_F32_ADD(WASM_F32(11.5f), WASM_F32(44.5f)))); CHECK_EQ(56, r.Call()); } - -TEST(Run_WasmFloat64Add) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Float64Add) { + WasmRunner<int32_t> r(execution_mode); // return int(13.5d + 43.5d) BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5)))); CHECK_EQ(57, r.Call()); } - -void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) { +void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, + int32_t expected, int32_t a, int32_t b) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // K op K BUILD(r, WASM_BINOP(opcode, WASM_I32V(a), WASM_I32V(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); // a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } -TEST(Run_WasmInt32Binops) { - TestInt32Binop(kExprI32Add, 88888888, 33333333, 55555555); - TestInt32Binop(kExprI32Sub, -1111111, 7777777, 8888888); - TestInt32Binop(kExprI32Mul, 65130756, 88734, 734); - TestInt32Binop(kExprI32DivS, -66, -4777344, 72384); - TestInt32Binop(kExprI32DivU, 805306368, 0xF0000000, 5); - TestInt32Binop(kExprI32RemS, -3, -3003, 1000); - TestInt32Binop(kExprI32RemU, 4, 4004, 1000); - TestInt32Binop(kExprI32And, 0xEE, 0xFFEE, 0xFF0000FF); - TestInt32Binop(kExprI32Ior, 0xF0FF00FF, 0xF0F000EE, 0x000F0011); - TestInt32Binop(kExprI32Xor, 0xABCDEF01, 0xABCDEFFF, 0xFE); - TestInt32Binop(kExprI32Shl, 0xA0000000, 0xA, 28); - TestInt32Binop(kExprI32ShrU, 0x07000010, 0x70000100, 4); - TestInt32Binop(kExprI32ShrS, 0xFF000000, 0x80000000, 7); - TestInt32Binop(kExprI32Ror, 0x01000000, 0x80000000, 7); - TestInt32Binop(kExprI32Ror, 0x01000000, 0x80000000, 39); - TestInt32Binop(kExprI32Rol, 0x00000040, 0x80000000, 7); - TestInt32Binop(kExprI32Rol, 0x00000040, 0x80000000, 39); - TestInt32Binop(kExprI32Eq, 1, -99, -99); - TestInt32Binop(kExprI32Ne, 0, -97, -97); - - TestInt32Binop(kExprI32LtS, 1, -4, 4); - TestInt32Binop(kExprI32LeS, 0, -2, -3); - TestInt32Binop(kExprI32LtU, 1, 0, -6); - TestInt32Binop(kExprI32LeU, 1, 98978, 0xF0000000); - - TestInt32Binop(kExprI32GtS, 1, 4, -4); - TestInt32Binop(kExprI32GeS, 0, -3, -2); - TestInt32Binop(kExprI32GtU, 1, -6, 0); - TestInt32Binop(kExprI32GeU, 1, 0xF0000000, 98978); -} - - -void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) { +WASM_EXEC_TEST(Int32Binops) { + TestInt32Binop(execution_mode, kExprI32Add, 88888888, 33333333, 55555555); + TestInt32Binop(execution_mode, kExprI32Sub, -1111111, 7777777, 8888888); + TestInt32Binop(execution_mode, kExprI32Mul, 65130756, 88734, 734); + TestInt32Binop(execution_mode, kExprI32DivS, -66, -4777344, 72384); + TestInt32Binop(execution_mode, kExprI32DivU, 805306368, 0xF0000000, 5); + TestInt32Binop(execution_mode, kExprI32RemS, -3, -3003, 1000); + TestInt32Binop(execution_mode, kExprI32RemU, 4, 4004, 1000); + TestInt32Binop(execution_mode, kExprI32And, 0xEE, 0xFFEE, 0xFF0000FF); + TestInt32Binop(execution_mode, kExprI32Ior, 0xF0FF00FF, 0xF0F000EE, + 0x000F0011); + TestInt32Binop(execution_mode, kExprI32Xor, 0xABCDEF01, 0xABCDEFFF, 0xFE); + TestInt32Binop(execution_mode, kExprI32Shl, 0xA0000000, 0xA, 28); + TestInt32Binop(execution_mode, kExprI32ShrU, 0x07000010, 0x70000100, 4); + TestInt32Binop(execution_mode, kExprI32ShrS, 0xFF000000, 0x80000000, 7); + TestInt32Binop(execution_mode, kExprI32Ror, 0x01000000, 0x80000000, 7); + TestInt32Binop(execution_mode, kExprI32Ror, 0x01000000, 0x80000000, 39); + TestInt32Binop(execution_mode, kExprI32Rol, 0x00000040, 0x80000000, 7); + TestInt32Binop(execution_mode, kExprI32Rol, 0x00000040, 0x80000000, 39); + TestInt32Binop(execution_mode, kExprI32Eq, 1, -99, -99); + TestInt32Binop(execution_mode, kExprI32Ne, 0, -97, -97); + + TestInt32Binop(execution_mode, kExprI32LtS, 1, -4, 4); + TestInt32Binop(execution_mode, kExprI32LeS, 0, -2, -3); + TestInt32Binop(execution_mode, kExprI32LtU, 1, 0, -6); + TestInt32Binop(execution_mode, kExprI32LeU, 1, 98978, 0xF0000000); + + TestInt32Binop(execution_mode, kExprI32GtS, 1, 4, -4); + TestInt32Binop(execution_mode, kExprI32GeS, 0, -3, -2); + TestInt32Binop(execution_mode, kExprI32GtU, 1, -6, 0); + TestInt32Binop(execution_mode, kExprI32GeU, 1, 0xF0000000, 98978); +} + +void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode, + int32_t expected, int32_t a) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return op K BUILD(r, WASM_UNOP(opcode, WASM_I32V(a))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // return op a BUILD(r, WASM_UNOP(opcode, WASM_GET_LOCAL(0))); CHECK_EQ(expected, r.Call(a)); } } - -TEST(Run_WasmInt32Clz) { - TestInt32Unop(kExprI32Clz, 0, 0x80001000); - TestInt32Unop(kExprI32Clz, 1, 0x40000500); - TestInt32Unop(kExprI32Clz, 2, 0x20000300); - TestInt32Unop(kExprI32Clz, 3, 0x10000003); - TestInt32Unop(kExprI32Clz, 4, 0x08050000); - TestInt32Unop(kExprI32Clz, 5, 0x04006000); - TestInt32Unop(kExprI32Clz, 6, 0x02000000); - TestInt32Unop(kExprI32Clz, 7, 0x010000a0); - TestInt32Unop(kExprI32Clz, 8, 0x00800c00); - TestInt32Unop(kExprI32Clz, 9, 0x00400000); - TestInt32Unop(kExprI32Clz, 10, 0x0020000d); - TestInt32Unop(kExprI32Clz, 11, 0x00100f00); - TestInt32Unop(kExprI32Clz, 12, 0x00080000); - TestInt32Unop(kExprI32Clz, 13, 0x00041000); - TestInt32Unop(kExprI32Clz, 14, 0x00020020); - TestInt32Unop(kExprI32Clz, 15, 0x00010300); - TestInt32Unop(kExprI32Clz, 16, 0x00008040); - TestInt32Unop(kExprI32Clz, 17, 0x00004005); - TestInt32Unop(kExprI32Clz, 18, 0x00002050); - TestInt32Unop(kExprI32Clz, 19, 0x00001700); - TestInt32Unop(kExprI32Clz, 20, 0x00000870); - TestInt32Unop(kExprI32Clz, 21, 0x00000405); - TestInt32Unop(kExprI32Clz, 22, 0x00000203); - TestInt32Unop(kExprI32Clz, 23, 0x00000101); - TestInt32Unop(kExprI32Clz, 24, 0x00000089); - TestInt32Unop(kExprI32Clz, 25, 0x00000041); - TestInt32Unop(kExprI32Clz, 26, 0x00000022); - TestInt32Unop(kExprI32Clz, 27, 0x00000013); - TestInt32Unop(kExprI32Clz, 28, 0x00000008); - TestInt32Unop(kExprI32Clz, 29, 0x00000004); - TestInt32Unop(kExprI32Clz, 30, 0x00000002); - TestInt32Unop(kExprI32Clz, 31, 0x00000001); - TestInt32Unop(kExprI32Clz, 32, 0x00000000); -} - - -TEST(Run_WasmInt32Ctz) { - TestInt32Unop(kExprI32Ctz, 32, 0x00000000); - TestInt32Unop(kExprI32Ctz, 31, 0x80000000); - TestInt32Unop(kExprI32Ctz, 30, 0x40000000); - TestInt32Unop(kExprI32Ctz, 29, 0x20000000); - TestInt32Unop(kExprI32Ctz, 28, 0x10000000); - TestInt32Unop(kExprI32Ctz, 27, 0xa8000000); - TestInt32Unop(kExprI32Ctz, 26, 0xf4000000); - TestInt32Unop(kExprI32Ctz, 25, 0x62000000); - TestInt32Unop(kExprI32Ctz, 24, 0x91000000); - TestInt32Unop(kExprI32Ctz, 23, 0xcd800000); - TestInt32Unop(kExprI32Ctz, 22, 0x09400000); - TestInt32Unop(kExprI32Ctz, 21, 0xaf200000); - TestInt32Unop(kExprI32Ctz, 20, 0xac100000); - TestInt32Unop(kExprI32Ctz, 19, 0xe0b80000); - TestInt32Unop(kExprI32Ctz, 18, 0x9ce40000); - TestInt32Unop(kExprI32Ctz, 17, 0xc7920000); - TestInt32Unop(kExprI32Ctz, 16, 0xb8f10000); - TestInt32Unop(kExprI32Ctz, 15, 0x3b9f8000); - TestInt32Unop(kExprI32Ctz, 14, 0xdb4c4000); - TestInt32Unop(kExprI32Ctz, 13, 0xe9a32000); - TestInt32Unop(kExprI32Ctz, 12, 0xfca61000); - TestInt32Unop(kExprI32Ctz, 11, 0x6c8a7800); - TestInt32Unop(kExprI32Ctz, 10, 0x8ce5a400); - TestInt32Unop(kExprI32Ctz, 9, 0xcb7d0200); - TestInt32Unop(kExprI32Ctz, 8, 0xcb4dc100); - TestInt32Unop(kExprI32Ctz, 7, 0xdfbec580); - TestInt32Unop(kExprI32Ctz, 6, 0x27a9db40); - TestInt32Unop(kExprI32Ctz, 5, 0xde3bcb20); - TestInt32Unop(kExprI32Ctz, 4, 0xd7e8a610); - TestInt32Unop(kExprI32Ctz, 3, 0x9afdbc88); - TestInt32Unop(kExprI32Ctz, 2, 0x9afdbc84); - TestInt32Unop(kExprI32Ctz, 1, 0x9afdbc82); - TestInt32Unop(kExprI32Ctz, 0, 0x9afdbc81); -} - - -TEST(Run_WasmInt32Popcnt) { - TestInt32Unop(kExprI32Popcnt, 32, 0xffffffff); - TestInt32Unop(kExprI32Popcnt, 0, 0x00000000); - TestInt32Unop(kExprI32Popcnt, 1, 0x00008000); - TestInt32Unop(kExprI32Popcnt, 13, 0x12345678); - TestInt32Unop(kExprI32Popcnt, 19, 0xfedcba09); -} - -TEST(Run_WasmI32Eqz) { - TestInt32Unop(kExprI32Eqz, 0, 1); - TestInt32Unop(kExprI32Eqz, 0, -1); - TestInt32Unop(kExprI32Eqz, 0, -827343); - TestInt32Unop(kExprI32Eqz, 0, 8888888); - TestInt32Unop(kExprI32Eqz, 1, 0); -} - -TEST(Run_WasmI32Shl) { - WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); +WASM_EXEC_TEST(Int32Clz) { + TestInt32Unop(execution_mode, kExprI32Clz, 0, 0x80001000); + TestInt32Unop(execution_mode, kExprI32Clz, 1, 0x40000500); + TestInt32Unop(execution_mode, kExprI32Clz, 2, 0x20000300); + TestInt32Unop(execution_mode, kExprI32Clz, 3, 0x10000003); + TestInt32Unop(execution_mode, kExprI32Clz, 4, 0x08050000); + TestInt32Unop(execution_mode, kExprI32Clz, 5, 0x04006000); + TestInt32Unop(execution_mode, kExprI32Clz, 6, 0x02000000); + TestInt32Unop(execution_mode, kExprI32Clz, 7, 0x010000a0); + TestInt32Unop(execution_mode, kExprI32Clz, 8, 0x00800c00); + TestInt32Unop(execution_mode, kExprI32Clz, 9, 0x00400000); + TestInt32Unop(execution_mode, kExprI32Clz, 10, 0x0020000d); + TestInt32Unop(execution_mode, kExprI32Clz, 11, 0x00100f00); + TestInt32Unop(execution_mode, kExprI32Clz, 12, 0x00080000); + TestInt32Unop(execution_mode, kExprI32Clz, 13, 0x00041000); + TestInt32Unop(execution_mode, kExprI32Clz, 14, 0x00020020); + TestInt32Unop(execution_mode, kExprI32Clz, 15, 0x00010300); + TestInt32Unop(execution_mode, kExprI32Clz, 16, 0x00008040); + TestInt32Unop(execution_mode, kExprI32Clz, 17, 0x00004005); + TestInt32Unop(execution_mode, kExprI32Clz, 18, 0x00002050); + TestInt32Unop(execution_mode, kExprI32Clz, 19, 0x00001700); + TestInt32Unop(execution_mode, kExprI32Clz, 20, 0x00000870); + TestInt32Unop(execution_mode, kExprI32Clz, 21, 0x00000405); + TestInt32Unop(execution_mode, kExprI32Clz, 22, 0x00000203); + TestInt32Unop(execution_mode, kExprI32Clz, 23, 0x00000101); + TestInt32Unop(execution_mode, kExprI32Clz, 24, 0x00000089); + TestInt32Unop(execution_mode, kExprI32Clz, 25, 0x00000041); + TestInt32Unop(execution_mode, kExprI32Clz, 26, 0x00000022); + TestInt32Unop(execution_mode, kExprI32Clz, 27, 0x00000013); + TestInt32Unop(execution_mode, kExprI32Clz, 28, 0x00000008); + TestInt32Unop(execution_mode, kExprI32Clz, 29, 0x00000004); + TestInt32Unop(execution_mode, kExprI32Clz, 30, 0x00000002); + TestInt32Unop(execution_mode, kExprI32Clz, 31, 0x00000001); + TestInt32Unop(execution_mode, kExprI32Clz, 32, 0x00000000); +} + +WASM_EXEC_TEST(Int32Ctz) { + TestInt32Unop(execution_mode, kExprI32Ctz, 32, 0x00000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 31, 0x80000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 30, 0x40000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 29, 0x20000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 28, 0x10000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 27, 0xa8000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 26, 0xf4000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 25, 0x62000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 24, 0x91000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 23, 0xcd800000); + TestInt32Unop(execution_mode, kExprI32Ctz, 22, 0x09400000); + TestInt32Unop(execution_mode, kExprI32Ctz, 21, 0xaf200000); + TestInt32Unop(execution_mode, kExprI32Ctz, 20, 0xac100000); + TestInt32Unop(execution_mode, kExprI32Ctz, 19, 0xe0b80000); + TestInt32Unop(execution_mode, kExprI32Ctz, 18, 0x9ce40000); + TestInt32Unop(execution_mode, kExprI32Ctz, 17, 0xc7920000); + TestInt32Unop(execution_mode, kExprI32Ctz, 16, 0xb8f10000); + TestInt32Unop(execution_mode, kExprI32Ctz, 15, 0x3b9f8000); + TestInt32Unop(execution_mode, kExprI32Ctz, 14, 0xdb4c4000); + TestInt32Unop(execution_mode, kExprI32Ctz, 13, 0xe9a32000); + TestInt32Unop(execution_mode, kExprI32Ctz, 12, 0xfca61000); + TestInt32Unop(execution_mode, kExprI32Ctz, 11, 0x6c8a7800); + TestInt32Unop(execution_mode, kExprI32Ctz, 10, 0x8ce5a400); + TestInt32Unop(execution_mode, kExprI32Ctz, 9, 0xcb7d0200); + TestInt32Unop(execution_mode, kExprI32Ctz, 8, 0xcb4dc100); + TestInt32Unop(execution_mode, kExprI32Ctz, 7, 0xdfbec580); + TestInt32Unop(execution_mode, kExprI32Ctz, 6, 0x27a9db40); + TestInt32Unop(execution_mode, kExprI32Ctz, 5, 0xde3bcb20); + TestInt32Unop(execution_mode, kExprI32Ctz, 4, 0xd7e8a610); + TestInt32Unop(execution_mode, kExprI32Ctz, 3, 0x9afdbc88); + TestInt32Unop(execution_mode, kExprI32Ctz, 2, 0x9afdbc84); + TestInt32Unop(execution_mode, kExprI32Ctz, 1, 0x9afdbc82); + TestInt32Unop(execution_mode, kExprI32Ctz, 0, 0x9afdbc81); +} + +WASM_EXEC_TEST(Int32Popcnt) { + TestInt32Unop(execution_mode, kExprI32Popcnt, 32, 0xffffffff); + TestInt32Unop(execution_mode, kExprI32Popcnt, 0, 0x00000000); + TestInt32Unop(execution_mode, kExprI32Popcnt, 1, 0x00008000); + TestInt32Unop(execution_mode, kExprI32Popcnt, 13, 0x12345678); + TestInt32Unop(execution_mode, kExprI32Popcnt, 19, 0xfedcba09); +} + +WASM_EXEC_TEST(I32Eqz) { + TestInt32Unop(execution_mode, kExprI32Eqz, 0, 1); + TestInt32Unop(execution_mode, kExprI32Eqz, 0, -1); + TestInt32Unop(execution_mode, kExprI32Eqz, 0, -827343); + TestInt32Unop(execution_mode, kExprI32Eqz, 0, 8888888); + TestInt32Unop(execution_mode, kExprI32Eqz, 1, 0); +} + +WASM_EXEC_TEST(I32Shl) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); BUILD(r, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT32_INPUTS(i) { @@ -336,8 +325,9 @@ TEST(Run_WasmI32Shl) { } } -TEST(Run_WasmI32Shr) { - WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); +WASM_EXEC_TEST(I32Shr) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); BUILD(r, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_UINT32_INPUTS(i) { @@ -348,8 +338,9 @@ TEST(Run_WasmI32Shr) { } } -TEST(Run_WasmI32Sar) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(I32Sar) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { @@ -360,8 +351,9 @@ TEST(Run_WasmI32Sar) { } } -TEST(Run_WASM_Int32DivS_trap) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32DivS_trap) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(0, r.Call(0, 100)); @@ -371,9 +363,9 @@ TEST(Run_WASM_Int32DivS_trap) { CHECK_TRAP(r.Call(kMin, 0)); } - -TEST(Run_WASM_Int32RemS_trap) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32RemS_trap) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(33, r.Call(133, 100)); @@ -383,9 +375,9 @@ TEST(Run_WASM_Int32RemS_trap) { CHECK_TRAP(r.Call(kMin, 0)); } - -TEST(Run_WASM_Int32DivU_trap) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32DivU_trap) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(0, r.Call(0, 100)); @@ -395,9 +387,9 @@ TEST(Run_WASM_Int32DivU_trap) { CHECK_TRAP(r.Call(kMin, 0)); } - -TEST(Run_WASM_Int32RemU_trap) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32RemU_trap) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(17, r.Call(217, 100)); const int32_t kMin = std::numeric_limits<int32_t>::min(); @@ -407,64 +399,11 @@ TEST(Run_WASM_Int32RemU_trap) { CHECK_EQ(kMin, r.Call(kMin, -1)); } -TEST(Run_WASM_Int32DivS_asmjs) { - TestingModule module; - module.origin = kAsmJsOrigin; - WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - const int32_t kMin = std::numeric_limits<int32_t>::min(); - CHECK_EQ(0, r.Call(0, 100)); - CHECK_EQ(0, r.Call(100, 0)); - CHECK_EQ(0, r.Call(-1001, 0)); - CHECK_EQ(kMin, r.Call(kMin, -1)); - CHECK_EQ(0, r.Call(kMin, 0)); -} - -TEST(Run_WASM_Int32RemS_asmjs) { - TestingModule module; - module.origin = kAsmJsOrigin; - WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - const int32_t kMin = std::numeric_limits<int32_t>::min(); - CHECK_EQ(33, r.Call(133, 100)); - CHECK_EQ(0, r.Call(kMin, -1)); - CHECK_EQ(0, r.Call(100, 0)); - CHECK_EQ(0, r.Call(-1001, 0)); - CHECK_EQ(0, r.Call(kMin, 0)); -} - -TEST(Run_WASM_Int32DivU_asmjs) { - TestingModule module; - module.origin = kAsmJsOrigin; - WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - const int32_t kMin = std::numeric_limits<int32_t>::min(); - CHECK_EQ(0, r.Call(0, 100)); - CHECK_EQ(0, r.Call(kMin, -1)); - CHECK_EQ(0, r.Call(100, 0)); - CHECK_EQ(0, r.Call(-1001, 0)); - CHECK_EQ(0, r.Call(kMin, 0)); -} - -TEST(Run_WASM_Int32RemU_asmjs) { - TestingModule module; - module.origin = kAsmJsOrigin; - WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - const int32_t kMin = std::numeric_limits<int32_t>::min(); - CHECK_EQ(17, r.Call(217, 100)); - CHECK_EQ(0, r.Call(100, 0)); - CHECK_EQ(0, r.Call(-1001, 0)); - CHECK_EQ(0, r.Call(kMin, 0)); - CHECK_EQ(kMin, r.Call(kMin, -1)); -} - - -TEST(Run_WASM_Int32DivS_byzero_const) { - for (int8_t denom = -2; denom < 8; denom++) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Int32DivS_byzero_const) { + for (int8_t denom = -2; denom < 8; ++denom) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I8(denom))); - for (int32_t val = -7; val < 8; val++) { + for (int32_t val = -7; val < 8; ++val) { if (denom == 0) { CHECK_TRAP(r.Call(val)); } else { @@ -474,13 +413,12 @@ TEST(Run_WASM_Int32DivS_byzero_const) { } } - -TEST(Run_WASM_Int32DivU_byzero_const) { - for (uint32_t denom = 0xfffffffe; denom < 8; denom++) { - WasmRunner<uint32_t> r(MachineType::Uint32()); +WASM_EXEC_TEST(Int32DivU_byzero_const) { + for (uint32_t denom = 0xfffffffe; denom < 8; ++denom) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32()); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); - for (uint32_t val = 0xfffffff0; val < 8; val++) { + for (uint32_t val = 0xfffffff0; val < 8; ++val) { if (denom == 0) { CHECK_TRAP(r.Call(val)); } else { @@ -490,9 +428,8 @@ TEST(Run_WASM_Int32DivU_byzero_const) { } } - -TEST(Run_WASM_Int32DivS_trap_effect) { - TestingModule module; +WASM_EXEC_TEST(Int32DivS_trap_effect) { + TestingModule module(execution_mode); module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); @@ -510,33 +447,36 @@ TEST(Run_WASM_Int32DivS_trap_effect) { CHECK_TRAP(r.Call(0, 0)); } -void TestFloat32Binop(WasmOpcode opcode, int32_t expected, float a, float b) { +void TestFloat32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, + int32_t expected, float a, float b) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return K op K BUILD(r, WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Float32(), MachineType::Float32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Float32(), + MachineType::Float32()); // return a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } - -void TestFloat32BinopWithConvert(WasmOpcode opcode, int32_t expected, float a, +void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode, + WasmOpcode opcode, int32_t expected, float a, float b) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return int(K op K) BUILD(r, WASM_I32_SCONVERT_F32(WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Float32(), MachineType::Float32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Float32(), + MachineType::Float32()); // return int(a op b) BUILD(r, WASM_I32_SCONVERT_F32( WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); @@ -544,116 +484,119 @@ void TestFloat32BinopWithConvert(WasmOpcode opcode, int32_t expected, float a, } } - -void TestFloat32UnopWithConvert(WasmOpcode opcode, int32_t expected, float a) { +void TestFloat32UnopWithConvert(WasmExecutionMode execution_mode, + WasmOpcode opcode, int32_t expected, float a) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return int(op(K)) BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_F32(a)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Float32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Float32()); // return int(op(a)) BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_GET_LOCAL(0)))); CHECK_EQ(expected, r.Call(a)); } } - -void TestFloat64Binop(WasmOpcode opcode, int32_t expected, double a, double b) { +void TestFloat64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, + int32_t expected, double a, double b) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return K op K BUILD(r, WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Float64(), MachineType::Float64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Float64(), + MachineType::Float64()); // return a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } - -void TestFloat64BinopWithConvert(WasmOpcode opcode, int32_t expected, double a, +void TestFloat64BinopWithConvert(WasmExecutionMode execution_mode, + WasmOpcode opcode, int32_t expected, double a, double b) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return int(K op K) BUILD(r, WASM_I32_SCONVERT_F64(WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Float64(), MachineType::Float64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Float64(), + MachineType::Float64()); BUILD(r, WASM_I32_SCONVERT_F64( WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); CHECK_EQ(expected, r.Call(a, b)); } } - -void TestFloat64UnopWithConvert(WasmOpcode opcode, int32_t expected, double a) { +void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode, + WasmOpcode opcode, int32_t expected, double a) { { - WasmRunner<int32_t> r; + WasmRunner<int32_t> r(execution_mode); // return int(op(K)) BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_F64(a)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t> r(MachineType::Float64()); + WasmRunner<int32_t> r(execution_mode, MachineType::Float64()); // return int(op(a)) BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_GET_LOCAL(0)))); CHECK_EQ(expected, r.Call(a)); } } -TEST(Run_WasmFloat32Binops) { - TestFloat32Binop(kExprF32Eq, 1, 8.125f, 8.125f); - TestFloat32Binop(kExprF32Ne, 1, 8.125f, 8.127f); - TestFloat32Binop(kExprF32Lt, 1, -9.5f, -9.0f); - TestFloat32Binop(kExprF32Le, 1, -1111.0f, -1111.0f); - TestFloat32Binop(kExprF32Gt, 1, -9.0f, -9.5f); - TestFloat32Binop(kExprF32Ge, 1, -1111.0f, -1111.0f); +WASM_EXEC_TEST(Float32Binops) { + TestFloat32Binop(execution_mode, kExprF32Eq, 1, 8.125f, 8.125f); + TestFloat32Binop(execution_mode, kExprF32Ne, 1, 8.125f, 8.127f); + TestFloat32Binop(execution_mode, kExprF32Lt, 1, -9.5f, -9.0f); + TestFloat32Binop(execution_mode, kExprF32Le, 1, -1111.0f, -1111.0f); + TestFloat32Binop(execution_mode, kExprF32Gt, 1, -9.0f, -9.5f); + TestFloat32Binop(execution_mode, kExprF32Ge, 1, -1111.0f, -1111.0f); - TestFloat32BinopWithConvert(kExprF32Add, 10, 3.5f, 6.5f); - TestFloat32BinopWithConvert(kExprF32Sub, 2, 44.5f, 42.5f); - TestFloat32BinopWithConvert(kExprF32Mul, -66, -132.1f, 0.5f); - TestFloat32BinopWithConvert(kExprF32Div, 11, 22.1f, 2.0f); + TestFloat32BinopWithConvert(execution_mode, kExprF32Add, 10, 3.5f, 6.5f); + TestFloat32BinopWithConvert(execution_mode, kExprF32Sub, 2, 44.5f, 42.5f); + TestFloat32BinopWithConvert(execution_mode, kExprF32Mul, -66, -132.1f, 0.5f); + TestFloat32BinopWithConvert(execution_mode, kExprF32Div, 11, 22.1f, 2.0f); } -TEST(Run_WasmFloat32Unops) { - TestFloat32UnopWithConvert(kExprF32Abs, 8, 8.125f); - TestFloat32UnopWithConvert(kExprF32Abs, 9, -9.125f); - TestFloat32UnopWithConvert(kExprF32Neg, -213, 213.125f); - TestFloat32UnopWithConvert(kExprF32Sqrt, 12, 144.4f); +WASM_EXEC_TEST(Float32Unops) { + TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 8, 8.125f); + TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 9, -9.125f); + TestFloat32UnopWithConvert(execution_mode, kExprF32Neg, -213, 213.125f); + TestFloat32UnopWithConvert(execution_mode, kExprF32Sqrt, 12, 144.4f); } -TEST(Run_WasmFloat64Binops) { - TestFloat64Binop(kExprF64Eq, 1, 16.25, 16.25); - TestFloat64Binop(kExprF64Ne, 1, 16.25, 16.15); - TestFloat64Binop(kExprF64Lt, 1, -32.4, 11.7); - TestFloat64Binop(kExprF64Le, 1, -88.9, -88.9); - TestFloat64Binop(kExprF64Gt, 1, 11.7, -32.4); - TestFloat64Binop(kExprF64Ge, 1, -88.9, -88.9); +WASM_EXEC_TEST(Float64Binops) { + TestFloat64Binop(execution_mode, kExprF64Eq, 1, 16.25, 16.25); + TestFloat64Binop(execution_mode, kExprF64Ne, 1, 16.25, 16.15); + TestFloat64Binop(execution_mode, kExprF64Lt, 1, -32.4, 11.7); + TestFloat64Binop(execution_mode, kExprF64Le, 1, -88.9, -88.9); + TestFloat64Binop(execution_mode, kExprF64Gt, 1, 11.7, -32.4); + TestFloat64Binop(execution_mode, kExprF64Ge, 1, -88.9, -88.9); - TestFloat64BinopWithConvert(kExprF64Add, 100, 43.5, 56.5); - TestFloat64BinopWithConvert(kExprF64Sub, 200, 12200.1, 12000.1); - TestFloat64BinopWithConvert(kExprF64Mul, -33, 134, -0.25); - TestFloat64BinopWithConvert(kExprF64Div, -1111, -2222.3, 2); + TestFloat64BinopWithConvert(execution_mode, kExprF64Add, 100, 43.5, 56.5); + TestFloat64BinopWithConvert(execution_mode, kExprF64Sub, 200, 12200.1, + 12000.1); + TestFloat64BinopWithConvert(execution_mode, kExprF64Mul, -33, 134, -0.25); + TestFloat64BinopWithConvert(execution_mode, kExprF64Div, -1111, -2222.3, 2); } -TEST(Run_WasmFloat64Unops) { - TestFloat64UnopWithConvert(kExprF64Abs, 108, 108.125); - TestFloat64UnopWithConvert(kExprF64Abs, 209, -209.125); - TestFloat64UnopWithConvert(kExprF64Neg, -209, 209.125); - TestFloat64UnopWithConvert(kExprF64Sqrt, 13, 169.4); +WASM_EXEC_TEST(Float64Unops) { + TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 108, 108.125); + TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 209, -209.125); + TestFloat64UnopWithConvert(execution_mode, kExprF64Neg, -209, 209.125); + TestFloat64UnopWithConvert(execution_mode, kExprF64Sqrt, 13, 169.4); } -TEST(Run_WasmFloat32Neg) { - WasmRunner<float> r(MachineType::Float32()); +WASM_EXEC_TEST(Float32Neg) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -662,9 +605,48 @@ TEST(Run_WasmFloat32Neg) { } } +WASM_EXEC_TEST(Float32SubMinusZero) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); + BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0))); + + uint32_t sNanValue = + bit_cast<uint32_t>(std::numeric_limits<float>::signaling_NaN()); + uint32_t qNanValue = + bit_cast<uint32_t>(std::numeric_limits<float>::quiet_NaN()); + uint32_t payload = 0x00200000; + + uint32_t expected = (qNanValue & 0xffc00000) | payload; + uint32_t operand = (sNanValue & 0xffc00000) | payload; + CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand)))); + + // Change the sign of the NaN. + expected |= 0x80000000; + operand |= 0x80000000; + CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand)))); +} + +WASM_EXEC_TEST(Float64SubMinusZero) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); + BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); + + uint64_t sNanValue = + bit_cast<uint64_t>(std::numeric_limits<double>::signaling_NaN()); + uint64_t qNanValue = + bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN()); + uint64_t payload = 0x0000123456789abc; + + uint64_t expected = (qNanValue & 0xfff8000000000000) | payload; + uint64_t operand = (sNanValue & 0xfff8000000000000) | payload; + CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand)))); + + // Change the sign of the NaN. + expected |= 0x8000000000000000; + operand |= 0x8000000000000000; + CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand)))); +} -TEST(Run_WasmFloat64Neg) { - WasmRunner<double> r(MachineType::Float64()); +WASM_EXEC_TEST(Float64Neg) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -673,9 +655,8 @@ TEST(Run_WasmFloat64Neg) { } } - -TEST(Run_Wasm_IfElse_P) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(IfElse_P) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // if (p0) return 11; else return 22; BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- WASM_I8(11), // -- @@ -686,9 +667,59 @@ TEST(Run_Wasm_IfElse_P) { } } +WASM_EXEC_TEST(If_empty1) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); + BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprEnd, WASM_GET_LOCAL(1)); + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); } +} + +WASM_EXEC_TEST(IfElse_empty1) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); + BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, kExprEnd, WASM_GET_LOCAL(1)); + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); } +} + +WASM_EXEC_TEST(IfElse_empty2) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); + BUILD(r, WASM_GET_LOCAL(0), kExprIf, WASM_ZERO, kExprElse, kExprEnd, + WASM_GET_LOCAL(1)); + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); } +} + +WASM_EXEC_TEST(IfElse_empty3) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); + BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, WASM_ZERO, kExprEnd, + WASM_GET_LOCAL(1)); + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); } +} -TEST(Run_Wasm_IfElse_Unreachable1) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(If_chain) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + // if (p0) 13; if (p0) 14; 15 + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_I8(13)), + WASM_IF(WASM_GET_LOCAL(0), WASM_I8(14)), WASM_I8(15)); + FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(*i)); } +} + +WASM_EXEC_TEST(If_chain_set) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + // if (p0) p1 = 73; if (p0) p1 = 74; p1 + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I8(73))), + WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I8(74))), + WASM_GET_LOCAL(1)); + FOR_INT32_INPUTS(i) { + int32_t expected = *i ? 74 : *i; + CHECK_EQ(expected, r.Call(*i, *i)); + } +} + +WASM_EXEC_TEST(IfElse_Unreachable1) { + WasmRunner<int32_t> r(execution_mode); // if (0) unreachable; else return 22; BUILD(r, WASM_IF_ELSE(WASM_ZERO, // -- WASM_UNREACHABLE, // -- @@ -696,34 +727,30 @@ TEST(Run_Wasm_IfElse_Unreachable1) { CHECK_EQ(27, r.Call()); } - -TEST(Run_Wasm_Return12) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Return12) { + WasmRunner<int32_t> r(execution_mode); BUILD(r, RET_I8(12)); CHECK_EQ(12, r.Call()); } - -TEST(Run_Wasm_Return17) { - WasmRunner<int32_t> r; +WASM_EXEC_TEST(Return17) { + WasmRunner<int32_t> r(execution_mode); BUILD(r, B1(RET_I8(17))); CHECK_EQ(17, r.Call()); } - -TEST(Run_Wasm_Return_I32) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Return_I32) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, RET(WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } - -TEST(Run_Wasm_Return_F32) { - WasmRunner<float> r(MachineType::Float32()); +WASM_EXEC_TEST(Return_F32) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, RET(WASM_GET_LOCAL(0))); @@ -738,9 +765,8 @@ TEST(Run_Wasm_Return_F32) { } } - -TEST(Run_Wasm_Return_F64) { - WasmRunner<double> r(MachineType::Float64()); +WASM_EXEC_TEST(Return_F64) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, RET(WASM_GET_LOCAL(0))); @@ -755,9 +781,8 @@ TEST(Run_Wasm_Return_F64) { } } - -TEST(Run_Wasm_Select) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Select) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // return select(11, 22, a); BUILD(r, WASM_SELECT(WASM_I8(11), WASM_I8(22), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { @@ -766,9 +791,8 @@ TEST(Run_Wasm_Select) { } } - -TEST(Run_Wasm_Select_strict1) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Select_strict1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // select(a=0, a=1, a=2); return a BUILD(r, B2(WASM_SELECT(WASM_SET_LOCAL(0, WASM_I8(0)), WASM_SET_LOCAL(0, WASM_I8(1)), @@ -777,9 +801,8 @@ TEST(Run_Wasm_Select_strict1) { FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); } } - -TEST(Run_Wasm_Select_strict2) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Select_strict2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32); // select(b=5, c=6, a) @@ -791,8 +814,8 @@ TEST(Run_Wasm_Select_strict2) { } } -TEST(Run_Wasm_Select_strict3) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Select_strict3) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32); // select(b=5, c=6, a=b) @@ -805,9 +828,8 @@ TEST(Run_Wasm_Select_strict3) { } } - -TEST(Run_Wasm_BrIf_strict) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrIf_strict) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD( r, B2(B1(WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(99)))), @@ -816,23 +838,23 @@ TEST(Run_Wasm_BrIf_strict) { FOR_INT32_INPUTS(i) { CHECK_EQ(99, r.Call(*i)); } } -TEST(Run_Wasm_BrTable0a) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrTable0a) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), WASM_I8(91))); FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); } } -TEST(Run_Wasm_BrTable0b) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrTable0b) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0))), WASM_I8(92))); FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); } } -TEST(Run_Wasm_BrTable0c) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrTable0c) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD( r, B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(1))), @@ -844,18 +866,17 @@ TEST(Run_Wasm_BrTable0c) { } } -TEST(Run_Wasm_BrTable1) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrTable1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93)); FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); } } -TEST(Run_Wasm_BrTable_loop) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, - B2(WASM_LOOP(1, WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2), +WASM_EXEC_TEST(BrTable_loop) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B2(WASM_LOOP(WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2), BR_TARGET(1), BR_TARGET(0))), - RET_I8(99)), + RET_I8(99)), WASM_I8(98)); CHECK_EQ(99, r.Call(0)); CHECK_EQ(98, r.Call(-1)); @@ -864,8 +885,8 @@ TEST(Run_Wasm_BrTable_loop) { CHECK_EQ(98, r.Call(-100)); } -TEST(Run_Wasm_BrTable_br) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrTable_br) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(1), BR_TARGET(0))), RET_I8(91)), @@ -876,8 +897,8 @@ TEST(Run_Wasm_BrTable_br) { CHECK_EQ(91, r.Call(3)); } -TEST(Run_Wasm_BrTable_br2) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(BrTable_br2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(1), BR_TARGET(2), BR_TARGET(3), BR_TARGET(0))), @@ -893,9 +914,9 @@ TEST(Run_Wasm_BrTable_br2) { CHECK_EQ(85, r.Call(5)); } -TEST(Run_Wasm_BrTable4) { - for (int i = 0; i < 4; i++) { - for (int t = 0; t < 4; t++) { +WASM_EXEC_TEST(BrTable4) { + for (int i = 0; i < 4; ++i) { + for (int t = 0; t < 4; ++t) { uint32_t cases[] = {0, 1, 2, 3}; cases[i] = t; byte code[] = {B2(B2(B2(B2(B1(WASM_BR_TABLE( @@ -908,10 +929,10 @@ TEST(Run_Wasm_BrTable4) { RET_I8(73)), WASM_I8(75)}; - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); r.Build(code, code + arraysize(code)); - for (int x = -3; x < 50; x++) { + for (int x = -3; x < 50; ++x) { int index = (x > 3 || x < 0) ? 3 : x; int32_t expected = 70 + cases[index]; CHECK_EQ(expected, r.Call(x)); @@ -920,12 +941,12 @@ TEST(Run_Wasm_BrTable4) { } } -TEST(Run_Wasm_BrTable4x4) { - for (byte a = 0; a < 4; a++) { - for (byte b = 0; b < 4; b++) { - for (byte c = 0; c < 4; c++) { - for (byte d = 0; d < 4; d++) { - for (int i = 0; i < 4; i++) { +WASM_EXEC_TEST(BrTable4x4) { + for (byte a = 0; a < 4; ++a) { + for (byte b = 0; b < 4; ++b) { + for (byte c = 0; c < 4; ++c) { + for (byte d = 0; d < 4; ++d) { + for (int i = 0; i < 4; ++i) { uint32_t cases[] = {a, b, c, d}; byte code[] = { B2(B2(B2(B2(B1(WASM_BR_TABLE( @@ -938,10 +959,10 @@ TEST(Run_Wasm_BrTable4x4) { RET_I8(53)), WASM_I8(55)}; - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); r.Build(code, code + arraysize(code)); - for (int x = -6; x < 47; x++) { + for (int x = -6; x < 47; ++x) { int index = (x > 3 || x < 0) ? 3 : x; int32_t expected = 50 + cases[index]; CHECK_EQ(expected, r.Call(x)); @@ -953,7 +974,7 @@ TEST(Run_Wasm_BrTable4x4) { } } -TEST(Run_Wasm_BrTable4_fallthru) { +WASM_EXEC_TEST(BrTable4_fallthru) { byte code[] = { B2(B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(0), BR_TARGET(1), BR_TARGET(2), BR_TARGET(3))), @@ -963,7 +984,8 @@ TEST(Run_Wasm_BrTable4_fallthru) { WASM_INC_LOCAL_BY(1, 8)), WASM_GET_LOCAL(1)}; - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); r.Build(code, code + arraysize(code)); CHECK_EQ(15, r.Call(0, 0)); @@ -979,8 +1001,8 @@ TEST(Run_Wasm_BrTable4_fallthru) { CHECK_EQ(108, r.Call(4, 100)); } -TEST(Run_Wasm_F32ReinterpretI32) { - TestingModule module; +WASM_EXEC_TEST(F32ReinterpretI32) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module); @@ -989,32 +1011,30 @@ TEST(Run_Wasm_F32ReinterpretI32) { FOR_INT32_INPUTS(i) { int32_t expected = *i; - memory[0] = expected; + module.WriteMemory(&memory[0], expected); CHECK_EQ(expected, r.Call()); } } - -TEST(Run_Wasm_I32ReinterpretF32) { - TestingModule module; +WASM_EXEC_TEST(I32ReinterpretF32) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Int32()); - BUILD(r, WASM_BLOCK( - 2, WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, - WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), - WASM_I8(107))); + BUILD(r, + WASM_BLOCK(WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, + WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), + WASM_I8(107))); FOR_INT32_INPUTS(i) { int32_t expected = *i; CHECK_EQ(107, r.Call(expected)); - CHECK_EQ(expected, memory[0]); + CHECK_EQ(expected, module.ReadMemory(&memory[0])); } } - -TEST(Run_Wasm_ReturnStore) { - TestingModule module; +WASM_EXEC_TEST(ReturnStore) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module); @@ -1023,18 +1043,17 @@ TEST(Run_Wasm_ReturnStore) { FOR_INT32_INPUTS(i) { int32_t expected = *i; - memory[0] = expected; + module.WriteMemory(&memory[0], expected); CHECK_EQ(expected, r.Call()); } } - -TEST(Run_Wasm_VoidReturn1) { +WASM_EXEC_TEST(VoidReturn1) { // We use a wrapper function because WasmRunner<void> does not exist. // Build the test function. TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(sigs.v_v(), &module); BUILD(t, kExprNop); uint32_t index = t.CompileAndAdd(); @@ -1048,12 +1067,11 @@ TEST(Run_Wasm_VoidReturn1) { CHECK_EQ(kExpected, result); } - -TEST(Run_Wasm_VoidReturn2) { +WASM_EXEC_TEST(VoidReturn2) { // We use a wrapper function because WasmRunner<void> does not exist. // Build the test function. TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(sigs.v_v(), &module); BUILD(t, WASM_RETURN0); uint32_t index = t.CompileAndAdd(); @@ -1067,13 +1085,43 @@ TEST(Run_Wasm_VoidReturn2) { CHECK_EQ(kExpected, result); } +WASM_EXEC_TEST(Block_empty) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, kExprBlock, kExprEnd, WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} + +WASM_EXEC_TEST(Block_empty_br1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} + +WASM_EXEC_TEST(Block_empty_brif1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} + +WASM_EXEC_TEST(Block_empty_brif2) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); + BUILD(r, B1(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } +} + +WASM_EXEC_TEST(Block_br2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(WASM_BRV(0, WASM_GET_LOCAL(0)))); + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} -TEST(Run_Wasm_Block_If_P) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Block_If_P) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // { if (p0) return 51; return 52; } BUILD(r, B2( // -- WASM_IF(WASM_GET_LOCAL(0), // -- - WASM_BRV(0, WASM_I8(51))), // -- + WASM_BRV(1, WASM_I8(51))), // -- WASM_I8(52))); // -- FOR_INT32_INPUTS(i) { int32_t expected = *i ? 51 : 52; @@ -1081,9 +1129,33 @@ TEST(Run_Wasm_Block_If_P) { } } +WASM_EXEC_TEST(Loop_empty) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, kExprLoop, kExprEnd, WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} + +WASM_EXEC_TEST(Loop_empty_br1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_LOOP(WASM_BR(1)), WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} + +WASM_EXEC_TEST(Loop_empty_brif1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_LOOP(WASM_BR_IF(1, WASM_ZERO)), WASM_GET_LOCAL(0)); + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } +} + +WASM_EXEC_TEST(Loop_empty_brif2) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32()); + BUILD(r, WASM_LOOP(WASM_BR_IF(1, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } +} -TEST(Run_Wasm_Block_BrIf_P) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Block_BrIf_P) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(51), WASM_GET_LOCAL(0)), WASM_I8(52))); FOR_INT32_INPUTS(i) { int32_t expected = *i ? 51 : 52; @@ -1091,9 +1163,8 @@ TEST(Run_Wasm_Block_BrIf_P) { } } - -TEST(Run_Wasm_Block_IfElse_P_assign) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Block_IfElse_P_assign) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // { if (p0) p0 = 71; else p0 = 72; return p0; } BUILD(r, B2( // -- WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- @@ -1106,9 +1177,8 @@ TEST(Run_Wasm_Block_IfElse_P_assign) { } } - -TEST(Run_Wasm_Block_IfElse_P_return) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Block_IfElse_P_return) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // if (p0) return 81; else return 82; BUILD(r, // -- WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- @@ -1120,30 +1190,27 @@ TEST(Run_Wasm_Block_IfElse_P_return) { } } - -TEST(Run_Wasm_Block_If_P_assign) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Block_If_P_assign) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // { if (p0) p0 = 61; p0; } - BUILD(r, WASM_BLOCK( - 2, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), - WASM_GET_LOCAL(0))); + BUILD(r, + WASM_BLOCK(WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), + WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { int32_t expected = *i ? 61 : *i; CHECK_EQ(expected, r.Call(*i)); } } - -TEST(Run_Wasm_DanglingAssign) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(DanglingAssign) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // { return 0; p0 = 0; } BUILD(r, B2(RET_I8(99), WASM_SET_LOCAL(0, WASM_ZERO))); CHECK_EQ(99, r.Call(1)); } - -TEST(Run_Wasm_ExprIf_P) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(ExprIf_P) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // p0 ? 11 : 22; BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- WASM_I8(11), // -- @@ -1154,9 +1221,8 @@ TEST(Run_Wasm_ExprIf_P) { } } - -TEST(Run_Wasm_ExprIf_P_fallthru) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(ExprIf_P_fallthru) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // p0 ? 11 : 22; BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- WASM_I8(11), // -- @@ -1167,54 +1233,47 @@ TEST(Run_Wasm_ExprIf_P_fallthru) { } } - -TEST(Run_Wasm_CountDown) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, - WASM_BLOCK( - 2, WASM_LOOP( - 1, WASM_IF(WASM_GET_LOCAL(0), - WASM_BRV(0, WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), +WASM_EXEC_TEST(CountDown) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_BLOCK( + WASM_LOOP(WASM_IF( + WASM_GET_LOCAL(0), + WASM_BRV(1, WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1)))))), - WASM_GET_LOCAL(0))); + WASM_GET_LOCAL(0))); CHECK_EQ(0, r.Call(1)); CHECK_EQ(0, r.Call(10)); CHECK_EQ(0, r.Call(100)); } - -TEST(Run_Wasm_CountDown_fallthru) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, - WASM_BLOCK( - 2, WASM_LOOP(3, WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), WASM_BREAK(0)), +WASM_EXEC_TEST(CountDown_fallthru) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_BLOCK( + WASM_LOOP(WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), WASM_BREAK(1)), WASM_SET_LOCAL( 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))), WASM_CONTINUE(0)), - WASM_GET_LOCAL(0))); + WASM_GET_LOCAL(0))); CHECK_EQ(0, r.Call(1)); CHECK_EQ(0, r.Call(10)); CHECK_EQ(0, r.Call(100)); } - -TEST(Run_Wasm_WhileCountDown) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, WASM_BLOCK( - 2, WASM_WHILE(WASM_GET_LOCAL(0), - WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), - WASM_I8(1)))), - WASM_GET_LOCAL(0))); +WASM_EXEC_TEST(WhileCountDown) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, + WASM_BLOCK(WASM_WHILE(WASM_GET_LOCAL(0), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), + WASM_I8(1)))), + WASM_GET_LOCAL(0))); CHECK_EQ(0, r.Call(1)); CHECK_EQ(0, r.Call(10)); CHECK_EQ(0, r.Call(100)); } - -TEST(Run_Wasm_Loop_if_break1) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, B2(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(0)), +WASM_EXEC_TEST(Loop_if_break1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B2(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), WASM_SET_LOCAL(0, WASM_I8(99))), WASM_GET_LOCAL(0))); CHECK_EQ(99, r.Call(0)); @@ -1223,10 +1282,9 @@ TEST(Run_Wasm_Loop_if_break1) { CHECK_EQ(-29, r.Call(-29)); } - -TEST(Run_Wasm_Loop_if_break2) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, B2(WASM_LOOP(2, WASM_BR_IF(1, WASM_GET_LOCAL(0)), +WASM_EXEC_TEST(Loop_if_break2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B2(WASM_LOOP(WASM_BR_IF(1, WASM_GET_LOCAL(0)), WASM_SET_LOCAL(0, WASM_I8(99))), WASM_GET_LOCAL(0))); CHECK_EQ(99, r.Call(0)); @@ -1235,10 +1293,9 @@ TEST(Run_Wasm_Loop_if_break2) { CHECK_EQ(-29, r.Call(-29)); } - -TEST(Run_Wasm_Loop_if_break_fallthru) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, B1(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), +WASM_EXEC_TEST(Loop_if_break_fallthru) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), WASM_SET_LOCAL(0, WASM_I8(93)))), WASM_GET_LOCAL(0)); CHECK_EQ(93, r.Call(0)); @@ -1247,70 +1304,84 @@ TEST(Run_Wasm_Loop_if_break_fallthru) { CHECK_EQ(-22, r.Call(-22)); } +WASM_EXEC_TEST(IfBreak1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)), + WASM_I8(91)); + CHECK_EQ(91, r.Call(0)); + CHECK_EQ(91, r.Call(1)); + CHECK_EQ(91, r.Call(-8734)); +} + +WASM_EXEC_TEST(IfBreak2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))), + WASM_I8(81)); + CHECK_EQ(81, r.Call(0)); + CHECK_EQ(81, r.Call(1)); + CHECK_EQ(81, r.Call(-8734)); +} -TEST(Run_Wasm_LoadMemI32) { - TestingModule module; +WASM_EXEC_TEST(LoadMemI32) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Int32()); module.RandomizeMemory(1111); BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_I8(0))); - memory[0] = 99999999; + module.WriteMemory(&memory[0], 99999999); CHECK_EQ(99999999, r.Call(0)); - memory[0] = 88888888; + module.WriteMemory(&memory[0], 88888888); CHECK_EQ(88888888, r.Call(0)); - memory[0] = 77777777; + module.WriteMemory(&memory[0], 77777777); CHECK_EQ(77777777, r.Call(0)); } - -TEST(Run_Wasm_LoadMemI32_oob) { - TestingModule module; +WASM_EXEC_TEST(LoadMemI32_alignment) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); - WasmRunner<int32_t> r(&module, MachineType::Uint32()); - module.RandomizeMemory(1111); + for (byte alignment = 0; alignment <= 2; ++alignment) { + WasmRunner<int32_t> r(&module, MachineType::Int32()); + module.RandomizeMemory(1111); - BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0))); + BUILD(r, + WASM_LOAD_MEM_ALIGNMENT(MachineType::Int32(), WASM_I8(0), alignment)); - memory[0] = 88888888; - CHECK_EQ(88888888, r.Call(0u)); - for (uint32_t offset = 29; offset < 40; offset++) { - CHECK_TRAP(r.Call(offset)); - } + module.WriteMemory(&memory[0], 0x1a2b3c4d); + CHECK_EQ(0x1a2b3c4d, r.Call(0)); - for (uint32_t offset = 0x80000000; offset < 0x80000010; offset++) { - CHECK_TRAP(r.Call(offset)); + module.WriteMemory(&memory[0], 0x5e6f7a8b); + CHECK_EQ(0x5e6f7a8b, r.Call(0)); + + module.WriteMemory(&memory[0], 0x7ca0b1c2); + CHECK_EQ(0x7ca0b1c2, r.Call(0)); } } - -TEST(Run_Wasm_LoadMemI32_oob_asm) { - TestingModule module; - module.origin = kAsmJsOrigin; +WASM_EXEC_TEST(LoadMemI32_oob) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Uint32()); - module.RandomizeMemory(1112); + module.RandomizeMemory(1111); BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0))); - memory[0] = 999999; - CHECK_EQ(999999, r.Call(0u)); - // TODO(titzer): offset 29-31 should also be OOB. - for (uint32_t offset = 32; offset < 40; offset++) { - CHECK_EQ(0, r.Call(offset)); + module.WriteMemory(&memory[0], 88888888); + CHECK_EQ(88888888, r.Call(0u)); + for (uint32_t offset = 29; offset < 40; ++offset) { + CHECK_TRAP(r.Call(offset)); } - for (uint32_t offset = 0x80000000; offset < 0x80000010; offset++) { - CHECK_EQ(0, r.Call(offset)); + for (uint32_t offset = 0x80000000; offset < 0x80000010; ++offset) { + CHECK_TRAP(r.Call(offset)); } } - -TEST(Run_Wasm_LoadMem_offset_oob) { - TestingModule module; +WASM_EXEC_TEST(LoadMem_offset_oob) { + TestingModule module(execution_mode); module.AddMemoryElems<int32_t>(8); static const MachineType machineTypes[] = { @@ -1319,7 +1390,7 @@ TEST(Run_Wasm_LoadMem_offset_oob) { MachineType::Int64(), MachineType::Uint64(), MachineType::Float32(), MachineType::Float64()}; - for (size_t m = 0; m < arraysize(machineTypes); m++) { + for (size_t m = 0; m < arraysize(machineTypes); ++m) { module.RandomizeMemory(1116 + static_cast<int>(m)); WasmRunner<int32_t> r(&module, MachineType::Uint32()); uint32_t boundary = 24 - WasmOpcodes::MemSize(machineTypes[m]); @@ -1329,47 +1400,43 @@ TEST(Run_Wasm_LoadMem_offset_oob) { CHECK_EQ(0, r.Call(boundary)); // in bounds. - for (uint32_t offset = boundary + 1; offset < boundary + 19; offset++) { + for (uint32_t offset = boundary + 1; offset < boundary + 19; ++offset) { CHECK_TRAP(r.Call(offset)); // out of bounds. } } } - -TEST(Run_Wasm_LoadMemI32_offset) { - TestingModule module; +WASM_EXEC_TEST(LoadMemI32_offset) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(4); WasmRunner<int32_t> r(&module, MachineType::Int32()); module.RandomizeMemory(1111); BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), 4, WASM_GET_LOCAL(0))); - memory[0] = 66666666; - memory[1] = 77777777; - memory[2] = 88888888; - memory[3] = 99999999; + module.WriteMemory(&memory[0], 66666666); + module.WriteMemory(&memory[1], 77777777); + module.WriteMemory(&memory[2], 88888888); + module.WriteMemory(&memory[3], 99999999); CHECK_EQ(77777777, r.Call(0)); CHECK_EQ(88888888, r.Call(4)); CHECK_EQ(99999999, r.Call(8)); - memory[0] = 11111111; - memory[1] = 22222222; - memory[2] = 33333333; - memory[3] = 44444444; + module.WriteMemory(&memory[0], 11111111); + module.WriteMemory(&memory[1], 22222222); + module.WriteMemory(&memory[2], 33333333); + module.WriteMemory(&memory[3], 44444444); CHECK_EQ(22222222, r.Call(0)); CHECK_EQ(33333333, r.Call(4)); CHECK_EQ(44444444, r.Call(8)); } - -#if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64 - -TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) { +WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) { const int kMemSize = 12; // TODO(titzer): Fix misaligned accesses on MIPS and re-enable. - for (int offset = 0; offset < kMemSize + 5; offset++) { - for (int index = 0; index < kMemSize + 5; index++) { - TestingModule module; + for (int offset = 0; offset < kMemSize + 5; ++offset) { + for (int index = 0; index < kMemSize + 5; ++index) { + TestingModule module(execution_mode); module.AddMemoryElems<byte>(kMemSize); WasmRunner<int32_t> r(&module); @@ -1387,14 +1454,11 @@ TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) { } } -#endif - - -TEST(Run_Wasm_LoadMemI32_const_oob) { +WASM_EXEC_TEST(LoadMemI32_const_oob) { const int kMemSize = 24; for (int offset = 0; offset < kMemSize + 5; offset += 4) { for (int index = 0; index < kMemSize + 5; index += 4) { - TestingModule module; + TestingModule module(execution_mode); module.AddMemoryElems<byte>(kMemSize); WasmRunner<int32_t> r(&module); @@ -1412,9 +1476,25 @@ TEST(Run_Wasm_LoadMemI32_const_oob) { } } +WASM_EXEC_TEST(StoreMemI32_alignment) { + TestingModule module(execution_mode); + int32_t* memory = module.AddMemoryElems<int32_t>(4); + const int32_t kWritten = 0x12345678; + + for (byte i = 0; i <= 2; ++i) { + WasmRunner<int32_t> r(&module, MachineType::Int32()); + BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ZERO, i, + WASM_GET_LOCAL(0))); + module.RandomizeMemory(1111); + memory[0] = 0; + + CHECK_EQ(kWritten, r.Call(kWritten)); + CHECK_EQ(kWritten, module.ReadMemory(&memory[0])); + } +} -TEST(Run_Wasm_StoreMemI32_offset) { - TestingModule module; +WASM_EXEC_TEST(StoreMemI32_offset) { + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(4); WasmRunner<int32_t> r(&module, MachineType::Int32()); const int32_t kWritten = 0xaabbccdd; @@ -1422,39 +1502,31 @@ TEST(Run_Wasm_StoreMemI32_offset) { BUILD(r, WASM_STORE_MEM_OFFSET(MachineType::Int32(), 4, WASM_GET_LOCAL(0), WASM_I32V_5(kWritten))); - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { module.RandomizeMemory(1111); - memory[0] = 66666666; - memory[1] = 77777777; - memory[2] = 88888888; - memory[3] = 99999999; + module.WriteMemory(&memory[0], 66666666); + module.WriteMemory(&memory[1], 77777777); + module.WriteMemory(&memory[2], 88888888); + module.WriteMemory(&memory[3], 99999999); CHECK_EQ(kWritten, r.Call(i * 4)); - CHECK_EQ(66666666, memory[0]); - CHECK_EQ(i == 0 ? kWritten : 77777777, memory[1]); - CHECK_EQ(i == 1 ? kWritten : 88888888, memory[2]); - CHECK_EQ(i == 2 ? kWritten : 99999999, memory[3]); + CHECK_EQ(66666666, module.ReadMemory(&memory[0])); + CHECK_EQ(i == 0 ? kWritten : 77777777, module.ReadMemory(&memory[1])); + CHECK_EQ(i == 1 ? kWritten : 88888888, module.ReadMemory(&memory[2])); + CHECK_EQ(i == 2 ? kWritten : 99999999, module.ReadMemory(&memory[3])); } } - -TEST(Run_Wasm_StoreMem_offset_oob) { - TestingModule module; +WASM_EXEC_TEST(StoreMem_offset_oob) { + TestingModule module(execution_mode); byte* memory = module.AddMemoryElems<byte>(32); -#if WASM_64 - static const MachineType machineTypes[] = { - MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), - MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(), - MachineType::Int64(), MachineType::Uint64(), MachineType::Float32(), - MachineType::Float64()}; -#else + // 64-bit cases are handled in test-run-wasm-64.cc static const MachineType machineTypes[] = { MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(), MachineType::Float32(), MachineType::Float64()}; -#endif - for (size_t m = 0; m < arraysize(machineTypes); m++) { + for (size_t m = 0; m < arraysize(machineTypes); ++m) { module.RandomizeMemory(1119 + static_cast<int>(m)); WasmRunner<int32_t> r(&module, MachineType::Uint32()); @@ -1467,253 +1539,231 @@ TEST(Run_Wasm_StoreMem_offset_oob) { CHECK_EQ(0, r.Call(boundary)); // in bounds. CHECK_EQ(0, memcmp(&memory[0], &memory[8 + boundary], memsize)); - for (uint32_t offset = boundary + 1; offset < boundary + 19; offset++) { + for (uint32_t offset = boundary + 1; offset < boundary + 19; ++offset) { CHECK_TRAP(r.Call(offset)); // out of bounds. } } } - -TEST(Run_Wasm_LoadMemI32_P) { +WASM_EXEC_TEST(LoadMemI32_P) { const int kNumElems = 8; - TestingModule module; + TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(kNumElems); WasmRunner<int32_t> r(&module, MachineType::Int32()); module.RandomizeMemory(2222); BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0))); - for (int i = 0; i < kNumElems; i++) { - CHECK_EQ(memory[i], r.Call(i * 4)); + for (int i = 0; i < kNumElems; ++i) { + CHECK_EQ(module.ReadMemory(&memory[i]), r.Call(i * 4)); } } - -TEST(Run_Wasm_MemI32_Sum) { +WASM_EXEC_TEST(MemI32_Sum) { const int kNumElems = 20; - TestingModule module; + TestingModule module(execution_mode); uint32_t* memory = module.AddMemoryElems<uint32_t>(kNumElems); WasmRunner<uint32_t> r(&module, MachineType::Int32()); const byte kSum = r.AllocateLocal(kAstI32); - BUILD(r, WASM_BLOCK( - 2, WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - 2, WASM_SET_LOCAL( - kSum, WASM_I32_ADD( - WASM_GET_LOCAL(kSum), + BUILD(r, + WASM_BLOCK( + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL( + kSum, WASM_I32_ADD(WASM_GET_LOCAL(kSum), WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), - WASM_GET_LOCAL(1))); + WASM_SET_LOCAL( + 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), + WASM_GET_LOCAL(1))); // Run 4 trials. - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 3; ++i) { module.RandomizeMemory(i * 33); uint32_t expected = 0; - for (size_t j = kNumElems - 1; j > 0; j--) { - expected += memory[j]; + for (size_t j = kNumElems - 1; j > 0; --j) { + expected += module.ReadMemory(&memory[j]); } - uint32_t result = r.Call(static_cast<int>(4 * (kNumElems - 1))); + uint32_t result = r.Call(4 * (kNumElems - 1)); CHECK_EQ(expected, result); } } - -TEST(Run_Wasm_CheckMachIntsZero) { +WASM_EXEC_TEST(CheckMachIntsZero) { const int kNumElems = 55; - TestingModule module; + TestingModule module(execution_mode); module.AddMemoryElems<uint32_t>(kNumElems); WasmRunner<uint32_t> r(&module, MachineType::Int32()); - BUILD(r, kExprBlock, 2, kExprLoop, 1, kExprIf, kExprGetLocal, 0, kExprBr, 0, - kExprIfElse, kExprI32LoadMem, ZERO_ALIGNMENT, ZERO_OFFSET, - kExprGetLocal, 0, kExprBr, 2, kExprI8Const, 255, kExprSetLocal, 0, - kExprI32Sub, kExprGetLocal, 0, kExprI8Const, 4, kExprI8Const, 0); + BUILD(r, kExprLoop, kExprGetLocal, 0, kExprIf, kExprGetLocal, 0, + kExprI32LoadMem, 0, 0, kExprIf, kExprI8Const, 255, kExprReturn, ARITY_1, + kExprEnd, kExprGetLocal, 0, kExprI8Const, 4, kExprI32Sub, kExprSetLocal, + 0, kExprBr, ARITY_1, DEPTH_0, kExprEnd, kExprEnd, kExprI8Const, 0); module.BlankMemory(); CHECK_EQ(0, r.Call((kNumElems - 1) * 4)); } - -TEST(Run_Wasm_MemF32_Sum) { +WASM_EXEC_TEST(MemF32_Sum) { const int kSize = 5; - TestingModule module; + TestingModule module(execution_mode); module.AddMemoryElems<float>(kSize); float* buffer = module.raw_mem_start<float>(); - buffer[0] = -99.25; - buffer[1] = -888.25; - buffer[2] = -77.25; - buffer[3] = 66666.25; - buffer[4] = 5555.25; + module.WriteMemory(&buffer[0], -99.25f); + module.WriteMemory(&buffer[1], -888.25f); + module.WriteMemory(&buffer[2], -77.25f); + module.WriteMemory(&buffer[3], 66666.25f); + module.WriteMemory(&buffer[4], 5555.25f); WasmRunner<int32_t> r(&module, MachineType::Int32()); const byte kSum = r.AllocateLocal(kAstF32); - BUILD(r, WASM_BLOCK( - 3, WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - 2, WASM_SET_LOCAL( - kSum, WASM_F32_ADD( - WASM_GET_LOCAL(kSum), + BUILD(r, + WASM_BLOCK( + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL( + kSum, WASM_F32_ADD(WASM_GET_LOCAL(kSum), WASM_LOAD_MEM(MachineType::Float32(), WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), - WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, - WASM_GET_LOCAL(kSum)), - WASM_GET_LOCAL(0))); + WASM_SET_LOCAL( + 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), + WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, + WASM_GET_LOCAL(kSum)), + WASM_GET_LOCAL(0))); CHECK_EQ(0, r.Call(4 * (kSize - 1))); - CHECK_NE(-99.25, buffer[0]); - CHECK_EQ(71256.0f, buffer[0]); + CHECK_NE(-99.25f, module.ReadMemory(&buffer[0])); + CHECK_EQ(71256.0f, module.ReadMemory(&buffer[0])); } - template <typename T> -T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size, - LocalType astType, MachineType memType) { - TestingModule module; - module.AddMemoryElems<T>(size); - for (size_t i = 0; i < size; i++) { - module.raw_mem_start<T>()[i] = buffer[i]; +T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop, + T* buffer, uint32_t size, LocalType astType, + MachineType memType) { + TestingModule module(execution_mode); + T* memory = module.AddMemoryElems<T>(size); + for (uint32_t i = 0; i < size; ++i) { + module.WriteMemory(&memory[i], buffer[i]); } WasmRunner<int32_t> r(&module, MachineType::Int32()); const byte kAccum = r.AllocateLocal(astType); - BUILD( - r, - WASM_BLOCK( - 4, WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)), - WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - 2, WASM_SET_LOCAL( - kAccum, - WASM_BINOP(binop, WASM_GET_LOCAL(kAccum), - WASM_LOAD_MEM(memType, WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(sizeof(T)))))), - WASM_STORE_MEM(memType, WASM_ZERO, WASM_GET_LOCAL(kAccum)), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_BLOCK( + WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)), + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL( + kAccum, WASM_BINOP(binop, WASM_GET_LOCAL(kAccum), + WASM_LOAD_MEM( + memType, WASM_GET_LOCAL(0)))), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), + WASM_I8(sizeof(T)))))), + WASM_STORE_MEM(memType, WASM_ZERO, WASM_GET_LOCAL(kAccum)), + WASM_GET_LOCAL(0))); r.Call(static_cast<int>(sizeof(T) * (size - 1))); - return module.raw_mem_at<double>(0); + return module.ReadMemory(&memory[0]); } - -TEST(Run_Wasm_MemF64_Mul) { +WASM_EXEC_TEST(MemF64_Mul) { const size_t kSize = 6; double buffer[kSize] = {1, 2, 2, 2, 2, 2}; - double result = GenerateAndRunFold<double>(kExprF64Mul, buffer, kSize, - kAstF64, MachineType::Float64()); + double result = + GenerateAndRunFold<double>(execution_mode, kExprF64Mul, buffer, kSize, + kAstF64, MachineType::Float64()); CHECK_EQ(32, result); } - -TEST(Build_Wasm_Infinite_Loop) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Build_Wasm_Infinite_Loop) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // Only build the graph and compile, don't run. BUILD(r, WASM_INFINITE_LOOP); } - -TEST(Build_Wasm_Infinite_Loop_effect) { - TestingModule module; +WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) { + TestingModule module(execution_mode); module.AddMemoryElems<int8_t>(16); WasmRunner<int32_t> r(&module, MachineType::Int32()); // Only build the graph and compile, don't run. - BUILD(r, WASM_LOOP(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))); + BUILD(r, WASM_LOOP(WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))); } - -TEST(Run_Wasm_Unreachable0a) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Unreachable0a) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV(0, WASM_I8(9)), RET(WASM_GET_LOCAL(0)))); CHECK_EQ(9, r.Call(0)); CHECK_EQ(9, r.Call(1)); } - -TEST(Run_Wasm_Unreachable0b) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Unreachable0b) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE)); CHECK_EQ(7, r.Call(0)); CHECK_EQ(7, r.Call(1)); } - TEST(Build_Wasm_Unreachable1) { - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); BUILD(r, WASM_UNREACHABLE); } - TEST(Build_Wasm_Unreachable2) { - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE); } - TEST(Build_Wasm_Unreachable3) { - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE); } - TEST(Build_Wasm_UnreachableIf1) { - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); BUILD(r, WASM_UNREACHABLE, WASM_IF(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); } - TEST(Build_Wasm_UnreachableIf2) { - WasmRunner<int32_t> r(MachineType::Int32()); + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); BUILD(r, WASM_UNREACHABLE, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); } - -TEST(Run_Wasm_Unreachable_Load) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Unreachable_Load) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV(0, WASM_GET_LOCAL(0)), WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); CHECK_EQ(11, r.Call(11)); CHECK_EQ(21, r.Call(21)); } - -TEST(Run_Wasm_Infinite_Loop_not_taken1) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Infinite_Loop_not_taken1) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(45))); // Run the code, but don't go into the infinite loop. CHECK_EQ(45, r.Call(0)); } - -TEST(Run_Wasm_Infinite_Loop_not_taken2) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(45)), +WASM_EXEC_TEST(Infinite_Loop_not_taken2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)), WASM_INFINITE_LOOP))); // Run the code, but don't go into the infinite loop. CHECK_EQ(45, r.Call(1)); } - -TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP)); // Run the code, but don't go into the infinite loop. CHECK_EQ(45, r.Call(1)); } - static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { - if (!WasmOpcodes::IsSupported(opcode)) return; - Isolate* isolate = CcTest::InitIsolateOnce(); Zone zone(isolate->allocator()); HandleScope scope(isolate); @@ -1726,20 +1776,18 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { FunctionSig* sig = WasmOpcodes::Signature(opcode); if (sig->parameter_count() == 1) { - byte code[] = {WASM_NO_LOCALS, static_cast<byte>(opcode), kExprGetLocal, 0}; - TestBuildingGraph(&zone, &jsgraph, nullptr, sig, code, + byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode)}; + TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, code + arraysize(code)); } else { CHECK_EQ(2, sig->parameter_count()); - byte code[] = {WASM_NO_LOCALS, static_cast<byte>(opcode), - kExprGetLocal, 0, - kExprGetLocal, 1}; - TestBuildingGraph(&zone, &jsgraph, nullptr, sig, code, + byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, kExprGetLocal, 1, + static_cast<byte>(opcode)}; + TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, code + arraysize(code)); } } - TEST(Build_Wasm_SimpleExprs) { // Test that the decoder can build a graph for all supported simple expressions. #define GRAPH_BUILD_TEST(name, opcode, sig) \ @@ -1750,9 +1798,8 @@ TEST(Build_Wasm_SimpleExprs) { #undef GRAPH_BUILD_TEST } - -TEST(Run_Wasm_Int32LoadInt8_signext) { - TestingModule module; +WASM_EXEC_TEST(Int32LoadInt8_signext) { + TestingModule module(execution_mode); const int kNumElems = 16; int8_t* memory = module.AddMemoryElems<int8_t>(kNumElems); module.RandomizeMemory(); @@ -1760,14 +1807,13 @@ TEST(Run_Wasm_Int32LoadInt8_signext) { WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD(r, WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0))); - for (size_t i = 0; i < kNumElems; i++) { - CHECK_EQ(memory[i], r.Call(static_cast<int>(i))); + for (int i = 0; i < kNumElems; ++i) { + CHECK_EQ(memory[i], r.Call(i)); } } - -TEST(Run_Wasm_Int32LoadInt8_zeroext) { - TestingModule module; +WASM_EXEC_TEST(Int32LoadInt8_zeroext) { + TestingModule module(execution_mode); const int kNumElems = 16; byte* memory = module.AddMemory(kNumElems); module.RandomizeMemory(77); @@ -1775,14 +1821,13 @@ TEST(Run_Wasm_Int32LoadInt8_zeroext) { WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD(r, WASM_LOAD_MEM(MachineType::Uint8(), WASM_GET_LOCAL(0))); - for (size_t i = 0; i < kNumElems; i++) { - CHECK_EQ(memory[i], r.Call(static_cast<int>(i))); + for (int i = 0; i < kNumElems; ++i) { + CHECK_EQ(memory[i], r.Call(i)); } } - -TEST(Run_Wasm_Int32LoadInt16_signext) { - TestingModule module; +WASM_EXEC_TEST(Int32LoadInt16_signext) { + TestingModule module(execution_mode); const int kNumBytes = 16; byte* memory = module.AddMemory(kNumBytes); module.RandomizeMemory(888); @@ -1790,15 +1835,14 @@ TEST(Run_Wasm_Int32LoadInt16_signext) { WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD(r, WASM_LOAD_MEM(MachineType::Int16(), WASM_GET_LOCAL(0))); - for (size_t i = 0; i < kNumBytes; i += 2) { + for (int i = 0; i < kNumBytes; i += 2) { int32_t expected = memory[i] | (static_cast<int8_t>(memory[i + 1]) << 8); - CHECK_EQ(expected, r.Call(static_cast<int>(i))); + CHECK_EQ(expected, r.Call(i)); } } - -TEST(Run_Wasm_Int32LoadInt16_zeroext) { - TestingModule module; +WASM_EXEC_TEST(Int32LoadInt16_zeroext) { + TestingModule module(execution_mode); const int kNumBytes = 16; byte* memory = module.AddMemory(kNumBytes); module.RandomizeMemory(9999); @@ -1806,20 +1850,19 @@ TEST(Run_Wasm_Int32LoadInt16_zeroext) { WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD(r, WASM_LOAD_MEM(MachineType::Uint16(), WASM_GET_LOCAL(0))); - for (size_t i = 0; i < kNumBytes; i += 2) { + for (int i = 0; i < kNumBytes; i += 2) { int32_t expected = memory[i] | (memory[i + 1] << 8); - CHECK_EQ(expected, r.Call(static_cast<int>(i))); + CHECK_EQ(expected, r.Call(i)); } } - -TEST(Run_WasmInt32Global) { - TestingModule module; - int32_t* global = module.AddGlobal<int32_t>(MachineType::Int32()); +WASM_EXEC_TEST(Int32Global) { + TestingModule module(execution_mode); + int32_t* global = module.AddGlobal<int32_t>(kAstI32); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, WASM_STORE_GLOBAL( - 0, WASM_I32_ADD(WASM_LOAD_GLOBAL(0), WASM_GET_LOCAL(0)))); + BUILD(r, WASM_SET_GLOBAL( + 0, WASM_I32_ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0)))); *global = 116; for (int i = 9; i < 444444; i += 111111) { @@ -1829,28 +1872,27 @@ TEST(Run_WasmInt32Global) { } } - -TEST(Run_WasmInt32Globals_DontAlias) { +WASM_EXEC_TEST(Int32Globals_DontAlias) { const int kNumGlobals = 3; - TestingModule module; - int32_t* globals[] = {module.AddGlobal<int32_t>(MachineType::Int32()), - module.AddGlobal<int32_t>(MachineType::Int32()), - module.AddGlobal<int32_t>(MachineType::Int32())}; + TestingModule module(execution_mode); + int32_t* globals[] = {module.AddGlobal<int32_t>(kAstI32), + module.AddGlobal<int32_t>(kAstI32), + module.AddGlobal<int32_t>(kAstI32)}; - for (int g = 0; g < kNumGlobals; g++) { + for (int g = 0; g < kNumGlobals; ++g) { // global = global + p0 WasmRunner<int32_t> r(&module, MachineType::Int32()); - BUILD(r, WASM_STORE_GLOBAL( - g, WASM_I32_ADD(WASM_LOAD_GLOBAL(g), WASM_GET_LOCAL(0)))); + BUILD(r, WASM_SET_GLOBAL( + g, WASM_I32_ADD(WASM_GET_GLOBAL(g), WASM_GET_LOCAL(0)))); // Check that reading/writing global number {g} doesn't alter the others. *globals[g] = 116 * g; int32_t before[kNumGlobals]; for (int i = 9; i < 444444; i += 111113) { int32_t sum = *globals[g] + i; - for (int j = 0; j < kNumGlobals; j++) before[j] = *globals[j]; + for (int j = 0; j < kNumGlobals; ++j) before[j] = *globals[j]; r.Call(i); - for (int j = 0; j < kNumGlobals; j++) { + for (int j = 0; j < kNumGlobals; ++j) { int32_t expected = j == g ? sum : before[j]; CHECK_EQ(expected, *globals[j]); } @@ -1858,14 +1900,13 @@ TEST(Run_WasmInt32Globals_DontAlias) { } } - -TEST(Run_WasmFloat32Global) { - TestingModule module; - float* global = module.AddGlobal<float>(MachineType::Float32()); +WASM_EXEC_TEST(Float32Global) { + TestingModule module(execution_mode); + float* global = module.AddGlobal<float>(kAstF32); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, B2(WASM_STORE_GLOBAL( - 0, WASM_F32_ADD(WASM_LOAD_GLOBAL(0), + BUILD(r, B2(WASM_SET_GLOBAL( + 0, WASM_F32_ADD(WASM_GET_GLOBAL(0), WASM_F32_SCONVERT_I32(WASM_GET_LOCAL(0)))), WASM_ZERO)); @@ -1877,14 +1918,13 @@ TEST(Run_WasmFloat32Global) { } } - -TEST(Run_WasmFloat64Global) { - TestingModule module; - double* global = module.AddGlobal<double>(MachineType::Float64()); +WASM_EXEC_TEST(Float64Global) { + TestingModule module(execution_mode); + double* global = module.AddGlobal<double>(kAstF64); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, B2(WASM_STORE_GLOBAL( - 0, WASM_F64_ADD(WASM_LOAD_GLOBAL(0), + BUILD(r, B2(WASM_SET_GLOBAL( + 0, WASM_F64_ADD(WASM_GET_GLOBAL(0), WASM_F64_SCONVERT_I32(WASM_GET_LOCAL(0)))), WASM_ZERO)); @@ -1896,37 +1936,25 @@ TEST(Run_WasmFloat64Global) { } } - -TEST(Run_WasmMixedGlobals) { - TestingModule module; - int32_t* unused = module.AddGlobal<int32_t>(MachineType::Int32()); +WASM_EXEC_TEST(MixedGlobals) { + TestingModule module(execution_mode); + int32_t* unused = module.AddGlobal<int32_t>(kAstI32); byte* memory = module.AddMemory(32); - int8_t* var_int8 = module.AddGlobal<int8_t>(MachineType::Int8()); - uint8_t* var_uint8 = module.AddGlobal<uint8_t>(MachineType::Uint8()); - int16_t* var_int16 = module.AddGlobal<int16_t>(MachineType::Int16()); - uint16_t* var_uint16 = module.AddGlobal<uint16_t>(MachineType::Uint16()); - int32_t* var_int32 = module.AddGlobal<int32_t>(MachineType::Int32()); - uint32_t* var_uint32 = module.AddGlobal<uint32_t>(MachineType::Uint32()); - float* var_float = module.AddGlobal<float>(MachineType::Float32()); - double* var_double = module.AddGlobal<double>(MachineType::Float64()); + int32_t* var_int32 = module.AddGlobal<int32_t>(kAstI32); + uint32_t* var_uint32 = module.AddGlobal<uint32_t>(kAstI32); + float* var_float = module.AddGlobal<float>(kAstF32); + double* var_double = module.AddGlobal<double>(kAstF64); WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD( r, WASM_BLOCK( - 9, - WASM_STORE_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int8(), WASM_ZERO)), - WASM_STORE_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint8(), WASM_ZERO)), - WASM_STORE_GLOBAL(3, WASM_LOAD_MEM(MachineType::Int16(), WASM_ZERO)), - WASM_STORE_GLOBAL(4, WASM_LOAD_MEM(MachineType::Uint16(), WASM_ZERO)), - WASM_STORE_GLOBAL(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), - WASM_STORE_GLOBAL(6, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)), - WASM_STORE_GLOBAL(7, - WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)), - WASM_STORE_GLOBAL(8, - WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)), + WASM_SET_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), + WASM_SET_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)), + WASM_SET_GLOBAL(3, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)), + WASM_SET_GLOBAL(4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)), WASM_ZERO)); memory[0] = 0xaa; @@ -1939,10 +1967,6 @@ TEST(Run_WasmMixedGlobals) { memory[7] = 0x99; r.Call(1); - CHECK(static_cast<int8_t>(0xaa) == *var_int8); - CHECK(static_cast<uint8_t>(0xaa) == *var_uint8); - CHECK(static_cast<int16_t>(0xccaa) == *var_int16); - CHECK(static_cast<uint16_t>(0xccaa) == *var_uint16); CHECK(static_cast<int32_t>(0xee55ccaa) == *var_int32); CHECK(static_cast<uint32_t>(0xee55ccaa) == *var_uint32); CHECK(bit_cast<float>(0xee55ccaa) == *var_float); @@ -1951,12 +1975,11 @@ TEST(Run_WasmMixedGlobals) { USE(unused); } - -TEST(Run_WasmCallEmpty) { +WASM_EXEC_TEST(CallEmpty) { const int32_t kExpected = -414444; // Build the target function. TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(sigs.i_v(), &module); BUILD(t, WASM_I32V_3(kExpected)); uint32_t index = t.CompileAndAdd(); @@ -1969,21 +1992,20 @@ TEST(Run_WasmCallEmpty) { CHECK_EQ(kExpected, result); } - -TEST(Run_WasmCallF32StackParameter) { +WASM_EXEC_TEST(CallF32StackParameter) { // Build the target function. LocalType param_types[20]; - for (int i = 0; i < 20; i++) param_types[i] = kAstF32; + for (int i = 0; i < 20; ++i) param_types[i] = kAstF32; FunctionSig sig(1, 19, param_types); - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(&sig, &module); BUILD(t, WASM_GET_LOCAL(17)); uint32_t index = t.CompileAndAdd(); // Build the calling function. WasmRunner<float> r(&module); - BUILD(r, WASM_CALL_FUNCTION( - index, WASM_F32(1.0f), WASM_F32(2.0f), WASM_F32(4.0f), + BUILD(r, WASM_CALL_FUNCTIONN( + 19, index, WASM_F32(1.0f), WASM_F32(2.0f), WASM_F32(4.0f), WASM_F32(8.0f), WASM_F32(16.0f), WASM_F32(32.0f), WASM_F32(64.0f), WASM_F32(128.0f), WASM_F32(256.0f), WASM_F32(1.5f), WASM_F32(2.5f), WASM_F32(4.5f), WASM_F32(8.5f), @@ -1994,39 +2016,38 @@ TEST(Run_WasmCallF32StackParameter) { CHECK_EQ(256.5f, result); } - -TEST(Run_WasmCallF64StackParameter) { +WASM_EXEC_TEST(CallF64StackParameter) { // Build the target function. LocalType param_types[20]; - for (int i = 0; i < 20; i++) param_types[i] = kAstF64; + for (int i = 0; i < 20; ++i) param_types[i] = kAstF64; FunctionSig sig(1, 19, param_types); - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(&sig, &module); BUILD(t, WASM_GET_LOCAL(17)); uint32_t index = t.CompileAndAdd(); // Build the calling function. WasmRunner<double> r(&module); - BUILD(r, WASM_CALL_FUNCTION(index, WASM_F64(1.0), WASM_F64(2.0), - WASM_F64(4.0), WASM_F64(8.0), WASM_F64(16.0), - WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), - WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), - WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), - WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), - WASM_F64(256.5), WASM_F64(512.5))); + BUILD(r, WASM_CALL_FUNCTIONN(19, index, WASM_F64(1.0), WASM_F64(2.0), + WASM_F64(4.0), WASM_F64(8.0), WASM_F64(16.0), + WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), + WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), + WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), + WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), + WASM_F64(256.5), WASM_F64(512.5))); float result = r.Call(); CHECK_EQ(256.5, result); } -TEST(Run_WasmCallVoid) { +WASM_EXEC_TEST(CallVoid) { const byte kMemOffset = 8; const int32_t kElemNum = kMemOffset / sizeof(int32_t); - const int32_t kExpected = -414444; + const int32_t kExpected = 414444; // Build the target function. TestSignatures sigs; - TestingModule module; - module.AddMemory(16); + TestingModule module(execution_mode); + int32_t* memory = module.AddMemoryElems<int32_t>(16 / sizeof(int32_t)); module.RandomizeMemory(); WasmFunctionCompiler t(sigs.v_v(), &module); BUILD(t, WASM_STORE_MEM(MachineType::Int32(), WASM_I8(kMemOffset), @@ -2040,21 +2061,21 @@ TEST(Run_WasmCallVoid) { int32_t result = r.Call(); CHECK_EQ(kExpected, result); - CHECK_EQ(kExpected, module.raw_mem_start<int32_t>()[kElemNum]); + CHECK_EQ(static_cast<int64_t>(kExpected), + static_cast<int64_t>(module.ReadMemory(&memory[kElemNum]))); } - -TEST(Run_WasmCall_Int32Add) { +WASM_EXEC_TEST(Call_Int32Add) { // Build the target function. TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(sigs.i_ii(), &module); BUILD(t, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); uint32_t index = t.CompileAndAdd(); // Build the caller function. WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { @@ -2065,9 +2086,9 @@ TEST(Run_WasmCall_Int32Add) { } } -TEST(Run_WasmCall_Float32Sub) { +WASM_EXEC_TEST(Call_Float32Sub) { TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t(sigs.f_ff(), &module); // Build the target function. @@ -2076,37 +2097,37 @@ TEST(Run_WasmCall_Float32Sub) { // Builder the caller function. WasmRunner<float> r(&module, MachineType::Float32(), MachineType::Float32()); - BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, r.Call(*i, *j)); } } } - -TEST(Run_WasmCall_Float64Sub) { - TestingModule module; +WASM_EXEC_TEST(Call_Float64Sub) { + TestingModule module(execution_mode); double* memory = module.AddMemoryElems<double>(16); WasmRunner<int32_t> r(&module); - BUILD(r, WASM_BLOCK( - 2, WASM_STORE_MEM( - MachineType::Float64(), WASM_ZERO, - WASM_F64_SUB( - WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO), - WASM_LOAD_MEM(MachineType::Float64(), WASM_I8(8)))), - WASM_I8(107))); + BUILD(r, + WASM_BLOCK(WASM_STORE_MEM( + MachineType::Float64(), WASM_ZERO, + WASM_F64_SUB( + WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO), + WASM_LOAD_MEM(MachineType::Float64(), WASM_I8(8)))), + WASM_I8(107))); FOR_FLOAT64_INPUTS(i) { FOR_FLOAT64_INPUTS(j) { - memory[0] = *i; - memory[1] = *j; + module.WriteMemory(&memory[0], *i); + module.WriteMemory(&memory[1], *j); double expected = *i - *j; CHECK_EQ(107, r.Call()); + if (expected != expected) { - CHECK(memory[0] != memory[0]); + CHECK(module.ReadMemory(&memory[0]) != module.ReadMemory(&memory[0])); } else { - CHECK_EQ(expected, memory[0]); + CHECK_EQ(expected, module.ReadMemory(&memory[0])); } } } @@ -2115,35 +2136,26 @@ TEST(Run_WasmCall_Float64Sub) { #define ADD_CODE(vec, ...) \ do { \ byte __buf[] = {__VA_ARGS__}; \ - for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ + for (size_t i = 0; i < sizeof(__buf); ++i) vec.push_back(__buf[i]); \ } while (false) - -static void Run_WasmMixedCall_N(int start) { +static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { const int kExpected = 6333; const int kElemSize = 8; TestSignatures sigs; -#if WASM_64 - static MachineType mixed[] = { - MachineType::Int32(), MachineType::Float32(), MachineType::Int64(), - MachineType::Float64(), MachineType::Float32(), MachineType::Int64(), - MachineType::Int32(), MachineType::Float64(), MachineType::Float32(), - MachineType::Float64(), MachineType::Int32(), MachineType::Int64(), - MachineType::Int32(), MachineType::Int32()}; -#else + // 64-bit cases handled in test-run-wasm-64.cc. static MachineType mixed[] = { MachineType::Int32(), MachineType::Float32(), MachineType::Float64(), MachineType::Float32(), MachineType::Int32(), MachineType::Float64(), MachineType::Float32(), MachineType::Float64(), MachineType::Int32(), MachineType::Int32(), MachineType::Int32()}; -#endif int num_params = static_cast<int>(arraysize(mixed)) - start; - for (int which = 0; which < num_params; which++) { + for (int which = 0; which < num_params; ++which) { v8::base::AccountingAllocator allocator; Zone zone(&allocator); - TestingModule module; + TestingModule module(execution_mode); module.AddMemory(1024); MachineType* memtypes = &mixed[start]; MachineType result = memtypes[which]; @@ -2154,7 +2166,7 @@ static void Run_WasmMixedCall_N(int start) { uint32_t index; FunctionSig::Builder b(&zone, 1, num_params); b.AddReturn(WasmOpcodes::LocalTypeFor(result)); - for (int i = 0; i < num_params; i++) { + for (int i = 0; i < num_params; ++i) { b.AddParam(WasmOpcodes::LocalTypeFor(memtypes[i])); } WasmFunctionCompiler t(b.Build(), &module); @@ -2165,31 +2177,38 @@ static void Run_WasmMixedCall_N(int start) { // Build the calling function. // ========================================================================= WasmRunner<int32_t> r(&module); - std::vector<byte> code; - ADD_CODE(code, - static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)), - ZERO_ALIGNMENT, ZERO_OFFSET); + + // Load the offset for the store. ADD_CODE(code, WASM_ZERO); - ADD_CODE(code, kExprCallFunction, static_cast<byte>(index)); - for (int i = 0; i < num_params; i++) { + // Load the arguments. + for (int i = 0; i < num_params; ++i) { int offset = (i + 1) * kElemSize; ADD_CODE(code, WASM_LOAD_MEM(memtypes[i], WASM_I8(offset))); } + // Call the selector function. + ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), + static_cast<byte>(index)); + + // Store the result in memory. + ADD_CODE(code, + static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)), + ZERO_ALIGNMENT, ZERO_OFFSET); + + // Return the expected value. ADD_CODE(code, WASM_I32V_2(kExpected)); - size_t end = code.size(); - code.push_back(0); - r.Build(&code[0], &code[end]); + + r.Build(&code[0], &code[0] + code.size()); // Run the code. - for (int t = 0; t < 10; t++) { + for (int t = 0; t < 10; ++t) { module.RandomizeMemory(); CHECK_EQ(kExpected, r.Call()); int size = WasmOpcodes::MemSize(result); - for (int i = 0; i < size; i++) { + for (int i = 0; i < size; ++i) { int base = (which + 1) * kElemSize; byte expected = module.raw_mem_at<byte>(base + i); byte result = module.raw_mem_at<byte>(i); @@ -2199,15 +2218,14 @@ static void Run_WasmMixedCall_N(int start) { } } +WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_mode, 0); } +WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_mode, 1); } +WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_mode, 2); } +WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_mode, 3); } -TEST(Run_WasmMixedCall_0) { Run_WasmMixedCall_N(0); } -TEST(Run_WasmMixedCall_1) { Run_WasmMixedCall_N(1); } -TEST(Run_WasmMixedCall_2) { Run_WasmMixedCall_N(2); } -TEST(Run_WasmMixedCall_3) { Run_WasmMixedCall_N(3); } - -TEST(Run_Wasm_AddCall) { +WASM_EXEC_TEST(AddCall) { TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t1(sigs.i_ii(), &module); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); t1.CompileAndAdd(); @@ -2216,21 +2234,21 @@ TEST(Run_Wasm_AddCall) { byte local = r.AllocateLocal(kAstI32); BUILD(r, B2(WASM_SET_LOCAL(local, WASM_I8(99)), WASM_I32_ADD( - WASM_CALL_FUNCTION(t1.function_index_, WASM_GET_LOCAL(0), - WASM_GET_LOCAL(0)), - WASM_CALL_FUNCTION(t1.function_index_, WASM_GET_LOCAL(1), - WASM_GET_LOCAL(local))))); + WASM_CALL_FUNCTION2(t1.function_index(), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(0)), + WASM_CALL_FUNCTION2(t1.function_index(), WASM_GET_LOCAL(1), + WASM_GET_LOCAL(local))))); CHECK_EQ(198, r.Call(0)); CHECK_EQ(200, r.Call(1)); CHECK_EQ(100, r.Call(-49)); } -TEST(Run_Wasm_CountDown_expr) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(CountDown_expr) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, WASM_LOOP( - 3, WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), - WASM_BREAKV(0, WASM_GET_LOCAL(0))), + WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), + WASM_BREAKV(1, WASM_GET_LOCAL(0))), WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))), WASM_CONTINUE(0))); CHECK_EQ(0, r.Call(1)); @@ -2238,51 +2256,46 @@ TEST(Run_Wasm_CountDown_expr) { CHECK_EQ(0, r.Call(100)); } - -TEST(Run_Wasm_ExprBlock2a) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(1))), WASM_I8(1))); +WASM_EXEC_TEST(ExprBlock2a) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(1))); CHECK_EQ(1, r.Call(0)); CHECK_EQ(1, r.Call(1)); } - -TEST(Run_Wasm_ExprBlock2b) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(1))), WASM_I8(2))); +WASM_EXEC_TEST(ExprBlock2b) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(2))); CHECK_EQ(2, r.Call(0)); CHECK_EQ(1, r.Call(1)); } - -TEST(Run_Wasm_ExprBlock2c) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(ExprBlock2c) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(1))); CHECK_EQ(1, r.Call(0)); CHECK_EQ(1, r.Call(1)); } - -TEST(Run_Wasm_ExprBlock2d) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(ExprBlock2d) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(2))); CHECK_EQ(2, r.Call(0)); CHECK_EQ(1, r.Call(1)); } - -TEST(Run_Wasm_ExprBlock_ManualSwitch) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, WASM_BLOCK(6, WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)), - WASM_BRV(0, WASM_I8(11))), +WASM_EXEC_TEST(ExprBlock_ManualSwitch) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_BLOCK(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)), + WASM_BRV(1, WASM_I8(11))), WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2)), - WASM_BRV(0, WASM_I8(12))), + WASM_BRV(1, WASM_I8(12))), WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3)), - WASM_BRV(0, WASM_I8(13))), + WASM_BRV(1, WASM_I8(13))), WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4)), - WASM_BRV(0, WASM_I8(14))), + WASM_BRV(1, WASM_I8(14))), WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5)), - WASM_BRV(0, WASM_I8(15))), + WASM_BRV(1, WASM_I8(15))), WASM_I8(99))); CHECK_EQ(99, r.Call(0)); CHECK_EQ(11, r.Call(1)); @@ -2293,21 +2306,19 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch) { CHECK_EQ(99, r.Call(6)); } - -TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) { - WasmRunner<int32_t> r(MachineType::Int32()); - BUILD(r, - WASM_BLOCK(6, WASM_BRV_IF(0, WASM_I8(11), +WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, WASM_BLOCK(WASM_BRV_IF(0, WASM_I8(11), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1))), - WASM_BRV_IF(0, WASM_I8(12), - WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2))), - WASM_BRV_IF(0, WASM_I8(13), - WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3))), - WASM_BRV_IF(0, WASM_I8(14), - WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4))), - WASM_BRV_IF(0, WASM_I8(15), - WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5))), - WASM_I8(99))); + WASM_BRV_IF(0, WASM_I8(12), + WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2))), + WASM_BRV_IF(0, WASM_I8(13), + WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3))), + WASM_BRV_IF(0, WASM_I8(14), + WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4))), + WASM_BRV_IF(0, WASM_I8(15), + WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5))), + WASM_I8(99))); CHECK_EQ(99, r.Call(0)); CHECK_EQ(11, r.Call(1)); CHECK_EQ(12, r.Call(2)); @@ -2317,45 +2328,41 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) { CHECK_EQ(99, r.Call(6)); } - -TEST(Run_Wasm_nested_ifs) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(nested_ifs) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_IF_ELSE( WASM_GET_LOCAL(0), WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); - CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(12, r.Call(1, 0)); CHECK_EQ(13, r.Call(0, 1)); CHECK_EQ(14, r.Call(0, 0)); } - -TEST(Run_Wasm_ExprBlock_if) { - WasmRunner<int32_t> r(MachineType::Int32()); +WASM_EXEC_TEST(ExprBlock_if) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(11)), - WASM_BRV(0, WASM_I8(14))))); + WASM_BRV(1, WASM_I8(14))))); CHECK_EQ(11, r.Call(1)); CHECK_EQ(14, r.Call(0)); } +WASM_EXEC_TEST(ExprBlock_nested_ifs) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); -TEST(Run_Wasm_ExprBlock_nested_ifs) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); - - BUILD(r, WASM_BLOCK( - 1, WASM_IF_ELSE( - WASM_GET_LOCAL(0), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(11)), - WASM_BRV(0, WASM_I8(12))), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(13)), - WASM_BRV(0, WASM_I8(14)))))); - + BUILD(r, WASM_BLOCK(WASM_IF_ELSE( + WASM_GET_LOCAL(0), + WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(11)), + WASM_BRV(1, WASM_I8(12))), + WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(13)), + WASM_BRV(1, WASM_I8(14)))))); CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(12, r.Call(1, 0)); @@ -2363,18 +2370,16 @@ TEST(Run_Wasm_ExprBlock_nested_ifs) { CHECK_EQ(14, r.Call(0, 0)); } +WASM_EXEC_TEST(ExprLoop_nested_ifs) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); -TEST(Run_Wasm_ExprLoop_nested_ifs) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); - - BUILD(r, WASM_LOOP( - 1, WASM_IF_ELSE( - WASM_GET_LOCAL(0), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(11)), - WASM_BRV(1, WASM_I8(12))), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(13)), - WASM_BRV(1, WASM_I8(14)))))); - + BUILD(r, WASM_LOOP(WASM_IF_ELSE( + WASM_GET_LOCAL(0), + WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(11)), + WASM_BRV(3, WASM_I8(12))), + WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(13)), + WASM_BRV(3, WASM_I8(14)))))); CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(12, r.Call(1, 0)); @@ -2382,10 +2387,9 @@ TEST(Run_Wasm_ExprLoop_nested_ifs) { CHECK_EQ(14, r.Call(0, 0)); } - -TEST(Run_Wasm_SimpleCallIndirect) { +WASM_EXEC_TEST(SimpleCallIndirect) { TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t1(sigs.i_ii(), &module); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -2401,23 +2405,23 @@ TEST(Run_Wasm_SimpleCallIndirect) { module.AddSignature(sigs.d_dd()); // Function table. - int table[] = {0, 1}; - module.AddIndirectFunctionTable(table, 2); + uint16_t indirect_function_table[] = {0, 1}; + module.AddIndirectFunctionTable(indirect_function_table, + arraysize(indirect_function_table)); module.PopulateIndirectFunctionTable(); // Builder the caller function. WasmRunner<int32_t> r(&module, MachineType::Int32()); - BUILD(r, WASM_CALL_INDIRECT(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22))); + BUILD(r, WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22))); CHECK_EQ(88, r.Call(0)); CHECK_EQ(44, r.Call(1)); CHECK_TRAP(r.Call(2)); } - -TEST(Run_Wasm_MultipleCallIndirect) { +WASM_EXEC_TEST(MultipleCallIndirect) { TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); WasmFunctionCompiler t1(sigs.i_ii(), &module); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -2433,18 +2437,19 @@ TEST(Run_Wasm_MultipleCallIndirect) { module.AddSignature(sigs.d_dd()); // Function table. - int table[] = {0, 1}; - module.AddIndirectFunctionTable(table, 2); + uint16_t indirect_function_table[] = {0, 1}; + module.AddIndirectFunctionTable(indirect_function_table, + arraysize(indirect_function_table)); module.PopulateIndirectFunctionTable(); // Builder the caller function. WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); - BUILD(r, - WASM_I32_ADD(WASM_CALL_INDIRECT(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), - WASM_GET_LOCAL(2)), - WASM_CALL_INDIRECT(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), - WASM_GET_LOCAL(0)))); + BUILD(r, WASM_I32_ADD( + WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), + WASM_GET_LOCAL(2)), + WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), + WASM_GET_LOCAL(0)))); CHECK_EQ(5, r.Call(0, 1, 2)); CHECK_EQ(19, r.Call(0, 1, 9)); @@ -2457,9 +2462,9 @@ TEST(Run_Wasm_MultipleCallIndirect) { CHECK_TRAP(r.Call(2, 1, 0)); } -TEST(Run_Wasm_CallIndirect_NoTable) { +WASM_EXEC_TEST(CallIndirect_NoTable) { TestSignatures sigs; - TestingModule module; + TestingModule module(execution_mode); // One function. WasmFunctionCompiler t1(sigs.i_ii(), &module); @@ -2472,241 +2477,125 @@ TEST(Run_Wasm_CallIndirect_NoTable) { // Builder the caller function. WasmRunner<int32_t> r(&module, MachineType::Int32()); - BUILD(r, WASM_CALL_INDIRECT(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22))); + BUILD(r, WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22))); CHECK_TRAP(r.Call(0)); CHECK_TRAP(r.Call(1)); CHECK_TRAP(r.Call(2)); } -TEST(Run_Wasm_F32Floor) { - WasmRunner<float> r(MachineType::Float32()); +WASM_EXEC_TEST(F32Floor) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); } } -TEST(Run_Wasm_F32Ceil) { - WasmRunner<float> r(MachineType::Float32()); +WASM_EXEC_TEST(F32Ceil) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); } } -TEST(Run_Wasm_F32Trunc) { - WasmRunner<float> r(MachineType::Float32()); +WASM_EXEC_TEST(F32Trunc) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); } } -TEST(Run_Wasm_F32NearestInt) { - WasmRunner<float> r(MachineType::Float32()); +WASM_EXEC_TEST(F32NearestInt) { + WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); } } -TEST(Run_Wasm_F64Floor) { - WasmRunner<double> r(MachineType::Float64()); +WASM_EXEC_TEST(F64Floor) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); } } -TEST(Run_Wasm_F64Ceil) { - WasmRunner<double> r(MachineType::Float64()); +WASM_EXEC_TEST(F64Ceil) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); } } -TEST(Run_Wasm_F64Trunc) { - WasmRunner<double> r(MachineType::Float64()); +WASM_EXEC_TEST(F64Trunc) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); } } -TEST(Run_Wasm_F64NearestInt) { - WasmRunner<double> r(MachineType::Float64()); +WASM_EXEC_TEST(F64NearestInt) { + WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); } } -TEST(Run_Wasm_F32Min) { - WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); +WASM_EXEC_TEST(F32Min) { + WasmRunner<float> r(execution_mode, MachineType::Float32(), + MachineType::Float32()); BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { - FOR_FLOAT32_INPUTS(j) { - float expected; - if (*i < *j) { - expected = *i; - } else if (*j < *i) { - expected = *j; - } else if (*i != *i) { - // If *i or *j is NaN, then the result is NaN. - expected = *i; - } else { - expected = *j; - } - - CHECK_FLOAT_EQ(expected, r.Call(*i, *j)); - } + FOR_FLOAT32_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(*i, *j), r.Call(*i, *j)); } } } - -TEST(Run_Wasm_F64Min) { - WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); +WASM_EXEC_TEST(F64Min) { + WasmRunner<double> r(execution_mode, MachineType::Float64(), + MachineType::Float64()); BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT64_INPUTS(i) { - FOR_FLOAT64_INPUTS(j) { - double expected; - if (*i < *j) { - expected = *i; - } else if (*j < *i) { - expected = *j; - } else if (*i != *i) { - // If *i or *j is NaN, then the result is NaN. - expected = *i; - } else { - expected = *j; - } - - CHECK_DOUBLE_EQ(expected, r.Call(*i, *j)); - } + FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(*i, *j), r.Call(*i, *j)); } } } - -TEST(Run_Wasm_F32Max) { - WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); +WASM_EXEC_TEST(F32Max) { + WasmRunner<float> r(execution_mode, MachineType::Float32(), + MachineType::Float32()); BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { - FOR_FLOAT32_INPUTS(j) { - float expected; - if (*i > *j) { - expected = *i; - } else if (*j > *i) { - expected = *j; - } else if (*i != *i) { - // If *i or *j is NaN, then the result is NaN. - expected = *i; - } else { - expected = *j; - } - - CHECK_FLOAT_EQ(expected, r.Call(*i, *j)); - } + FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(JSMax(*i, *j), r.Call(*i, *j)); } } } - -TEST(Run_Wasm_F64Max) { - WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); +WASM_EXEC_TEST(F64Max) { + WasmRunner<double> r(execution_mode, MachineType::Float64(), + MachineType::Float64()); BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT64_INPUTS(i) { FOR_FLOAT64_INPUTS(j) { - double expected; - if (*i > *j) { - expected = *i; - } else if (*j > *i) { - expected = *j; - } else if (*i != *i) { - // If *i or *j is NaN, then the result is NaN. - expected = *i; - } else { - expected = *j; - } - - CHECK_DOUBLE_EQ(expected, r.Call(*i, *j)); + double result = r.Call(*i, *j); + CHECK_DOUBLE_EQ(JSMax(*i, *j), result); } } } -// TODO(ahaas): Fix on arm and mips and reenable. -#if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS && \ - !V8_TARGET_ARCH_MIPS64 - -TEST(Run_Wasm_F32Min_Snan) { - // Test that the instruction does not return a signalling NaN. - { - WasmRunner<float> r; - BUILD(r, - WASM_F32_MIN(WASM_F32(bit_cast<float>(0xff80f1e2)), WASM_F32(57.67))); - CHECK_EQ(0xffc0f1e2, bit_cast<uint32_t>(r.Call())); - } - { - WasmRunner<float> r; - BUILD(r, - WASM_F32_MIN(WASM_F32(45.73), WASM_F32(bit_cast<float>(0x7f80f1e2)))); - CHECK_EQ(0x7fc0f1e2, bit_cast<uint32_t>(r.Call())); - } -} - -TEST(Run_Wasm_F32Max_Snan) { - // Test that the instruction does not return a signalling NaN. - { - WasmRunner<float> r; - BUILD(r, - WASM_F32_MAX(WASM_F32(bit_cast<float>(0xff80f1e2)), WASM_F32(57.67))); - CHECK_EQ(0xffc0f1e2, bit_cast<uint32_t>(r.Call())); - } - { - WasmRunner<float> r; - BUILD(r, - WASM_F32_MAX(WASM_F32(45.73), WASM_F32(bit_cast<float>(0x7f80f1e2)))); - CHECK_EQ(0x7fc0f1e2, bit_cast<uint32_t>(r.Call())); - } -} - -TEST(Run_Wasm_F64Min_Snan) { - // Test that the instruction does not return a signalling NaN. - { - WasmRunner<double> r; - BUILD(r, WASM_F64_MIN(WASM_F64(bit_cast<double>(0xfff000000000f1e2)), - WASM_F64(57.67))); - CHECK_EQ(0xfff800000000f1e2, bit_cast<uint64_t>(r.Call())); - } - { - WasmRunner<double> r; - BUILD(r, WASM_F64_MIN(WASM_F64(45.73), - WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); - CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); - } -} - -TEST(Run_Wasm_F64Max_Snan) { - // Test that the instruction does not return a signalling NaN. - { - WasmRunner<double> r; - BUILD(r, WASM_F64_MAX(WASM_F64(bit_cast<double>(0xfff000000000f1e2)), - WASM_F64(57.67))); - CHECK_EQ(0xfff800000000f1e2, bit_cast<uint64_t>(r.Call())); - } - { - WasmRunner<double> r; - BUILD(r, WASM_F64_MAX(WASM_F64(45.73), - WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); - CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); - } -} - -#endif - -TEST(Run_Wasm_I32SConvertF32) { - WasmRunner<int32_t> r(MachineType::Float32()); +WASM_EXEC_TEST(I32SConvertF32) { + WasmRunner<int32_t> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0))); + // The upper bound is (INT32_MAX + 1), which is the lowest float-representable + // number above INT32_MAX which cannot be represented as int32. + float upper_bound = 2147483648.0f; + // We use INT32_MIN as a lower bound because (INT32_MIN - 1) is not + // representable as float, and no number between (INT32_MIN - 1) and INT32_MIN + // is. + float lower_bound = static_cast<float>(INT32_MIN); FOR_FLOAT32_INPUTS(i) { - if (*i < static_cast<float>(INT32_MAX) && - *i >= static_cast<float>(INT32_MIN)) { + if (*i < upper_bound && *i >= lower_bound) { CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2714,28 +2603,35 @@ TEST(Run_Wasm_I32SConvertF32) { } } - -TEST(Run_Wasm_I32SConvertF64) { - WasmRunner<int32_t> r(MachineType::Float64()); +WASM_EXEC_TEST(I32SConvertF64) { + WasmRunner<int32_t> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0))); + // The upper bound is (INT32_MAX + 1), which is the lowest double- + // representable number above INT32_MAX which cannot be represented as int32. + double upper_bound = 2147483648.0; + // The lower bound is (INT32_MIN - 1), which is the greatest double- + // representable number below INT32_MIN which cannot be represented as int32. + double lower_bound = -2147483649.0; FOR_FLOAT64_INPUTS(i) { - if (*i < (static_cast<double>(INT32_MAX) + 1.0) && - *i > (static_cast<double>(INT32_MIN) - 1.0)) { - CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); + if (*i<upper_bound&& * i> lower_bound) { + CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); } } } - -TEST(Run_Wasm_I32UConvertF32) { - WasmRunner<uint32_t> r(MachineType::Float32()); +WASM_EXEC_TEST(I32UConvertF32) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); - + // The upper bound is (UINT32_MAX + 1), which is the lowest + // float-representable number above UINT32_MAX which cannot be represented as + // uint32. + double upper_bound = 4294967296.0f; + double lower_bound = -1.0f; FOR_FLOAT32_INPUTS(i) { - if (*i < (static_cast<float>(UINT32_MAX) + 1.0) && *i > -1) { + if (*i<upper_bound&& * i> lower_bound) { CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2743,13 +2639,16 @@ TEST(Run_Wasm_I32UConvertF32) { } } - -TEST(Run_Wasm_I32UConvertF64) { - WasmRunner<uint32_t> r(MachineType::Float64()); +WASM_EXEC_TEST(I32UConvertF64) { + WasmRunner<uint32_t> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); - + // The upper bound is (UINT32_MAX + 1), which is the lowest + // double-representable number above UINT32_MAX which cannot be represented as + // uint32. + double upper_bound = 4294967296.0; + double lower_bound = -1.0; FOR_FLOAT64_INPUTS(i) { - if (*i < (static_cast<float>(UINT32_MAX) + 1.0) && *i > -1) { + if (*i<upper_bound&& * i> lower_bound) { CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2757,8 +2656,9 @@ TEST(Run_Wasm_I32UConvertF64) { } } -TEST(Run_Wasm_F64CopySign) { - WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); +WASM_EXEC_TEST(F64CopySign) { + WasmRunner<double> r(execution_mode, MachineType::Float64(), + MachineType::Float64()); BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT64_INPUTS(i) { @@ -2766,9 +2666,9 @@ TEST(Run_Wasm_F64CopySign) { } } - -TEST(Run_Wasm_F32CopySign) { - WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); +WASM_EXEC_TEST(F32CopySign) { + WasmRunner<float> r(execution_mode, MachineType::Float32(), + MachineType::Float32()); BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { @@ -2776,15 +2676,15 @@ TEST(Run_Wasm_F32CopySign) { } } -void CompileCallIndirectMany(LocalType param) { +static void CompileCallIndirectMany(LocalType param) { // Make sure we don't run out of registers when compiling indirect calls // with many many parameters. TestSignatures sigs; - for (byte num_params = 0; num_params < 40; num_params++) { + for (byte num_params = 0; num_params < 40; ++num_params) { v8::base::AccountingAllocator allocator; Zone zone(&allocator); HandleScope scope(CcTest::InitIsolateOnce()); - TestingModule module; + TestingModule module(kExecuteCompiled); FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); module.AddSignature(sig); @@ -2794,33 +2694,26 @@ void CompileCallIndirectMany(LocalType param) { WasmFunctionCompiler t(sig, &module); std::vector<byte> code; - ADD_CODE(code, kExprCallIndirect, 1); ADD_CODE(code, kExprI8Const, 0); - for (byte p = 0; p < num_params; p++) { + for (byte p = 0; p < num_params; ++p) { ADD_CODE(code, kExprGetLocal, p); } + ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1); t.Build(&code[0], &code[0] + code.size()); t.Compile(); } } - TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); } - -#if WASM_64 -TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } -#endif - - TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } - TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } -TEST(Run_WASM_Int32RemS_dead) { - WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); +WASM_EXEC_TEST(Int32RemS_dead) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(0, r.Call(133, 100)); diff --git a/deps/v8/test/cctest/wasm/test-signatures.h b/deps/v8/test/cctest/wasm/test-signatures.h index a5bc7b4f14..95f24cbb93 100644 --- a/deps/v8/test/cctest/wasm/test-signatures.h +++ b/deps/v8/test/cctest/wasm/test-signatures.h @@ -35,7 +35,8 @@ class TestSignatures { sig_v_v(0, 0, kIntTypes4), sig_v_i(0, 1, kIntTypes4), sig_v_ii(0, 2, kIntTypes4), - sig_v_iii(0, 3, kIntTypes4) { + sig_v_iii(0, 3, kIntTypes4), + sig_s_i(1, 1, kSimd128IntTypes4) { // I used C++ and you won't believe what happened next.... for (int i = 0; i < 4; i++) kIntTypes4[i] = kAstI32; for (int i = 0; i < 4; i++) kLongTypes4[i] = kAstI64; @@ -44,9 +45,11 @@ class TestSignatures { for (int i = 0; i < 4; i++) kIntLongTypes4[i] = kAstI64; for (int i = 0; i < 4; i++) kIntFloatTypes4[i] = kAstF32; for (int i = 0; i < 4; i++) kIntDoubleTypes4[i] = kAstF64; + for (int i = 0; i < 4; i++) kSimd128IntTypes4[i] = kAstS128; kIntLongTypes4[0] = kAstI32; kIntFloatTypes4[0] = kAstI32; kIntDoubleTypes4[0] = kAstI32; + kSimd128IntTypes4[1] = kAstI32; } FunctionSig* i_v() { return &sig_i_v; } @@ -71,6 +74,7 @@ class TestSignatures { FunctionSig* v_i() { return &sig_v_i; } FunctionSig* v_ii() { return &sig_v_ii; } FunctionSig* v_iii() { return &sig_v_iii; } + FunctionSig* s_i() { return &sig_s_i; } FunctionSig* many(Zone* zone, LocalType ret, LocalType param, int count) { FunctionSig::Builder builder(zone, ret == kAstStmt ? 0 : 1, count); @@ -89,6 +93,7 @@ class TestSignatures { LocalType kIntLongTypes4[4]; LocalType kIntFloatTypes4[4]; LocalType kIntDoubleTypes4[4]; + LocalType kSimd128IntTypes4[4]; FunctionSig sig_i_v; FunctionSig sig_i_i; @@ -112,6 +117,7 @@ class TestSignatures { FunctionSig sig_v_i; FunctionSig sig_v_ii; FunctionSig sig_v_iii; + FunctionSig sig_s_i; }; } // namespace wasm } // namespace internal diff --git a/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc b/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc new file mode 100644 index 0000000000..1ae78dcb4e --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc @@ -0,0 +1,120 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/wasm/wasm-function-name-table.h" +#include "src/wasm/wasm-module.h" + +#include "test/cctest/cctest.h" + +using namespace v8::internal; +using namespace v8::internal::wasm; + +namespace { + +#define CHECK_STREQ(exp, found) \ + do { \ + Vector<const char> exp_ = (exp); \ + Vector<const char> found_ = (found); \ + if (V8_UNLIKELY(exp_.length() != found_.length() || \ + memcmp(exp_.start(), found_.start(), exp_.length()))) { \ + V8_Fatal(__FILE__, __LINE__, \ + "Check failed: (%s) != (%s) ('%.*s' vs '%.*s').", #exp, #found, \ + exp_.length(), exp_.start(), found_.length(), found_.start()); \ + } \ + } while (0) + +void testFunctionNameTable(Vector<Vector<const char>> names) { + Isolate *isolate = CcTest::InitIsolateOnce(); + HandleAndZoneScope scope; + + WasmModule module; + std::vector<char> all_names; + // No name should have offset 0, because that encodes unnamed functions. + // In real wasm binary, offset 0 is impossible anyway. + all_names.push_back('\0'); + + uint32_t func_index = 0; + for (Vector<const char> name : names) { + size_t name_offset = name.start() ? all_names.size() : 0; + all_names.insert(all_names.end(), name.start(), + name.start() + name.length()); + // Make every second function name null-terminated. + if (func_index % 2) all_names.push_back('\0'); + module.functions.push_back({nullptr, 0, 0, + static_cast<uint32_t>(name_offset), + static_cast<uint32_t>(name.length()), 0, 0}); + ++func_index; + } + + module.module_start = reinterpret_cast<byte *>(all_names.data()); + module.module_end = module.module_start + all_names.size(); + + Handle<Object> wasm_function_name_table = + BuildFunctionNamesTable(isolate, &module); + CHECK(wasm_function_name_table->IsByteArray()); + + func_index = 0; + for (Vector<const char> name : names) { + MaybeHandle<String> string = GetWasmFunctionNameFromTable( + Handle<ByteArray>::cast(wasm_function_name_table), func_index); + if (name.start()) { + CHECK(string.ToHandleChecked()->IsUtf8EqualTo(name)); + } else { + CHECK(string.is_null()); + } + ++func_index; + } +} + +void testFunctionNameTable(Vector<const char *> names) { + std::vector<Vector<const char>> names_vec; + for (const char *name : names) + names_vec.push_back(name ? CStrVector(name) : Vector<const char>()); + testFunctionNameTable(Vector<Vector<const char>>( + names_vec.data(), static_cast<int>(names_vec.size()))); +} + +} // namespace + +TEST(NoFunctions) { testFunctionNameTable(Vector<Vector<const char>>()); } + +TEST(OneFunctions) { + const char *names[] = {"foo"}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(ThreeFunctions) { + const char *names[] = {"foo", "bar", "baz"}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(OneUnnamedFunction) { + const char *names[] = {""}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(UnnamedFirstFunction) { + const char *names[] = {"", "bar", "baz"}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(UnnamedLastFunction) { + const char *names[] = {"bar", "baz", ""}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(ThreeUnnamedFunctions) { + const char *names[] = {"", "", ""}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(UTF8Names) { + const char *names[] = {"↱fun↰", "↺", "alpha:α beta:β"}; + testFunctionNameTable(ArrayVector(names)); +} + +TEST(UnnamedVsEmptyNames) { + const char *names[] = {"", nullptr, nullptr, ""}; + testFunctionNameTable(ArrayVector(names)); +} diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc new file mode 100644 index 0000000000..f2a848161b --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc @@ -0,0 +1,164 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/wasm/wasm-macro-gen.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/test-signatures.h" +#include "test/cctest/wasm/wasm-run-utils.h" + +using namespace v8::base; +using namespace v8::internal; +using namespace v8::internal::compiler; +using namespace v8::internal::wasm; + +using v8::Local; +using v8::Utils; + +namespace { + +#define CHECK_CSTREQ(exp, found) \ + do { \ + const char* exp_ = (exp); \ + const char* found_ = (found); \ + DCHECK_NOT_NULL(exp); \ + if (V8_UNLIKELY(found_ == nullptr || strcmp(exp_, found_) != 0)) { \ + V8_Fatal(__FILE__, __LINE__, \ + "Check failed: (%s) != (%s) ('%s' vs '%s').", #exp, #found, \ + exp_, found_ ? found_ : "<null>"); \ + } \ + } while (0) + +void PrintStackTrace(v8::Local<v8::StackTrace> stack) { + printf("Stack Trace (length %d):\n", stack->GetFrameCount()); + for (int i = 0, e = stack->GetFrameCount(); i != e; ++i) { + v8::Local<v8::StackFrame> frame = stack->GetFrame(i); + v8::Local<v8::String> script = frame->GetScriptName(); + v8::Local<v8::String> func = frame->GetFunctionName(); + printf("[%d] (%s) %s:%d:%d\n", i, + script.IsEmpty() ? "<null>" : *v8::String::Utf8Value(script), + func.IsEmpty() ? "<null>" : *v8::String::Utf8Value(func), + frame->GetLineNumber(), frame->GetColumn()); + } +} + +struct ExceptionInfo { + const char* func_name; + int line_nr; + int column; +}; + +template <int N> +void CheckExceptionInfos(Handle<Object> exc, + const ExceptionInfo (&excInfos)[N]) { + // Check that it's indeed an Error object. + CHECK(exc->IsJSError()); + + // Extract stack frame from the exception. + Local<v8::Value> localExc = Utils::ToLocal(exc); + v8::Local<v8::StackTrace> stack = v8::Exception::GetStackTrace(localExc); + PrintStackTrace(stack); + CHECK(!stack.IsEmpty()); + CHECK_EQ(N, stack->GetFrameCount()); + + for (int frameNr = 0; frameNr < N; ++frameNr) { + v8::Local<v8::StackFrame> frame = stack->GetFrame(frameNr); + v8::String::Utf8Value funName(frame->GetFunctionName()); + CHECK_CSTREQ(excInfos[frameNr].func_name, *funName); + CHECK_EQ(excInfos[frameNr].line_nr, frame->GetLineNumber()); + CHECK_EQ(excInfos[frameNr].column, frame->GetColumn()); + } +} + +} // namespace + +// Call from JS to WASM to JS and throw an Error from JS. +TEST(CollectDetailedWasmStack_ExplicitThrowFromJs) { + TestSignatures sigs; + TestingModule module; + + // Initialize WasmFunctionCompiler first, since it sets up the HandleScope. + WasmFunctionCompiler comp1(sigs.v_v(), &module); + + uint32_t js_throwing_index = module.AddJsFunction( + sigs.v_v(), + "(function js() {\n function a() {\n throw new Error(); };\n a(); })"); + + // Add a nop such that we don't always get position 1. + BUILD(comp1, WASM_NOP, WASM_CALL_FUNCTION0(js_throwing_index)); + uint32_t wasm_index = comp1.CompileAndAdd(); + + WasmFunctionCompiler comp2(sigs.v_v(), &module); + BUILD(comp2, WASM_CALL_FUNCTION0(wasm_index)); + uint32_t wasm_index_2 = comp2.CompileAndAdd(); + + Handle<JSFunction> js_wasm_wrapper = module.WrapCode(wasm_index_2); + + Handle<JSFunction> js_trampoline = Handle<JSFunction>::cast( + v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( + CompileRun("(function callFn(fn) { fn(); })")))); + + Isolate* isolate = js_wasm_wrapper->GetIsolate(); + isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, + v8::StackTrace::kOverview); + Handle<Object> global(isolate->context()->global_object(), isolate); + MaybeHandle<Object> maybe_exc; + Handle<Object> args[] = {js_wasm_wrapper}; + MaybeHandle<Object> returnObjMaybe = + Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); + CHECK(returnObjMaybe.is_null()); + + // The column is 1-based, so add 1 to the actual byte offset. + ExceptionInfo expected_exceptions[] = { + {"a", 3, 8}, // - + {"js", 4, 2}, // - + {"<WASM UNNAMED>", static_cast<int>(wasm_index), 3}, // - + {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // - + {"callFn", 1, 24} // - + }; + CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); +} + +// Trigger a trap in WASM, stack should be JS -> WASM -> WASM. +TEST(CollectDetailedWasmStack_WasmError) { + TestSignatures sigs; + TestingModule module; + + WasmFunctionCompiler comp1(sigs.i_v(), &module, + ArrayVector("exec_unreachable")); + // Set the execution context, such that a runtime error can be thrown. + comp1.SetModuleContext(); + BUILD(comp1, WASM_UNREACHABLE); + uint32_t wasm_index = comp1.CompileAndAdd(); + + WasmFunctionCompiler comp2(sigs.i_v(), &module, + ArrayVector("call_exec_unreachable")); + BUILD(comp2, WASM_CALL_FUNCTION0(wasm_index)); + uint32_t wasm_index_2 = comp2.CompileAndAdd(); + + Handle<JSFunction> js_wasm_wrapper = module.WrapCode(wasm_index_2); + + Handle<JSFunction> js_trampoline = Handle<JSFunction>::cast( + v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( + CompileRun("(function callFn(fn) { fn(); })")))); + + Isolate* isolate = js_wasm_wrapper->GetIsolate(); + isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, + v8::StackTrace::kOverview); + Handle<Object> global(isolate->context()->global_object(), isolate); + MaybeHandle<Object> maybe_exc; + Handle<Object> args[] = {js_wasm_wrapper}; + MaybeHandle<Object> maybe_return_obj = + Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); + CHECK(maybe_return_obj.is_null()); + + // The column is 1-based, so add 1 to the actual byte offset. + ExceptionInfo expected_exceptions[] = { + {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // - + {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // - + {"callFn", 1, 24} //- + }; + CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); +} diff --git a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc new file mode 100644 index 0000000000..30f5d48a07 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc @@ -0,0 +1,139 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/wasm/wasm-macro-gen.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/test-signatures.h" +#include "test/cctest/wasm/wasm-run-utils.h" + +using namespace v8::base; +using namespace v8::internal; +using namespace v8::internal::compiler; +using namespace v8::internal::wasm; + +using v8::Local; +using v8::Utils; + +namespace { + +#define CHECK_CSTREQ(exp, found) \ + do { \ + const char* exp_ = (exp); \ + const char* found_ = (found); \ + DCHECK_NOT_NULL(exp); \ + if (V8_UNLIKELY(found_ == nullptr || strcmp(exp_, found_) != 0)) { \ + V8_Fatal(__FILE__, __LINE__, \ + "Check failed: (%s) != (%s) ('%s' vs '%s').", #exp, #found, \ + exp_, found_ ? found_ : "<null>"); \ + } \ + } while (0) + +struct ExceptionInfo { + const char* func_name; + int line_nr; + int column; +}; + +template <int N> +void CheckExceptionInfos(Handle<Object> exc, + const ExceptionInfo (&excInfos)[N]) { + // Check that it's indeed an Error object. + CHECK(exc->IsJSError()); + + // Extract stack frame from the exception. + Local<v8::Value> localExc = Utils::ToLocal(exc); + v8::Local<v8::StackTrace> stack = v8::Exception::GetStackTrace(localExc); + CHECK(!stack.IsEmpty()); + CHECK_EQ(N, stack->GetFrameCount()); + + for (int frameNr = 0; frameNr < N; ++frameNr) { + v8::Local<v8::StackFrame> frame = stack->GetFrame(frameNr); + v8::String::Utf8Value funName(frame->GetFunctionName()); + CHECK_CSTREQ(excInfos[frameNr].func_name, *funName); + CHECK_EQ(excInfos[frameNr].line_nr, frame->GetLineNumber()); + CHECK_EQ(excInfos[frameNr].column, frame->GetColumn()); + } +} + +} // namespace + +// Trigger a trap for executing unreachable. +TEST(Unreachable) { + TestSignatures sigs; + TestingModule module; + + WasmFunctionCompiler comp1(sigs.v_v(), &module, + ArrayVector("exec_unreachable")); + // Set the execution context, such that a runtime error can be thrown. + comp1.SetModuleContext(); + BUILD(comp1, WASM_UNREACHABLE); + uint32_t wasm_index = comp1.CompileAndAdd(); + + Handle<JSFunction> js_wasm_wrapper = module.WrapCode(wasm_index); + + Handle<JSFunction> js_trampoline = Handle<JSFunction>::cast( + v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( + CompileRun("(function callFn(fn) { fn(); })")))); + + Isolate* isolate = js_wasm_wrapper->GetIsolate(); + isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, + v8::StackTrace::kOverview); + Handle<Object> global(isolate->context()->global_object(), isolate); + MaybeHandle<Object> maybe_exc; + Handle<Object> args[] = {js_wasm_wrapper}; + MaybeHandle<Object> returnObjMaybe = + Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); + CHECK(returnObjMaybe.is_null()); + + // The column is 1-based, so add 1 to the actual byte offset. + ExceptionInfo expected_exceptions[] = { + {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // -- + {"callFn", 1, 24} // -- + }; + CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); +} + +// Trigger a trap for loading from out-of-bounds. +TEST(IllegalLoad) { + TestSignatures sigs; + TestingModule module; + + WasmFunctionCompiler comp1(sigs.v_v(), &module, ArrayVector("mem_oob")); + // Set the execution context, such that a runtime error can be thrown. + comp1.SetModuleContext(); + BUILD(comp1, WASM_IF(WASM_ONE, + WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(-3)))); + uint32_t wasm_index = comp1.CompileAndAdd(); + + WasmFunctionCompiler comp2(sigs.v_v(), &module, ArrayVector("call_mem_oob")); + // Insert a NOP such that the position of the call is not one. + BUILD(comp2, WASM_NOP, WASM_CALL_FUNCTION0(wasm_index)); + uint32_t wasm_index_2 = comp2.CompileAndAdd(); + + Handle<JSFunction> js_wasm_wrapper = module.WrapCode(wasm_index_2); + + Handle<JSFunction> js_trampoline = Handle<JSFunction>::cast( + v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( + CompileRun("(function callFn(fn) { fn(); })")))); + + Isolate* isolate = js_wasm_wrapper->GetIsolate(); + isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, + v8::StackTrace::kOverview); + Handle<Object> global(isolate->context()->global_object(), isolate); + MaybeHandle<Object> maybe_exc; + Handle<Object> args[] = {js_wasm_wrapper}; + MaybeHandle<Object> returnObjMaybe = + Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); + CHECK(returnObjMaybe.is_null()); + + // The column is 1-based, so add 1 to the actual byte offset. + ExceptionInfo expected_exceptions[] = { + {"<WASM UNNAMED>", static_cast<int>(wasm_index), 7}, // -- + {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 3}, // -- + {"callFn", 1, 24} // -- + }; + CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); +} diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index 1e85f46887..0a11fedfd1 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -9,6 +9,9 @@ #include <stdlib.h> #include <string.h> +#include <memory> + +#include "src/base/accounting-allocator.h" #include "src/base/utils/random-number-generator.h" #include "src/compiler/graph-visualizer.h" @@ -17,9 +20,12 @@ #include "src/compiler/node.h" #include "src/compiler/pipeline.h" #include "src/compiler/wasm-compiler.h" +#include "src/compiler/zone-pool.h" #include "src/wasm/ast-decoder.h" +#include "src/wasm/wasm-interpreter.h" #include "src/wasm/wasm-js.h" +#include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-opcodes.h" @@ -29,15 +35,10 @@ #include "test/cctest/compiler/call-tester.h" #include "test/cctest/compiler/graph-builder-tester.h" -// TODO(titzer): pull WASM_64 up to a common header. -#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 -#define WASM_64 1 -#else -#define WASM_64 0 -#endif - static const uint32_t kMaxFunctions = 10; +enum WasmExecutionMode { kExecuteInterpreted, kExecuteCompiled }; + // TODO(titzer): check traps more robustly in tests. // Currently, in tests, we just return 0xdeadbeef from the function in which // the trap occurs if the runtime context is not available to throw a JavaScript @@ -70,16 +71,21 @@ const uint32_t kMaxGlobalsSize = 128; // {WasmModuleInstance}. class TestingModule : public ModuleEnv { public: - TestingModule() : instance_(&module_), global_offset(0) { - module_.shared_isolate = CcTest::InitIsolateOnce(); + explicit TestingModule(WasmExecutionMode mode = kExecuteCompiled) + : execution_mode_(mode), + instance_(&module_), + isolate_(CcTest::InitIsolateOnce()), + global_offset(0), + interpreter_(mode == kExecuteInterpreted + ? new WasmInterpreter(&instance_, &allocator_) + : nullptr) { module = &module_; instance = &instance_; instance->module = &module_; instance->globals_start = global_data; - instance->globals_size = kMaxGlobalsSize; + module_.globals_size = kMaxGlobalsSize; instance->mem_start = nullptr; instance->mem_size = 0; - linker = nullptr; origin = kWasmOrigin; memset(global_data, 0, sizeof(global_data)); } @@ -88,9 +94,10 @@ class TestingModule : public ModuleEnv { if (instance->mem_start) { free(instance->mem_start); } + if (interpreter_) delete interpreter_; } - byte* AddMemory(size_t size) { + byte* AddMemory(uint32_t size) { CHECK_NULL(instance->mem_start); CHECK_EQ(0, instance->mem_size); instance->mem_start = reinterpret_cast<byte*>(malloc(size)); @@ -101,19 +108,19 @@ class TestingModule : public ModuleEnv { } template <typename T> - T* AddMemoryElems(size_t count) { + T* AddMemoryElems(uint32_t count) { AddMemory(count * sizeof(T)); return raw_mem_start<T>(); } template <typename T> - T* AddGlobal(MachineType mem_type) { - WasmGlobal* global = AddGlobal(mem_type); + T* AddGlobal(LocalType type) { + const WasmGlobal* global = AddGlobal(type); return reinterpret_cast<T*>(instance->globals_start + global->offset); } byte AddSignature(FunctionSig* sig) { - module->signatures.push_back(sig); + module_.signatures.push_back(sig); size_t size = module->signatures.size(); CHECK(size < 127); return static_cast<byte>(size - 1); @@ -134,14 +141,22 @@ class TestingModule : public ModuleEnv { template <typename T> T raw_mem_at(int i) { DCHECK(instance->mem_start); - return reinterpret_cast<T*>(instance->mem_start)[i]; + return ReadMemory(&(reinterpret_cast<T*>(instance->mem_start)[i])); } template <typename T> T raw_val_at(int i) { - T val; - memcpy(&val, reinterpret_cast<void*>(instance->mem_start + i), sizeof(T)); - return val; + return ReadMemory(reinterpret_cast<T*>(instance->mem_start + i)); + } + + template <typename T> + void WriteMemory(T* p, T val) { + WriteLittleEndianValue<T>(p, val); + } + + template <typename T> + T ReadMemory(T* p) { + return ReadLittleEndianValue<T>(p); } // Zero-initialize the memory. @@ -159,57 +174,100 @@ class TestingModule : public ModuleEnv { rng.NextBytes(raw, end - raw); } - int AddFunction(FunctionSig* sig, Handle<Code> code) { + uint32_t AddFunction(FunctionSig* sig, Handle<Code> code) { if (module->functions.size() == 0) { // TODO(titzer): Reserving space here to avoid the underlying WasmFunction // structs from moving. - module->functions.reserve(kMaxFunctions); + module_.functions.reserve(kMaxFunctions); } uint32_t index = static_cast<uint32_t>(module->functions.size()); - module->functions.push_back( - {sig, index, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, false}); + module_.functions.push_back({sig, index, 0, 0, 0, 0, 0}); instance->function_code.push_back(code); + if (interpreter_) { + const WasmFunction* function = &module->functions.back(); + int interpreter_index = interpreter_->AddFunctionForTesting(function); + CHECK_EQ(index, static_cast<uint32_t>(interpreter_index)); + } DCHECK_LT(index, kMaxFunctions); // limited for testing. return index; } + uint32_t AddJsFunction(FunctionSig* sig, const char* source) { + Handle<JSFunction> jsfunc = Handle<JSFunction>::cast(v8::Utils::OpenHandle( + *v8::Local<v8::Function>::Cast(CompileRun(source)))); + uint32_t index = AddFunction(sig, Handle<Code>::null()); + Handle<Code> code = + CompileWasmToJSWrapper(isolate_, jsfunc, sig, index, + Handle<String>::null(), Handle<String>::null()); + instance->function_code[index] = code; + return index; + } + + Handle<JSFunction> WrapCode(uint32_t index) { + // Wrap the code so it can be called as a JS function. + Handle<String> name = isolate_->factory()->NewStringFromStaticChars("main"); + Handle<JSObject> module_object = Handle<JSObject>(0, isolate_); + Handle<Code> code = instance->function_code[index]; + WasmJs::InstallWasmFunctionMap(isolate_, isolate_->native_context()); + Handle<Code> ret_code = + compiler::CompileJSToWasmWrapper(isolate_, this, code, index); + FunctionSig* funcSig = this->module->functions[index].sig; + Handle<ByteArray> exportedSig = isolate_->factory()->NewByteArray( + static_cast<int>(funcSig->parameter_count() + funcSig->return_count()), + TENURED); + exportedSig->copy_in(0, reinterpret_cast<const byte*>(funcSig->raw_data()), + exportedSig->length()); + Handle<JSFunction> ret = WrapExportCodeAsJSFunction( + isolate_, ret_code, name, + static_cast<int>(this->module->functions[index].sig->parameter_count()), + exportedSig, module_object); + return ret; + } + void SetFunctionCode(uint32_t index, Handle<Code> code) { instance->function_code[index] = code; } - void AddIndirectFunctionTable(int* functions, int table_size) { - Isolate* isolate = module->shared_isolate; - Handle<FixedArray> fixed = - isolate->factory()->NewFixedArray(2 * table_size); - instance->function_table = fixed; - DCHECK_EQ(0u, module->function_table.size()); - for (int i = 0; i < table_size; i++) { - module->function_table.push_back(functions[i]); + void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { + module_.function_tables.push_back( + {table_size, table_size, std::vector<uint16_t>()}); + for (uint32_t i = 0; i < table_size; ++i) { + module_.function_tables.back().values.push_back(functions[i]); } + + Handle<FixedArray> values = BuildFunctionTable( + isolate_, static_cast<int>(module_.function_tables.size() - 1), + &module_); + instance->function_tables.push_back(values); } void PopulateIndirectFunctionTable() { - if (instance->function_table.is_null()) return; - int table_size = static_cast<int>(module->function_table.size()); - for (int i = 0; i < table_size; i++) { - int function_index = module->function_table[i]; - WasmFunction* function = &module->functions[function_index]; - instance->function_table->set(i, Smi::FromInt(function->sig_index)); - instance->function_table->set(i + table_size, - *instance->function_code[function_index]); + for (uint32_t i = 0; i < instance->function_tables.size(); i++) { + PopulateFunctionTable(instance->function_tables[i], + module_.function_tables[i].size, + &instance->function_code); } } + WasmFunction* GetFunctionAt(int index) { return &module_.functions[index]; } + + WasmInterpreter* interpreter() { return interpreter_; } + WasmExecutionMode execution_mode() { return execution_mode_; } + private: + WasmExecutionMode execution_mode_; WasmModule module_; WasmModuleInstance instance_; + Isolate* isolate_; + v8::base::AccountingAllocator allocator_; uint32_t global_offset; V8_ALIGNED(8) byte global_data[kMaxGlobalsSize]; // preallocated global data. + WasmInterpreter* interpreter_; - WasmGlobal* AddGlobal(MachineType mem_type) { - byte size = WasmOpcodes::MemSize(mem_type); + const WasmGlobal* AddGlobal(LocalType type) { + byte size = WasmOpcodes::MemSize(WasmOpcodes::MachineTypeFor(type)); global_offset = (global_offset + size - 1) & ~(size - 1); // align - module->globals.push_back({0, 0, mem_type, global_offset, false}); + module_.globals.push_back({0, 0, type, global_offset, false}); global_offset += size; // limit number of globals. CHECK_LT(global_offset, kMaxGlobalsSize); @@ -218,10 +276,11 @@ class TestingModule : public ModuleEnv { }; inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, - FunctionSig* sig, const byte* start, - const byte* end) { - compiler::WasmGraphBuilder builder(zone, jsgraph, sig); - TreeResult result = + FunctionSig* sig, + SourcePositionTable* source_position_table, + const byte* start, const byte* end) { + compiler::WasmGraphBuilder builder(zone, jsgraph, sig, source_position_table); + DecodeResult result = BuildTFGraph(zone->allocator(), &builder, module, sig, start, end); if (result.failed()) { ptrdiff_t pc = result.error_pc - result.start; @@ -356,7 +415,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, r.LowerGraph(); } - CompilationInfo info("testing", isolate, graph()->zone()); + CompilationInfo info(ArrayVector("testing"), isolate, graph()->zone()); code_ = Pipeline::GenerateCodeForTesting(&info, descriptor, graph(), nullptr); CHECK(!code_.is_null()); @@ -382,41 +441,72 @@ class WasmFunctionWrapper : public HandleAndZoneScope, // A helper for compiling WASM functions for testing. This class can create a // standalone function if {module} is NULL or a function within a // {TestingModule}. It contains the internal state for compilation (i.e. -// TurboFan graph) and, later, interpretation. +// TurboFan graph) and interpretation (by adding to the interpreter manually). class WasmFunctionCompiler : public HandleAndZoneScope, private GraphAndBuilders { public: - explicit WasmFunctionCompiler(FunctionSig* sig, TestingModule* module) + explicit WasmFunctionCompiler( + FunctionSig* sig, WasmExecutionMode mode, + Vector<const char> debug_name = ArrayVector("<WASM UNNAMED>")) : GraphAndBuilders(main_zone()), + execution_mode_(mode), jsgraph(this->isolate(), this->graph(), this->common(), nullptr, nullptr, this->machine()), sig(sig), descriptor_(nullptr), - testing_module_(module) { - if (module) { - // Get a new function from the testing module. - function_ = nullptr; - function_index_ = module->AddFunction(sig, Handle<Code>::null()); - } else { - // Create our own function. - function_ = new WasmFunction(); - function_->sig = sig; - function_index_ = 0; + testing_module_(nullptr), + debug_name_(debug_name), + local_decls(main_zone(), sig), + source_position_table_(this->graph()), + interpreter_(nullptr) { + // Create our own function. + function_ = new WasmFunction(); + function_->sig = sig; + function_->func_index = 0; + function_->sig_index = 0; + if (mode == kExecuteInterpreted) { + interpreter_ = new WasmInterpreter(nullptr, zone()->allocator()); + int index = interpreter_->AddFunctionForTesting(function_); + CHECK_EQ(0, index); } } + explicit WasmFunctionCompiler( + FunctionSig* sig, TestingModule* module, + Vector<const char> debug_name = ArrayVector("<WASM UNNAMED>")) + : GraphAndBuilders(main_zone()), + execution_mode_(module->execution_mode()), + jsgraph(this->isolate(), this->graph(), this->common(), nullptr, + nullptr, this->machine()), + sig(sig), + descriptor_(nullptr), + testing_module_(module), + debug_name_(debug_name), + local_decls(main_zone(), sig), + source_position_table_(this->graph()), + interpreter_(module->interpreter()) { + // Get a new function from the testing module. + int index = module->AddFunction(sig, Handle<Code>::null()); + function_ = testing_module_->GetFunctionAt(index); + } + ~WasmFunctionCompiler() { - if (function_) delete function_; + if (testing_module_) return; // testing module owns the below things. + delete function_; + if (interpreter_) delete interpreter_; } + WasmExecutionMode execution_mode_; JSGraph jsgraph; FunctionSig* sig; // The call descriptor is initialized when the function is compiled. CallDescriptor* descriptor_; TestingModule* testing_module_; + Vector<const char> debug_name_; WasmFunction* function_; - int function_index_; LocalDeclEncoder local_decls; + SourcePositionTable source_position_table_; + WasmInterpreter* interpreter_; Isolate* isolate() { return main_isolate(); } Graph* graph() const { return main_graph_; } @@ -429,16 +519,21 @@ class WasmFunctionCompiler : public HandleAndZoneScope, } } CallDescriptor* descriptor() { return descriptor_; } + uint32_t function_index() { return function_->func_index; } void Build(const byte* start, const byte* end) { // Build the TurboFan graph. - local_decls.Prepend(&start, &end); - TestBuildingGraph(main_zone(), &jsgraph, testing_module_, sig, start, end); - delete[] start; + local_decls.Prepend(main_zone(), &start, &end); + TestBuildingGraph(main_zone(), &jsgraph, testing_module_, sig, + &source_position_table_, start, end); + if (interpreter_) { + // Add the code to the interpreter. + CHECK(interpreter_->SetFunctionCodeForTesting(function_, start, end)); + } } byte AllocateLocal(LocalType type) { - uint32_t index = local_decls.AddLocals(1, type, sig); + uint32_t index = local_decls.AddLocals(1, type); byte result = static_cast<byte>(index); DCHECK_EQ(index, result); return result; @@ -450,30 +545,52 @@ class WasmFunctionCompiler : public HandleAndZoneScope, if (kPointerSize == 4) { desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc); } - CompilationInfo info("wasm compile", this->isolate(), this->zone()); - Handle<Code> result = - Pipeline::GenerateCodeForTesting(&info, desc, this->graph()); + CompilationInfo info(debug_name_, this->isolate(), this->zone(), + Code::ComputeFlags(Code::WASM_FUNCTION)); + std::unique_ptr<CompilationJob> job(Pipeline::NewWasmCompilationJob( + &info, graph(), desc, &source_position_table_)); + if (job->ExecuteJob() != CompilationJob::SUCCEEDED || + job->FinalizeJob() != CompilationJob::SUCCEEDED) + return Handle<Code>::null(); + + Handle<Code> code = info.code(); + + // Length is always 2, since usually <wasm_obj, func_index> is stored in + // the deopt data. Here, we only store the function index. + DCHECK(code->deoptimization_data() == nullptr || + code->deoptimization_data()->length() == 0); + Handle<FixedArray> deopt_data = + isolate()->factory()->NewFixedArray(2, TENURED); + deopt_data->set(1, Smi::FromInt(static_cast<int>(function_index()))); + deopt_data->set_length(2); + code->set_deoptimization_data(*deopt_data); + #ifdef ENABLE_DISASSEMBLER - if (!result.is_null() && FLAG_print_opt_code) { + if (FLAG_print_opt_code) { OFStream os(stdout); - result->Disassemble("wasm code", os); + code->Disassemble("wasm code", os); } #endif - return result; + return code; } uint32_t CompileAndAdd(uint16_t sig_index = 0) { CHECK(testing_module_); - function()->sig_index = sig_index; + function_->sig_index = sig_index; Handle<Code> code = Compile(); - testing_module_->SetFunctionCode(function_index_, code); - return static_cast<uint32_t>(function_index_); + testing_module_->SetFunctionCode(function_index(), code); + return function_index(); } - WasmFunction* function() { - if (function_) return function_; - return &testing_module_->module->functions[function_index_]; + // Set the context, such that e.g. runtime functions can be called. + void SetModuleContext() { + if (!testing_module_->instance->context.is_null()) { + CHECK(testing_module_->instance->context.is_identical_to( + main_isolate()->native_context())); + return; + } + testing_module_->instance->context = main_isolate()->native_context(); } }; @@ -482,7 +599,8 @@ class WasmFunctionCompiler : public HandleAndZoneScope, template <typename ReturnType> class WasmRunner { public: - WasmRunner(MachineType p0 = MachineType::None(), + WasmRunner(WasmExecutionMode execution_mode, + MachineType p0 = MachineType::None(), MachineType p1 = MachineType::None(), MachineType p2 = MachineType::None(), MachineType p3 = MachineType::None()) @@ -490,7 +608,7 @@ class WasmRunner { compiled_(false), signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, GetParameterCount(p0, p1, p2, p3), storage_), - compiler_(&signature_, nullptr) { + compiler_(&signature_, execution_mode) { InitSigStorage(p0, p1, p2, p3); } @@ -533,51 +651,102 @@ class WasmRunner { void Build(const byte* start, const byte* end) { CHECK(!compiled_); compiled_ = true; - - // Build the TF graph within the compiler. compiler_.Build(start, end); - // Generate code. - Handle<Code> code = compiler_.Compile(); - if (compiler_.testing_module_) { - // Update the table of function code in the module. - compiler_.testing_module_->SetFunctionCode(compiler_.function_index_, - code); - } + if (!interpret()) { + // Compile machine code and install it into the module. + Handle<Code> code = compiler_.Compile(); - wrapper_.SetInnerCode(code); + if (compiler_.testing_module_) { + // Update the table of function code in the module. + compiler_.testing_module_->SetFunctionCode( + compiler_.function_->func_index, code); + } + + wrapper_.SetInnerCode(code); + } } - ReturnType Call() { return Call(0, 0, 0, 0); } + ReturnType Call() { + if (interpret()) { + return CallInterpreter(Vector<WasmVal>(nullptr, 0)); + } else { + return Call(0, 0, 0, 0); + } + } template <typename P0> ReturnType Call(P0 p0) { - return Call(p0, 0, 0, 0); + if (interpret()) { + WasmVal args[] = {WasmVal(p0)}; + return CallInterpreter(ArrayVector(args)); + } else { + return Call(p0, 0, 0, 0); + } } template <typename P0, typename P1> ReturnType Call(P0 p0, P1 p1) { - return Call(p0, p1, 0, 0); + if (interpret()) { + WasmVal args[] = {WasmVal(p0), WasmVal(p1)}; + return CallInterpreter(ArrayVector(args)); + } else { + return Call(p0, p1, 0, 0); + } } template <typename P0, typename P1, typename P2> ReturnType Call(P0 p0, P1 p1, P2 p2) { - return Call(p0, p1, p2, 0); + if (interpret()) { + WasmVal args[] = {WasmVal(p0), WasmVal(p1), WasmVal(p2)}; + return CallInterpreter(ArrayVector(args)); + } else { + return Call(p0, p1, p2, 0); + } } template <typename P0, typename P1, typename P2, typename P3> ReturnType Call(P0 p0, P1 p1, P2 p2, P3 p3) { - CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(), - wrapper_.GetWrapperCode(), wrapper_.signature()); - ReturnType return_value; - int32_t result = runner.Call<void*, void*, void*, void*, void*>( - &p0, &p1, &p2, &p3, &return_value); - CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); - return return_value; + if (interpret()) { + WasmVal args[] = {WasmVal(p0), WasmVal(p1), WasmVal(p2), WasmVal(p3)}; + return CallInterpreter(ArrayVector(args)); + } else { + CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(), + wrapper_.GetWrapperCode(), + wrapper_.signature()); + ReturnType return_value; + int32_t result = runner.Call<void*, void*, void*, void*, void*>( + &p0, &p1, &p2, &p3, &return_value); + CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); + return return_value; + } + } + + ReturnType CallInterpreter(Vector<WasmVal> args) { + CHECK_EQ(args.length(), + static_cast<int>(compiler_.function_->sig->parameter_count())); + WasmInterpreter::Thread* thread = interpreter()->GetThread(0); + thread->Reset(); + thread->PushFrame(compiler_.function_, args.start()); + if (thread->Run() == WasmInterpreter::FINISHED) { + WasmVal val = thread->GetReturnValue(); + return val.to<ReturnType>(); + } else if (thread->state() == WasmInterpreter::TRAPPED) { + // TODO(titzer): return the correct trap code + int64_t result = 0xdeadbeefdeadbeef; + return static_cast<ReturnType>(result); + } else { + // TODO(titzer): falling off end + ReturnType val = 0; + return val; + } } byte AllocateLocal(LocalType type) { return compiler_.AllocateLocal(type); } + WasmFunction* function() { return compiler_.function_; } + WasmInterpreter* interpreter() { return compiler_.interpreter_; } + protected: v8::base::AccountingAllocator allocator_; Zone zone; @@ -587,6 +756,8 @@ class WasmRunner { WasmFunctionCompiler compiler_; WasmFunctionWrapper<ReturnType> wrapper_; + bool interpret() { return compiler_.execution_mode_ == kExecuteInterpreted; } + static size_t GetParameterCount(MachineType p0, MachineType p1, MachineType p2, MachineType p3) { if (p0 == MachineType::None()) return 0; @@ -597,6 +768,16 @@ class WasmRunner { } }; +// A macro to define tests that run in different engine configurations. +// Currently only supports compiled tests, but a future +// RunWasmInterpreted_##name version will allow each test to also run in the +// interpreter. +#define WASM_EXEC_TEST(name) \ + void RunWasm_##name(WasmExecutionMode execution_mode); \ + TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ + TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ + void RunWasm_##name(WasmExecutionMode execution_mode) + } // namespace #endif |