diff options
Diffstat (limited to 'deps/v8/test/cctest')
171 files changed, 5164 insertions, 3403 deletions
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index ee6407c74b..89fe36f65b 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -14,17 +14,11 @@ config("cctest_config") { v8_executable("cctest") { testonly = true - sources = [ - "cctest.cc", - ] + sources = [ "cctest.cc" ] - deps = [ - ":cctest_sources", - ] + deps = [ ":cctest_sources" ] - data_deps = [ - "../../tools:v8_testrunner", - ] + data_deps = [ "../../tools:v8_testrunner" ] data = [ "testcfg.py", @@ -35,15 +29,12 @@ v8_executable("cctest") { configs = [ "../..:external_config", "../..:internal_config_base", + "../..:v8_tracing_config", ":cctest_config", ] ldflags = [] - if (v8_use_perfetto) { - deps += [ "//third_party/perfetto/include/perfetto/tracing" ] - } - # TODO(machenbach): Translate from gyp. #["OS=="aix"", { # "ldflags": [ "-Wl,-bbigtoc" ], @@ -58,9 +49,7 @@ v8_header_set("cctest_headers") { "../..:internal_config_base", ] - sources = [ - "cctest.h", - ] + sources = [ "cctest.h" ] } v8_source_set("cctest_sources") { @@ -230,6 +219,7 @@ v8_source_set("cctest_sources") { "test-intl.cc", "test-js-weak-refs.cc", "test-liveedit.cc", + "test-local-handles.cc", "test-lockers.cc", "test-log.cc", "test-managed.cc", @@ -293,6 +283,8 @@ v8_source_set("cctest_sources") { "wasm/test-streaming-compilation.cc", "wasm/test-wasm-breakpoints.cc", "wasm/test-wasm-codegen.cc", + "wasm/test-wasm-debug-evaluate.cc", + "wasm/test-wasm-debug-evaluate.h", "wasm/test-wasm-import-wrapper-cache.cc", "wasm/test-wasm-interpreter-entry.cc", "wasm/test-wasm-serialization.cc", @@ -386,6 +378,7 @@ v8_source_set("cctest_sources") { configs = [ "../..:external_config", "../..:internal_config_base", + "../..:v8_tracing_config", ] public_deps = [ @@ -400,9 +393,7 @@ v8_source_set("cctest_sources") { ] defines = [] - deps = [ - "../..:run_torque", - ] + deps = [ "../..:run_torque" ] if (v8_enable_i18n_support) { defines += [ "V8_INTL_SUPPORT" ] @@ -432,6 +423,11 @@ v8_source_set("cctest_sources") { # MSVS wants this for gay-{precision,shortest}.cc. cflags += [ "/bigobj" ] + + if (symbol_level == 2) { + sources += [ "test-v8windbg.cc" ] + deps += [ "../../tools/v8windbg:v8windbg_test" ] + } } if (v8_use_perfetto) { @@ -439,6 +435,7 @@ v8_source_set("cctest_sources") { "//third_party/perfetto/include/perfetto/tracing", "//third_party/perfetto/protos/perfetto/trace/chrome:lite", "//third_party/perfetto/protos/perfetto/trace/chrome:zero", + "//third_party/perfetto/src/tracing:in_process_backend", ] } } @@ -465,7 +462,5 @@ v8_executable("generate-bytecode-expectations") { "//build/win:default_exe_manifest", ] - data = [ - "interpreter/bytecode_expectations/", - ] + data = [ "interpreter/bytecode_expectations/" ] } diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index 8a5a5a6d31..e503b51914 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -36,6 +36,7 @@ #include "src/codegen/register-configuration.h" #include "src/debug/debug-interface.h" #include "src/execution/isolate.h" +#include "src/execution/simulator.h" #include "src/flags/flags.h" #include "src/heap/factory.h" #include "src/init/v8.h" @@ -358,16 +359,13 @@ static inline v8::Local<v8::Integer> v8_int(int32_t x) { } static inline v8::Local<v8::String> v8_str(const char* x) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x, - v8::NewStringType::kNormal) - .ToLocalChecked(); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x).ToLocalChecked(); } static inline v8::Local<v8::String> v8_str(v8::Isolate* isolate, const char* x) { - return v8::String::NewFromUtf8(isolate, x, v8::NewStringType::kNormal) - .ToLocalChecked(); + return v8::String::NewFromUtf8(isolate, x).ToLocalChecked(); } @@ -437,8 +435,7 @@ static inline v8::MaybeLocal<v8::Value> CompileRun( static inline v8::Local<v8::Value> CompileRunChecked(v8::Isolate* isolate, const char* source) { v8::Local<v8::String> source_string = - v8::String::NewFromUtf8(isolate, source, v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromUtf8(isolate, source).ToLocalChecked(); v8::Local<v8::Context> context = isolate->GetCurrentContext(); v8::Local<v8::Script> script = v8::Script::Compile(context, source_string).ToLocalChecked(); @@ -735,4 +732,65 @@ class TestPlatform : public v8::Platform { DISALLOW_COPY_AND_ASSIGN(TestPlatform); }; +#if defined(USE_SIMULATOR) +class SimulatorHelper { + public: + inline bool Init(v8::Isolate* isolate) { + simulator_ = reinterpret_cast<v8::internal::Isolate*>(isolate) + ->thread_local_top() + ->simulator_; + // Check if there is active simulator. + return simulator_ != nullptr; + } + + inline void FillRegisters(v8::RegisterState* state) { +#if V8_TARGET_ARCH_ARM + state->pc = reinterpret_cast<void*>(simulator_->get_pc()); + state->sp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::sp)); + state->fp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::r11)); + state->lr = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::lr)); +#elif V8_TARGET_ARCH_ARM64 + if (simulator_->sp() == 0 || simulator_->fp() == 0) { + // It's possible that the simulator is interrupted while it is updating + // the sp or fp register. ARM64 simulator does this in two steps: + // first setting it to zero and then setting it to a new value. + // Bailout if sp/fp doesn't contain the new value. + return; + } + state->pc = reinterpret_cast<void*>(simulator_->pc()); + state->sp = reinterpret_cast<void*>(simulator_->sp()); + state->fp = reinterpret_cast<void*>(simulator_->fp()); + state->lr = reinterpret_cast<void*>(simulator_->lr()); +#elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 + state->pc = reinterpret_cast<void*>(simulator_->get_pc()); + state->sp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::sp)); + state->fp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::fp)); +#elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 + state->pc = reinterpret_cast<void*>(simulator_->get_pc()); + state->sp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::sp)); + state->fp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::fp)); + state->lr = reinterpret_cast<void*>(simulator_->get_lr()); +#elif V8_TARGET_ARCH_S390 || V8_TARGET_ARCH_S390X + state->pc = reinterpret_cast<void*>(simulator_->get_pc()); + state->sp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::sp)); + state->fp = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::fp)); + state->lr = reinterpret_cast<void*>( + simulator_->get_register(v8::internal::Simulator::ra)); +#endif + } + + private: + v8::internal::Simulator* simulator_; +}; +#endif // USE_SIMULATOR + #endif // ifndef CCTEST_H_ diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index 06583f6bd5..444ec9d8ec 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -140,8 +140,6 @@ ############################################################################## ['arch == arm64', { - 'test-api/Bug618': [PASS], - # BUG(v8:3385). 'test-serialize/StartupSerializerOnceRunScript': [PASS, FAIL], 'test-serialize/StartupSerializerTwiceRunScript': [PASS, FAIL], @@ -178,6 +176,12 @@ }], # variant == nooptimization and (arch == arm or arch == arm64) and simulator_run ############################################################################## +['variant == no_lfa', { + # https://crbug.com/v8/10219 + 'test-compiler/DecideToPretenureDuringCompilation': [SKIP], +}], # variant == no_lfa + +############################################################################## ['asan == True', { # Skip tests not suitable for ASAN. 'test-assembler-x64/AssemblerX64XchglOperations': [SKIP], @@ -190,6 +194,10 @@ ['msan == True', { # ICU upstream issues. 'test-strings/CountBreakIterator': [SKIP], + + # BUG(v8:10244): MSAN finding uninitialized bytes during memcmp + 'test-code-stub-assembler/SmallOrderedHashSetAllocate': [SKIP], + 'test-code-stub-assembler/SmallOrderedHashMapAllocate': [SKIP], }], # 'msan == True' ############################################################################## @@ -207,8 +215,8 @@ ############################################################################## ['byteorder == big', { - # Skip WASM atomic tests on big-endian machines. - # There is no support to emulate atomic WASM operations on big-endian + # Skip Wasm atomic tests on big-endian machines. + # There is no support to emulate atomic Wasm operations on big-endian # platforms, since this would require bit swapping as a part of atomic # operations. 'test-run-wasm-atomics/*': [SKIP], @@ -455,7 +463,7 @@ 'test-api-wasm/WasmStreaming*': [SKIP], 'test-backing-store/Run_WasmModule_Buffer_Externalized_Regression_UseAfterFree': [SKIP], 'test-c-wasm-entry/*': [SKIP], - 'test-compilation-cache/TestAsyncCache': [SKIP], + 'test-compilation-cache/*': [SKIP], 'test-jump-table-assembler/*': [SKIP], 'test-grow-memory/*': [SKIP], 'test-run-wasm-64/*': [SKIP], @@ -474,6 +482,7 @@ 'test-streaming-compilation/*': [SKIP], 'test-wasm-breakpoints/*': [SKIP], 'test-wasm-codegen/*': [SKIP], + 'test-wasm-debug-evaluate/*': [SKIP], 'test-wasm-import-wrapper-cache/*': [SKIP], 'test-wasm-interpreter-entry/*': [SKIP], 'test-wasm-serialization/*': [SKIP], @@ -484,6 +493,7 @@ # Tests that generate code at runtime. 'codegen-tester/*': [SKIP], + 'serializer-tester/*': [SKIP], 'test-accessor-assembler/*': [SKIP], 'test-assembler-*': [SKIP], 'test-basic-block-profiler/*': [SKIP], @@ -492,7 +502,10 @@ 'test-code-generator/*': [SKIP], 'test-code-pages/*': [SKIP], 'test-code-stub-assembler/*': [SKIP], + 'test-debug-helper/GetObjectProperties': [SKIP], + 'test-disasm-x64/DisasmX64': [SKIP], 'test-js-context-specialization/*': [SKIP], + 'test-macro-assembler-x64/EmbeddedObj': [SKIP], 'test-multiple-return/*': [SKIP], 'test-regexp/MacroAssemblernativeAtStart': [SKIP], 'test-regexp/MacroAssemblerNativeBackReferenceLATIN1': [SKIP], @@ -523,8 +536,11 @@ 'test-run-tail-calls/*': [SKIP], 'test-run-unwinding-info/*': [SKIP], 'test-run-variables/*': [SKIP], + 'test-serialize/*': [SKIP], 'test-torque/*': [SKIP], - 'test-macro-assembler-x64/EmbeddedObj': [SKIP], + 'test-unwinder/PCIsInV8_InCodeOrEmbeddedRange': [SKIP], + 'test-unwinder/PCIsInV8_LargeCodeObject': [SKIP], + 'test-unwinder-code-pages/PCIsInV8_LargeCodeObject_CodePagesAPI': [SKIP], # Field representation tracking is disabled in jitless mode. 'test-field-type-tracking/*': [SKIP], @@ -600,11 +616,4 @@ 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], }], # variant == turboprop -############################################################################## -['variant != future', { - # Wasm native module cache is temporarily disabled in non-future variant - # (https://crbug.com/1070199) - 'test-compilation-cache/*': [SKIP] -}], # variant != future - ] diff --git a/deps/v8/test/cctest/compiler/test-code-assembler.cc b/deps/v8/test/cctest/compiler/test-code-assembler.cc index e3db983488..9c9210f77e 100644 --- a/deps/v8/test/cctest/compiler/test-code-assembler.cc +++ b/deps/v8/test/cctest/compiler/test-code-assembler.cc @@ -34,12 +34,6 @@ Node* UndefinedConstant(CodeAssembler* m) { return m->LoadRoot(RootIndex::kUndefinedValue); } -TNode<Smi> SmiFromInt32(CodeAssembler* m, Node* value) { - value = m->ChangeInt32ToIntPtr(value); - return m->BitcastWordToTaggedSigned( - m->WordShl(value, kSmiShiftSize + kSmiTagSize)); -} - Node* LoadObjectField(CodeAssembler* m, Node* object, int offset, MachineType type = MachineType::AnyTagged()) { return m->Load(type, object, m->IntPtrConstant(offset - kHeapObjectTag)); @@ -87,7 +81,7 @@ TEST(SimpleCallRuntime1Arg) { CodeAssembler m(asm_tester.state()); TNode<Context> context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* b = SmiTag(&m, m.Int32Constant(0)); + TNode<Smi> b = SmiTag(&m, m.Int32Constant(0)); m.Return(m.CallRuntime(Runtime::kIsSmi, context, b)); FunctionTester ft(asm_tester.GenerateCode()); CHECK(ft.CallChecked<Oddball>().is_identical_to( @@ -100,7 +94,7 @@ TEST(SimpleTailCallRuntime1Arg) { CodeAssembler m(asm_tester.state()); TNode<Context> context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* b = SmiTag(&m, m.Int32Constant(0)); + TNode<Smi> b = SmiTag(&m, m.Int32Constant(0)); m.TailCallRuntime(Runtime::kIsSmi, context, b); FunctionTester ft(asm_tester.GenerateCode()); CHECK(ft.CallChecked<Oddball>().is_identical_to( @@ -113,8 +107,8 @@ TEST(SimpleCallRuntime2Arg) { CodeAssembler m(asm_tester.state()); TNode<Context> context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* a = SmiTag(&m, m.Int32Constant(2)); - Node* b = SmiTag(&m, m.Int32Constant(4)); + TNode<Smi> a = SmiTag(&m, m.Int32Constant(2)); + TNode<Smi> b = SmiTag(&m, m.Int32Constant(4)); m.Return(m.CallRuntime(Runtime::kAdd, context, a, b)); FunctionTester ft(asm_tester.GenerateCode()); CHECK_EQ(6, ft.CallChecked<Smi>()->value()); @@ -126,8 +120,8 @@ TEST(SimpleTailCallRuntime2Arg) { CodeAssembler m(asm_tester.state()); TNode<Context> context = m.HeapConstant(Handle<Context>(isolate->native_context())); - Node* a = SmiTag(&m, m.Int32Constant(2)); - Node* b = SmiTag(&m, m.Int32Constant(4)); + TNode<Smi> a = SmiTag(&m, m.Int32Constant(2)); + TNode<Smi> b = SmiTag(&m, m.Int32Constant(4)); m.TailCallRuntime(Runtime::kAdd, context, a, b); FunctionTester ft(asm_tester.GenerateCode()); CHECK_EQ(6, ft.CallChecked<Smi>()->value()); @@ -446,127 +440,6 @@ TEST(TestOutOfScopeVariable) { CHECK(!asm_tester.GenerateCode().is_null()); } -TEST(GotoIfException) { - Isolate* isolate(CcTest::InitIsolateOnce()); - - const int kNumParams = 1; - CodeAssemblerTester asm_tester(isolate, kNumParams); - CodeAssembler m(asm_tester.state()); - - TNode<Context> context = - m.HeapConstant(Handle<Context>(isolate->native_context())); - TNode<Symbol> to_string_tag = - m.HeapConstant(isolate->factory()->to_string_tag_symbol()); - Variable exception(&m, MachineRepresentation::kTagged); - - CodeAssemblerLabel exception_handler(&m); - Callable to_string = Builtins::CallableFor(isolate, Builtins::kToString); - TNode<Object> string = m.CallStub(to_string, context, to_string_tag); - m.GotoIfException(string, &exception_handler, &exception); - m.Return(string); - - m.Bind(&exception_handler); - m.Return(m.UncheckedCast<Object>(exception.value())); - - FunctionTester ft(asm_tester.GenerateCode(), kNumParams); - Handle<Object> result = ft.Call().ToHandleChecked(); - - // Should be a TypeError. - CHECK(result->IsJSObject()); - - Handle<Object> constructor = - Object::GetPropertyOrElement(isolate, result, - isolate->factory()->constructor_string()) - .ToHandleChecked(); - CHECK(constructor->SameValue(*isolate->type_error_function())); -} - -TEST(GotoIfExceptionMultiple) { - Isolate* isolate(CcTest::InitIsolateOnce()); - - const int kNumParams = 4; // receiver, first, second, third - CodeAssemblerTester asm_tester(isolate, kNumParams); - CodeAssembler m(asm_tester.state()); - - TNode<Context> 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); - - CodeAssemblerLabel exception_handler1(&m); - CodeAssemblerLabel exception_handler2(&m); - CodeAssemblerLabel 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 = Builtins::CallableFor(isolate, Builtins::kToString); - TNode<Object> 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(UndefinedConstant(&m)); - string = m.CallStub(to_string, context, second_value); - m.GotoIfException(string, &exception_handler2, &error); - m.Return(SmiFromInt32(&m, return_value.value())); - - // try { ToString(param3); return 7 & ~2; } catch (e) { return e; } - m.Bind(&exception_handler2); - // Return returnValue & ~2 - error.Bind(UndefinedConstant(&m)); - string = m.CallStub(to_string, context, third_value); - m.GotoIfException(string, &exception_handler3, &error); - m.Return(SmiFromInt32( - &m, m.Word32And(return_value.value(), - m.Word32Xor(m.Int32Constant(2), m.Int32Constant(-1))))); - - m.Bind(&exception_handler3); - m.Return(m.UncheckedCast<Object>(error.value())); - - FunctionTester ft(asm_tester.GenerateCode(), 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::ToInt(*result)); - - // 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::ToInt(*result)); - - // 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(isolate, result, - isolate->factory()->constructor_string()) - .ToHandleChecked(); - CHECK(constructor->SameValue(*isolate->type_error_function())); -} - TEST(ExceptionHandler) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; @@ -576,7 +449,7 @@ TEST(ExceptionHandler) { CodeAssembler::TVariable<Object> var(m.SmiConstant(0), &m); CodeAssemblerLabel exception(&m, {&var}, CodeAssemblerLabel::kDeferred); { - CodeAssemblerScopedExceptionHandler handler(&m, &exception, &var); + ScopedExceptionHandler handler(&m, &exception, &var); TNode<Context> context = m.HeapConstant(Handle<Context>(isolate->native_context())); m.CallRuntime(Runtime::kThrow, context, m.SmiConstant(2)); diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc index 3e66856189..16faf976b6 100644 --- a/deps/v8/test/cctest/compiler/test-code-generator.cc +++ b/deps/v8/test/cctest/compiler/test-code-generator.cc @@ -5,6 +5,7 @@ #include "src/base/utils/random-number-generator.h" #include "src/codegen/assembler-inl.h" #include "src/codegen/code-stub-assembler.h" +#include "src/codegen/macro-assembler-inl.h" #include "src/codegen/optimized-compilation-info.h" #include "src/compiler/backend/code-generator.h" #include "src/compiler/backend/instruction.h" @@ -1002,6 +1003,8 @@ class CodeGeneratorTester { Builtins::kNoBuiltinId, kMaxUnoptimizedFrameHeight, kMaxPushedArgumentCount); + generator_->tasm()->CodeEntry(); + // Force a frame to be created. generator_->frame_access_state()->MarkHasFrame(true); generator_->AssembleConstructFrame(); @@ -1069,7 +1072,7 @@ class CodeGeneratorTester { CodeGeneratorTester::PushTypeFlag push_type) { generator_->AssembleTailCallBeforeGap(instr, first_unused_stack_slot); #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_S390) || \ - defined(V8_TARGET_ARCH_PPC) + defined(V8_TARGET_ARCH_PPC) || defined(V8_TARGET_ARCH_PPC64) // Only folding register pushes is supported on ARM. bool supported = ((push_type & CodeGenerator::kRegisterPush) == push_type); #elif defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_IA32) || \ diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index 156ea8074a..fe12950bba 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -34,11 +34,11 @@ CallDescriptor* CreateCallDescriptor(Zone* zone, int return_count, wasm::FunctionSig::Builder builder(zone, return_count, param_count); for (int i = 0; i < param_count; i++) { - builder.AddParam(wasm::ValueTypes::ValueTypeFor(type)); + builder.AddParam(wasm::ValueType::For(type)); } for (int i = 0; i < return_count; i++) { - builder.AddReturn(wasm::ValueTypes::ValueTypeFor(type)); + builder.AddReturn(wasm::ValueType::For(type)); } return compiler::GetWasmCallDescriptor(zone, builder.Build()); } diff --git a/deps/v8/test/cctest/compiler/test-run-jsobjects.cc b/deps/v8/test/cctest/compiler/test-run-jsobjects.cc index 2ce6242e9e..724dc05ebb 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsobjects.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsobjects.cc @@ -14,8 +14,8 @@ namespace compiler { TEST(ArgumentsMapped) { FunctionTester T("(function(a) { return arguments; })"); - Handle<Object> arguments; - T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandle(&arguments); + Handle<Object> arguments = + T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandleChecked(); CHECK(arguments->IsJSObject() && !arguments->IsJSArray()); CHECK(JSObject::cast(*arguments).HasSloppyArgumentsElements()); Handle<String> l = T.isolate->factory()->length_string(); @@ -28,8 +28,8 @@ TEST(ArgumentsMapped) { TEST(ArgumentsUnmapped) { FunctionTester T("(function(a) { 'use strict'; return arguments; })"); - Handle<Object> arguments; - T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandle(&arguments); + Handle<Object> arguments = + T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandleChecked(); CHECK(arguments->IsJSObject() && !arguments->IsJSArray()); CHECK(!JSObject::cast(*arguments).HasSloppyArgumentsElements()); Handle<String> l = T.isolate->factory()->length_string(); @@ -42,8 +42,8 @@ TEST(ArgumentsUnmapped) { TEST(ArgumentsRest) { FunctionTester T("(function(a, ...args) { return args; })"); - Handle<Object> arguments; - T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandle(&arguments); + Handle<Object> arguments = + T.Call(T.Val(19), T.Val(23), T.Val(42), T.Val(65)).ToHandleChecked(); CHECK(arguments->IsJSObject() && arguments->IsJSArray()); CHECK(!JSObject::cast(*arguments).HasSloppyArgumentsElements()); Handle<String> l = T.isolate->factory()->length_string(); diff --git a/deps/v8/test/cctest/compiler/test-run-load-store.cc b/deps/v8/test/cctest/compiler/test-run-load-store.cc index 6f52f339f3..2def65a79e 100644 --- a/deps/v8/test/cctest/compiler/test-run-load-store.cc +++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc @@ -264,15 +264,17 @@ void RunLoadImmIndex(MachineType type, TestAlignment t) { for (int offset = -1; offset <= 200000; offset *= -5) { for (int i = 0; i < kNumElems; i++) { BufferedRawMachineAssemblerTester<CType> m; - void* base_pointer = ComputeOffset(&buffer[0], offset * sizeof(CType)); + CType* base_pointer = reinterpret_cast<CType*>( + ComputeOffset(&buffer[0], offset * sizeof(CType))); #ifdef V8_COMPRESS_POINTERS if (type.IsTagged()) { // When pointer compression is enabled then we need to access only // the lower 32-bit of the tagged value while the buffer contains // full 64-bit values. - base_pointer = LSB(base_pointer, kTaggedSize); + base_pointer = reinterpret_cast<CType*>(LSB(base_pointer, kTaggedSize)); } #endif + Node* base = m.PointerConstant(base_pointer); Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); if (t == TestAlignment::kAligned) { @@ -300,15 +302,21 @@ void RunLoadStore(MachineType type, TestAlignment t) { MemCopy(&zap_value, &zap_data, sizeof(CType)); InitBuffer(in_buffer, kNumElems, type); +#ifdef V8_TARGET_BIG_ENDIAN + int offset = sizeof(CType) - ElementSizeInBytes(type.representation()); +#else + int offset = 0; +#endif + for (int32_t x = 0; x < kNumElems; x++) { int32_t y = kNumElems - x - 1; RawMachineAssemblerTester<int32_t> m; int32_t OK = 0x29000 + x; Node* in_base = m.PointerConstant(in_buffer); - Node* in_index = m.IntPtrConstant(x * sizeof(CType)); + Node* in_index = m.IntPtrConstant(x * sizeof(CType) + offset); Node* out_base = m.PointerConstant(out_buffer); - Node* out_index = m.IntPtrConstant(y * sizeof(CType)); + Node* out_index = m.IntPtrConstant(y * sizeof(CType) + offset); if (t == TestAlignment::kAligned) { Node* load = m.Load(type, in_base, in_index); m.Store(type.representation(), out_base, out_index, load, diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc index 30ebfd0502..15f9c2d89f 100644 --- a/deps/v8/test/cctest/heap/heap-utils.cc +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -173,8 +173,8 @@ void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) { if (!force_completion) return; while (!marking->IsComplete()) { - marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, - i::StepOrigin::kV8); + marking->Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + i::StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc index 684bda4411..d92375d362 100644 --- a/deps/v8/test/cctest/heap/test-alloc.cc +++ b/deps/v8/test/cctest/heap/test-alloc.cc @@ -46,8 +46,8 @@ Handle<Object> HeapTester::TestAllocateAfterFailures() { // we wrap the allocator function in an AlwaysAllocateScope. Test that // all allocations succeed immediately without any retry. CcTest::CollectAllAvailableGarbage(); - AlwaysAllocateScope scope(CcTest::i_isolate()); Heap* heap = CcTest::heap(); + AlwaysAllocateScopeForTesting scope(heap); int size = FixedArray::SizeFor(100); // Young generation. HeapObject obj = @@ -159,17 +159,13 @@ TEST(StressJS) { // Add the Foo constructor the global object. CHECK(env->Global() - ->Set(env, v8::String::NewFromUtf8(CcTest::isolate(), "Foo", - v8::NewStringType::kNormal) - .ToLocalChecked(), + ->Set(env, v8::String::NewFromUtf8Literal(CcTest::isolate(), "Foo"), v8::Utils::CallableToLocal(function)) .FromJust()); // Call the accessor through JavaScript. v8::Local<v8::Value> result = - v8::Script::Compile( - env, v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get", - v8::NewStringType::kNormal) - .ToLocalChecked()) + v8::Script::Compile(env, v8::String::NewFromUtf8Literal(CcTest::isolate(), + "(new Foo).get")) .ToLocalChecked() ->Run(env) .ToLocalChecked(); diff --git a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc index 82cc6c84f3..56730e7b76 100644 --- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc +++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc @@ -42,6 +42,11 @@ bool IsTracked(i::Heap* heap, i::ArrayBufferExtension* extension) { return in_young || in_old; } +bool IsTracked(i::Heap* heap, i::JSArrayBuffer buffer) { + return V8_ARRAY_BUFFER_EXTENSION_BOOL ? IsTracked(heap, buffer.extension()) + : IsTracked(buffer); +} + } // namespace namespace v8 { @@ -504,6 +509,7 @@ TEST(ArrayBuffer_ExternalBackingStoreSizeIncreases) { } TEST(ArrayBuffer_ExternalBackingStoreSizeDecreases) { + FLAG_concurrent_array_buffer_sweeping = false; CcTest::InitializeVM(); LocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -525,9 +531,10 @@ TEST(ArrayBuffer_ExternalBackingStoreSizeDecreases) { } TEST(ArrayBuffer_ExternalBackingStoreSizeIncreasesMarkCompact) { - if (FLAG_never_compact || V8_ARRAY_BUFFER_EXTENSION_BOOL) return; + if (FLAG_never_compact) return; ManualGCScope manual_gc_scope; FLAG_manual_evacuation_candidates_selection = true; + FLAG_concurrent_array_buffer_sweeping = false; CcTest::InitializeVM(); LocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -544,13 +551,13 @@ TEST(ArrayBuffer_ExternalBackingStoreSizeIncreasesMarkCompact) { Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, kArraybufferSize); Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); - CHECK(IsTracked(*buf1)); + CHECK(IsTracked(heap, *buf1)); heap::GcAndSweep(heap, NEW_SPACE); heap::GcAndSweep(heap, NEW_SPACE); Page* page_before_gc = Page::FromHeapObject(*buf1); heap::ForceEvacuationCandidate(page_before_gc); - CHECK(IsTracked(*buf1)); + CHECK(IsTracked(heap, *buf1)); CcTest::CollectAllGarbage(); diff --git a/deps/v8/test/cctest/heap/test-external-string-tracker.cc b/deps/v8/test/cctest/heap/test-external-string-tracker.cc index 7eb03e10e2..d6cffd43ca 100644 --- a/deps/v8/test/cctest/heap/test-external-string-tracker.cc +++ b/deps/v8/test/cctest/heap/test-external-string-tracker.cc @@ -147,8 +147,7 @@ TEST(ExternalString_ExternalBackingStoreSizeIncreasesAfterExternalization) { // Allocate normal string in the new gen. v8::Local<v8::String> str = - v8::String::NewFromUtf8(isolate, TEST_STR, v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(isolate, TEST_STR); CHECK_EQ(0, heap->new_space()->ExternalBackingStoreBytes(type) - new_backing_store_before); @@ -199,8 +198,7 @@ TEST(ExternalString_PromotedThinString) { // New external string in the young space. This string has the same content // as the previous one (that was already internalized). v8::Local<v8::String> string2 = - v8::String::NewFromUtf8(isolate, TEST_STR, v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(isolate, TEST_STR); bool success = string2->MakeExternal(new TestOneByteResource(i::StrDup(TEST_STR))); CHECK(success); diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index 5eaa28404e..d181f764f8 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -1576,7 +1576,7 @@ HEAP_TEST(TestSizeOfObjects) { // Allocate objects on several different old-space pages so that // concurrent sweeper threads will be busy sweeping the old space on // subsequent GC runs. - AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + AlwaysAllocateScopeForTesting always_allocate(heap); int filler_size = static_cast<int>(FixedArray::SizeFor(8192)); for (int i = 1; i <= 100; i++) { isolate->factory()->NewFixedArray(8192, AllocationType::kOld); @@ -2175,8 +2175,8 @@ TEST(InstanceOfStubWriteBarrier) { while (!marking_state->IsBlack(f->code()) && !marking->IsStopped()) { // Discard any pending GC requests otherwise we will get GC when we enter // code below. - marking->V8Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD, - StepOrigin::kV8); + marking->Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + StepOrigin::kV8); } CHECK(marking->IsMarking()); @@ -2189,7 +2189,6 @@ TEST(InstanceOfStubWriteBarrier) { g->Call(ctx, global, 0, nullptr).ToLocalChecked(); } - CcTest::heap()->incremental_marking()->set_should_hurry(true); CcTest::CollectGarbage(OLD_SPACE); } @@ -2269,8 +2268,8 @@ TEST(IdleNotificationFinishMarking) { const double kStepSizeInMs = 100; do { - marking->V8Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD, - StepOrigin::kV8); + marking->Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + StepOrigin::kV8); } while (!CcTest::heap() ->mark_compact_collector() ->marking_worklists() @@ -2299,7 +2298,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) { v8::HandleScope scope(CcTest::isolate()); v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); heap::SimulateFullSpace(CcTest::heap()->new_space()); - AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + AlwaysAllocateScopeForTesting always_allocate(CcTest::heap()); v8::Local<v8::Value> res = CompileRun( "function c(x) {" " this.x = x;" @@ -2823,7 +2822,7 @@ TEST(Regress1465) { CompileRun("function F() {}"); { - AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + AlwaysAllocateScopeForTesting always_allocate(CcTest::i_isolate()->heap()); for (int i = 0; i < transitions_count; i++) { EmbeddedVector<char, 64> buffer; SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i); @@ -2861,7 +2860,7 @@ static i::Handle<JSObject> GetByName(const char* name) { #ifdef DEBUG static void AddTransitions(int transitions_count) { - AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + AlwaysAllocateScopeForTesting always_allocate(CcTest::i_isolate()->heap()); for (int i = 0; i < transitions_count; i++) { EmbeddedVector<char, 64> buffer; SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i); @@ -3011,7 +3010,7 @@ TEST(ReleaseOverReservedPages) { 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); + AlwaysAllocateScopeForTesting always_allocate(heap); heap::SimulateFullSpace(old_space); factory->NewFixedArray(1, AllocationType::kOld); } @@ -3507,8 +3506,13 @@ TEST(DetailedErrorStackTraceBuiltinExit) { FixedArray parameters = stack_trace->Parameters(0); CHECK_EQ(parameters.length(), 2); +#ifdef V8_REVERSE_JSARGS + CHECK(parameters.get(1).IsSmi()); + CHECK_EQ(Smi::ToInt(parameters.get(1)), 9999); +#else CHECK(parameters.get(0).IsSmi()); CHECK_EQ(Smi::ToInt(parameters.get(0)), 9999); +#endif }); } @@ -3588,7 +3592,7 @@ TEST(Regress169928) { // This should crash with a protection violation if we are running a build // with the bug. - AlwaysAllocateScope aa_scope(isolate); + AlwaysAllocateScopeForTesting aa_scope(isolate->heap()); v8::Script::Compile(env.local(), mote_code_string) .ToLocalChecked() ->Run(env.local()) @@ -4858,10 +4862,8 @@ TEST(Regress357137) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope hscope(isolate); v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); - global->Set( - v8::String::NewFromUtf8(isolate, "interrupt", v8::NewStringType::kNormal) - .ToLocalChecked(), - v8::FunctionTemplate::New(isolate, RequestInterrupt)); + global->Set(v8::String::NewFromUtf8Literal(isolate, "interrupt"), + v8::FunctionTemplate::New(isolate, RequestInterrupt)); v8::Local<v8::Context> context = v8::Context::New(isolate, nullptr, global); CHECK(!context.IsEmpty()); v8::Context::Scope cscope(context); @@ -4985,7 +4987,6 @@ TEST(Regress3631) { "for (var i = 0; i < 50; i++) {" " weak_map.set(future_keys[i], i);" "}"); - heap->incremental_marking()->set_should_hurry(true); CcTest::CollectGarbage(OLD_SPACE); } @@ -5131,7 +5132,7 @@ void AllocateInSpace(Isolate* isolate, size_t bytes, AllocationSpace space) { CHECK(IsAligned(bytes, kTaggedSize)); Factory* factory = isolate->factory(); HandleScope scope(isolate); - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(isolate->heap()); int elements = static_cast<int>((bytes - FixedArray::kHeaderSize) / kTaggedSize); Handle<FixedArray> array = factory->NewFixedArray( @@ -5217,10 +5218,8 @@ TEST(MessageObjectLeak) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); - global->Set( - v8::String::NewFromUtf8(isolate, "check", v8::NewStringType::kNormal) - .ToLocalChecked(), - v8::FunctionTemplate::New(isolate, CheckLeak)); + global->Set(v8::String::NewFromUtf8Literal(isolate, "check"), + v8::FunctionTemplate::New(isolate, CheckLeak)); v8::Local<v8::Context> context = v8::Context::New(isolate, nullptr, global); v8::Context::Scope cscope(context); @@ -5421,7 +5420,7 @@ HEAP_TEST(Regress589413) { { // Ensure that incremental marking is not started unexpectedly. - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(isolate->heap()); // Make sure the byte arrays will be promoted on the next GC. CcTest::CollectGarbage(NEW_SPACE); @@ -5553,9 +5552,9 @@ TEST(Regress598319) { // only partially marked the large object. const double kSmallStepSizeInMs = 0.1; while (!marking->IsComplete()) { - marking->V8Step(kSmallStepSizeInMs, - i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, - StepOrigin::kV8); + marking->Step(kSmallStepSizeInMs, + i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + StepOrigin::kV8); if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->ProgressBar() > 0) { CHECK_NE(page->ProgressBar(), arr.get().Size()); { @@ -5573,9 +5572,9 @@ TEST(Regress598319) { // Finish marking with bigger steps to speed up test. const double kLargeStepSizeInMs = 1000; while (!marking->IsComplete()) { - marking->V8Step(kLargeStepSizeInMs, - i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, - StepOrigin::kV8); + marking->Step(kLargeStepSizeInMs, + i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } @@ -5651,14 +5650,14 @@ TEST(Regress615489) { CHECK(marking->IsMarking()); marking->StartBlackAllocationForTesting(); { - AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + AlwaysAllocateScopeForTesting always_allocate(heap); v8::HandleScope inner(CcTest::isolate()); isolate->factory()->NewFixedArray(500, AllocationType::kOld)->Size(); } const double kStepSizeInMs = 100; while (!marking->IsComplete()) { - marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, - StepOrigin::kV8); + marking->Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } @@ -5711,8 +5710,7 @@ TEST(Regress631969) { // 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); + Handle<String> s3 = factory->NewConsString(s1, s2).ToHandleChecked(); CcTest::CollectGarbage(NEW_SPACE); CcTest::CollectGarbage(NEW_SPACE); @@ -5720,8 +5718,8 @@ TEST(Regress631969) { const double kStepSizeInMs = 100; IncrementalMarking* marking = heap->incremental_marking(); while (!marking->IsComplete()) { - marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, - StepOrigin::kV8); + marking->Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } @@ -6391,13 +6389,13 @@ HEAP_TEST(RegressMissingWriteBarrierInAllocate) { heap::SimulateIncrementalMarking(heap, false); Handle<Map> map; { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); map = isolate->factory()->NewMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); } heap->incremental_marking()->StartBlackAllocationForTesting(); Handle<HeapObject> object; { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); object = handle(isolate->factory()->NewForTest(map, AllocationType::kOld), isolate); } @@ -6893,6 +6891,48 @@ TEST(Regress9701) { CHECK_EQ(mark_sweep_count_before, mark_sweep_count_after); } +#if defined(V8_TARGET_ARCH_64_BIT) && !defined(V8_OS_ANDROID) +UNINITIALIZED_TEST(HugeHeapLimit) { + uint64_t kMemoryGB = 16; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + create_params.constraints.ConfigureDefaults(kMemoryGB * GB, kMemoryGB * GB); + v8::Isolate* isolate = v8::Isolate::New(create_params); + Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); +#ifdef V8_COMPRESS_POINTERS + size_t kExpectedHeapLimit = Heap::AllocatorLimitOnMaxOldGenerationSize(); +#else + size_t kExpectedHeapLimit = size_t{4} * GB; +#endif + CHECK_EQ(kExpectedHeapLimit, i_isolate->heap()->MaxOldGenerationSize()); + CHECK_LT(size_t{3} * GB, i_isolate->heap()->MaxOldGenerationSize()); + isolate->Dispose(); +} +#endif + +UNINITIALIZED_TEST(HeapLimit) { + uint64_t kMemoryGB = 15; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + create_params.constraints.ConfigureDefaults(kMemoryGB * GB, kMemoryGB * GB); + v8::Isolate* isolate = v8::Isolate::New(create_params); + Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); +#if defined(V8_TARGET_ARCH_64_BIT) && !defined(V8_OS_ANDROID) + size_t kExpectedHeapLimit = size_t{2} * GB; +#else + size_t kExpectedHeapLimit = size_t{1} * GB; +#endif + CHECK_EQ(kExpectedHeapLimit, i_isolate->heap()->MaxOldGenerationSize()); + isolate->Dispose(); +} + +TEST(NoCodeRangeInJitlessMode) { + if (!FLAG_jitless) return; + CcTest::InitializeVM(); + CHECK( + CcTest::i_isolate()->heap()->memory_allocator()->code_range().is_empty()); +} + } // namespace heap } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-invalidated-slots.cc b/deps/v8/test/cctest/heap/test-invalidated-slots.cc index 861c48d69d..67e5c0d48e 100644 --- a/deps/v8/test/cctest/heap/test-invalidated-slots.cc +++ b/deps/v8/test/cctest/heap/test-invalidated-slots.cc @@ -24,12 +24,11 @@ Page* HeapTester::AllocateByteArraysOnPage( const int kLength = 256 - ByteArray::kHeaderSize; const int kSize = ByteArray::SizeFor(kLength); CHECK_EQ(kSize, 256); - Isolate* isolate = heap->isolate(); PagedSpace* old_space = heap->old_space(); Page* page; // Fill a page with byte arrays. { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); heap::SimulateFullSpace(old_space); ByteArray byte_array; CHECK(AllocateByteArrayForTest(heap, kLength, AllocationType::kOld) @@ -181,7 +180,7 @@ HEAP_TEST(InvalidatedSlotsResetObjectRegression) { Handle<FixedArray> AllocateArrayOnFreshPage(Isolate* isolate, PagedSpace* old_space, int length) { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(isolate->heap()); heap::SimulateFullSpace(old_space); return isolate->factory()->NewFixedArray(length, AllocationType::kOld); } @@ -242,7 +241,7 @@ HEAP_TEST(InvalidatedSlotsRightTrimLargeFixedArray) { AllocateArrayOnEvacuationCandidate(isolate, old_space, 1); Handle<FixedArray> trimmed; { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); trimmed = factory->NewFixedArray( kMaxRegularHeapObjectSize / kTaggedSize + 100, AllocationType::kOld); DCHECK(MemoryChunk::FromHeapObject(*trimmed)->InLargeObjectSpace()); @@ -319,7 +318,7 @@ HEAP_TEST(InvalidatedSlotsFastToSlow) { AllocateArrayOnFreshPage(isolate, old_space, 1); Handle<JSObject> obj; { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); Handle<JSFunction> function = factory->NewFunctionForTest(name); function->shared().set_expected_nof_properties(3); obj = factory->NewJSObject(function, AllocationType::kOld); diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc index 56649dd1dd..eb91a5e671 100644 --- a/deps/v8/test/cctest/heap/test-spaces.cc +++ b/deps/v8/test/cctest/heap/test-spaces.cc @@ -350,7 +350,7 @@ TEST(SizeOfInitialHeap) { // snapshot. // In PPC the page size is 64K, causing more internal fragmentation // hence requiring a larger limit. -#if V8_OS_LINUX && V8_HOST_ARCH_PPC +#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64) const size_t kMaxInitialSizePerSpace = 3 * MB; #else const size_t kMaxInitialSizePerSpace = 2 * MB; @@ -568,7 +568,7 @@ HEAP_TEST(Regress777177) { { // Ensure a new linear allocation area on a fresh page. - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); heap::SimulateFullSpace(old_space); AllocationResult result = old_space->AllocateRaw(filler_size, kWordAligned); HeapObject obj = result.ToObjectChecked(); diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc index 6d2e697472..7be26694ad 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc @@ -51,8 +51,7 @@ const char* const BytecodeExpectationsPrinter::kIndent = " "; v8::Local<v8::String> BytecodeExpectationsPrinter::V8StringFromUTF8( const char* data) const { - return v8::String::NewFromUtf8(isolate_, data, v8::NewStringType::kNormal) - .ToLocalChecked(); + return v8::String::NewFromUtf8(isolate_, data).ToLocalChecked(); } std::string BytecodeExpectationsPrinter::WrapCodeInFunction( diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden index 067979d20d..98d2c6c61f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), /* 50 S> */ B(Return), ] @@ -29,9 +28,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), @@ -60,9 +58,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(4), /* 61 S> */ B(Return), ] @@ -78,9 +75,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 66 +bytecode array length: 65 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(4), @@ -123,9 +119,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), /* 52 S> */ B(CreateArrayFromIterable), @@ -143,9 +138,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 75 +bytecode array length: 74 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), @@ -190,9 +184,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), /* 52 S> */ B(CreateArrayFromIterable), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden index 07d2ea75ef..826018e952 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden @@ -12,9 +12,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 49 S> */ B(LdaSmi), I8(1), @@ -42,9 +41,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), /* 54 S> */ B(LdaSmi), I8(100), @@ -65,9 +63,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(100), @@ -95,9 +92,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 28 +bytecode array length: 27 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(56), @@ -125,9 +121,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), /* 54 S> */ B(LdaSmi), I8(1), @@ -158,9 +153,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(55), B(Star), R(0), /* 54 S> */ B(LdaSmi), I8(1), @@ -190,9 +184,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 73 +bytecode array length: 72 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 50 S> */ B(LdaSmi), I8(20), @@ -238,9 +231,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 43 +bytecode array length: 42 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(17), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden index 8691944b20..8701e50592 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden @@ -14,13 +14,12 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 148 +bytecode array length: 144 bytecodes: [ - /* 17 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(1), B(Mov), R(this), R(2), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), + /* 17 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), B(Star), R(0), B(Mov), R(context), R(3), B(Mov), R(context), R(4), @@ -35,9 +34,12 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(1), B(Mov), R(5), R(2), - B(Jump), U8(53), - B(Ldar), R(5), - B(Jump), U8(36), + B(Jump), U8(50), + B(LdaUndefined), + B(Star), R(2), + B(LdaSmi), I8(1), + B(Star), R(1), + B(Jump), U8(41), B(Star), R(5), B(CreateCatchContext), R(5), U8(3), B(Star), R(4), @@ -53,10 +55,6 @@ bytecodes: [ B(Star), R(2), B(LdaSmi), I8(2), B(Star), R(1), - B(Jump), U8(15), - B(LdaSmi), I8(-1), - B(Star), R(2), - B(Star), R(1), B(Jump), U8(7), B(Star), R(2), B(LdaZero), @@ -93,8 +91,8 @@ constant pool: [ Smi [23], ] handlers: [ - [20, 94, 102], - [23, 56, 60], + [19, 98, 98], + [22, 64, 64], ] --- @@ -104,13 +102,12 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 193 +bytecode array length: 189 bytecodes: [ - /* 17 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(1), B(Mov), R(this), R(2), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), + /* 17 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), B(Star), R(0), B(Mov), R(context), R(3), B(Mov), R(context), R(4), @@ -125,7 +122,7 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(1), B(Mov), R(5), R(2), - B(Jump), U8(98), + B(Jump), U8(95), /* 22 S> */ B(LdaSmi), I8(42), B(Star), R(6), B(LdaFalse), @@ -142,9 +139,12 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(1), B(Mov), R(5), R(2), - B(Jump), U8(53), - B(Ldar), R(5), - B(Jump), U8(36), + B(Jump), U8(50), + B(LdaUndefined), + B(Star), R(2), + B(LdaSmi), I8(1), + B(Star), R(1), + B(Jump), U8(41), B(Star), R(5), B(CreateCatchContext), R(5), U8(6), B(Star), R(4), @@ -160,10 +160,6 @@ bytecodes: [ B(Star), R(2), B(LdaSmi), I8(2), B(Star), R(1), - B(Jump), U8(15), - B(LdaSmi), I8(-1), - B(Star), R(2), - B(Star), R(1), B(Jump), U8(7), B(Star), R(2), B(LdaZero), @@ -203,8 +199,8 @@ constant pool: [ Smi [23], ] handlers: [ - [20, 139, 147], - [23, 101, 105], + [19, 143, 143], + [22, 109, 109], ] --- @@ -214,13 +210,12 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 364 +bytecode array length: 361 bytecodes: [ - /* 17 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + /* 17 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), B(Star), R(0), B(Mov), R(context), R(6), B(Mov), R(context), R(7), @@ -254,13 +249,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(14), U8(1), B(LdaNamedProperty), R(14), U8(6), U8(9), - B(JumpIfToBooleanTrue), U8(67), + B(JumpIfToBooleanTrue), U8(66), B(LdaNamedProperty), R(14), U8(7), U8(11), B(Star), R(14), B(LdaFalse), B(Star), R(10), B(Mov), R(14), R(1), - /* 22 E> */ B(StackCheck), /* 31 S> */ B(Mov), R(1), R(3), /* 42 S> */ B(LdaFalse), B(Star), R(17), @@ -279,7 +273,7 @@ bytecodes: [ B(Mov), R(15), R(12), B(Jump), U8(20), B(Ldar), R(15), - B(JumpLoop), U8(84), I8(0), + /* 22 E> */ B(JumpLoop), U8(83), I8(0), B(LdaSmi), I8(-1), B(Star), R(12), B(Star), R(11), @@ -325,8 +319,12 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(4), B(Mov), R(12), R(5), - B(Jump), U8(51), - B(Jump), U8(36), + B(Jump), U8(50), + B(LdaUndefined), + B(Star), R(5), + B(LdaSmi), I8(1), + B(Star), R(4), + B(Jump), U8(41), B(Star), R(8), B(CreateCatchContext), R(8), U8(14), B(Star), R(7), @@ -342,10 +340,6 @@ bytecodes: [ B(Star), R(5), B(LdaSmi), I8(2), B(Star), R(4), - B(Jump), U8(15), - B(LdaSmi), I8(-1), - B(Star), R(5), - B(Star), R(4), B(Jump), U8(7), B(Star), R(5), B(LdaZero), @@ -374,7 +368,7 @@ bytecodes: [ ] constant pool: [ Smi [29], - Smi [142], + Smi [141], Smi [16], Smi [7], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, @@ -388,16 +382,16 @@ constant pool: [ Smi [6], Smi [9], SCOPE_INFO_TYPE, - Smi [269], + Smi [267], Smi [6], Smi [9], Smi [23], ] handlers: [ - [20, 310, 318], - [23, 274, 276], - [87, 174, 182], - [206, 239, 241], + [19, 315, 315], + [22, 281, 281], + [86, 172, 180], + [204, 237, 239], ] --- @@ -408,13 +402,12 @@ snippet: " " frame size: 17 parameter count: 1 -bytecode array length: 467 +bytecode array length: 463 bytecodes: [ - /* 44 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(5), B(Mov), R(closure), R(1), B(Mov), R(this), R(2), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), + /* 44 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), B(Star), R(0), B(Mov), R(context), R(3), B(Mov), R(context), R(4), @@ -477,7 +470,7 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(1), B(Mov), R(10), R(2), - B(Jump), U8(241), + B(Jump), U8(238), B(LdaNamedProperty), R(7), U8(14), U8(20), B(JumpIfUndefinedOrNull), U8(11), B(Star), R(12), @@ -545,9 +538,12 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(1), B(Mov), R(7), R(2), - B(Jump), U8(53), - B(Ldar), R(7), - B(Jump), U8(36), + B(Jump), U8(50), + B(LdaUndefined), + B(Star), R(2), + B(LdaSmi), I8(1), + B(Star), R(1), + B(Jump), U8(41), B(Star), R(5), B(CreateCatchContext), R(5), U8(17), B(Star), R(4), @@ -563,10 +559,6 @@ bytecodes: [ B(Star), R(2), B(LdaSmi), I8(2), B(Star), R(1), - B(Jump), U8(15), - B(LdaSmi), I8(-1), - B(Star), R(2), - B(Star), R(1), B(Jump), U8(7), B(Star), R(2), B(LdaZero), @@ -612,13 +604,13 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], SCOPE_INFO_TYPE, - Smi [372], + Smi [369], Smi [6], Smi [9], Smi [23], ] handlers: [ - [20, 413, 421], - [23, 375, 379], + [19, 417, 417], + [22, 383, 383], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden index 6d88ba285a..94d285aa15 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden @@ -12,162 +12,148 @@ top level await: yes snippet: " await 42; " -frame size: 8 -parameter count: 2 -bytecode array length: 142 +frame size: 7 +parameter count: 1 +bytecode array length: 127 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), - B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), - B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), - B(Ldar), R(3), + B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 10 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(Ldar), R(1), - B(Mov), R(context), R(3), + B(Mov), R(context), R(2), /* 0 S> */ B(LdaSmi), I8(42), - B(Star), R(5), - B(Mov), R(0), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(4), U8(2), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(1), - B(ResumeGenerator), R(0), R(0), U8(4), B(Star), R(4), + B(Mov), R(0), R(3), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(3), U8(2), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(1), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(Star), R(5), + B(Star), R(4), B(LdaZero), - B(TestReferenceEqual), R(5), + B(TestReferenceEqual), R(4), B(JumpIfTrue), U8(5), - B(Ldar), R(4), + B(Ldar), R(3), B(ReThrow), B(LdaUndefined), - B(Star), R(5), + B(Star), R(4), B(LdaTrue), - B(Star), R(6), - B(Mov), R(0), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), + B(Star), R(5), + B(Mov), R(0), R(3), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3), /* 10 S> */ B(Return), - B(Star), R(4), - B(CreateCatchContext), R(4), U8(5), B(Star), R(3), + B(CreateCatchContext), R(3), U8(4), + B(Star), R(2), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(3), - B(PushContext), R(4), + B(Ldar), R(2), + B(PushContext), R(3), B(LdaImmutableCurrentContextSlot), U8(2), - B(Star), R(6), + B(Star), R(5), B(LdaTrue), - B(Star), R(7), - B(Mov), R(0), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3), + B(Star), R(6), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3), /* 10 S> */ B(Return), ] constant pool: [ - Smi [35], - Smi [79], - SCOPE_INFO_TYPE, + Smi [21], + Smi [65], Smi [10], Smi [7], SCOPE_INFO_TYPE, ] handlers: [ - [64, 114, 114], + [49, 99, 99], ] --- snippet: " await import(\"foo\"); " -frame size: 8 -parameter count: 2 -bytecode array length: 152 +frame size: 7 +parameter count: 1 +bytecode array length: 137 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), - B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), - B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), - B(Ldar), R(3), + B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 21 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(Ldar), R(1), - B(Mov), R(context), R(3), - /* 0 S> */ B(LdaConstant), U8(5), - B(Star), R(5), - B(Mov), R(closure), R(4), - B(CallRuntime), U16(Runtime::kDynamicImportCall), R(4), U8(2), - B(Star), R(5), - B(Mov), R(0), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(4), U8(2), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(1), - B(ResumeGenerator), R(0), R(0), U8(4), + B(Mov), R(context), R(2), + /* 0 S> */ B(LdaConstant), U8(4), + B(Star), R(4), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kDynamicImportCall), R(3), U8(2), B(Star), R(4), + B(Mov), R(0), R(3), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(3), U8(2), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(1), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(Star), R(5), + B(Star), R(4), B(LdaZero), - B(TestReferenceEqual), R(5), + B(TestReferenceEqual), R(4), B(JumpIfTrue), U8(5), - B(Ldar), R(4), + B(Ldar), R(3), B(ReThrow), B(LdaUndefined), - B(Star), R(5), + B(Star), R(4), B(LdaTrue), - B(Star), R(6), - B(Mov), R(0), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), + B(Star), R(5), + B(Mov), R(0), R(3), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3), /* 21 S> */ B(Return), - B(Star), R(4), - B(CreateCatchContext), R(4), U8(6), B(Star), R(3), + B(CreateCatchContext), R(3), U8(5), + B(Star), R(2), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(3), - B(PushContext), R(4), + B(Ldar), R(2), + B(PushContext), R(3), B(LdaImmutableCurrentContextSlot), U8(2), - B(Star), R(6), + B(Star), R(5), B(LdaTrue), - B(Star), R(7), - B(Mov), R(0), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3), + B(Star), R(6), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3), /* 21 S> */ B(Return), ] constant pool: [ - Smi [35], - Smi [89], - SCOPE_INFO_TYPE, + Smi [21], + Smi [75], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], SCOPE_INFO_TYPE, ] handlers: [ - [64, 124, 124], + [49, 109, 109], ] --- @@ -178,84 +164,77 @@ snippet: " } foo(); " -frame size: 9 -parameter count: 2 -bytecode array length: 153 +frame size: 8 +parameter count: 1 +bytecode array length: 138 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), - B(LdaConstant), U8(2), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), - B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2), B(Star), R(0), - B(CreateClosure), U8(3), U8(0), U8(0), + B(CreateClosure), U8(2), U8(0), U8(0), B(Star), R(1), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0), - B(Ldar), R(4), + B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 54 S> */ B(Return), - B(Mov), R(4), R(2), + B(Mov), R(3), R(2), B(Ldar), R(2), - B(Mov), R(context), R(4), + B(Mov), R(context), R(3), /* 0 S> */ B(LdaSmi), I8(42), - B(Star), R(6), - B(Mov), R(0), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(5), U8(2), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(1), - B(ResumeGenerator), R(0), R(0), U8(5), B(Star), R(5), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(4), U8(2), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(1), + B(ResumeGenerator), R(0), R(0), U8(4), + B(Star), R(4), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(Star), R(6), + B(Star), R(5), B(LdaZero), - B(TestReferenceEqual), R(6), + B(TestReferenceEqual), R(5), B(JumpIfTrue), U8(5), - B(Ldar), R(5), + B(Ldar), R(4), B(ReThrow), /* 47 S> */ B(CallUndefinedReceiver0), R(1), U8(0), B(LdaUndefined), - B(Star), R(6), + B(Star), R(5), B(LdaTrue), - B(Star), R(7), - B(Mov), R(0), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), + B(Star), R(6), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), /* 54 S> */ B(Return), - B(Star), R(5), - B(CreateCatchContext), R(5), U8(6), B(Star), R(4), + B(CreateCatchContext), R(4), U8(5), + B(Star), R(3), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(4), - B(PushContext), R(5), + B(Ldar), R(3), + B(PushContext), R(4), B(LdaImmutableCurrentContextSlot), U8(2), - B(Star), R(7), + B(Star), R(6), B(LdaTrue), - B(Star), R(8), - B(Mov), R(0), R(6), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3), + B(Star), R(7), + B(Mov), R(0), R(5), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3), /* 54 S> */ B(Return), ] constant pool: [ - Smi [43], - Smi [87], - SCOPE_INFO_TYPE, + Smi [29], + Smi [73], SHARED_FUNCTION_INFO_TYPE, Smi [10], Smi [7], SCOPE_INFO_TYPE, ] handlers: [ - [72, 125, 125], + [57, 110, 110], ] --- @@ -263,87 +242,80 @@ snippet: " import * as foo from \"bar\"; await import(\"goo\"); " -frame size: 9 -parameter count: 2 -bytecode array length: 164 +frame size: 8 +parameter count: 1 +bytecode array length: 149 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), - B(LdaConstant), U8(2), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), - B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2), B(Star), R(0), B(LdaZero), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(4), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(3), U8(1), B(Star), R(1), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), - B(Ldar), R(4), + B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 49 S> */ B(Return), - B(Mov), R(4), R(2), + B(Mov), R(3), R(2), B(Ldar), R(2), - B(Mov), R(context), R(4), - /* 28 S> */ B(LdaConstant), U8(5), - B(Star), R(6), - B(Mov), R(closure), R(5), - B(CallRuntime), U16(Runtime::kDynamicImportCall), R(5), U8(2), - B(Star), R(6), - B(Mov), R(0), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(5), U8(2), - /* 28 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(1), - B(ResumeGenerator), R(0), R(0), U8(5), + B(Mov), R(context), R(3), + /* 28 S> */ B(LdaConstant), U8(4), + B(Star), R(5), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kDynamicImportCall), R(4), U8(2), B(Star), R(5), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(4), U8(2), + /* 28 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(1), + B(ResumeGenerator), R(0), R(0), U8(4), + B(Star), R(4), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(Star), R(6), + B(Star), R(5), B(LdaZero), - B(TestReferenceEqual), R(6), + B(TestReferenceEqual), R(5), B(JumpIfTrue), U8(5), - B(Ldar), R(5), + B(Ldar), R(4), B(ReThrow), B(LdaUndefined), - B(Star), R(6), + B(Star), R(5), B(LdaTrue), - B(Star), R(7), - B(Mov), R(0), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), + B(Star), R(6), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), /* 49 S> */ B(Return), - B(Star), R(5), - B(CreateCatchContext), R(5), U8(6), B(Star), R(4), + B(CreateCatchContext), R(4), U8(5), + B(Star), R(3), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(4), - B(PushContext), R(5), + B(Ldar), R(3), + B(PushContext), R(4), B(LdaImmutableCurrentContextSlot), U8(2), - B(Star), R(7), + B(Star), R(6), B(LdaTrue), - B(Star), R(8), - B(Mov), R(0), R(6), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3), + B(Star), R(7), + B(Mov), R(0), R(5), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3), /* 49 S> */ B(Return), ] constant pool: [ - Smi [47], - Smi [101], - SCOPE_INFO_TYPE, + Smi [33], + Smi [87], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"], SCOPE_INFO_TYPE, ] handlers: [ - [76, 136, 136], + [61, 121, 121], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden index 8677bcd99b..61e3ff9e4f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(8), @@ -36,9 +35,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(11), @@ -61,9 +59,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(8), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden index a5f97d46c4..4d53c3afa5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 97 S> */ B(Return), @@ -35,9 +34,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 86 S> */ B(Return), @@ -61,17 +59,15 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 54 +bytecode array length: 52 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 65 S> */ B(LdaSmi), I8(10), /* 65 E> */ B(TestLessThan), R(0), U8(0), - B(JumpIfFalse), U8(38), - /* 56 E> */ B(StackCheck), + B(JumpIfFalse), U8(37), /* 75 S> */ B(Ldar), R(1), /* 81 E> */ B(MulSmi), I8(12), U8(1), B(Star), R(1), @@ -86,7 +82,7 @@ bytecodes: [ /* 132 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 138 S> */ B(Jump), U8(5), - B(JumpLoop), U8(40), I8(0), + /* 56 E> */ B(JumpLoop), U8(39), I8(0), /* 147 S> */ B(Ldar), R(1), /* 156 S> */ B(Return), ] @@ -110,12 +106,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 62 +bytecode array length: 60 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 E> */ B(StackCheck), /* 62 S> */ B(LdaZero), /* 68 E> */ B(TestLessThan), R(0), U8(0), B(JumpIfFalse), U8(4), @@ -139,7 +133,7 @@ bytecodes: [ /* 173 S> */ B(Ldar), R(0), /* 179 E> */ B(AddSmi), I8(1), U8(5), B(Star), R(0), - B(JumpLoop), U8(52), I8(0), + /* 45 E> */ B(JumpLoop), U8(51), I8(0), /* 186 S> */ B(Ldar), R(0), /* 195 S> */ B(Return), ] @@ -163,28 +157,26 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 44 +bytecode array length: 43 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 E> */ B(StackCheck), /* 71 S> */ B(LdaSmi), I8(3), /* 71 E> */ B(TestLessThan), R(0), U8(0), - B(JumpIfFalse), U8(22), - /* 62 E> */ B(StackCheck), + B(JumpIfFalse), U8(20), /* 82 S> */ B(LdaSmi), I8(2), /* 88 E> */ B(TestEqual), R(0), U8(1), B(JumpIfFalse), U8(4), - /* 94 S> */ B(Jump), U8(12), + /* 94 S> */ B(Jump), U8(11), /* 105 S> */ B(Ldar), R(0), /* 111 E> */ B(AddSmi), I8(1), U8(2), B(Star), R(0), - B(JumpLoop), U8(24), I8(1), + B(Jump), U8(11), /* 122 S> */ B(Ldar), R(0), /* 128 E> */ B(AddSmi), I8(1), U8(3), B(Star), R(0), - /* 135 S> */ B(Jump), U8(2), + /* 135 S> */ B(Jump), U8(5), + /* 45 E> */ B(JumpLoop), U8(34), I8(0), /* 144 S> */ B(Ldar), R(0), /* 153 S> */ B(Return), ] @@ -205,23 +197,21 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 34 +bytecode array length: 32 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 54 S> */ B(LdaSmi), I8(1), B(Star), R(1), /* 64 S> */ B(Ldar), R(0), - B(JumpIfToBooleanFalse), U8(20), - /* 57 E> */ B(StackCheck), + B(JumpIfToBooleanFalse), U8(19), /* 71 S> */ B(Ldar), R(1), /* 77 E> */ B(MulSmi), I8(12), U8(0), B(Star), R(1), /* 85 S> */ B(Ldar), R(0), /* 91 E> */ B(SubSmi), I8(1), U8(1), B(Star), R(0), - B(JumpLoop), U8(19), I8(0), + /* 57 E> */ B(JumpLoop), U8(18), I8(0), /* 98 S> */ B(Ldar), R(1), /* 107 S> */ B(Return), ] @@ -243,14 +233,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 54 +bytecode array length: 52 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), - /* 56 E> */ B(StackCheck), /* 63 S> */ B(Ldar), R(1), /* 69 E> */ B(MulSmi), I8(10), U8(0), B(Star), R(1), @@ -268,7 +256,7 @@ bytecodes: [ /* 144 S> */ B(LdaSmi), I8(10), /* 144 E> */ B(TestLessThan), R(0), U8(4), B(JumpIfFalse), U8(5), - B(JumpLoop), U8(40), I8(0), + /* 56 E> */ B(JumpLoop), U8(39), I8(0), /* 151 S> */ B(Ldar), R(1), /* 160 S> */ B(Return), ] @@ -289,14 +277,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 32 +bytecode array length: 30 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 54 S> */ B(LdaSmi), I8(1), B(Star), R(1), - /* 57 E> */ B(StackCheck), /* 64 S> */ B(Ldar), R(1), /* 70 E> */ B(MulSmi), I8(12), U8(0), B(Star), R(1), @@ -304,7 +290,7 @@ bytecodes: [ /* 84 E> */ B(SubSmi), I8(1), U8(1), B(Star), R(0), /* 98 S> */ B(JumpIfToBooleanFalse), U8(5), - B(JumpLoop), U8(17), I8(0), + /* 57 E> */ B(JumpLoop), U8(16), I8(0), /* 102 S> */ B(Ldar), R(1), /* 111 S> */ B(Return), ] @@ -326,14 +312,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 42 +bytecode array length: 40 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), - /* 56 E> */ B(StackCheck), /* 69 S> */ B(MulSmi), I8(10), U8(0), B(Star), R(1), /* 77 S> */ B(LdaSmi), I8(5), @@ -368,14 +352,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 47 +bytecode array length: 45 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(1), B(Star), R(1), - /* 56 E> */ B(StackCheck), /* 63 S> */ B(Ldar), R(1), /* 69 E> */ B(MulSmi), I8(10), U8(0), B(Star), R(1), @@ -390,7 +372,7 @@ bytecodes: [ /* 117 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 123 S> */ B(Jump), U8(2), - B(JumpLoop), U8(33), I8(0), + /* 56 E> */ B(JumpLoop), U8(32), I8(0), /* 149 S> */ B(Ldar), R(1), /* 158 S> */ B(Return), ] @@ -410,12 +392,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 35 +bytecode array length: 33 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 E> */ B(StackCheck), /* 58 S> */ B(LdaSmi), I8(1), /* 64 E> */ B(TestEqual), R(0), U8(0), B(JumpIfFalse), U8(4), @@ -427,7 +407,7 @@ bytecodes: [ /* 103 S> */ B(Ldar), R(0), /* 109 E> */ B(AddSmi), I8(1), U8(2), B(Star), R(0), - B(JumpLoop), U8(26), I8(0), + /* 45 E> */ B(JumpLoop), U8(25), I8(0), B(LdaUndefined), /* 116 S> */ B(Return), ] @@ -446,12 +426,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 35 +bytecode array length: 33 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 47 S> */ B(LdaZero), B(Star), R(0), - /* 34 E> */ B(StackCheck), /* 56 S> */ B(LdaSmi), I8(1), /* 62 E> */ B(TestEqual), R(0), U8(0), B(JumpIfFalse), U8(4), @@ -463,7 +441,7 @@ bytecodes: [ /* 101 S> */ B(Ldar), R(0), /* 107 E> */ B(AddSmi), I8(1), U8(2), B(Star), R(0), - B(JumpLoop), U8(26), I8(0), + /* 34 E> */ B(JumpLoop), U8(25), I8(0), B(LdaUndefined), /* 114 S> */ B(Return), ] @@ -482,12 +460,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 35 +bytecode array length: 33 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 E> */ B(StackCheck), /* 68 S> */ B(LdaSmi), I8(1), /* 74 E> */ B(TestEqual), R(0), U8(0), B(JumpIfFalse), U8(4), @@ -499,7 +475,7 @@ bytecodes: [ /* 55 S> */ B(Ldar), R(0), /* 59 E> */ B(AddSmi), I8(1), U8(2), B(Star), R(0), - B(JumpLoop), U8(26), I8(0), + /* 45 E> */ B(JumpLoop), U8(25), I8(0), B(LdaUndefined), /* 113 S> */ B(Return), ] @@ -517,12 +493,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 35 +bytecode array length: 33 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 47 S> */ B(LdaZero), B(Star), R(0), - /* 34 E> */ B(StackCheck), /* 66 S> */ B(LdaSmi), I8(1), /* 72 E> */ B(TestEqual), R(0), U8(0), B(JumpIfFalse), U8(4), @@ -534,7 +508,7 @@ bytecodes: [ /* 53 S> */ B(Ldar), R(0), /* 57 E> */ B(AddSmi), I8(1), U8(2), B(Star), R(0), - B(JumpLoop), U8(26), I8(0), + /* 34 E> */ B(JumpLoop), U8(25), I8(0), B(LdaUndefined), /* 111 S> */ B(Return), ] @@ -553,17 +527,15 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 36 +bytecode array length: 34 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 58 S> */ B(LdaZero), B(Star), R(1), /* 63 S> */ B(LdaSmi), I8(100), /* 63 E> */ B(TestLessThan), R(1), U8(0), - B(JumpIfFalse), U8(22), - /* 45 E> */ B(StackCheck), + B(JumpIfFalse), U8(21), /* 85 S> */ B(Ldar), R(0), /* 91 E> */ B(AddSmi), I8(1), U8(1), B(Star), R(0), @@ -571,7 +543,7 @@ bytecodes: [ /* 72 S> */ B(Ldar), R(1), /* 76 E> */ B(AddSmi), I8(1), U8(2), B(Star), R(1), - B(JumpLoop), U8(24), I8(0), + /* 45 E> */ B(JumpLoop), U8(23), I8(0), B(LdaUndefined), /* 110 S> */ B(Return), ] @@ -590,23 +562,21 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 33 +bytecode array length: 31 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 58 S> */ B(LdaSmi), I8(10), B(Star), R(1), /* 62 S> */ B(Ldar), R(1), - B(JumpIfToBooleanFalse), U8(19), - /* 45 E> */ B(StackCheck), + B(JumpIfToBooleanFalse), U8(18), /* 74 S> */ B(Ldar), R(0), /* 80 E> */ B(MulSmi), I8(12), U8(0), B(Star), R(0), /* 67 S> */ B(Ldar), R(1), B(Dec), U8(1), B(Star), R(1), - B(JumpLoop), U8(18), I8(0), + /* 45 E> */ B(JumpLoop), U8(17), I8(0), /* 88 S> */ B(Ldar), R(0), /* 97 S> */ B(Return), ] @@ -625,9 +595,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 58 S> */ B(LdaZero), @@ -651,14 +620,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 36 +bytecode array length: 34 bytecodes: [ - /* 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(Ldar), R(0), /* 82 E> */ B(AddSmi), I8(1), U8(0), B(Star), R(0), @@ -669,7 +636,7 @@ bytecodes: [ /* 69 S> */ B(Ldar), R(1), B(Inc), U8(2), B(Star), R(1), - B(JumpLoop), U8(23), I8(0), + /* 45 E> */ B(JumpLoop), U8(22), I8(0), /* 112 S> */ B(Ldar), R(0), /* 121 S> */ B(Return), ] @@ -692,14 +659,12 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 50 +bytecode array length: 48 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 52 S> */ B(Ldar), R(0), - B(JumpIfToBooleanFalse), U8(42), - /* 45 E> */ B(StackCheck), + B(JumpIfToBooleanFalse), U8(41), B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), @@ -717,7 +682,7 @@ bytecodes: [ B(Inc), U8(0), /* 127 E> */ B(StaCurrentContextSlot), U8(2), B(PopContext), R(3), - B(JumpLoop), U8(41), I8(0), + /* 45 E> */ B(JumpLoop), U8(40), I8(0), B(LdaUndefined), /* 137 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden index 18814169b9..e37a3ca0cf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden @@ -17,9 +17,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 62 S> */ B(AddSmi), I8(1), U8(0), @@ -48,23 +47,20 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 69 +bytecode array length: 66 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaZero), B(Star), R(0), /* 71 S> */ B(LdaZero), B(Star), R(1), /* 76 S> */ B(LdaSmi), I8(10), /* 76 E> */ B(TestLessThan), R(1), U8(0), - B(JumpIfFalse), U8(54), - /* 58 E> */ B(StackCheck), + B(JumpIfFalse), U8(52), /* 106 S> */ B(LdaZero), B(Star), R(2), /* 111 S> */ B(LdaSmi), I8(3), /* 111 E> */ B(TestLessThan), R(2), U8(1), - B(JumpIfFalse), U8(34), - /* 93 E> */ B(StackCheck), + B(JumpIfFalse), U8(33), /* 129 S> */ B(Ldar), R(0), B(Inc), U8(2), B(Star), R(0), @@ -78,11 +74,11 @@ bytecodes: [ /* 118 S> */ B(Ldar), R(2), B(Inc), U8(5), B(Star), R(2), - B(JumpLoop), U8(36), I8(1), + /* 93 E> */ B(JumpLoop), U8(35), I8(1), /* 84 S> */ B(Ldar), R(1), B(Inc), U8(6), B(Star), R(1), - B(JumpLoop), U8(56), I8(0), + /* 58 E> */ B(JumpLoop), U8(54), I8(0), /* 188 S> */ B(Ldar), R(0), /* 199 S> */ B(Return), ] @@ -101,10 +97,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 29 +bytecode array length: 28 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -141,10 +136,9 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 53 +bytecode array length: 52 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden index 4d3d1eb7d6..293ad72957 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(1), /* 39 E> */ B(LdaNamedProperty), R(1), U8(1), U8(2), @@ -38,9 +37,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 28 +bytecode array length: 27 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(1), /* 39 E> */ B(LdaNamedProperty), R(1), U8(1), U8(2), @@ -67,9 +65,8 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 101 +bytecode array length: 100 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), B(LdaNamedProperty), R(0), U8(1), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden index 5c5c0ac00c..2dfa6dc4c0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), /* 39 E> */ B(CallUndefinedReceiver0), R(0), U8(2), @@ -36,9 +35,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - /* 34 E> */ B(StackCheck), /* 39 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), B(LdaSmi), I8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden index 4b48871fd2..1e5e0a2c8e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden @@ -11,10 +11,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 75 +bytecode array length: 74 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden index 4e7e6d3190..8674673d3d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 45 E> */ B(StackCheck), /* 50 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), /* 57 E> */ B(Construct), R(0), R(0), U8(0), U8(2), @@ -36,9 +35,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 58 E> */ B(StackCheck), /* 63 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), B(LdaSmi), I8(3), @@ -66,9 +64,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 26 +bytecode array length: 25 bytecodes: [ - /* 100 E> */ B(StackCheck), /* 105 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), B(LdaSmi), I8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden index 761436decb..32a9a902ae 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), B(LdaUndefined), /* 26 S> */ B(Return), @@ -32,9 +31,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 16 S> */ B(CallRuntime), U16(Runtime::kIsArray), R(arg0), U8(1), /* 34 S> */ B(Return), ] @@ -50,9 +48,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(LdaSmi), I8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden index 7021630123..b4425f57fe 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden @@ -22,9 +22,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 34 +bytecode array length: 33 bytecodes: [ - /* 99 E> */ B(StackCheck), B(Mov), R(closure), R(0), /* 104 S> */ B(LdaConstant), U8(0), /* 111 E> */ B(LdaKeyedProperty), R(closure), U8(1), @@ -62,9 +61,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 47 +bytecode array length: 46 bytecodes: [ - /* 125 E> */ B(StackCheck), B(Mov), R(closure), R(0), /* 130 S> */ B(LdaConstant), U8(0), /* 130 E> */ B(LdaKeyedProperty), R(closure), U8(0), @@ -106,9 +104,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 40 +bytecode array length: 39 bytecodes: [ - /* 113 E> */ B(StackCheck), B(Mov), R(closure), R(1), /* 118 S> */ B(Ldar), R(1), B(GetSuperConstructor), R(3), @@ -149,9 +146,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 112 E> */ B(StackCheck), B(Mov), R(closure), R(1), /* 117 S> */ B(Ldar), R(1), B(GetSuperConstructor), R(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index d785701c0d..b16056a344 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -14,10 +14,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 41 +bytecode array length: 40 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -53,10 +52,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 41 +bytecode array length: 40 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -94,10 +92,9 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 84 +bytecode array length: 83 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(2), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(2), B(PushContext), R(1), /* 43 S> */ B(LdaConstant), U8(1), /* 43 E> */ B(StaCurrentContextSlot), U8(2), @@ -153,10 +150,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 49 +bytecode array length: 48 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), /* 46 S> */ B(LdaZero), /* 46 E> */ B(StaCurrentContextSlot), U8(2), @@ -193,9 +189,8 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 70 +bytecode array length: 69 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden index d9413a1866..848c420967 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden @@ -12,9 +12,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(TestNull), @@ -32,9 +31,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaUndefined), B(Star), R(0), /* 53 S> */ B(TestUndefined), @@ -52,9 +50,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaUndefined), B(Star), R(0), /* 53 S> */ B(TestUndefined), @@ -73,9 +70,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 45 S> */ B(TestUndetectable), @@ -94,9 +90,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaUndefined), B(Star), R(0), /* 53 S> */ B(TestUndetectable), @@ -114,9 +109,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaUndefined), B(Star), R(0), /* 53 S> */ B(JumpIfNotUndefined), U8(6), @@ -137,9 +131,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(TestUndetectable), @@ -161,9 +154,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfUndefined), U8(6), @@ -184,9 +176,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfNotNull), U8(6), @@ -211,9 +202,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfNotNull), U8(5), @@ -236,9 +226,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(TestUndetectable), @@ -263,20 +252,18 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaUndefined), B(Star), R(0), /* 61 S> */ B(LdaZero), B(Star), R(1), /* 73 S> */ B(Ldar), R(0), - B(JumpIfUndefined), U8(12), - /* 64 E> */ B(StackCheck), + B(JumpIfUndefined), U8(11), /* 92 S> */ B(Ldar), R(1), B(Inc), U8(0), B(Star), R(1), - B(JumpLoop), U8(11), I8(0), + /* 64 E> */ B(JumpLoop), U8(10), I8(0), B(LdaUndefined), /* 99 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareTypeOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareTypeOf.golden index 41108b12c8..9349f993dc 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareTypeOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareTypeOf.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(1), B(TestTypeOf), U8(0), /* 64 S> */ B(Return), @@ -29,9 +28,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaConstant), U8(0), B(TestTypeOf), U8(1), /* 68 S> */ B(Return), @@ -48,9 +46,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaTrue), B(TestTypeOf), U8(3), /* 67 S> */ B(Return), @@ -66,9 +63,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaUndefined), B(TestTypeOf), U8(1), /* 72 S> */ B(Return), @@ -84,9 +80,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaFalse), /* 73 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden index b8e9ebdb04..a040decf23 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(AddSmi), I8(2), U8(0), @@ -32,9 +31,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(DivSmi), I8(2), U8(0), @@ -53,9 +51,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 20 +bytecode array length: 19 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), @@ -77,9 +74,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 52 S> */ B(LdaSmi), I8(1), @@ -102,10 +98,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden index 2f82f7dda1..cd8f5de491 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(2), /* 51 S> */ B(Return), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(3), /* 59 S> */ B(Return), ] @@ -45,9 +43,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaZero), B(Star), R(0), B(LdaSmi), I8(1), @@ -70,9 +67,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(6), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden index 0393f7407e..d5240602e1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), I8(10), B(Star), R(0), B(LdaUndefined), @@ -30,9 +29,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 57 S> */ B(Return), @@ -48,9 +46,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 21 +bytecode array length: 20 bytecodes: [ - /* 30 E> */ B(StackCheck), B(LdaTheHole), B(Star), R(0), /* 44 S> */ B(LdaSmi), I8(20), @@ -74,9 +71,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 48 S> */ B(LdaSmi), I8(20), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden index 3f07cbfd5f..8250d98b0f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden @@ -11,10 +11,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -35,10 +34,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -59,10 +57,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 26 +bytecode array length: 25 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -88,10 +85,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden index c4fa209b33..d6a5199e52 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden @@ -13,10 +13,9 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(2), @@ -37,10 +36,9 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 19 +bytecode array length: 18 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(2), @@ -63,10 +61,9 @@ snippet: " " frame size: 1 parameter count: 5 -bytecode array length: 19 +bytecode array length: 18 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(2), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(2), B(PushContext), R(0), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(3), @@ -89,10 +86,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), /* 26 S> */ B(Ldar), R(this), /* 26 E> */ B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden index 88be31af43..73d710b2fa 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden @@ -11,10 +11,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), /* 41 S> */ B(CreateClosure), U8(1), U8(0), U8(2), /* 70 S> */ B(Return), @@ -32,10 +31,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(2), @@ -55,10 +53,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 19 +bytecode array length: 18 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(2), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(2), B(PushContext), R(0), /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(2), @@ -80,10 +77,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), /* 41 S> */ B(CreateClosure), U8(1), U8(0), U8(2), B(Star), R(1), @@ -106,10 +102,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 29 +bytecode array length: 28 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -393,10 +388,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 797 +bytecode array length: 796 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(Wide), B(CreateFunctionContext), U16(0), U16(256), + /* 30 E> */ B(Wide), B(CreateFunctionContext), U16(0), U16(256), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden index 7a397e95af..0edc219769 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(Inc), U8(0), @@ -31,9 +30,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(ToNumeric), U8(0), @@ -54,9 +52,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(Dec), U8(0), @@ -74,9 +71,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(ToNumeric), U8(0), @@ -97,9 +93,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 26 +bytecode array length: 25 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), @@ -124,9 +119,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), @@ -149,9 +143,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 31 +bytecode array length: 30 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), @@ -179,9 +172,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), @@ -207,10 +199,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(2), @@ -234,10 +225,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 29 +bytecode array length: 28 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), /* 42 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaCurrentContextSlot), U8(2), @@ -264,9 +254,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 55 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden index cc4909beff..3bb8f8ac2c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden @@ -13,10 +13,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 10 E> */ B(CreateMappedArguments), B(Star), R(0), /* 32 S> */ B(Return), ] @@ -32,10 +31,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 10 E> */ B(CreateMappedArguments), B(Star), R(0), /* 15 S> */ B(LdaZero), /* 31 E> */ B(LdaKeyedProperty), R(0), U8(0), @@ -53,10 +51,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateUnmappedArguments), + /* 10 E> */ B(CreateUnmappedArguments), B(Star), R(0), /* 46 S> */ B(Return), ] @@ -72,10 +69,9 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(2), @@ -98,10 +94,9 @@ snippet: " " frame size: 2 parameter count: 4 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(3), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(3), B(PushContext), R(1), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(4), @@ -126,10 +121,9 @@ snippet: " " frame size: 1 parameter count: 4 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateUnmappedArguments), + /* 10 E> */ B(CreateUnmappedArguments), B(Star), R(0), /* 53 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden index 14ce4e20a4..a0063ba5c4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden @@ -13,10 +13,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateRestParameter), + /* 10 E> */ B(CreateRestParameter), B(Star), R(1), B(Star), R(0), /* 42 S> */ B(Return), @@ -33,10 +32,9 @@ snippet: " " frame size: 3 parameter count: 2 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateRestParameter), + /* 10 E> */ B(CreateRestParameter), B(Star), R(2), B(Mov), R(arg0), R(0), B(Mov), R(2), R(1), @@ -55,10 +53,9 @@ snippet: " " frame size: 3 parameter count: 2 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateRestParameter), + /* 10 E> */ B(CreateRestParameter), B(Star), R(2), B(Mov), R(arg0), R(0), B(Mov), R(2), R(1), @@ -78,10 +75,9 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateUnmappedArguments), + /* 10 E> */ B(CreateUnmappedArguments), B(Star), R(3), B(CreateRestParameter), B(Star), R(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden index e164e29ab9..3d95c9c4f4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaUndefined), /* 41 S> */ B(Return), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 66 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(LdaUndefined), @@ -47,9 +45,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(LdaSmi), I8(1), /* 55 S> */ B(Return), ] @@ -64,9 +61,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden index fb36d01f98..27be2b47bd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -12,13 +12,12 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 20 +bytecode array length: 19 bytecodes: [ - /* 0 E> */ B(StackCheck), B(LdaConstant), U8(0), B(Star), R(1), B(Mov), R(closure), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), + /* 0 E> */ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), /* 8 S> */ B(LdaSmi), I8(1), /* 8 E> */ B(StaGlobal), U8(1), U8(0), B(LdaUndefined), @@ -37,13 +36,12 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 0 E> */ B(StackCheck), B(LdaConstant), U8(0), B(Star), R(0), B(Mov), R(closure), R(1), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(0), U8(2), + /* 0 E> */ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(0), U8(2), B(LdaUndefined), /* 16 S> */ B(Return), ] @@ -60,13 +58,12 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 26 +bytecode array length: 25 bytecodes: [ - /* 0 E> */ B(StackCheck), B(LdaConstant), U8(0), B(Star), R(1), B(Mov), R(closure), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), + /* 0 E> */ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), /* 8 S> */ B(LdaSmi), I8(1), /* 8 E> */ B(StaGlobal), U8(1), U8(0), /* 11 S> */ B(LdaSmi), I8(2), @@ -88,13 +85,12 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - /* 0 E> */ B(StackCheck), B(LdaConstant), U8(0), B(Star), R(1), B(Mov), R(closure), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), + /* 0 E> */ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), /* 16 S> */ B(LdaGlobal), U8(1), U8(0), B(Star), R(1), /* 16 E> */ B(CallUndefinedReceiver0), R(1), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden index 2d1ad15fe2..3af61115bd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 56 S> */ B(LdaConstant), U8(1), @@ -33,9 +32,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 70 S> */ B(LdaConstant), U8(1), @@ -55,9 +53,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 56 S> */ B(LdaSmi), I8(2), @@ -76,9 +73,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(LdaFalse), @@ -98,10 +94,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), /* 56 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), /* 56 E> */ B(StaCurrentContextSlot), U8(2), @@ -126,9 +121,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaTrue), /* 55 S> */ B(Return), ] @@ -143,9 +137,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaTrue), /* 53 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden index 587ed9b2ba..bff4c7a5da 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden @@ -19,9 +19,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaConstant), U8(0), B(Star), R(0), B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), @@ -47,9 +46,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaFalse), /* 31 S> */ B(Return), ] @@ -71,9 +69,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaConstant), U8(0), B(Star), R(0), B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden index 8f23cff964..4bb89c6179 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden @@ -12,9 +12,8 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 167 +bytecode array length: 166 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(1), /* 60 S> */ B(GetIterator), R(1), U8(1), U8(3), @@ -99,8 +98,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [35, 77, 85], - [109, 142, 144], + [34, 76, 84], + [108, 141, 143], ] --- @@ -110,9 +109,8 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 253 +bytecode array length: 252 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(2), /* 69 S> */ B(GetIterator), R(2), U8(1), U8(3), @@ -231,8 +229,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [35, 163, 171], - [195, 228, 230], + [34, 162, 170], + [194, 227, 229], ] --- @@ -242,9 +240,8 @@ snippet: " " frame size: 16 parameter count: 1 -bytecode array length: 218 +bytecode array length: 217 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 40 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 51 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), @@ -351,8 +348,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [38, 128, 136], - [160, 193, 195], + [37, 127, 135], + [159, 192, 194], ] --- @@ -362,9 +359,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(1), /* 54 S> */ B(LdaNamedProperty), R(1), U8(1), U8(1), @@ -386,9 +382,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 20 +bytecode array length: 19 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 40 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 48 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), @@ -413,9 +408,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 33 +bytecode array length: 32 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(1), /* 64 S> */ B(LdaConstant), U8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden index 60e585f974..5bf3618bed 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(Debugger), B(LdaUndefined), /* 44 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden index a8609261a7..bb695e0c35 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden @@ -11,10 +11,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 59 +bytecode array length: 58 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden index df9074524b..866694aa03 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden @@ -16,13 +16,12 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 321 +bytecode array length: 319 bytecodes: [ - /* 16 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), B(Star), R(0), B(Mov), R(context), R(4), /* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37), @@ -65,16 +64,15 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(LdaNamedProperty), R(11), U8(6), U8(13), - B(JumpIfToBooleanTrue), U8(23), + B(JumpIfToBooleanTrue), U8(22), B(LdaNamedProperty), R(11), U8(7), U8(15), B(Star), R(11), B(LdaFalse), B(Star), R(7), B(Mov), R(11), R(1), - /* 23 E> */ B(StackCheck), /* 38 S> */ B(Mov), R(1), R(3), B(Ldar), R(11), - B(JumpLoop), U8(77), I8(0), + /* 23 E> */ B(JumpLoop), U8(76), I8(0), B(LdaSmi), I8(-1), B(Star), R(9), B(Star), R(8), @@ -83,7 +81,7 @@ bytecodes: [ B(LdaZero), B(Star), R(8), B(LdaTheHole), - /* 38 E> */ B(SetPendingMessage), + B(SetPendingMessage), B(Star), R(10), B(Ldar), R(7), B(JumpIfToBooleanTrue), U8(94), @@ -155,7 +153,7 @@ bytecodes: [ ] constant pool: [ Smi [95], - Smi [224], + Smi [223], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, @@ -167,9 +165,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 293, 293], - [75, 155, 163], - [187, 256, 258], + [19, 291, 291], + [74, 153, 161], + [185, 254, 256], ] --- @@ -181,13 +179,12 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 342 +bytecode array length: 340 bytecodes: [ - /* 16 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), B(Star), R(0), B(Mov), R(context), R(4), /* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37), @@ -230,13 +227,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(LdaNamedProperty), R(11), U8(6), U8(13), - B(JumpIfToBooleanTrue), U8(27), + B(JumpIfToBooleanTrue), U8(26), B(LdaNamedProperty), R(11), U8(7), U8(15), B(Star), R(11), B(LdaFalse), B(Star), R(7), B(Mov), R(11), R(1), - /* 23 E> */ B(StackCheck), /* 38 S> */ B(Mov), R(1), R(3), /* 56 S> */ B(LdaSmi), I8(1), B(Mov), R(11), R(9), @@ -328,7 +324,7 @@ bytecodes: [ ] constant pool: [ Smi [95], - Smi [228], + Smi [227], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, @@ -342,9 +338,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 314, 314], - [75, 159, 167], - [191, 260, 262], + [19, 312, 312], + [74, 157, 165], + [189, 258, 260], ] --- @@ -359,13 +355,12 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 337 +bytecode array length: 335 bytecodes: [ - /* 16 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), B(Star), R(0), B(Mov), R(context), R(4), /* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37), @@ -408,13 +403,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(LdaNamedProperty), R(11), U8(6), U8(13), - B(JumpIfToBooleanTrue), U8(39), + B(JumpIfToBooleanTrue), U8(38), B(LdaNamedProperty), R(11), U8(7), U8(15), B(Star), R(11), B(LdaFalse), B(Star), R(7), B(Mov), R(11), R(1), - /* 23 E> */ B(StackCheck), /* 38 S> */ B(Mov), R(1), R(3), /* 63 S> */ B(LdaSmi), I8(10), /* 69 E> */ B(TestEqual), R(3), U8(17), @@ -424,7 +418,7 @@ bytecodes: [ /* 96 E> */ B(TestEqual), R(3), U8(18), B(JumpIfFalse), U8(4), /* 103 S> */ B(Jump), U8(5), - B(JumpLoop), U8(93), I8(0), + /* 23 E> */ B(JumpLoop), U8(92), I8(0), B(LdaSmi), I8(-1), B(Star), R(9), B(Star), R(8), @@ -505,7 +499,7 @@ bytecodes: [ ] constant pool: [ Smi [95], - Smi [240], + Smi [239], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, @@ -517,9 +511,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 309, 309], - [75, 171, 179], - [203, 272, 274], + [19, 307, 307], + [74, 169, 177], + [201, 270, 272], ] --- @@ -532,12 +526,11 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 253 +bytecode array length: 251 bytecodes: [ - /* 16 E> */ B(StackCheck), B(Mov), R(closure), R(2), B(Mov), R(this), R(3), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2), B(Star), R(0), B(Mov), R(context), R(2), /* 31 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), @@ -560,14 +553,13 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), B(LdaNamedProperty), R(9), U8(3), U8(10), - B(JumpIfToBooleanTrue), U8(33), + B(JumpIfToBooleanTrue), U8(32), B(LdaNamedProperty), R(9), U8(4), U8(12), B(Star), R(9), B(LdaFalse), B(Star), R(5), B(Ldar), R(9), /* 58 E> */ B(StaNamedProperty), R(1), U8(5), U8(14), - /* 53 E> */ B(StackCheck), /* 87 S> */ B(LdaNamedProperty), R(1), U8(5), U8(16), B(Star), R(7), B(LdaSmi), I8(1), @@ -658,8 +650,8 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [16, 225, 225], - [53, 106, 114], - [138, 171, 173], + [15, 223, 223], + [52, 104, 112], + [136, 169, 171], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden index fe1defeefb..680e5ee5cf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), B(LdaUndefined), /* 57 S> */ B(Return), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), B(LdaUndefined), /* 62 S> */ B(Return), ] @@ -45,9 +43,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), B(LdaUndefined), /* 62 S> */ B(Return), ] @@ -63,28 +60,26 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 44 +bytecode array length: 42 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 68 S> */ B(JumpIfUndefinedOrNull), U8(37), + /* 68 S> */ B(JumpIfUndefinedOrNull), U8(36), B(ToObject), R(3), B(ForInEnumerate), R(3), B(ForInPrepare), R(4), U8(0), B(LdaZero), B(Star), R(7), /* 63 S> */ B(ForInContinue), R(7), R(6), - B(JumpIfFalse), U8(22), + B(JumpIfFalse), U8(21), B(ForInNext), R(3), R(7), R(4), U8(0), - B(JumpIfUndefined), U8(8), + B(JumpIfUndefined), U8(7), B(Star), R(2), - /* 54 E> */ B(StackCheck), /* 63 S> */ B(Star), R(1), /* 82 S> */ B(Return), B(ForInStep), R(7), B(Star), R(7), - B(JumpLoop), U8(22), I8(0), + /* 54 E> */ B(JumpLoop), U8(21), I8(0), B(LdaUndefined), /* 85 S> */ B(Return), ] @@ -101,24 +96,22 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 56 +bytecode array length: 54 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(1), U8(37), - B(JumpIfUndefinedOrNull), U8(46), + B(JumpIfUndefinedOrNull), U8(45), B(ToObject), R(3), B(ForInEnumerate), R(3), B(ForInPrepare), R(4), U8(0), B(LdaZero), B(Star), R(7), /* 54 S> */ B(ForInContinue), R(7), R(6), - B(JumpIfFalse), U8(31), + B(JumpIfFalse), U8(30), B(ForInNext), R(3), R(7), R(4), U8(0), - B(JumpIfUndefined), U8(17), + B(JumpIfUndefined), U8(16), B(Star), R(2), - /* 45 E> */ B(StackCheck), /* 54 S> */ B(Star), R(1), /* 70 S> */ B(Ldar), R(2), /* 75 E> */ B(Add), R(0), U8(2), @@ -126,7 +119,7 @@ bytecodes: [ B(Star), R(0), /* 72 E> */ B(ForInStep), R(7), B(Star), R(7), - B(JumpLoop), U8(31), I8(0), + /* 45 E> */ B(JumpLoop), U8(30), I8(0), B(LdaUndefined), /* 80 S> */ B(Return), ] @@ -146,26 +139,24 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 83 +bytecode array length: 81 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(37), - B(JumpIfUndefinedOrNull), U8(70), + B(JumpIfUndefinedOrNull), U8(69), B(ToObject), R(1), B(ForInEnumerate), R(1), B(ForInPrepare), R(2), U8(1), B(LdaZero), B(Star), R(5), /* 68 S> */ B(ForInContinue), R(5), R(4), - B(JumpIfFalse), U8(55), + B(JumpIfFalse), U8(54), B(ForInNext), R(1), R(5), R(2), U8(1), - B(JumpIfUndefined), U8(41), + B(JumpIfUndefined), U8(40), B(Star), R(6), B(Ldar), R(6), /* 68 E> */ B(StaNamedProperty), R(0), U8(2), U8(3), - /* 62 E> */ B(StackCheck), /* 100 S> */ B(LdaNamedProperty), R(0), U8(2), U8(5), B(Star), R(6), B(LdaSmi), I8(10), @@ -180,7 +171,7 @@ bytecodes: [ /* 143 S> */ B(Jump), U8(9), B(ForInStep), R(5), B(Star), R(5), - B(JumpLoop), U8(55), I8(0), + /* 62 E> */ B(JumpLoop), U8(54), I8(0), B(LdaUndefined), /* 152 S> */ B(Return), ] @@ -199,34 +190,32 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 62 +bytecode array length: 60 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), /* 72 S> */ B(CreateArrayLiteral), U8(1), U8(2), U8(37), - B(JumpIfUndefinedOrNull), U8(49), + B(JumpIfUndefinedOrNull), U8(48), B(ToObject), R(1), B(ForInEnumerate), R(1), B(ForInPrepare), R(2), U8(1), B(LdaZero), B(Star), R(5), /* 65 S> */ B(ForInContinue), R(5), R(4), - B(JumpIfFalse), U8(34), + B(JumpIfFalse), U8(33), B(ForInNext), R(1), R(5), R(2), U8(1), - B(JumpIfUndefined), U8(20), + B(JumpIfUndefined), U8(19), B(Star), R(6), B(LdaZero), B(Star), R(8), B(Ldar), R(6), /* 65 E> */ B(StaKeyedProperty), R(0), R(8), U8(3), - /* 59 E> */ B(StackCheck), /* 83 S> */ B(LdaSmi), I8(3), /* 91 E> */ B(LdaKeyedProperty), R(0), U8(5), /* 95 S> */ B(Return), B(ForInStep), R(5), B(Star), R(5), - B(JumpLoop), U8(34), I8(0), + /* 59 E> */ B(JumpLoop), U8(33), I8(0), B(LdaUndefined), /* 98 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index 7be4c0bdea..681b4bc9f5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 165 +bytecode array length: 163 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(4), B(GetIterator), R(4), U8(1), U8(3), @@ -32,16 +31,15 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), B(LdaNamedProperty), R(8), U8(2), U8(9), - B(JumpIfToBooleanTrue), U8(23), + B(JumpIfToBooleanTrue), U8(22), B(LdaNamedProperty), R(8), U8(3), U8(11), B(Star), R(8), B(LdaFalse), B(Star), R(4), B(Mov), R(8), R(1), - /* 34 E> */ B(StackCheck), /* 43 S> */ B(Mov), R(1), R(0), B(Ldar), R(8), - B(JumpLoop), U8(40), I8(0), + /* 34 E> */ B(JumpLoop), U8(39), I8(0), B(LdaSmi), I8(-1), B(Star), R(6), B(Star), R(5), @@ -50,7 +48,7 @@ bytecodes: [ B(LdaZero), B(Star), R(5), B(LdaTheHole), - /* 43 E> */ B(SetPendingMessage), + B(SetPendingMessage), B(Star), R(7), B(Ldar), R(4), B(JumpIfToBooleanTrue), U8(58), @@ -96,8 +94,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [32, 75, 83], - [107, 140, 142], + [31, 73, 81], + [105, 138, 140], ] --- @@ -107,9 +105,8 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 173 +bytecode array length: 171 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 68 S> */ B(GetIterator), R(0), U8(0), U8(2), @@ -128,13 +125,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), B(LdaNamedProperty), R(9), U8(2), U8(8), - B(JumpIfToBooleanTrue), U8(27), + B(JumpIfToBooleanTrue), U8(26), B(LdaNamedProperty), R(9), U8(3), U8(10), B(Star), R(9), B(LdaFalse), B(Star), R(5), B(Mov), R(9), R(2), - /* 54 E> */ B(StackCheck), /* 63 S> */ B(Mov), R(2), R(1), /* 73 S> */ B(LdaSmi), I8(1), B(Mov), R(9), R(7), @@ -198,8 +194,8 @@ constant pool: [ Smi [9], ] handlers: [ - [30, 77, 85], - [109, 142, 144], + [29, 75, 83], + [107, 140, 142], ] --- @@ -211,9 +207,8 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 181 +bytecode array length: 179 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(4), B(GetIterator), R(4), U8(1), U8(3), @@ -232,13 +227,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), B(LdaNamedProperty), R(8), U8(2), U8(9), - B(JumpIfToBooleanTrue), U8(39), + B(JumpIfToBooleanTrue), U8(38), B(LdaNamedProperty), R(8), U8(3), U8(11), B(Star), R(8), B(LdaFalse), B(Star), R(4), B(Mov), R(8), R(1), - /* 34 E> */ B(StackCheck), /* 43 S> */ B(Mov), R(1), R(0), /* 66 S> */ B(LdaSmi), I8(10), /* 72 E> */ B(TestEqual), R(0), U8(13), @@ -248,7 +242,7 @@ bytecodes: [ /* 97 E> */ B(TestEqual), R(0), U8(14), B(JumpIfFalse), U8(4), /* 104 S> */ B(Jump), U8(5), - B(JumpLoop), U8(56), I8(0), + /* 34 E> */ B(JumpLoop), U8(55), I8(0), B(LdaSmi), I8(-1), B(Star), R(6), B(Star), R(5), @@ -303,8 +297,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [32, 91, 99], - [123, 156, 158], + [31, 89, 97], + [121, 154, 156], ] --- @@ -314,9 +308,8 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 187 +bytecode array length: 185 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), @@ -337,14 +330,13 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), B(LdaNamedProperty), R(7), U8(3), U8(10), - B(JumpIfToBooleanTrue), U8(33), + B(JumpIfToBooleanTrue), U8(32), B(LdaNamedProperty), R(7), U8(4), U8(12), B(Star), R(7), B(LdaFalse), B(Star), R(3), B(Ldar), R(7), /* 67 E> */ B(StaNamedProperty), R(0), U8(5), U8(14), - /* 62 E> */ B(StackCheck), /* 96 S> */ B(LdaNamedProperty), R(0), U8(5), U8(16), B(Star), R(5), B(LdaSmi), I8(1), @@ -411,7 +403,7 @@ constant pool: [ Smi [9], ] handlers: [ - [38, 91, 99], - [123, 156, 158], + [37, 89, 97], + [121, 154, 156], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden index 1f1cf6a332..a38d3d78dd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden @@ -15,9 +15,8 @@ snippet: " " frame size: 15 parameter count: 2 -bytecode array length: 162 +bytecode array length: 160 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 34 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), @@ -34,17 +33,16 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), B(LdaNamedProperty), R(10), U8(1), U8(8), - B(JumpIfToBooleanTrue), U8(26), + B(JumpIfToBooleanTrue), U8(25), B(LdaNamedProperty), R(10), U8(2), U8(10), B(Star), R(10), B(LdaFalse), B(Star), R(6), B(Mov), R(10), R(0), - /* 20 E> */ B(StackCheck), /* 29 S> */ B(Mov), R(0), R(2), /* 49 S> */ B(Mov), R(2), R(3), B(Ldar), R(10), - B(JumpLoop), U8(43), I8(0), + /* 20 E> */ B(JumpLoop), U8(42), I8(0), B(LdaSmi), I8(-1), B(Star), R(8), B(Star), R(7), @@ -53,7 +51,7 @@ bytecodes: [ B(LdaZero), B(Star), R(7), B(LdaTheHole), - /* 49 E> */ B(SetPendingMessage), + B(SetPendingMessage), B(Star), R(9), B(Ldar), R(6), B(JumpIfToBooleanTrue), U8(58), @@ -98,8 +96,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [26, 72, 80], - [104, 137, 139], + [25, 70, 78], + [102, 135, 137], ] --- @@ -111,10 +109,9 @@ snippet: " " frame size: 20 parameter count: 2 -bytecode array length: 246 +bytecode array length: 244 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(5), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(5), B(PushContext), R(2), B(Ldar), R(this), B(StaCurrentContextSlot), U8(4), @@ -146,13 +143,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), B(LdaNamedProperty), R(10), U8(3), U8(8), - B(JumpIfToBooleanTrue), U8(75), + B(JumpIfToBooleanTrue), U8(74), B(LdaNamedProperty), R(10), U8(4), U8(10), B(Star), R(10), B(LdaFalse), B(Star), R(6), B(Mov), R(10), R(0), - /* 20 E> */ B(StackCheck), B(CreateBlockContext), U8(5), B(PushContext), R(11), B(LdaTheHole), @@ -177,7 +173,7 @@ bytecodes: [ /* 41 E> */ B(CallUndefinedReceiver1), R(12), R(13), U8(14), B(PopContext), R(11), B(Mov), R(0), R(10), - B(JumpLoop), U8(92), I8(0), + /* 20 E> */ B(JumpLoop), U8(91), I8(0), B(LdaSmi), I8(-1), B(Star), R(8), B(Star), R(7), @@ -237,8 +233,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [59, 154, 162], - [186, 219, 221], + [58, 152, 160], + [184, 217, 219], ] --- @@ -250,9 +246,8 @@ snippet: " " frame size: 14 parameter count: 2 -bytecode array length: 179 +bytecode array length: 177 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 34 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), @@ -269,13 +264,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), B(LdaNamedProperty), R(8), U8(1), U8(8), - B(JumpIfToBooleanTrue), U8(43), + B(JumpIfToBooleanTrue), U8(42), B(LdaNamedProperty), R(8), U8(2), U8(10), B(Star), R(8), B(LdaFalse), B(Star), R(4), B(Mov), R(8), R(0), - /* 20 E> */ B(StackCheck), B(CreateBlockContext), U8(3), B(PushContext), R(9), B(LdaTheHole), @@ -287,7 +281,7 @@ bytecodes: [ /* 67 E> */ B(CallUndefinedReceiver0), R(10), U8(12), B(PopContext), R(9), B(Mov), R(0), R(8), - B(JumpLoop), U8(60), I8(0), + /* 20 E> */ B(JumpLoop), U8(59), I8(0), B(LdaSmi), I8(-1), B(Star), R(6), B(Star), R(5), @@ -343,8 +337,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [26, 89, 97], - [121, 154, 156], + [25, 87, 95], + [119, 152, 154], ] --- @@ -356,9 +350,8 @@ snippet: " " frame size: 17 parameter count: 2 -bytecode array length: 173 +bytecode array length: 171 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 41 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), @@ -375,13 +368,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), B(LdaNamedProperty), R(12), U8(1), U8(8), - B(JumpIfToBooleanTrue), U8(37), + B(JumpIfToBooleanTrue), U8(36), B(LdaNamedProperty), R(12), U8(2), U8(10), B(Star), R(12), B(LdaFalse), B(Star), R(8), B(Mov), R(12), R(0), - /* 20 E> */ B(StackCheck), /* 31 S> */ B(LdaNamedProperty), R(0), U8(3), U8(12), B(Star), R(3), /* 34 S> */ B(LdaNamedProperty), R(0), U8(4), U8(14), @@ -389,7 +381,7 @@ bytecodes: [ /* 56 S> */ B(Ldar), R(4), /* 58 E> */ B(Add), R(3), U8(16), B(Star), R(5), - B(JumpLoop), U8(54), I8(0), + /* 20 E> */ B(JumpLoop), U8(53), I8(0), B(LdaSmi), I8(-1), B(Star), R(10), B(Star), R(9), @@ -398,7 +390,7 @@ bytecodes: [ B(LdaZero), B(Star), R(9), B(LdaTheHole), - /* 56 E> */ B(SetPendingMessage), + B(SetPendingMessage), B(Star), R(11), B(Ldar), R(8), B(JumpIfToBooleanTrue), U8(58), @@ -445,8 +437,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [26, 83, 91], - [115, 148, 150], + [25, 81, 89], + [113, 146, 148], ] --- @@ -458,13 +450,12 @@ snippet: " " frame size: 16 parameter count: 2 -bytecode array length: 203 +bytecode array length: 201 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(5), B(Mov), R(this), R(6), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0), B(ResumeGenerator), R(0), R(0), U8(5), @@ -491,17 +482,16 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(LdaNamedProperty), R(11), U8(4), U8(8), - B(JumpIfToBooleanTrue), U8(26), + B(JumpIfToBooleanTrue), U8(25), B(LdaNamedProperty), R(11), U8(5), U8(10), B(Star), R(11), B(LdaFalse), B(Star), R(7), B(Mov), R(11), R(1), - /* 21 E> */ B(StackCheck), /* 30 S> */ B(Mov), R(1), R(3), /* 50 S> */ B(Mov), R(3), R(4), B(Ldar), R(11), - B(JumpLoop), U8(43), I8(0), + /* 21 E> */ B(JumpLoop), U8(42), I8(0), B(LdaSmi), I8(-1), B(Star), R(9), B(Star), R(8), @@ -510,7 +500,7 @@ bytecodes: [ B(LdaZero), B(Star), R(8), B(LdaTheHole), - /* 50 E> */ B(SetPendingMessage), + B(SetPendingMessage), B(Star), R(10), B(Ldar), R(7), B(JumpIfToBooleanTrue), U8(58), @@ -558,8 +548,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [67, 113, 121], - [145, 178, 180], + [66, 111, 119], + [143, 176, 178], ] --- @@ -571,13 +561,12 @@ snippet: " " frame size: 15 parameter count: 2 -bytecode array length: 247 +bytecode array length: 245 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), B(ResumeGenerator), R(0), R(0), U8(4), @@ -604,13 +593,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), B(LdaNamedProperty), R(10), U8(5), U8(8), - B(JumpIfToBooleanTrue), U8(64), + B(JumpIfToBooleanTrue), U8(63), B(LdaNamedProperty), R(10), U8(6), U8(10), B(Star), R(10), B(LdaFalse), B(Star), R(6), B(Mov), R(10), R(1), - /* 21 E> */ B(StackCheck), /* 30 S> */ B(Mov), R(1), R(3), /* 40 S> */ B(LdaFalse), B(Star), R(12), @@ -628,7 +616,7 @@ bytecodes: [ B(Mov), R(11), R(8), B(Jump), U8(20), B(Ldar), R(11), - B(JumpLoop), U8(81), I8(0), + /* 21 E> */ B(JumpLoop), U8(80), I8(0), B(LdaSmi), I8(-1), B(Star), R(8), B(Star), R(7), @@ -678,7 +666,7 @@ bytecodes: [ ] constant pool: [ Smi [21], - Smi [119], + Smi [118], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], @@ -692,8 +680,8 @@ constant pool: [ Smi [9], ] handlers: [ - [67, 151, 159], - [183, 216, 218], + [66, 149, 157], + [181, 214, 216], ] --- @@ -705,12 +693,11 @@ snippet: " " frame size: 17 parameter count: 2 -bytecode array length: 217 +bytecode array length: 215 bytecodes: [ - /* 16 E> */ B(StackCheck), B(Mov), R(closure), R(5), B(Mov), R(this), R(6), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(5), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(5), U8(2), B(Star), R(0), B(Mov), R(context), R(5), /* 40 S> */ B(GetIterator), R(arg0), U8(0), U8(2), @@ -729,17 +716,16 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), B(LdaNamedProperty), R(12), U8(1), U8(8), - B(JumpIfToBooleanTrue), U8(26), + B(JumpIfToBooleanTrue), U8(25), B(LdaNamedProperty), R(12), U8(2), U8(10), B(Star), R(12), B(LdaFalse), B(Star), R(8), B(Mov), R(12), R(1), - /* 26 E> */ B(StackCheck), /* 35 S> */ B(Mov), R(1), R(3), /* 55 S> */ B(Mov), R(3), R(4), B(Ldar), R(12), - B(JumpLoop), U8(43), I8(0), + /* 26 E> */ B(JumpLoop), U8(42), I8(0), B(LdaSmi), I8(-1), B(Star), R(10), B(Star), R(9), @@ -748,7 +734,7 @@ bytecodes: [ B(LdaZero), B(Star), R(9), B(LdaTheHole), - /* 55 E> */ B(SetPendingMessage), + B(SetPendingMessage), B(Star), R(11), B(Ldar), R(8), B(JumpIfToBooleanTrue), U8(58), @@ -813,9 +799,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [16, 189, 189], - [41, 87, 95], - [119, 152, 154], + [15, 187, 187], + [40, 85, 93], + [117, 150, 152], ] --- @@ -827,13 +813,12 @@ snippet: " " frame size: 16 parameter count: 2 -bytecode array length: 253 +bytecode array length: 251 bytecodes: [ - /* 16 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2), B(Star), R(0), B(Mov), R(context), R(4), /* 40 S> */ B(GetIterator), R(arg0), U8(0), U8(2), @@ -852,13 +837,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(LdaNamedProperty), R(11), U8(2), U8(8), - B(JumpIfToBooleanTrue), U8(58), + B(JumpIfToBooleanTrue), U8(57), B(LdaNamedProperty), R(11), U8(3), U8(10), B(Star), R(11), B(LdaFalse), B(Star), R(7), B(Mov), R(11), R(1), - /* 26 E> */ B(StackCheck), /* 35 S> */ B(Mov), R(1), R(3), /* 45 S> */ B(Mov), R(0), R(12), B(Mov), R(3), R(13), @@ -874,7 +858,7 @@ bytecodes: [ B(Ldar), R(12), B(ReThrow), B(Ldar), R(12), - B(JumpLoop), U8(75), I8(0), + /* 26 E> */ B(JumpLoop), U8(74), I8(0), B(LdaSmi), I8(-1), B(Star), R(9), B(Star), R(8), @@ -940,7 +924,7 @@ bytecodes: [ /* 54 S> */ B(Return), ] constant pool: [ - Smi [97], + Smi [96], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -949,8 +933,8 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 225, 225], - [45, 123, 131], - [155, 188, 190], + [19, 223, 223], + [44, 121, 129], + [153, 186, 188], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden index 0416d1815a..d73ca7d69c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateClosure), U8(0), U8(0), U8(2), /* 54 S> */ B(Return), ] @@ -29,9 +28,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateClosure), U8(0), U8(0), U8(2), B(Star), R(0), /* 56 E> */ B(CallUndefinedReceiver0), R(0), U8(0), @@ -49,9 +47,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateClosure), U8(0), U8(0), U8(2), B(Star), R(0), B(LdaSmi), I8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden index 02f8f49ece..071b6ae8ff 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GenerateTestUndetectable.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -44,9 +43,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -74,9 +72,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -104,9 +101,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -134,9 +130,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -163,9 +158,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -192,9 +186,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -221,9 +214,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 46 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 63 S> */ B(LdaSmi), I8(10), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index c84e6ec0eb..c3f8b980cf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -13,13 +13,12 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 44 +bytecode array length: 43 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(1), B(Mov), R(this), R(2), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0), B(ResumeGenerator), R(0), R(0), U8(1), @@ -48,13 +47,12 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 80 +bytecode array length: 79 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(1), B(Mov), R(this), R(2), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0), B(ResumeGenerator), R(0), R(0), U8(1), @@ -100,13 +98,12 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 253 +bytecode array length: 251 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), B(ResumeGenerator), R(0), R(0), U8(4), @@ -135,13 +132,12 @@ bytecodes: [ B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), B(LdaNamedProperty), R(10), U8(6), U8(9), - B(JumpIfToBooleanTrue), U8(64), + B(JumpIfToBooleanTrue), U8(63), B(LdaNamedProperty), R(10), U8(7), U8(11), B(Star), R(10), B(LdaFalse), B(Star), R(6), B(Mov), R(10), R(1), - /* 16 E> */ B(StackCheck), /* 25 S> */ B(Mov), R(1), R(3), /* 36 S> */ B(LdaFalse), B(Star), R(12), @@ -159,7 +155,7 @@ bytecodes: [ B(Mov), R(11), R(8), B(Jump), U8(20), B(Ldar), R(11), - B(JumpLoop), U8(81), I8(0), + /* 16 E> */ B(JumpLoop), U8(80), I8(0), B(LdaSmi), I8(-1), B(Star), R(8), B(Star), R(7), @@ -209,7 +205,7 @@ bytecodes: [ ] constant pool: [ Smi [21], - Smi [125], + Smi [124], Smi [10], Smi [7], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, @@ -224,8 +220,8 @@ constant pool: [ Smi [9], ] handlers: [ - [73, 157, 165], - [189, 222, 224], + [72, 155, 163], + [187, 220, 222], ] --- @@ -236,13 +232,12 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 205 +bytecode array length: 204 bytecodes: [ - /* 38 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(1), B(Mov), R(this), R(2), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), + /* 38 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(1), U8(2), B(Star), R(0), /* 38 E> */ B(SuspendGenerator), R(0), R(0), U8(1), U8(0), B(ResumeGenerator), R(0), R(0), U8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden index b24e5d0aa1..808f608f25 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(0), U8(0), B(BitwiseAndSmi), I8(1), U8(2), /* 45 E> */ B(StaGlobal), U8(0), U8(3), @@ -36,9 +35,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(0), U8(0), B(AddSmi), I8(1), U8(2), /* 51 E> */ B(StaGlobal), U8(0), U8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden index f0479d594d..dd6f8ea9e7 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(0), U8(0), B(Inc), U8(2), /* 40 E> */ B(StaGlobal), U8(0), U8(3), @@ -36,9 +35,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(0), U8(0), B(ToNumeric), U8(2), B(Star), R(0), @@ -61,9 +59,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 27 E> */ B(StackCheck), /* 46 S> */ B(LdaGlobal), U8(0), U8(0), B(Dec), U8(2), /* 55 E> */ B(StaGlobal), U8(0), U8(3), @@ -83,9 +80,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(0), U8(0), B(ToNumeric), U8(2), B(Star), R(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden index e1994bcdd2..4167138f1f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden @@ -16,9 +16,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 32 E> */ B(StackCheck), /* 39 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), B(LdaConstant), U8(1), @@ -43,9 +42,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 28 E> */ B(StackCheck), /* 51 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(0), B(LdaSmi), I8(1), @@ -68,9 +66,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 32 E> */ B(StackCheck), /* 39 S> */ B(LdaConstant), U8(0), B(Star), R(0), B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), @@ -92,9 +89,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 18 E> */ B(StackCheck), /* 25 S> */ B(LdaConstant), U8(0), B(Star), R(0), B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden index d6b6bb6c60..49a80d13c9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaConstant), U8(0), /* 45 S> */ B(Return), ] @@ -29,9 +28,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 47 S> */ B(LdaConstant), U8(1), @@ -50,9 +48,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 48 S> */ B(LdaConstant), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden index 56b6e0afac..8f45fff2cb 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden @@ -21,10 +21,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 40 +bytecode array length: 39 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(CreateEmptyObjectLiteral), /* 31 E> */ B(StaGlobal), U8(0), U8(0), @@ -65,10 +64,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 69 +bytecode array length: 67 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(CreateEmptyObjectLiteral), /* 31 E> */ B(StaGlobal), U8(0), U8(0), @@ -78,8 +76,7 @@ bytecodes: [ B(Star), R(1), B(LdaSmi), I8(5), /* 59 E> */ B(TestLessThan), R(1), U8(6), - B(JumpIfFalse), U8(43), - /* 45 E> */ B(StackCheck), + B(JumpIfFalse), U8(42), /* 81 S> */ B(LdaGlobal), U8(0), U8(7), B(Star), R(1), B(LdaSmi), I8(2), @@ -93,7 +90,7 @@ bytecodes: [ /* 66 S> */ B(LdaGlobal), U8(1), U8(4), B(Inc), U8(15), /* 66 E> */ B(StaGlobal), U8(1), U8(2), - B(JumpLoop), U8(50), I8(0), + /* 45 E> */ B(JumpLoop), U8(49), I8(0), /* 149 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 156 S> */ B(Return), ] @@ -124,10 +121,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 70 +bytecode array length: 68 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(CreateEmptyObjectLiteral), /* 31 E> */ B(StaGlobal), U8(0), U8(0), @@ -137,8 +133,7 @@ bytecodes: [ B(Star), R(1), B(LdaSmi), I8(4), /* 68 E> */ B(TestGreaterThan), R(1), U8(6), - B(JumpIfFalse), U8(43), - /* 60 E> */ B(StackCheck), + B(JumpIfFalse), U8(42), /* 85 S> */ B(LdaGlobal), U8(0), U8(7), B(Star), R(1), B(LdaSmi), I8(2), @@ -152,7 +147,7 @@ bytecodes: [ /* 128 S> */ B(LdaGlobal), U8(1), U8(4), B(Dec), U8(15), /* 129 E> */ B(StaGlobal), U8(1), U8(2), - B(JumpLoop), U8(50), I8(0), + /* 60 E> */ B(JumpLoop), U8(49), I8(0), /* 168 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 175 S> */ B(Return), ] @@ -183,16 +178,14 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 70 +bytecode array length: 68 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(CreateEmptyObjectLiteral), /* 31 E> */ B(StaGlobal), U8(0), U8(0), /* 45 S> */ B(LdaSmi), I8(4), /* 47 E> */ B(StaGlobal), U8(1), U8(2), - /* 60 E> */ B(StackCheck), /* 75 S> */ B(LdaGlobal), U8(0), U8(4), B(Star), R(1), B(LdaSmi), I8(2), @@ -211,7 +204,7 @@ bytecodes: [ B(LdaSmi), I8(4), /* 141 E> */ B(TestGreaterThan), R(1), U8(15), B(JumpIfFalse), U8(5), - B(JumpLoop), U8(50), I8(0), + /* 60 E> */ B(JumpLoop), U8(49), I8(0), /* 171 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 178 S> */ B(Return), ] @@ -244,10 +237,9 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 71 +bytecode array length: 70 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(LdaConstant), U8(0), B(Star), R(2), @@ -297,10 +289,9 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(LdaConstant), U8(0), B(Star), R(3), @@ -330,10 +321,9 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(LdaConstant), U8(0), B(Star), R(3), @@ -374,10 +364,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 137 +bytecode array length: 136 bytecodes: [ - /* 237 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 237 E> */ B(CreateMappedArguments), B(Star), R(0), /* 255 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(0), B(Star), R(1), @@ -469,10 +458,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 140 +bytecode array length: 139 bytecodes: [ - /* 189 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 189 E> */ B(CreateMappedArguments), B(Star), R(0), /* 202 S> */ B(LdaUndefined), B(Star), R(2), @@ -567,10 +555,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 43 +bytecode array length: 42 bytecodes: [ - /* 79 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 79 E> */ B(CreateMappedArguments), B(Star), R(0), /* 93 S> */ B(CreateEmptyObjectLiteral), /* 95 E> */ B(StaGlobal), U8(0), U8(0), @@ -616,10 +603,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 43 +bytecode array length: 42 bytecodes: [ - /* 76 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 76 E> */ B(CreateMappedArguments), B(Star), R(0), /* 92 S> */ B(CreateEmptyObjectLiteral), /* 94 E> */ B(StaGlobal), U8(0), U8(0), @@ -657,9 +643,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 25 E> */ B(StackCheck), /* 32 S> */ B(LdaSmi), I8(3), /* 36 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(0), /* 41 S> */ B(Ldar), R(arg0), @@ -680,9 +665,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 26 E> */ B(StackCheck), /* 33 S> */ B(LdaSmi), I8(3), /* 37 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(0), /* 42 S> */ B(Ldar), R(arg0), @@ -703,9 +687,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 37 S> */ B(LdaSmi), I8(3), /* 41 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(0), /* 46 S> */ B(Ldar), R(arg0), @@ -727,9 +710,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 29 E> */ B(StackCheck), /* 36 S> */ B(LdaSmi), I8(3), /* 40 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(0), /* 45 S> */ B(Ldar), R(arg0), @@ -751,10 +733,9 @@ snippet: " " frame size: 3 parameter count: 2 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - /* 46 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 46 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(2), @@ -784,10 +765,9 @@ snippet: " " frame size: 3 parameter count: 2 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden index c3b8dcc22f..c911947481 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden @@ -20,10 +20,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 42 +bytecode array length: 41 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(CreateEmptyObjectLiteral), /* 31 E> */ B(StaGlobal), U8(0), U8(0), @@ -68,10 +67,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 65 +bytecode array length: 64 bytecodes: [ - /* 16 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 16 E> */ B(CreateMappedArguments), B(Star), R(0), /* 29 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), /* 31 E> */ B(StaGlobal), U8(1), U8(1), @@ -128,10 +126,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 144 +bytecode array length: 143 bytecodes: [ - /* 237 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 237 E> */ B(CreateMappedArguments), B(Star), R(0), /* 255 S> */ B(LdaNamedProperty), R(this), U8(0), U8(0), B(Star), R(1), @@ -221,10 +218,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 126 +bytecode array length: 125 bytecodes: [ - /* 189 E> */ B(StackCheck), - B(CreateMappedArguments), + /* 189 E> */ B(CreateMappedArguments), B(Star), R(0), /* 202 S> */ B(LdaGlobal), U8(0), U8(0), B(Star), R(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden index 46d972af0c..de6b5e0844 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden @@ -19,9 +19,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 55 S> */ B(LdaSmi), I8(-1), /* 65 S> */ B(Return), ] @@ -43,9 +42,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 36 S> */ B(LdaSmi), I8(1), /* 45 S> */ B(Return), ] @@ -67,9 +65,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 59 S> */ B(LdaSmi), I8(-1), /* 69 S> */ B(Return), ] @@ -89,9 +86,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 17 S> */ B(LdaUndefined), /* 48 S> */ B(Return), ] @@ -114,9 +110,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 21 +bytecode array length: 20 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 25 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 30 S> */ B(JumpIfToBooleanFalse), U8(11), @@ -147,9 +142,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 18 S> */ B(LdaZero), /* 24 E> */ B(TestLessThanOrEqual), R(arg0), U8(0), B(JumpIfFalse), U8(7), @@ -169,9 +163,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 19 S> */ B(Ldar), R(arg1), /* 25 E> */ B(TestIn), R(arg0), U8(0), B(JumpIfFalse), U8(7), @@ -256,9 +249,8 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 27 +bytecode array length: 26 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 24 S> */ B(LdaZero), B(Star), R(0), /* 35 S> */ B(LdaZero), @@ -353,9 +345,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 25 S> */ B(LdaZero), B(Star), R(0), /* 36 S> */ B(LdaZero), @@ -390,9 +381,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 83 +bytecode array length: 82 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 21 S> */ B(Ldar), R(arg1), /* 27 E> */ B(TestEqual), R(arg0), U8(0), B(JumpIfFalse), U8(5), @@ -455,9 +445,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 25 S> */ B(LdaZero), B(Star), R(0), /* 30 S> */ B(JumpIfToBooleanFalse), U8(5), @@ -486,9 +475,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 34 +bytecode array length: 33 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 21 S> */ B(Ldar), R(arg1), /* 27 E> */ B(TestEqual), R(arg0), U8(0), B(JumpIfTrue), U8(8), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden index ea0f55d478..951b3543a8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(ExtraWide), B(LdaSmi), I32(12345678), /* 50 S> */ B(Return), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), /* 48 S> */ B(Wide), B(LdaSmi), I16(5678), @@ -47,9 +45,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), /* 48 S> */ B(Wide), B(LdaSmi), I16(1234), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden index a7900cf8eb..0ee86f4cea 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), B(LdaUndefined), @@ -30,9 +29,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 55 S> */ B(Return), @@ -48,9 +46,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 30 E> */ B(StackCheck), B(LdaTheHole), B(Star), R(0), /* 42 S> */ B(LdaSmi), I8(20), @@ -73,9 +70,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(20), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden index 61f898d5d7..fe82887e3c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden @@ -11,10 +11,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -35,10 +34,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 16 +bytecode array length: 15 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -59,10 +57,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -89,10 +86,9 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 19 +bytecode array length: 18 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 30 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden index c34d6bd739..3199c09d94 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 21 E> */ B(StackCheck), /* 26 S> */ B(LdaGlobal), U8(0), U8(0), /* 35 S> */ B(Return), ] @@ -34,9 +33,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(0), U8(0), /* 41 S> */ B(Return), ] @@ -54,9 +52,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 17 E> */ B(StackCheck), /* 22 S> */ B(LdaGlobal), U8(0), U8(0), /* 31 S> */ B(Return), ] @@ -205,9 +202,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 523 +bytecode array length: 522 bytecodes: [ - /* 17 E> */ B(StackCheck), /* 33 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 41 S> */ B(LdaNamedProperty), R(0), U8(0), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden index 9f51448614..ddcf588467 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(4), @@ -31,9 +30,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(1), @@ -53,9 +51,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(4), @@ -73,9 +70,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaZero), @@ -95,9 +91,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanTrue), U8(4), @@ -115,9 +110,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(2), B(Star), R(0), /* 49 S> */ B(LdaSmi), I8(3), @@ -174,9 +168,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 276 +bytecode array length: 275 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -360,9 +353,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 275 +bytecode array length: 274 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -546,9 +538,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 279 +bytecode array length: 278 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -733,9 +724,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 278 +bytecode array length: 277 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -888,9 +878,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaZero), /* 48 S> */ B(Return), ] @@ -905,9 +894,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(1), /* 48 S> */ B(Return), ] @@ -922,9 +910,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(4), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden index f7da45c224..f7a4289e61 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden @@ -12,10 +12,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 63 +bytecode array length: 62 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), @@ -57,10 +56,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 64 +bytecode array length: 63 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), @@ -103,10 +101,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 64 +bytecode array length: 63 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), @@ -154,10 +151,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 63 +bytecode array length: 62 bytecodes: [ - /* 38 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 38 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), @@ -204,10 +200,9 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 63 +bytecode array length: 62 bytecodes: [ - /* 34 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 34 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(1), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden index 0ace6d1dc5..f8b66ce3d2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden @@ -17,9 +17,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaLookupGlobalSlot), U8(0), U8(0), U8(1), /* 24 S> */ B(Return), ] @@ -40,9 +39,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaSmi), I8(10), /* 17 E> */ B(StaLookupSlot), U8(0), U8(0), B(LdaUndefined), @@ -65,9 +63,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 29 S> */ B(LdaSmi), I8(10), /* 31 E> */ B(StaLookupSlot), U8(0), U8(1), B(LdaUndefined), @@ -90,9 +87,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaLookupGlobalSlotInsideTypeof), U8(0), U8(0), U8(1), B(TypeOf), /* 31 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden index b21dea1dcb..854a78c921 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -11,37 +11,30 @@ top level: yes snippet: " import \"bar\"; " -frame size: 5 -parameter count: 2 -bytecode array length: 62 +frame size: 4 +parameter count: 1 +bytecode array length: 47 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), - B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 14 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(Ldar), R(1), /* 14 S> */ B(Return), ] constant pool: [ - Smi [35], - SCOPE_INFO_TYPE, + Smi [21], Smi [10], Smi [7], ] @@ -52,37 +45,30 @@ handlers: [ snippet: " import {foo} from \"bar\"; " -frame size: 5 -parameter count: 2 -bytecode array length: 62 +frame size: 4 +parameter count: 1 +bytecode array length: 47 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), - B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 25 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(Ldar), R(1), /* 25 S> */ B(Return), ] constant pool: [ - Smi [35], - SCOPE_INFO_TYPE, + Smi [21], Smi [10], Smi [7], ] @@ -95,50 +81,43 @@ snippet: " goo(42); { let x; { goo(42) } }; " -frame size: 6 -parameter count: 2 -bytecode array length: 92 +frame size: 5 +parameter count: 1 +bytecode array length: 77 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), - B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(4), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 65 S> */ B(Return), /* 32 S> */ B(LdaModuleVariable), I8(-1), U8(0), - B(ThrowReferenceErrorIfHole), U8(4), - B(Star), R(4), + B(ThrowReferenceErrorIfHole), U8(3), + B(Star), R(3), B(LdaSmi), I8(42), - B(Star), R(5), - /* 32 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(0), + B(Star), R(4), + /* 32 E> */ B(CallUndefinedReceiver1), R(3), R(4), U8(0), /* 47 S> */ B(LdaUndefined), B(Star), R(2), /* 52 S> */ B(LdaModuleVariable), I8(-1), U8(0), - B(ThrowReferenceErrorIfHole), U8(4), - B(Star), R(4), + B(ThrowReferenceErrorIfHole), U8(3), + B(Star), R(3), B(LdaSmi), I8(42), - B(Star), R(5), - /* 52 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(2), + B(Star), R(4), + /* 52 E> */ B(CallUndefinedReceiver1), R(3), R(4), U8(2), B(Star), R(1), /* 65 S> */ B(Return), ] constant pool: [ - Smi [35], - SCOPE_INFO_TYPE, + Smi [21], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"], @@ -152,29 +131,23 @@ snippet: " foo++; { let x; { foo++ } }; " -frame size: 6 -parameter count: 2 -bytecode array length: 90 +frame size: 5 +parameter count: 1 +bytecode array length: 75 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), - B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(4), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 50 S> */ B(Return), /* 17 S> */ B(LdaSmi), I8(42), /* 17 E> */ B(StaModuleVariable), I8(1), U8(0), @@ -185,16 +158,15 @@ bytecodes: [ B(Star), R(2), /* 39 S> */ B(LdaModuleVariable), I8(1), U8(0), B(ToNumeric), U8(1), - B(Star), R(4), + B(Star), R(3), B(Inc), U8(1), /* 42 E> */ B(StaModuleVariable), I8(1), U8(0), - B(Mov), R(4), R(1), + B(Mov), R(3), R(1), B(Ldar), R(1), /* 50 S> */ B(Return), ] constant pool: [ - Smi [35], - SCOPE_INFO_TYPE, + Smi [21], Smi [10], Smi [7], ] @@ -207,32 +179,28 @@ snippet: " foo++; { let x; { foo++ } }; " -frame size: 6 -parameter count: 2 -bytecode array length: 96 +frame size: 5 +parameter count: 1 +bytecode array length: 89 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + B(Star), R(0), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), + B(Star), R(3), B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), - B(Star), R(0), - B(LdaTheHole), - B(StaModuleVariable), I8(1), U8(0), + B(CallRuntime), U16(Runtime::kDeclareModuleExports), R(3), U8(2), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(4), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 50 S> */ B(Return), /* 17 S> */ B(LdaSmi), I8(42), /* 17 E> */ B(StaModuleVariable), I8(1), U8(0), @@ -243,16 +211,16 @@ bytecodes: [ B(Star), R(2), /* 39 S> */ B(LdaModuleVariable), I8(1), U8(0), B(ToNumeric), U8(1), - B(Star), R(4), + B(Star), R(3), B(Inc), U8(1), /* 42 E> */ B(StaModuleVariable), I8(1), U8(0), - B(Mov), R(4), R(1), + B(Mov), R(3), R(1), B(Ldar), R(1), /* 50 S> */ B(Return), ] constant pool: [ - Smi [41], - SCOPE_INFO_TYPE, + Smi [35], + FIXED_ARRAY_TYPE, Smi [10], Smi [7], ] @@ -265,32 +233,28 @@ snippet: " foo++; { let x; { foo++ } }; " -frame size: 6 -parameter count: 2 -bytecode array length: 100 +frame size: 5 +parameter count: 1 +bytecode array length: 93 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + B(Star), R(0), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), + B(Star), R(3), B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), - B(Star), R(0), - B(LdaTheHole), - B(StaModuleVariable), I8(1), U8(0), + B(CallRuntime), U16(Runtime::kDeclareModuleExports), R(3), U8(2), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(4), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 52 S> */ B(Return), /* 19 S> */ B(LdaSmi), I8(42), /* 19 E> */ B(StaModuleVariable), I8(1), U8(0), @@ -301,16 +265,16 @@ bytecodes: [ B(Star), R(2), /* 41 S> */ B(LdaModuleVariable), I8(1), U8(0), B(ToNumeric), U8(1), - B(Star), R(4), + B(Star), R(3), B(Inc), U8(1), /* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Mov), R(4), R(1), + B(Mov), R(3), R(1), B(Ldar), R(1), /* 52 S> */ B(Return), ] constant pool: [ - Smi [41], - SCOPE_INFO_TYPE, + Smi [35], + FIXED_ARRAY_TYPE, Smi [10], Smi [7], ] @@ -321,42 +285,38 @@ handlers: [ snippet: " export default (function () {}); " -frame size: 5 -parameter count: 2 -bytecode array length: 75 +frame size: 4 +parameter count: 1 +bytecode array length: 68 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), + B(Star), R(0), B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), + B(Star), R(2), B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(Star), R(0), - B(LdaTheHole), - B(StaModuleVariable), I8(1), U8(0), + B(CallRuntime), U16(Runtime::kDeclareModuleExports), R(2), U8(2), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 33 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(CreateClosure), U8(4), U8(0), U8(0), B(StaModuleVariable), I8(1), U8(0), B(Ldar), R(1), /* 33 S> */ B(Return), ] constant pool: [ - Smi [41], - SCOPE_INFO_TYPE, + Smi [35], + FIXED_ARRAY_TYPE, Smi [10], Smi [7], SHARED_FUNCTION_INFO_TYPE, @@ -368,51 +328,47 @@ handlers: [ snippet: " export default (class {}); " -frame size: 7 -parameter count: 2 -bytecode array length: 96 +frame size: 6 +parameter count: 1 +bytecode array length: 89 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), + B(Star), R(0), B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), + B(Star), R(2), B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(Star), R(0), - B(LdaTheHole), - B(StaModuleVariable), I8(1), U8(0), + B(CallRuntime), U16(Runtime::kDeclareModuleExports), R(2), U8(2), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 27 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(5), U8(0), U8(0), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(4), - B(Star), R(4), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), - B(Star), R(4), - B(Ldar), R(5), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(Ldar), R(4), B(StaModuleVariable), I8(1), U8(0), B(Ldar), R(1), /* 27 S> */ B(Return), ] constant pool: [ - Smi [41], - SCOPE_INFO_TYPE, + Smi [35], + FIXED_ARRAY_TYPE, Smi [10], Smi [7], FIXED_ARRAY_TYPE, @@ -425,37 +381,30 @@ handlers: [ snippet: " export {foo as goo} from \"bar\" " -frame size: 5 -parameter count: 2 -bytecode array length: 62 +frame size: 4 +parameter count: 1 +bytecode array length: 47 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), - B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 31 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(Ldar), R(1), /* 31 S> */ B(Return), ] constant pool: [ - Smi [35], - SCOPE_INFO_TYPE, + Smi [21], Smi [10], Smi [7], ] @@ -466,37 +415,30 @@ handlers: [ snippet: " export * from \"bar\" " -frame size: 5 -parameter count: 2 -bytecode array length: 62 +frame size: 4 +parameter count: 1 +bytecode array length: 47 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(3), - B(Mov), R(arg0), R(2), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(2), - B(PushContext), R(2), - B(Mov), R(closure), R(3), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + B(Mov), R(closure), R(2), + B(Mov), R(this), R(3), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), B(Star), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), - B(ResumeGenerator), R(0), R(0), U8(3), - B(Star), R(3), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), + B(ResumeGenerator), R(0), R(0), U8(2), + B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(2), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(2), /* 20 S> */ B(Return), - B(Mov), R(3), R(1), + B(Mov), R(2), R(1), B(Ldar), R(1), /* 20 S> */ B(Return), ] constant pool: [ - Smi [35], - SCOPE_INFO_TYPE, + Smi [21], Smi [10], Smi [7], ] @@ -508,46 +450,39 @@ snippet: " import * as foo from \"bar\" foo.f(foo, foo.x); " -frame size: 8 -parameter count: 2 -bytecode array length: 89 +frame size: 7 +parameter count: 1 +bytecode array length: 74 bytecodes: [ - /* 0 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), - B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(2), - B(PushContext), R(3), - B(Mov), R(closure), R(4), - B(Mov), R(this), R(5), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Mov), R(closure), R(3), + B(Mov), R(this), R(4), + /* 0 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), B(Star), R(0), B(LdaZero), - B(Star), R(4), - B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(4), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(3), U8(1), B(Star), R(1), B(Ldar), R(0), - /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), - B(ResumeGenerator), R(0), R(0), U8(4), - B(Star), R(4), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), + B(ResumeGenerator), R(0), R(0), U8(3), + B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(4), + B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), + B(Ldar), R(3), /* 0 E> */ B(Throw), - B(Ldar), R(4), + B(Ldar), R(3), /* 46 S> */ B(Return), - /* 31 S> */ B(LdaNamedProperty), R(1), U8(4), U8(0), - B(Star), R(4), - /* 42 E> */ B(LdaNamedProperty), R(1), U8(5), U8(2), - B(Star), R(7), - /* 31 E> */ B(CallProperty2), R(4), R(1), R(1), R(7), U8(4), + /* 31 S> */ B(LdaNamedProperty), R(1), U8(3), U8(0), + B(Star), R(3), + /* 42 E> */ B(LdaNamedProperty), R(1), U8(4), U8(2), + B(Star), R(6), + /* 31 E> */ B(CallProperty2), R(3), R(1), R(1), R(6), U8(4), B(Star), R(2), /* 46 S> */ B(Return), ] constant pool: [ - Smi [47], - SCOPE_INFO_TYPE, + Smi [33], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["f"], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden index 2d994ac100..d0ab8d1281 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden @@ -12,10 +12,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 48 +bytecode array length: 47 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -51,10 +50,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 51 +bytecode array length: 50 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -92,10 +90,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 122 +bytecode array length: 121 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden index 53ef573033..a7681926c9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(Ldar), R(0), /* 52 S> */ B(Return), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaUndefined), /* 46 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden index 82c47ff88d..a5256793a0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateEmptyObjectLiteral), /* 45 S> */ B(Return), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), /* 70 S> */ B(Return), ] @@ -46,9 +44,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 20 +bytecode array length: 19 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), @@ -71,9 +68,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), @@ -97,9 +93,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 49 E> */ B(CreateClosure), U8(1), U8(0), U8(2), @@ -121,9 +116,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 18 +bytecode array length: 17 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), /* 43 E> */ B(CreateClosure), U8(1), U8(0), U8(2), @@ -145,9 +139,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 34 +bytecode array length: 33 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), B(LdaConstant), U8(1), @@ -177,9 +170,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 37 +bytecode array length: 36 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), B(LdaConstant), U8(1), @@ -210,9 +202,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 34 +bytecode array length: 33 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(0), B(LdaConstant), U8(1), @@ -242,9 +233,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 29 +bytecode array length: 28 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), @@ -269,9 +259,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(57), /* 61 S> */ B(Return), ] @@ -287,9 +276,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 25 +bytecode array length: 24 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), @@ -314,9 +302,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 31 +bytecode array length: 30 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), @@ -344,9 +331,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), @@ -375,9 +361,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 64 +bytecode array length: 63 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden index 146715e03a..bb4aac932e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden @@ -20,9 +20,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 97 E> */ B(StackCheck), /* 102 S> */ B(LdaImmutableContextSlot), R(context), U8(2), U8(1), B(Star), R(0), B(LdaImmutableCurrentContextSlot), U8(2), @@ -48,9 +47,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 97 E> */ B(StackCheck), /* 102 S> */ B(LdaImmutableCurrentContextSlot), U8(2), /* 111 E> */ B(StaContextSlot), R(context), U8(2), U8(1), B(LdaUndefined), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden index 81d6408e14..d52e3016b4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 15 S> */ B(Ldar), R(this), /* 27 S> */ B(Return), ] @@ -31,9 +30,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 19 S> */ B(Ldar), R(arg0), /* 31 S> */ B(Return), ] @@ -49,9 +47,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 19 S> */ B(Ldar), R(this), /* 31 S> */ B(Return), ] @@ -67,9 +64,8 @@ snippet: " " frame size: 0 parameter count: 8 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 55 S> */ B(Ldar), R(arg3), /* 67 S> */ B(Return), ] @@ -85,9 +81,8 @@ snippet: " " frame size: 0 parameter count: 8 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 55 S> */ B(Ldar), R(this), /* 67 S> */ B(Return), ] @@ -103,9 +98,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 19 S> */ B(LdaSmi), I8(1), B(Star), R(arg0), B(LdaUndefined), @@ -123,9 +117,8 @@ snippet: " " frame size: 0 parameter count: 5 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 37 S> */ B(LdaSmi), I8(1), B(Star), R(arg1), B(LdaUndefined), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden index 4b0d05f8b0..daf96cdd44 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 5 +bytecode array length: 4 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 54 S> */ B(Return), @@ -29,9 +28,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 54 S> */ B(AddSmi), I8(3), U8(0), @@ -48,9 +46,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(3), @@ -70,9 +67,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 54 S> */ B(SubSmi), I8(3), U8(0), @@ -89,9 +85,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(3), @@ -111,9 +106,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), /* 54 S> */ B(MulSmi), I8(3), U8(0), @@ -130,9 +124,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), /* 54 S> */ B(MulSmi), I8(3), U8(0), @@ -149,9 +142,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), /* 54 S> */ B(DivSmi), I8(3), U8(0), @@ -168,9 +160,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(3), @@ -190,9 +181,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), /* 54 S> */ B(ModSmi), I8(3), U8(0), @@ -209,9 +199,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(4), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(3), @@ -231,9 +220,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 54 S> */ B(BitwiseOrSmi), I8(2), U8(0), @@ -250,9 +238,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 54 S> */ B(BitwiseOrSmi), I8(2), U8(0), @@ -269,9 +256,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 54 S> */ B(BitwiseXorSmi), I8(2), U8(0), @@ -288,9 +274,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 54 S> */ B(BitwiseXorSmi), I8(2), U8(0), @@ -307,9 +292,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 54 S> */ B(BitwiseAndSmi), I8(2), U8(0), @@ -326,9 +310,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 54 S> */ B(BitwiseAndSmi), I8(2), U8(0), @@ -345,9 +328,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 55 S> */ B(ShiftLeftSmi), I8(3), U8(0), @@ -364,9 +346,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(3), @@ -386,9 +367,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 55 S> */ B(ShiftRightSmi), I8(3), U8(0), @@ -405,9 +385,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(3), @@ -427,9 +406,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 55 S> */ B(ShiftRightLogicalSmi), I8(3), U8(0), @@ -446,9 +424,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(10), B(Star), R(0), /* 46 S> */ B(LdaSmi), I8(3), @@ -468,9 +445,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden index e31ab85708..77f55145cc 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden @@ -10,9 +10,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), B(LdaUndefined), /* 34 S> */ B(Return), ] @@ -27,9 +26,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaUndefined), /* 41 S> */ B(Return), ] @@ -44,9 +42,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaNull), /* 46 S> */ B(Return), ] @@ -61,9 +58,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaTrue), /* 46 S> */ B(Return), ] @@ -78,9 +74,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaFalse), /* 47 S> */ B(Return), ] @@ -95,9 +90,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaZero), /* 43 S> */ B(Return), ] @@ -112,9 +106,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(1), /* 44 S> */ B(Return), ] @@ -129,9 +122,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(-1), /* 44 S> */ B(Return), ] @@ -146,9 +138,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(127), /* 46 S> */ B(Return), ] @@ -163,9 +154,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(-128), /* 46 S> */ B(Return), ] @@ -180,9 +170,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(2), /* 45 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorAccess.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorAccess.golden index ff4c255949..7ac886945c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorAccess.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorAccess.golden @@ -24,14 +24,13 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 98 +bytecode array length: 97 bytecodes: [ - /* 67 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 67 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 76 S> */ B(LdaCurrentContextSlot), U8(2), B(Star), R(4), B(LdaCurrentContextSlot), U8(3), @@ -78,15 +77,14 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 48 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), - /* 53 S> */ B(Wide), B(LdaSmi), I16(265), + /* 48 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 53 S> */ B(Wide), B(LdaSmi), I16(266), B(Star), R(3), B(LdaConstant), U8(0), B(Star), R(4), @@ -110,15 +108,14 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 41 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), - /* 46 S> */ B(Wide), B(LdaSmi), I16(264), + /* 41 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 46 S> */ B(Wide), B(LdaSmi), I16(265), B(Star), R(3), B(LdaConstant), U8(0), B(Star), R(4), @@ -142,15 +139,14 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 48 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), - /* 53 S> */ B(Wide), B(LdaSmi), I16(265), + /* 48 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 53 S> */ B(Wide), B(LdaSmi), I16(266), B(Star), R(3), B(LdaConstant), U8(0), B(Star), R(4), @@ -174,15 +170,14 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 41 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), - /* 46 S> */ B(Wide), B(LdaSmi), I16(264), + /* 41 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 46 S> */ B(Wide), B(LdaSmi), I16(265), B(Star), R(4), B(LdaConstant), U8(0), B(Star), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden index cf12be82ba..085e38d7db 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden @@ -17,10 +17,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 65 +bytecode array length: 64 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaConstant), U8(2), B(Star), R(3), @@ -67,10 +66,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 62 +bytecode array length: 61 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaConstant), U8(2), B(Star), R(3), @@ -116,10 +114,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 62 +bytecode array length: 61 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaConstant), U8(2), B(Star), R(3), @@ -171,10 +168,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 127 +bytecode array length: 126 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaConstant), U8(2), B(Star), R(4), @@ -251,10 +247,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 113 +bytecode array length: 112 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), B(Star), R(6), @@ -325,10 +320,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 113 +bytecode array length: 112 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), B(Star), R(6), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden index 90ae0a6688..5e00600435 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden @@ -24,10 +24,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 131 +bytecode array length: 130 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaConstant), U8(2), B(Star), R(4), @@ -130,10 +129,9 @@ snippet: " " frame size: 12 parameter count: 1 -bytecode array length: 268 +bytecode array length: 267 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaConstant), U8(2), B(Star), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodAccess.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodAccess.golden index d413b43af8..cd5dd6f5a6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodAccess.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodAccess.golden @@ -19,14 +19,13 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 31 +bytecode array length: 30 bytecodes: [ - /* 44 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 49 S> */ B(LdaCurrentContextSlot), U8(3), /* 61 E> */ B(LdaKeyedProperty), R(this), U8(0), B(LdaCurrentContextSlot), U8(2), @@ -51,15 +50,14 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 44 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), - /* 49 S> */ B(Wide), B(LdaSmi), I16(263), + /* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 49 S> */ B(Wide), B(LdaSmi), I16(264), B(Star), R(3), B(LdaConstant), U8(0), B(Star), R(4), @@ -84,15 +82,14 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 44 E> */ B(StackCheck), B(LdaCurrentContextSlot), U8(3), B(Star), R(1), B(Mov), R(this), R(0), B(Mov), R(context), R(2), - B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), - /* 49 S> */ B(Wide), B(LdaSmi), I16(263), + /* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), + /* 49 S> */ B(Wide), B(LdaSmi), I16(264), B(Star), R(3), B(LdaConstant), U8(0), B(Star), R(4), @@ -117,10 +114,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 58 +bytecode array length: 57 bytecodes: [ - /* 44 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(1), + /* 44 E> */ B(CreateFunctionContext), U8(0), U8(1), B(PushContext), R(0), B(Ldar), R(this), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden index ef7c245d46..9643de4f23 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden @@ -16,10 +16,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 52 +bytecode array length: 51 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaConstant), U8(2), B(Star), R(3), @@ -64,10 +63,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 101 +bytecode array length: 100 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaConstant), U8(2), B(Star), R(4), @@ -133,10 +131,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 98 +bytecode array length: 97 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), B(Star), R(6), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden index 9d55cd6cb8..2e067b6f53 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 25 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), B(Star), R(0), /* 25 E> */ B(CallProperty0), R(0), R(arg0), U8(2), @@ -34,9 +33,8 @@ snippet: " " frame size: 1 parameter count: 4 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 31 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), B(Star), R(0), /* 31 E> */ B(CallProperty2), R(0), R(arg0), R(arg1), R(arg2), U8(2), @@ -55,9 +53,8 @@ snippet: " " frame size: 3 parameter count: 3 -bytecode array length: 21 +bytecode array length: 20 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 28 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), B(Star), R(0), B(Ldar), R(arg1), @@ -210,9 +207,8 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 543 +bytecode array length: 542 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 26 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 34 S> */ B(LdaNamedProperty), R(0), U8(0), U8(0), @@ -490,9 +486,8 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 51 +bytecode array length: 50 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 25 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), B(Star), R(2), B(LdaSmi), I8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden index e6eacf6fd6..6fd6116f0c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden @@ -22,9 +22,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 77 +bytecode array length: 76 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(2), B(LdaSmi), I8(41), @@ -80,9 +79,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 120 +bytecode array length: 118 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(2), B(LdaSmi), I8(41), @@ -97,8 +95,7 @@ bytecodes: [ B(Star), R(1), B(LdaSmi), I8(5), /* 77 E> */ B(TestLessThan), R(1), U8(6), - B(JumpIfFalse), U8(83), - /* 63 E> */ B(StackCheck), + B(JumpIfFalse), U8(82), /* 97 S> */ B(LdaGlobal), U8(1), U8(7), B(Star), R(1), /* 106 E> */ B(LdaGlobal), U8(1), U8(7), @@ -126,7 +123,7 @@ bytecodes: [ /* 84 S> */ B(LdaGlobal), U8(2), U8(4), B(Inc), U8(19), /* 84 E> */ B(StaGlobal), U8(2), U8(2), - B(JumpLoop), U8(90), I8(0), + /* 63 E> */ B(JumpLoop), U8(89), I8(0), B(Ldar), R(0), /* 171 S> */ B(Return), ] @@ -155,9 +152,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 109 +bytecode array length: 107 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(2), B(LdaSmi), I8(41), @@ -170,8 +166,7 @@ bytecodes: [ B(Star), R(1), B(LdaZero), /* 72 E> */ B(TestGreaterThan), R(1), U8(4), - B(JumpIfFalse), U8(77), - /* 63 E> */ B(StackCheck), + B(JumpIfFalse), U8(76), /* 87 S> */ B(LdaGlobal), U8(1), U8(5), B(Star), R(1), /* 97 E> */ B(LdaGlobal), U8(1), U8(5), @@ -197,7 +192,7 @@ bytecodes: [ /* 130 E> */ B(StaNamedProperty), R(1), U8(4), U8(15), B(Mov), R(2), R(0), B(Ldar), R(2), - B(JumpLoop), U8(83), I8(0), + /* 63 E> */ B(JumpLoop), U8(82), I8(0), B(Ldar), R(0), /* 163 S> */ B(Return), ] @@ -226,9 +221,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 81 +bytecode array length: 79 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(2), B(LdaSmi), I8(41), @@ -239,7 +233,6 @@ bytecodes: [ /* 65 E> */ B(StaGlobal), U8(2), U8(2), B(LdaUndefined), B(Star), R(0), - /* 77 E> */ B(StackCheck), /* 90 S> */ B(LdaGlobal), U8(1), U8(4), B(Star), R(1), /* 99 E> */ B(LdaGlobal), U8(1), U8(4), @@ -258,7 +251,7 @@ bytecodes: [ B(LdaSmi), I8(10), /* 133 E> */ B(TestLessThan), R(1), U8(15), B(JumpIfFalse), U8(5), - B(JumpLoop), U8(50), I8(0), + /* 77 E> */ B(JumpLoop), U8(49), I8(0), B(Ldar), R(0), /* 146 S> */ B(Return), ] @@ -288,9 +281,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 75 +bytecode array length: 74 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(2), B(LdaSmi), I8(41), @@ -339,9 +331,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 20 +bytecode array length: 19 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(3), B(LdaSmi), I8(4), @@ -366,9 +357,8 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 20 +bytecode array length: 19 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), B(Star), R(3), B(LdaSmi), I8(37), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden index fe75e8a344..ef630cfa6f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden @@ -21,9 +21,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 71 +bytecode array length: 70 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), /* 9 E> */ B(StaGlobal), U8(1), U8(1), /* 66 S> */ B(LdaGlobal), U8(1), U8(4), @@ -76,9 +75,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 67 +bytecode array length: 66 bytecodes: [ - /* 0 E> */ B(StackCheck), /* 7 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), /* 9 E> */ B(StaGlobal), U8(1), U8(1), /* 65 S> */ B(LdaGlobal), U8(1), U8(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden index 4b1a1c03a9..e28ded8006 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 25 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), /* 30 S> */ B(Return), ] @@ -32,9 +31,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 24 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), /* 32 S> */ B(Return), ] @@ -51,9 +49,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaSmi), I8(100), /* 24 E> */ B(LdaKeyedProperty), R(arg0), U8(0), /* 30 S> */ B(Return), @@ -70,9 +67,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 19 S> */ B(Ldar), R(arg1), /* 27 E> */ B(LdaKeyedProperty), R(arg0), U8(0), /* 31 S> */ B(Return), @@ -89,9 +85,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 26 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), B(Star), R(0), /* 32 S> */ B(LdaSmi), I8(-124), @@ -242,9 +237,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 525 +bytecode array length: 524 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 26 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 34 S> */ B(LdaNamedProperty), R(0), U8(0), U8(0), @@ -650,9 +644,8 @@ snippet: " " frame size: 1 parameter count: 3 -bytecode array length: 906 +bytecode array length: 905 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 30 S> */ B(Ldar), R(arg1), /* 35 E> */ B(LdaKeyedProperty), R(arg0), U8(0), B(Star), R(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden index 2bb062b707..32e4e31848 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaConstant), U8(0), /* 23 E> */ B(StaNamedProperty), R(arg0), U8(1), U8(0), B(LdaUndefined), @@ -35,9 +34,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaConstant), U8(0), /* 25 E> */ B(StaNamedProperty), R(arg0), U8(1), U8(0), B(LdaUndefined), @@ -57,9 +55,8 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaSmi), I8(100), B(Star), R(1), B(LdaConstant), U8(0), @@ -80,9 +77,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 19 S> */ B(LdaConstant), U8(0), /* 24 E> */ B(StaKeyedProperty), R(arg0), R(arg1), U8(0), B(LdaUndefined), @@ -101,9 +97,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaSmi), I8(-124), /* 26 E> */ B(LdaKeyedProperty), R(arg0), U8(0), /* 23 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(2), @@ -123,9 +118,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 30 S> */ B(LdaConstant), U8(0), /* 37 E> */ B(StaNamedProperty), R(arg0), U8(1), U8(0), B(LdaUndefined), @@ -145,9 +139,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 9 +bytecode array length: 8 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 33 S> */ B(LdaConstant), U8(0), /* 38 E> */ B(StaKeyedProperty), R(arg0), R(arg1), U8(0), B(LdaUndefined), @@ -298,9 +291,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 534 +bytecode array length: 533 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 18 S> */ B(LdaSmi), I8(1), /* 25 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(0), /* 40 S> */ B(CreateEmptyObjectLiteral), @@ -712,9 +704,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 534 +bytecode array length: 533 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 33 S> */ B(LdaSmi), I8(1), /* 40 E> */ B(StaNamedProperty), R(arg0), U8(0), U8(0), /* 55 S> */ B(CreateEmptyObjectLiteral), @@ -1123,9 +1114,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 781 +bytecode array length: 780 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 21 S> */ B(LdaSmi), I8(1), /* 26 E> */ B(StaKeyedProperty), R(arg0), R(arg1), U8(0), /* 33 S> */ B(LdaSmi), I8(1), @@ -1530,9 +1520,8 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 781 +bytecode array length: 780 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 37 S> */ B(LdaSmi), I8(1), /* 42 E> */ B(StaKeyedProperty), R(arg0), R(arg1), U8(0), /* 49 S> */ B(LdaSmi), I8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden index ab5fcf5c4c..a841e05375 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden @@ -23,10 +23,9 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 119 +bytecode array length: 118 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -122,10 +121,9 @@ snippet: " " frame size: 12 parameter count: 1 -bytecode array length: 229 +bytecode array length: 228 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden index 69f63eb8b4..8f43e97280 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), /* 48 S> */ B(Return), ] @@ -29,9 +28,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(2), /* 57 S> */ B(Return), ] @@ -47,9 +45,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), B(Star), R(1), /* 48 E> */ B(LdaNamedProperty), R(1), U8(1), U8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden index 7896ffc3ce..22831a3ff3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden @@ -16,12 +16,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 28 +bytecode array length: 26 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 48 E> */ B(StackCheck), /* 64 S> */ B(Ldar), R(0), /* 76 E> */ B(Add), R(0), U8(0), B(Star), R(0), @@ -29,7 +27,7 @@ bytecodes: [ /* 95 E> */ B(TestGreaterThan), R(0), U8(1), B(JumpIfFalse), U8(4), /* 101 S> */ B(Jump), U8(5), - B(JumpLoop), U8(17), I8(0), + /* 48 E> */ B(JumpLoop), U8(16), I8(0), /* 110 S> */ B(Ldar), R(0), /* 122 S> */ B(Return), ] @@ -49,12 +47,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 23 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaSmi), I8(1), B(Star), R(0), - /* 48 E> */ B(StackCheck), /* 67 S> */ B(Add), R(0), U8(0), B(Star), R(0), /* 77 S> */ B(LdaSmi), I8(10), @@ -77,9 +73,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 10 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 62 S> */ B(Add), R(0), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden index 82a43ae36c..7d7a8d39b3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden @@ -15,20 +15,18 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 26 +bytecode array length: 24 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 30 S> */ B(LdaZero), B(Star), R(0), /* 35 S> */ B(LdaSmi), I8(10), /* 35 E> */ B(TestLessThan), R(0), U8(0), - B(JumpIfFalse), U8(15), - /* 17 E> */ B(StackCheck), + B(JumpIfFalse), U8(14), /* 56 S> */ B(Mov), R(0), R(1), /* 43 S> */ B(Ldar), R(1), B(Inc), U8(1), B(Star), R(0), - B(JumpLoop), U8(17), I8(0), + /* 17 E> */ B(JumpLoop), U8(16), I8(0), B(LdaUndefined), /* 61 S> */ B(Return), ] @@ -46,10 +44,9 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 165 +bytecode array length: 162 bytecodes: [ - /* 10 E> */ B(StackCheck), - B(CreateFunctionContext), U8(0), U8(4), + /* 10 E> */ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(4), B(Ldar), R(this), B(StaCurrentContextSlot), U8(3), @@ -67,8 +64,7 @@ bytecodes: [ B(Star), R(0), B(LdaSmi), I8(1), B(Star), R(1), - /* 59 E> */ B(StackCheck), - B(CreateBlockContext), U8(2), + /* 59 E> */ B(CreateBlockContext), U8(2), B(PushContext), R(6), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -92,11 +88,10 @@ bytecodes: [ B(JumpIfFalse), U8(4), B(Jump), U8(6), B(PopContext), R(6), - B(Jump), U8(77), + B(Jump), U8(76), B(LdaSmi), I8(1), B(TestEqual), R(2), U8(3), - B(JumpIfFalse), U8(54), - /* 17 E> */ B(StackCheck), + B(JumpIfFalse), U8(53), /* 48 S> */ B(LdaLookupGlobalSlot), U8(3), U8(4), U8(3), B(Star), R(7), B(LdaConstant), U8(4), @@ -117,14 +112,14 @@ bytecodes: [ B(Star), R(2), B(LdaCurrentContextSlot), U8(2), B(Star), R(0), - B(JumpLoop), U8(56), I8(1), + /* 17 E> */ B(JumpLoop), U8(55), I8(1), B(LdaSmi), I8(1), - /* 59 E> */ B(TestEqual), R(2), U8(8), + B(TestEqual), R(2), U8(8), B(JumpIfFalse), U8(6), B(PopContext), R(6), B(Jump), U8(7), B(PopContext), R(6), - B(JumpLoop), U8(123), I8(0), + B(JumpLoop), U8(121), I8(0), B(PopContext), R(5), B(LdaUndefined), /* 61 S> */ B(Return), @@ -148,16 +143,14 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 106 +bytecode array length: 103 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 30 S> */ B(LdaZero), B(Star), R(3), B(Star), R(0), B(LdaSmi), I8(1), B(Star), R(1), - /* 78 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 78 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -181,11 +174,10 @@ bytecodes: [ B(JumpIfFalse), U8(4), B(Jump), U8(6), B(PopContext), R(4), - B(Jump), U8(45), + B(Jump), U8(44), B(LdaSmi), I8(1), B(TestEqual), R(2), U8(3), - B(JumpIfFalse), U8(22), - /* 17 E> */ B(StackCheck), + B(JumpIfFalse), U8(21), /* 48 S> */ B(CreateClosure), U8(1), U8(0), U8(2), B(Star), R(5), /* 74 E> */ B(CallUndefinedReceiver0), R(5), U8(4), @@ -193,14 +185,14 @@ bytecodes: [ B(Star), R(2), B(LdaCurrentContextSlot), U8(2), B(Star), R(0), - B(JumpLoop), U8(24), I8(1), + /* 17 E> */ B(JumpLoop), U8(23), I8(1), B(LdaSmi), I8(1), - /* 78 E> */ B(TestEqual), R(2), U8(6), + B(TestEqual), R(2), U8(6), B(JumpIfFalse), U8(6), B(PopContext), R(4), B(Jump), U8(7), B(PopContext), R(4), - B(JumpLoop), U8(91), I8(0), + B(JumpLoop), U8(89), I8(0), B(LdaUndefined), /* 80 S> */ B(Return), ] @@ -220,9 +212,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 44 +bytecode array length: 42 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 37 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(Star), R(3), /* 28 S> */ B(LdaNamedProperty), R(3), U8(1), U8(1), @@ -231,15 +222,14 @@ bytecodes: [ B(Star), R(1), /* 55 S> */ B(LdaZero), /* 55 E> */ B(TestGreaterThan), R(1), U8(5), - B(JumpIfFalse), U8(19), - /* 17 E> */ B(StackCheck), + B(JumpIfFalse), U8(18), /* 75 S> */ B(Ldar), R(1), /* 77 E> */ B(Add), R(0), U8(6), B(Star), R(2), /* 62 S> */ B(Ldar), R(1), B(Dec), U8(7), B(Star), R(1), - B(JumpLoop), U8(20), I8(0), + /* 17 E> */ B(JumpLoop), U8(19), I8(0), B(LdaUndefined), /* 84 S> */ B(Return), ] @@ -260,13 +250,12 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 67 +bytecode array length: 65 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(3), B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0), B(ResumeGenerator), R(0), R(0), U8(3), @@ -281,13 +270,12 @@ bytecodes: [ B(Star), R(1), /* 36 S> */ B(LdaSmi), I8(10), /* 36 E> */ B(TestLessThan), R(1), U8(0), - B(JumpIfFalse), U8(15), - /* 18 E> */ B(StackCheck), + B(JumpIfFalse), U8(14), /* 57 S> */ B(Mov), R(1), R(2), /* 44 S> */ B(Ldar), R(2), B(Inc), U8(1), B(Star), R(1), - B(JumpLoop), U8(17), I8(0), + /* 18 E> */ B(JumpLoop), U8(16), I8(0), B(LdaUndefined), /* 62 S> */ B(Return), ] @@ -308,13 +296,12 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 99 +bytecode array length: 97 bytecodes: [ - /* 11 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(2), B(Mov), R(this), R(3), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), + /* 11 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2), B(Star), R(0), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), B(ResumeGenerator), R(0), R(0), U8(2), @@ -329,8 +316,7 @@ bytecodes: [ B(Star), R(1), /* 36 S> */ B(LdaSmi), I8(10), /* 36 E> */ B(TestLessThan), R(1), U8(0), - B(JumpIfFalse), U8(47), - /* 18 E> */ B(StackCheck), + B(JumpIfFalse), U8(46), /* 47 S> */ B(LdaFalse), B(Star), R(3), B(Mov), R(1), R(2), @@ -347,13 +333,13 @@ bytecodes: [ /* 44 S> */ B(Ldar), R(1), B(Inc), U8(1), B(Star), R(1), - B(JumpLoop), U8(49), I8(0), + /* 18 E> */ B(JumpLoop), U8(48), I8(0), B(LdaUndefined), /* 56 S> */ B(Return), ] constant pool: [ Smi [21], - Smi [67], + Smi [66], Smi [10], Smi [7], Smi [10], @@ -371,31 +357,29 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 81 +bytecode array length: 79 bytecodes: [ - /* 16 E> */ B(StackCheck), B(Mov), R(closure), R(3), B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2), B(Star), R(0), B(Mov), R(context), R(3), /* 36 S> */ B(LdaZero), B(Star), R(1), /* 41 S> */ B(LdaSmi), I8(10), /* 41 E> */ B(TestLessThan), R(1), U8(0), - B(JumpIfFalse), U8(15), - /* 23 E> */ B(StackCheck), + B(JumpIfFalse), U8(14), /* 62 S> */ B(Mov), R(1), R(2), /* 49 S> */ B(Ldar), R(2), B(Inc), U8(1), B(Star), R(1), - B(JumpLoop), U8(17), I8(0), + /* 23 E> */ B(JumpLoop), U8(16), I8(0), B(LdaUndefined), B(Star), R(5), B(LdaFalse), B(Star), R(6), B(Mov), R(0), R(4), - /* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), /* 67 S> */ B(Return), B(Star), R(4), B(CreateCatchContext), R(4), U8(0), @@ -416,7 +400,7 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [16, 53, 53], + [15, 51, 51], ] --- @@ -428,21 +412,19 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 117 +bytecode array length: 115 bytecodes: [ - /* 16 E> */ B(StackCheck), B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(2), B(Mov), R(this), R(3), - B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2), + /* 16 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2), B(Star), R(0), B(Mov), R(context), R(2), /* 36 S> */ B(LdaZero), B(Star), R(1), /* 41 S> */ B(LdaSmi), I8(10), /* 41 E> */ B(TestLessThan), R(1), U8(0), - B(JumpIfFalse), U8(47), - /* 23 E> */ B(StackCheck), + B(JumpIfFalse), U8(46), /* 52 S> */ B(Mov), R(0), R(3), B(Mov), R(1), R(4), B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(3), U8(2), @@ -459,13 +441,13 @@ bytecodes: [ /* 49 S> */ B(Ldar), R(1), B(Inc), U8(1), B(Star), R(1), - B(JumpLoop), U8(49), I8(0), + /* 23 E> */ B(JumpLoop), U8(48), I8(0), B(LdaUndefined), B(Star), R(4), B(LdaTrue), B(Star), R(5), B(Mov), R(0), R(3), - /* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3), /* 61 S> */ B(Return), B(Star), R(3), B(CreateCatchContext), R(3), U8(1), @@ -483,10 +465,10 @@ bytecodes: [ /* 61 S> */ B(Return), ] constant pool: [ - Smi [45], + Smi [44], SCOPE_INFO_TYPE, ] handlers: [ - [20, 89, 89], + [19, 87, 87], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden index e456906b2b..2b7639a885 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden @@ -27,10 +27,9 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 185 +bytecode array length: 184 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), @@ -162,10 +161,9 @@ snippet: " " frame size: 12 parameter count: 1 -bytecode array length: 334 +bytecode array length: 333 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden index 70628162df..352ec83961 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden @@ -19,14 +19,13 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 51 E> */ B(StackCheck), /* 56 S> */ B(LdaCurrentContextSlot), U8(3), B(TestReferenceEqual), R(this), B(Mov), R(this), R(1), B(JumpIfTrue), U8(18), - B(Wide), B(LdaSmi), I16(261), + B(Wide), B(LdaSmi), I16(262), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(3), @@ -55,10 +54,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 51 E> */ B(StackCheck), - /* 56 S> */ B(Wide), B(LdaSmi), I16(263), + /* 56 S> */ B(Wide), B(LdaSmi), I16(264), B(Star), R(0), B(LdaConstant), U8(0), B(Star), R(1), @@ -83,10 +81,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 51 E> */ B(StackCheck), - /* 56 S> */ B(Wide), B(LdaSmi), I16(263), + /* 56 S> */ B(Wide), B(LdaSmi), I16(264), B(Star), R(0), B(LdaConstant), U8(0), B(Star), R(1), @@ -117,16 +114,15 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 143 +bytecode array length: 142 bytecodes: [ - /* 81 E> */ B(StackCheck), /* 90 S> */ B(LdaCurrentContextSlot), U8(2), B(Star), R(1), B(LdaCurrentContextSlot), U8(3), /* 94 E> */ B(TestReferenceEqual), R(this), B(Mov), R(this), R(0), B(JumpIfTrue), U8(18), - B(Wide), B(LdaSmi), I16(261), + B(Wide), B(LdaSmi), I16(262), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(3), @@ -148,7 +144,7 @@ bytecodes: [ /* 109 E> */ B(TestReferenceEqual), R(this), B(Mov), R(this), R(1), B(JumpIfTrue), U8(18), - B(Wide), B(LdaSmi), I16(262), + B(Wide), B(LdaSmi), I16(263), B(Star), R(3), B(LdaConstant), U8(0), B(Star), R(4), @@ -163,7 +159,7 @@ bytecodes: [ /* 133 E> */ B(TestReferenceEqual), R(this), B(Mov), R(this), R(0), B(JumpIfTrue), U8(18), - B(Wide), B(LdaSmi), I16(261), + B(Wide), B(LdaSmi), I16(262), B(Star), R(2), B(LdaConstant), U8(0), B(Star), R(3), @@ -191,10 +187,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 55 E> */ B(StackCheck), - /* 60 S> */ B(Wide), B(LdaSmi), I16(265), + /* 60 S> */ B(Wide), B(LdaSmi), I16(266), B(Star), R(0), B(LdaConstant), U8(0), B(Star), R(1), @@ -218,10 +213,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 48 E> */ B(StackCheck), - /* 53 S> */ B(Wide), B(LdaSmi), I16(264), + /* 53 S> */ B(Wide), B(LdaSmi), I16(265), B(Star), R(0), B(LdaConstant), U8(0), B(Star), R(1), @@ -245,10 +239,9 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 55 E> */ B(StackCheck), - /* 60 S> */ B(Wide), B(LdaSmi), I16(265), + /* 60 S> */ B(Wide), B(LdaSmi), I16(266), B(Star), R(0), B(LdaConstant), U8(0), B(Star), R(1), @@ -272,10 +265,9 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 41 E> */ B(StackCheck), - /* 46 S> */ B(Wide), B(LdaSmi), I16(264), + /* 46 S> */ B(Wide), B(LdaSmi), I16(265), B(Star), R(1), B(LdaConstant), U8(0), B(Star), R(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden index b074e54243..1af4690aa5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden @@ -16,10 +16,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 41 +bytecode array length: 40 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -56,10 +55,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 51 +bytecode array length: 50 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -100,10 +98,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 51 +bytecode array length: 50 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -145,10 +142,9 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 54 +bytecode array length: 53 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), B(Star), R(5), @@ -191,10 +187,9 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 58 +bytecode array length: 57 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateBlockContext), U8(0), + /* 30 E> */ B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaConstant), U8(2), B(Star), R(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden index eed4f0467c..0a2c2995e6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 21 E> */ B(StackCheck), /* 26 S> */ B(LdaSmi), I8(2), /* 28 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), @@ -35,9 +34,8 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 26 E> */ B(StackCheck), /* 32 S> */ B(Ldar), R(arg0), /* 34 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), @@ -57,9 +55,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 35 E> */ B(StackCheck), /* 40 S> */ B(LdaSmi), I8(2), /* 42 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), @@ -79,9 +76,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 17 E> */ B(StackCheck), /* 22 S> */ B(LdaSmi), I8(2), /* 24 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), @@ -232,9 +228,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 526 +bytecode array length: 525 bytecodes: [ - /* 17 E> */ B(StackCheck), /* 33 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 41 S> */ B(LdaNamedProperty), R(0), U8(0), U8(0), @@ -644,9 +639,8 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 526 +bytecode array length: 525 bytecodes: [ - /* 17 E> */ B(StackCheck), /* 49 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 57 S> */ B(LdaNamedProperty), R(0), U8(0), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConcat.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConcat.golden index 3fa52040a8..9e94fe593d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConcat.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConcat.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -41,9 +40,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 26 +bytecode array length: 25 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -71,9 +69,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -99,9 +96,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 43 +bytecode array length: 42 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -138,9 +134,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 29 +bytecode array length: 28 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -170,10 +165,9 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 42 +bytecode array length: 41 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateClosure), U8(0), U8(0), U8(2), + /* 30 E> */ B(CreateClosure), U8(0), U8(0), U8(2), B(Star), R(2), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden index 0f4b595c8e..385c3089c1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaConstant), U8(0), /* 60 S> */ B(Return), ] @@ -29,9 +28,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 58 S> */ B(LdaConstant), U8(1), @@ -50,9 +48,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 57 S> */ B(LdaConstant), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden index 2fd27fcce1..4124d91274 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden @@ -19,10 +19,9 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 19 +bytecode array length: 18 bytecodes: [ - /* 93 E> */ B(StackCheck), - B(CreateRestParameter), + /* 93 E> */ B(CreateRestParameter), B(Star), R(2), B(Mov), R(closure), R(1), /* 93 S> */ B(Ldar), R(1), @@ -51,10 +50,9 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 40 +bytecode array length: 39 bytecodes: [ - /* 128 E> */ B(StackCheck), - B(CreateRestParameter), + /* 128 E> */ B(CreateRestParameter), B(Star), R(3), B(Mov), R(closure), R(1), B(Mov), R(3), R(2), @@ -93,10 +91,9 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 119 +bytecode array length: 118 bytecodes: [ - /* 128 E> */ B(StackCheck), - B(CreateRestParameter), + /* 128 E> */ B(CreateRestParameter), B(Star), R(3), B(Mov), R(closure), R(1), B(Mov), R(3), R(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden index ca596e7a5e..5b12e3fc79 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden @@ -15,9 +15,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 32 +bytecode array length: 31 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(1), @@ -50,9 +49,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 38 +bytecode array length: 37 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(1), @@ -87,9 +85,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(1), @@ -124,9 +121,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 36 +bytecode array length: 35 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(2), @@ -161,9 +157,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 44 +bytecode array length: 43 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(TypeOf), @@ -202,9 +197,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 30 +bytecode array length: 29 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(TypeOf), @@ -303,9 +297,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 290 +bytecode array length: 289 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(1), @@ -472,9 +465,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 58 +bytecode array length: 57 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), I8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TemplateLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TemplateLiterals.golden index c85f155947..b7821fa66c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TemplateLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TemplateLiterals.golden @@ -13,9 +13,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 28 +bytecode array length: 27 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -45,9 +44,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 28 +bytecode array length: 27 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -77,9 +75,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 28 +bytecode array length: 27 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -109,9 +106,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 50 +bytecode array length: 49 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -153,9 +149,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 35 +bytecode array length: 34 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 53 S> */ B(LdaSmi), I8(2), @@ -189,10 +184,9 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 45 +bytecode array length: 44 bytecodes: [ - /* 30 E> */ B(StackCheck), - B(CreateClosure), U8(0), U8(0), U8(2), + /* 30 E> */ B(CreateClosure), U8(0), U8(0), U8(2), B(Star), R(2), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden index 6c65fda872..557d0b4487 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden @@ -14,9 +14,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 3 +bytecode array length: 2 bytecodes: [ - /* 21 E> */ B(StackCheck), B(LdaUndefined), /* 25 S> */ B(Return), ] @@ -33,9 +32,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 21 E> */ B(StackCheck), B(Mov), R(closure), R(0), /* 26 S> */ B(Ldar), R(0), /* 35 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden index 73e203a60b..35926e7711 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaSmi), I8(1), /* 34 E> */ B(Throw), ] @@ -28,9 +27,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 3 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaConstant), U8(0), /* 34 E> */ B(Throw), ] @@ -46,9 +44,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(JumpIfToBooleanFalse), U8(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden index c3e04111aa..f080925637 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden @@ -12,13 +12,12 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 34 +bytecode array length: 33 bytecodes: [ - /* 0 E> */ B(StackCheck), B(LdaConstant), U8(0), B(Star), R(1), B(Mov), R(closure), R(2), - B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), + /* 0 E> */ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), /* 8 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41), B(Star), R(1), /* 16 E> */ B(CreateClosure), U8(2), U8(0), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden index ec70270dae..5a299760ab 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ - /* 30 E> */ B(StackCheck), B(Mov), R(context), R(0), /* 40 S> */ B(LdaSmi), I8(1), /* 49 S> */ B(Return), @@ -31,7 +30,7 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [4, 7, 7], + [3, 6, 6], ] --- @@ -42,9 +41,8 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 55 +bytecode array length: 54 bytecodes: [ - /* 30 E> */ B(StackCheck), B(Mov), R(context), R(1), /* 47 S> */ B(LdaSmi), I8(1), B(Star), R(0), @@ -79,7 +77,7 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [4, 8, 10], - [28, 32, 34], + [3, 7, 9], + [27, 31, 33], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden index 22d4e0c154..d06342c1b8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden @@ -12,9 +12,8 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 46 +bytecode array length: 45 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Mov), R(context), R(3), @@ -45,7 +44,7 @@ bytecodes: [ constant pool: [ ] handlers: [ - [8, 12, 20], + [7, 11, 19], ] --- @@ -55,9 +54,8 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 70 +bytecode array length: 69 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), B(Mov), R(context), R(3), @@ -101,8 +99,8 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [8, 36, 44], - [11, 15, 17], + [7, 35, 43], + [10, 14, 16], ] --- @@ -113,9 +111,8 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 90 +bytecode array length: 89 bytecodes: [ - /* 30 E> */ B(StackCheck), B(Mov), R(context), R(3), B(Mov), R(context), R(4), B(Mov), R(context), R(5), @@ -170,8 +167,8 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [4, 56, 64], - [7, 35, 37], - [10, 14, 16], + [3, 55, 63], + [6, 34, 36], + [9, 13, 15], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden index bd73b4acdb..ea335954e0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden @@ -16,9 +16,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 6 bytecodes: [ - /* 10 E> */ B(StackCheck), /* 24 S> */ B(LdaSmi), I8(13), B(Star), R(0), /* 29 S> */ B(TypeOf), @@ -39,9 +38,8 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 6 +bytecode array length: 5 bytecodes: [ - /* 22 E> */ B(StackCheck), /* 28 S> */ B(LdaGlobalInsideTypeof), U8(0), U8(0), B(TypeOf), /* 45 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden index b8b4c4bde8..b564000c3b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden @@ -15,19 +15,17 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 25 +bytecode array length: 23 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 54 S> */ B(LdaSmi), I8(10), /* 54 E> */ B(TestEqual), R(0), U8(0), - B(JumpIfTrue), U8(13), - /* 45 E> */ B(StackCheck), + B(JumpIfTrue), U8(12), /* 65 S> */ B(Ldar), R(0), /* 71 E> */ B(AddSmi), I8(10), U8(1), B(Star), R(0), - B(JumpLoop), U8(15), I8(0), + /* 45 E> */ B(JumpLoop), U8(14), I8(0), /* 79 S> */ B(Ldar), R(0), /* 88 S> */ B(Return), ] @@ -46,19 +44,17 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 22 +bytecode array length: 20 bytecodes: [ - /* 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), U8(0), B(JumpIfFalse), U8(5), - B(JumpLoop), U8(12), I8(0), + /* 49 E> */ B(JumpLoop), U8(11), I8(0), /* 85 S> */ B(Ldar), R(0), /* 94 S> */ B(Return), ] @@ -74,9 +70,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 10 +bytecode array length: 9 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(101), B(Star), R(0), /* 61 S> */ B(MulSmi), I8(3), U8(0), @@ -96,9 +91,8 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 17 +bytecode array length: 16 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(Wide), B(LdaSmi), I16(1234), B(Star), R(0), /* 64 S> */ B(Mul), R(0), U8(1), @@ -119,9 +113,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(13), B(Star), R(0), /* 53 S> */ B(BitwiseNot), U8(0), @@ -139,9 +132,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(13), B(Star), R(0), /* 53 S> */ B(ToNumber), U8(0), @@ -159,9 +151,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 8 +bytecode array length: 7 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), I8(13), B(Star), R(0), /* 53 S> */ B(Negate), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden index 066d6e9f03..afbe8e89a4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden @@ -169,9 +169,8 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 547 +bytecode array length: 546 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), @@ -659,9 +658,8 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 549 +bytecode array length: 548 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), @@ -1149,9 +1147,8 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 555 +bytecode array length: 554 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), @@ -1645,9 +1642,8 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 576 +bytecode array length: 575 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), @@ -2147,9 +2143,8 @@ snippet: " " frame size: 158 parameter count: 1 -bytecode array length: 593 +bytecode array length: 591 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), @@ -2472,8 +2467,7 @@ bytecodes: [ B(Wide), B(Star), R16(128), /* 2166 S> */ B(LdaSmi), I8(64), /* 2166 E> */ B(Wide), B(TestLessThan), R16(128), U16(0), - B(JumpIfFalse), U8(31), - /* 2146 E> */ B(StackCheck), + B(JumpIfFalse), U8(30), /* 2183 S> */ B(Wide), B(Ldar), R16(128), /* 2189 E> */ B(Add), R(1), U8(1), B(Wide), B(Mov), R16(1), R16(157), @@ -2481,7 +2475,7 @@ bytecodes: [ /* 2176 S> */ B(Wide), B(Ldar), R16(128), B(Inc), U8(2), B(Wide), B(Star), R16(128), - B(JumpLoop), U8(36), I8(0), + /* 2146 E> */ B(JumpLoop), U8(35), I8(0), /* 2195 S> */ B(Wide), B(Ldar), R16(128), /* 2207 S> */ B(Return), ] @@ -2655,9 +2649,8 @@ snippet: " " frame size: 163 parameter count: 1 -bytecode array length: 624 +bytecode array length: 622 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), @@ -2977,25 +2970,24 @@ bytecodes: [ /* 2146 S> */ B(LdaZero), B(Star), R(1), /* 2162 S> */ B(Ldar), R(0), - B(JumpIfUndefinedOrNull), U8(72), + B(JumpIfUndefinedOrNull), U8(71), B(Wide), B(ToObject), R16(157), B(Wide), B(ForInEnumerate), R16(157), B(Wide), B(ForInPrepare), R16(158), U16(0), B(LdaZero), B(Wide), B(Star), R16(161), /* 2154 S> */ B(Wide), B(ForInContinue), R16(161), R16(160), - B(JumpIfFalse), U8(45), + B(JumpIfFalse), U8(44), B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(0), - B(JumpIfUndefined), U8(22), + B(JumpIfUndefined), U8(21), B(Wide), B(Star), R16(128), - /* 2149 E> */ B(StackCheck), /* 2169 S> */ B(Wide), B(Ldar), R16(128), /* 2175 E> */ B(Add), R(1), U8(1), B(Wide), B(Mov), R16(1), R16(162), B(Star), R(1), /* 2172 E> */ B(Wide), B(ForInStep), R16(161), B(Wide), B(Star), R16(161), - B(JumpLoop), U8(48), I8(0), + /* 2149 E> */ B(JumpLoop), U8(47), I8(0), /* 2181 S> */ B(Ldar), R(1), /* 2191 S> */ B(Return), ] @@ -3170,9 +3162,8 @@ snippet: " " frame size: 159 parameter count: 1 -bytecode array length: 590 +bytecode array length: 589 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaZero), B(Star), R(0), /* 55 S> */ B(LdaZero), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden index 0b44c07300..0ffcdab0da 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden @@ -11,9 +11,8 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ - /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), B(ToObject), R(0), B(CreateWithContext), R(0), U8(1), diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.h b/deps/v8/test/cctest/interpreter/interpreter-tester.h index fbc2666c10..64c9a90ca4 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.h +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.h @@ -20,34 +20,54 @@ namespace v8 { namespace internal { namespace interpreter { -MaybeHandle<Object> CallInterpreter(Isolate* isolate, - Handle<JSFunction> function); template <class... A> static MaybeHandle<Object> CallInterpreter(Isolate* isolate, Handle<JSFunction> function, - A... args) { - Handle<Object> argv[] = {args...}; - return Execution::Call(isolate, function, - isolate->factory()->undefined_value(), sizeof...(args), - argv); + Handle<Object> receiver, A... args) { + // Pad the array with an empty handle to ensure that argv size is at least 1. + // It avoids MSVC error C2466. + Handle<Object> argv[] = {args..., Handle<Object>()}; + return Execution::Call(isolate, function, receiver, sizeof...(args), argv); } template <class... A> class InterpreterCallable { public: + virtual ~InterpreterCallable() = default; + + FeedbackVector vector() const { return function_->feedback_vector(); } + + protected: InterpreterCallable(Isolate* isolate, Handle<JSFunction> function) : isolate_(isolate), function_(function) {} - virtual ~InterpreterCallable() = default; + + Isolate* isolate_; + Handle<JSFunction> function_; +}; + +template <class... A> +class InterpreterCallableUndefinedReceiver : public InterpreterCallable<A...> { + public: + InterpreterCallableUndefinedReceiver(Isolate* isolate, + Handle<JSFunction> function) + : InterpreterCallable<A...>(isolate, function) {} MaybeHandle<Object> operator()(A... args) { - return CallInterpreter(isolate_, function_, args...); + return CallInterpreter(this->isolate_, this->function_, + this->isolate_->factory()->undefined_value(), + args...); } +}; - FeedbackVector vector() const { return function_->feedback_vector(); } +template <class... A> +class InterpreterCallableWithReceiver : public InterpreterCallable<A...> { + public: + InterpreterCallableWithReceiver(Isolate* isolate, Handle<JSFunction> function) + : InterpreterCallable<A...>(isolate, function) {} - private: - Isolate* isolate_; - Handle<JSFunction> function_; + MaybeHandle<Object> operator()(Handle<Object> receiver, A... args) { + return CallInterpreter(this->isolate_, this->function_, receiver, args...); + } }; class InterpreterTester { @@ -68,8 +88,15 @@ class InterpreterTester { virtual ~InterpreterTester(); template <class... A> - InterpreterCallable<A...> GetCallable() { - return InterpreterCallable<A...>(isolate_, GetBytecodeFunction<A...>()); + InterpreterCallableUndefinedReceiver<A...> GetCallable() { + return InterpreterCallableUndefinedReceiver<A...>( + isolate_, GetBytecodeFunction<A...>()); + } + + template <class... A> + InterpreterCallableWithReceiver<A...> GetCallableWithReceiver() { + return InterpreterCallableWithReceiver<A...>(isolate_, + GetBytecodeFunction<A...>()); } Local<Message> CheckThrowsReturnMessage(); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc index 3e1c006f20..6889747e17 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -28,9 +28,23 @@ class InvokeIntrinsicHelper { template <class... A> Handle<Object> Invoke(A... args) { CHECK(IntrinsicsHelper::IsSupported(function_id_)); - BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, nullptr); + int parameter_count = sizeof...(args); +#ifdef V8_REVERSE_JSARGS + // Move the parameter to locals, since the order of the + // arguments in the stack is reversed. + BytecodeArrayBuilder builder(zone_, parameter_count + 1, parameter_count, + nullptr); + for (int i = 0; i < parameter_count; i++) { + builder.MoveRegister(builder.Parameter(i), builder.Local(i)); + } + RegisterList reg_list = + InterpreterTester::NewRegisterList(0, parameter_count); +#else + // Add the receiver in the parameter count. + BytecodeArrayBuilder builder(zone_, parameter_count + 1, 0, nullptr); RegisterList reg_list = InterpreterTester::NewRegisterList( - builder.Receiver().index(), sizeof...(args)); + builder.Parameter(0).index(), parameter_count); +#endif builder.CallRuntime(function_id_, reg_list).Return(); InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_)); auto callable = tester.GetCallable<A...>(); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index 8f687fdc8b..33daf581c7 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -170,7 +170,7 @@ TEST(InterpreterLoadLiteral) { builder.LoadLiteral(-2.1e19).Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); @@ -189,14 +189,13 @@ TEST(InterpreterLoadLiteral) { const AstRawString* raw_string = ast_factory.GetOneByteString("String"); builder.LoadLiteral(raw_string).Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); - CHECK(i::String::cast(*return_val) - .Equals(*raw_string->string().get<Factory>())); + CHECK(i::String::cast(*return_val).Equals(*raw_string->string())); } } @@ -535,7 +534,7 @@ TEST(InterpreterStringAdd) { builder.LoadLiteral(test_cases[i].lhs).StoreAccumulatorInRegister(reg); LoadLiteralForTest(&builder, test_cases[i].rhs); builder.BinaryOperation(Token::Value::ADD, reg, GetIndex(slot)).Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); @@ -551,7 +550,7 @@ TEST(InterpreterStringAdd) { } } -TEST(InterpreterParameter1) { +TEST(InterpreterReceiverParameter) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Zone* zone = handles.main_zone(); @@ -560,6 +559,24 @@ TEST(InterpreterParameter1) { builder.LoadAccumulatorWithRegister(builder.Receiver()).Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); + + InterpreterTester tester(isolate, bytecode_array); + auto callable = tester.GetCallableWithReceiver<>(); + Handle<Object> return_val = callable(object).ToHandleChecked(); + + CHECK(return_val.is_identical_to(object)); +} + +TEST(InterpreterParameter0) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); + BytecodeArrayBuilder builder(zone, 2, 0); + + builder.LoadAccumulatorWithRegister(builder.Parameter(0)).Return(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<Handle<Object>>(); @@ -603,12 +620,12 @@ TEST(InterpreterParameter8) { .BinaryOperation(Token::Value::ADD, builder.Parameter(5), GetIndex(slot5)) .BinaryOperation(Token::Value::ADD, builder.Parameter(6), GetIndex(slot6)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); using H = Handle<Object>; - auto callable = tester.GetCallable<H, H, H, H, H, H, H, H>(); + auto callable = tester.GetCallableWithReceiver<H, H, H, H, H, H, H>(); Handle<Smi> arg1 = Handle<Smi>(Smi::FromInt(1), handles.main_isolate()); Handle<Smi> arg2 = Handle<Smi>(Smi::FromInt(2), handles.main_isolate()); @@ -743,7 +760,7 @@ TEST(InterpreterBinaryOpTypeFeedback) { LoadLiteralForTest(&builder, test_case.arg2); builder.BinaryOperation(test_case.op, reg, GetIndex(slot0)).Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); @@ -849,7 +866,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { .BinaryOperation(test_case.op, reg, GetIndex(slot0)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); @@ -891,7 +908,7 @@ TEST(InterpreterUnaryOpFeedback) { {Token::Value::DEC, smi_one, smi_min, number, bigint, str}}; for (TestCase const& test_case : kTestCases) { i::FeedbackVectorSpec feedback_spec(zone); - BytecodeArrayBuilder builder(zone, 5, 0, &feedback_spec); + BytecodeArrayBuilder builder(zone, 6, 0, &feedback_spec); i::FeedbackSlot slot0 = feedback_spec.AddBinaryOpICSlot(); i::FeedbackSlot slot1 = feedback_spec.AddBinaryOpICSlot(); @@ -902,15 +919,15 @@ TEST(InterpreterUnaryOpFeedback) { Handle<i::FeedbackMetadata> metadata = i::NewFeedbackMetadata(isolate, &feedback_spec); - builder.LoadAccumulatorWithRegister(builder.Receiver()) + builder.LoadAccumulatorWithRegister(builder.Parameter(0)) .UnaryOperation(test_case.op, GetIndex(slot0)) - .LoadAccumulatorWithRegister(builder.Parameter(0)) - .UnaryOperation(test_case.op, GetIndex(slot1)) .LoadAccumulatorWithRegister(builder.Parameter(1)) - .UnaryOperation(test_case.op, GetIndex(slot2)) + .UnaryOperation(test_case.op, GetIndex(slot1)) .LoadAccumulatorWithRegister(builder.Parameter(2)) - .UnaryOperation(test_case.op, GetIndex(slot3)) + .UnaryOperation(test_case.op, GetIndex(slot2)) .LoadAccumulatorWithRegister(builder.Parameter(3)) + .UnaryOperation(test_case.op, GetIndex(slot3)) + .LoadAccumulatorWithRegister(builder.Parameter(4)) .UnaryOperation(test_case.op, GetIndex(slot4)) .Return(); @@ -959,7 +976,7 @@ TEST(InterpreterBitwiseTypeFeedback) { for (Token::Value op : kBitwiseBinaryOperators) { i::FeedbackVectorSpec feedback_spec(zone); - BytecodeArrayBuilder builder(zone, 4, 0, &feedback_spec); + BytecodeArrayBuilder builder(zone, 5, 0, &feedback_spec); i::FeedbackSlot slot0 = feedback_spec.AddBinaryOpICSlot(); i::FeedbackSlot slot1 = feedback_spec.AddBinaryOpICSlot(); @@ -968,10 +985,10 @@ TEST(InterpreterBitwiseTypeFeedback) { Handle<i::FeedbackMetadata> metadata = i::NewFeedbackMetadata(isolate, &feedback_spec); - builder.LoadAccumulatorWithRegister(builder.Receiver()) - .BinaryOperation(op, builder.Parameter(0), GetIndex(slot0)) - .BinaryOperation(op, builder.Parameter(1), GetIndex(slot1)) - .BinaryOperation(op, builder.Parameter(2), GetIndex(slot2)) + builder.LoadAccumulatorWithRegister(builder.Parameter(0)) + .BinaryOperation(op, builder.Parameter(1), GetIndex(slot0)) + .BinaryOperation(op, builder.Parameter(2), GetIndex(slot1)) + .BinaryOperation(op, builder.Parameter(3), GetIndex(slot2)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -1015,7 +1032,7 @@ TEST(InterpreterParameter1Assign) { Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> return_val = callable(Handle<Smi>(Smi::FromInt(3), handles.main_isolate())) @@ -1146,11 +1163,11 @@ TEST(InterpreterLoadNamedProperty) { BytecodeArrayBuilder builder(zone, 1, 0, &feedback_spec); builder.LoadNamedProperty(builder.Receiver(), name, GetIndex(slot)).Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); // Test IC miss. @@ -1200,11 +1217,11 @@ TEST(InterpreterLoadKeyedProperty) { builder.LoadLiteral(key) .LoadKeyedProperty(builder.Receiver(), GetIndex(slot)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject("({ key : 123 })"); // Test IC miss. @@ -1243,11 +1260,11 @@ TEST(InterpreterStoreNamedProperty) { .StoreNamedProperty(builder.Receiver(), name, GetIndex(slot), LanguageMode::kStrict) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); // Test IC miss. Handle<Object> result; @@ -1308,11 +1325,11 @@ TEST(InterpreterStoreKeyedProperty) { .StoreKeyedProperty(builder.Receiver(), Register(0), GetIndex(slot), i::LanguageMode::kSloppy) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); // Test IC miss. Handle<Object> result; @@ -1368,11 +1385,11 @@ TEST(InterpreterCall) { builder.CallProperty(reg, args, call_slot_index); builder.Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject( "new (function Obj() { this.func = function() { return 0x265; }})()"); @@ -1390,11 +1407,11 @@ TEST(InterpreterCall) { .MoveRegister(builder.Receiver(), args[0]); builder.CallProperty(reg, args, call_slot_index); builder.Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject( "new (function Obj() {" @@ -1424,11 +1441,11 @@ TEST(InterpreterCall) { builder.Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject( "new (function Obj() { " @@ -1473,11 +1490,11 @@ TEST(InterpreterCall) { builder.Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - auto callable = tester.GetCallable<Handle<Object>>(); + auto callable = tester.GetCallableWithReceiver<>(); Handle<Object> object = InterpreterTester::NewObject( "new (function Obj() { " @@ -1538,7 +1555,7 @@ TEST(InterpreterJumps) { IncrementRegister(&builder, reg, 1, scratch, GetIndex(slot)).Jump(&label[1]); SetRegister(&builder, reg, 2048, scratch).Bind(&label[0]); IncrementRegister(&builder, reg, 2, scratch, GetIndex(slot1)) - .JumpLoop(&loop_header, 0); + .JumpLoop(&loop_header, 0, 0); SetRegister(&builder, reg, 4096, scratch).Bind(&label[1]); IncrementRegister(&builder, reg, 4, scratch, GetIndex(slot2)) .LoadAccumulatorWithRegister(reg) @@ -1691,7 +1708,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { builder.LoadAccumulatorWithRegister(reg); builder.Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); BytecodeArrayIterator iterator(bytecode_array); @@ -1735,7 +1752,7 @@ TEST(InterpreterJumpWith32BitOperand) { builder.Bind(&done); builder.Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); BytecodeArrayIterator iterator(bytecode_array); @@ -1873,7 +1890,7 @@ TEST(InterpreterHeapNumberComparisons) { .CompareOperation(comparison, r0, GetIndex(slot)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); @@ -1920,7 +1937,7 @@ TEST(InterpreterBigIntComparisons) { .CompareOperation(comparison, r0, GetIndex(slot)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); @@ -1968,7 +1985,7 @@ TEST(InterpreterStringComparisons) { .CompareOperation(comparison, r0, GetIndex(slot)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); @@ -2080,7 +2097,7 @@ TEST(InterpreterMixedComparisons) { builder.CompareOperation(comparison, lhs_reg, GetIndex(slot)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); @@ -2208,8 +2225,8 @@ TEST(InterpreterCompareTypeOf) { LiteralFlag literal_flag = kLiterals[l]; if (literal_flag == LiteralFlag::kOther) continue; - BytecodeArrayBuilder builder(zone, 1, 0); - builder.LoadAccumulatorWithRegister(builder.Receiver()) + BytecodeArrayBuilder builder(zone, 2, 0); + builder.LoadAccumulatorWithRegister(builder.Parameter(0)) .CompareTypeOf(kLiterals[l]) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -2295,7 +2312,7 @@ TEST(InterpreterTestIn) { .CompareOperation(Token::Value::IN, r0, GetIndex(slot)) .Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); auto callable = tester.GetCallable<>(); @@ -2353,7 +2370,7 @@ TEST(InterpreterUnaryNotNonBoolean) { Register r0(0); LoadLiteralForTest(&builder, object_type_tuples[i].first); builder.LogicalNot(ToBooleanMode::kConvertToBoolean).Return(); - ast_factory.Internalize(isolate->factory()); + ast_factory.Internalize(isolate); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array); auto callable = tester.GetCallable<>(); @@ -5012,7 +5029,7 @@ TEST(InterpreterGenerators) { } } -#ifndef V8_TARGET_ARCH_ARM +#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X) TEST(InterpreterWithNativeStack) { i::FLAG_interpreted_frames_native_stack = true; @@ -5034,7 +5051,7 @@ TEST(InterpreterWithNativeStack) { CHECK(code.is_interpreter_trampoline_builtin()); CHECK_NE(code.address(), interpreter_entry_trampoline->address()); } -#endif // V8_TARGET_ARCH_ARM +#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X TEST(InterpreterGetBytecodeHandler) { HandleAndZoneScope handles; diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc index 28687cef5b..35b7048bb0 100644 --- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc +++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc @@ -331,8 +331,8 @@ TEST(Utf8AdvanceUntilOverChunkBoundaries) { for (size_t i = 1; i < len; i++) { // Copy source string into buffer, splitting it at i. // Then add three chunks, 0..i-1, i..strlen-1, empty. - memcpy(buffer, unicode_utf8, i); - memcpy(buffer + i + 1, unicode_utf8 + i, len - i); + strncpy(buffer, unicode_utf8, i); + strncpy(buffer + i + 1, unicode_utf8 + i, len - i); buffer[i] = '\0'; buffer[len + 1] = '\n'; buffer[len + 2] = '\0'; @@ -360,8 +360,8 @@ TEST(Utf8ChunkBoundaries) { for (size_t i = 1; i < len; i++) { // Copy source string into buffer, splitting it at i. // Then add three chunks, 0..i-1, i..strlen-1, empty. - memcpy(buffer, unicode_utf8, i); - memcpy(buffer + i + 1, unicode_utf8 + i, len - i); + strncpy(buffer, unicode_utf8, i); + strncpy(buffer + i + 1, unicode_utf8 + i, len - i); buffer[i] = '\0'; buffer[len + 1] = '\0'; buffer[len + 2] = '\0'; diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc index e0c93501c2..ec14e8d0c2 100644 --- a/deps/v8/test/cctest/test-accessors.cc +++ b/deps/v8/test/cctest/test-accessors.cc @@ -298,13 +298,10 @@ static void HandleAllocatingGetter( const v8::PropertyCallbackInfo<v8::Value>& info) { ApiTestFuzzer::Fuzz(); for (int i = 0; i < C; i++) { - v8::String::NewFromUtf8(info.GetIsolate(), "foo", - v8::NewStringType::kNormal) - .ToLocalChecked(); + USE(v8::String::NewFromUtf8Literal(info.GetIsolate(), "foo")); } - info.GetReturnValue().Set(v8::String::NewFromUtf8(info.GetIsolate(), "foo", - v8::NewStringType::kNormal) - .ToLocalChecked()); + info.GetReturnValue().Set( + v8::String::NewFromUtf8Literal(info.GetIsolate(), "foo")); } diff --git a/deps/v8/test/cctest/test-api-array-buffer.cc b/deps/v8/test/cctest/test-api-array-buffer.cc index 9ce26323d8..b15fe80151 100644 --- a/deps/v8/test/cctest/test-api-array-buffer.cc +++ b/deps/v8/test/cctest/test-api-array-buffer.cc @@ -636,6 +636,43 @@ TEST(SharedArrayBuffer_NewBackingStore_CustomDeleter) { CHECK(backing_store_custom_called); } +TEST(ArrayBuffer_NewBackingStore_EmptyDeleter) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope handle_scope(isolate); + char static_buffer[100]; + std::unique_ptr<v8::BackingStore> backing_store = + v8::ArrayBuffer::NewBackingStore(static_buffer, sizeof(static_buffer), + v8::BackingStore::EmptyDeleter, nullptr); + uint64_t external_memory_before = + isolate->AdjustAmountOfExternalAllocatedMemory(0); + v8::ArrayBuffer::New(isolate, std::move(backing_store)); + uint64_t external_memory_after = + isolate->AdjustAmountOfExternalAllocatedMemory(0); + // The ArrayBuffer constructor does not increase the external memory counter. + // The counter may decrease however if the allocation triggers GC. + CHECK_GE(external_memory_before, external_memory_after); +} + +TEST(SharedArrayBuffer_NewBackingStore_EmptyDeleter) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope handle_scope(isolate); + char static_buffer[100]; + std::unique_ptr<v8::BackingStore> backing_store = + v8::SharedArrayBuffer::NewBackingStore( + static_buffer, sizeof(static_buffer), v8::BackingStore::EmptyDeleter, + nullptr); + uint64_t external_memory_before = + isolate->AdjustAmountOfExternalAllocatedMemory(0); + v8::SharedArrayBuffer::New(isolate, std::move(backing_store)); + uint64_t external_memory_after = + isolate->AdjustAmountOfExternalAllocatedMemory(0); + // The SharedArrayBuffer constructor does not increase the external memory + // counter. The counter may decrease however if the allocation triggers GC. + CHECK_GE(external_memory_before, external_memory_after); +} + THREADED_TEST(BackingStore_NotShared) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -729,46 +766,6 @@ TEST(BackingStore_HoldAllocatorAlive_UntilIsolateShutdown) { CHECK(allocator_weak.expired()); } -class NullptrAllocator final : public v8::ArrayBuffer::Allocator { - public: - void* Allocate(size_t length) override { - CHECK_EQ(length, 0); - return nullptr; - } - void* AllocateUninitialized(size_t length) override { - CHECK_EQ(length, 0); - return nullptr; - } - void Free(void* data, size_t length) override { CHECK_EQ(data, nullptr); } -}; - -TEST(BackingStore_ReleaseAllocator_NullptrBackingStore) { - std::shared_ptr<NullptrAllocator> allocator = - std::make_shared<NullptrAllocator>(); - std::weak_ptr<NullptrAllocator> allocator_weak(allocator); - - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator_shared = allocator; - v8::Isolate* isolate = v8::Isolate::New(create_params); - isolate->Enter(); - - allocator.reset(); - create_params.array_buffer_allocator_shared.reset(); - CHECK(!allocator_weak.expired()); - - { - std::shared_ptr<v8::BackingStore> backing_store = - v8::ArrayBuffer::NewBackingStore(isolate, 0); - // This should release a reference to the allocator, even though the - // buffer is empty/nullptr. - backing_store.reset(); - } - - isolate->Exit(); - isolate->Dispose(); - CHECK(allocator_weak.expired()); -} - TEST(BackingStore_HoldAllocatorAlive_AfterIsolateShutdown) { std::shared_ptr<DummyAllocator> allocator = std::make_shared<DummyAllocator>(); @@ -801,3 +798,74 @@ TEST(BackingStore_HoldAllocatorAlive_AfterIsolateShutdown) { backing_store.reset(); CHECK(allocator_weak.expired()); } + +TEST(BackingStore_ReallocateExpand) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + std::unique_ptr<v8::BackingStore> backing_store = + v8::ArrayBuffer::NewBackingStore(isolate, 10); + { + uint8_t* data = reinterpret_cast<uint8_t*>( + reinterpret_cast<uintptr_t>(backing_store->Data())); + for (uint8_t i = 0; i < 10; i++) { + data[i] = i; + } + } + std::unique_ptr<v8::BackingStore> new_backing_store = + v8::BackingStore::Reallocate(isolate, std::move(backing_store), 20); + CHECK_EQ(new_backing_store->ByteLength(), 20); + CHECK(!new_backing_store->IsShared()); + { + uint8_t* data = reinterpret_cast<uint8_t*>( + reinterpret_cast<uintptr_t>(new_backing_store->Data())); + for (uint8_t i = 0; i < 10; i++) { + CHECK_EQ(data[i], i); + } + for (uint8_t i = 10; i < 20; i++) { + CHECK_EQ(data[i], 0); + } + } +} + +TEST(BackingStore_ReallocateShrink) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + std::unique_ptr<v8::BackingStore> backing_store = + v8::ArrayBuffer::NewBackingStore(isolate, 20); + { + uint8_t* data = reinterpret_cast<uint8_t*>(backing_store->Data()); + for (uint8_t i = 0; i < 20; i++) { + data[i] = i; + } + } + std::unique_ptr<v8::BackingStore> new_backing_store = + v8::BackingStore::Reallocate(isolate, std::move(backing_store), 10); + CHECK_EQ(new_backing_store->ByteLength(), 10); + CHECK(!new_backing_store->IsShared()); + { + uint8_t* data = reinterpret_cast<uint8_t*>(new_backing_store->Data()); + for (uint8_t i = 0; i < 10; i++) { + CHECK_EQ(data[i], i); + } + } +} + +TEST(BackingStore_ReallocateNotShared) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + std::unique_ptr<v8::BackingStore> backing_store = + v8::ArrayBuffer::NewBackingStore(isolate, 20); + std::unique_ptr<v8::BackingStore> new_backing_store = + v8::BackingStore::Reallocate(isolate, std::move(backing_store), 10); + CHECK(!new_backing_store->IsShared()); +} + +TEST(BackingStore_ReallocateShared) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + std::unique_ptr<v8::BackingStore> backing_store = + v8::SharedArrayBuffer::NewBackingStore(isolate, 20); + std::unique_ptr<v8::BackingStore> new_backing_store = + v8::BackingStore::Reallocate(isolate, std::move(backing_store), 10); + CHECK(new_backing_store->IsShared()); +} diff --git a/deps/v8/test/cctest/test-api-stack-traces.cc b/deps/v8/test/cctest/test-api-stack-traces.cc index bceba18c4a..cc6795ba51 100644 --- a/deps/v8/test/cctest/test-api-stack-traces.cc +++ b/deps/v8/test/cctest/test-api-stack-traces.cc @@ -339,7 +339,7 @@ TEST(CaptureStackTrace) { CHECK(detailed_result->IsObject()); // Test using function.name and function.displayName in stack trace - const char* function_name_source = + const char function_name_source[] = "function bar(function_name, display_name, testGroup) {\n" " var f = new Function(`AnalyzeStackInNativeCode(${testGroup});`);\n" " if (function_name) {\n" @@ -356,9 +356,7 @@ TEST(CaptureStackTrace) { "bar('function.name', 239, 6);\n" "bar(239, undefined, 7);\n"; v8::Local<v8::String> function_name_src = - v8::String::NewFromUtf8(isolate, function_name_source, - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(isolate, function_name_source); v8::ScriptCompiler::Source script_source3(function_name_src, v8::ScriptOrigin(origin)); v8::Local<Value> function_name_result( diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 5f84bfffcd..7f4b300203 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -37,6 +37,7 @@ #include <unistd.h> // NOLINT #endif +#include "include/v8-fast-api-calls.h" #include "include/v8-util.h" #include "src/api/api-inl.h" #include "src/base/overflowing-math.h" @@ -561,8 +562,7 @@ THREADED_TEST(ScriptMakingExternalString) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); Local<String> source = - String::NewFromTwoByte(env->GetIsolate(), two_byte_source, - v8::NewStringType::kNormal) + String::NewFromTwoByte(env->GetIsolate(), two_byte_source) .ToLocalChecked(); // Trigger GCs so that the newly allocated string moves to old gen. CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now @@ -624,15 +624,13 @@ TEST(MakingExternalStringConditions) { uint16_t* two_byte_string = AsciiToTwoByteString("s1"); Local<String> tiny_local_string = - String::NewFromTwoByte(env->GetIsolate(), two_byte_string, - v8::NewStringType::kNormal) + String::NewFromTwoByte(env->GetIsolate(), two_byte_string) .ToLocalChecked(); i::DeleteArray(two_byte_string); two_byte_string = AsciiToTwoByteString("s1234"); Local<String> local_string = - String::NewFromTwoByte(env->GetIsolate(), two_byte_string, - v8::NewStringType::kNormal) + String::NewFromTwoByte(env->GetIsolate(), two_byte_string) .ToLocalChecked(); i::DeleteArray(two_byte_string); @@ -942,8 +940,7 @@ THREADED_TEST(StringConcat) { uint16_t* two_byte_source = AsciiToTwoByteString(two_byte_string_1); Local<String> right = - String::NewFromTwoByte(env->GetIsolate(), two_byte_source, - v8::NewStringType::kNormal) + String::NewFromTwoByte(env->GetIsolate(), two_byte_source) .ToLocalChecked(); i::DeleteArray(two_byte_source); @@ -962,8 +959,7 @@ THREADED_TEST(StringConcat) { source = String::Concat(isolate, source, right); two_byte_source = AsciiToTwoByteString(two_byte_string_2); - right = String::NewFromTwoByte(env->GetIsolate(), two_byte_source, - v8::NewStringType::kNormal) + right = String::NewFromTwoByte(env->GetIsolate(), two_byte_source) .ToLocalChecked(); i::DeleteArray(two_byte_source); @@ -3380,9 +3376,7 @@ THREADED_TEST(PrivatePropertiesOnProxies) { CHECK(priv2->Name() ->Equals(env.local(), - v8::String::NewFromUtf8(isolate, "my-private", - v8::NewStringType::kNormal) - .ToLocalChecked()) + v8::String::NewFromUtf8Literal(isolate, "my-private")) .FromJust()); // Make sure delete of a non-existent private symbol property works. @@ -3408,10 +3402,9 @@ THREADED_TEST(PrivatePropertiesOnProxies) { proxy->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length()); unsigned num_props = proxy->GetPropertyNames(env.local()).ToLocalChecked()->Length(); - CHECK(proxy->Set(env.local(), v8::String::NewFromUtf8( - isolate, "bla", v8::NewStringType::kNormal) - .ToLocalChecked(), - v8::Integer::New(isolate, 20)) + CHECK(proxy + ->Set(env.local(), v8::String::NewFromUtf8Literal(isolate, "bla"), + v8::Integer::New(isolate, 20)) .FromJust()); CHECK_EQ(1u, proxy->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length()); @@ -3474,9 +3467,7 @@ THREADED_TEST(PrivateProperties) { CHECK(priv2->Name() ->Equals(env.local(), - v8::String::NewFromUtf8(isolate, "my-private", - v8::NewStringType::kNormal) - .ToLocalChecked()) + v8::String::NewFromUtf8Literal(isolate, "my-private")) .FromJust()); // Make sure delete of a non-existent private symbol property works. @@ -3502,9 +3493,7 @@ THREADED_TEST(PrivateProperties) { obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length()); unsigned num_props = obj->GetPropertyNames(env.local()).ToLocalChecked()->Length(); - CHECK(obj->Set(env.local(), v8::String::NewFromUtf8( - isolate, "bla", v8::NewStringType::kNormal) - .ToLocalChecked(), + CHECK(obj->Set(env.local(), v8::String::NewFromUtf8Literal(isolate, "bla"), v8::Integer::New(isolate, 20)) .FromJust()); CHECK_EQ(1u, @@ -3999,9 +3988,8 @@ class TwoPassCallbackData { HandleScope scope(isolate); i::ScopedVector<char> buffer(40); i::SNPrintF(buffer, "%p", static_cast<void*>(this)); - auto string = v8::String::NewFromUtf8(isolate, buffer.begin(), - v8::NewStringType::kNormal) - .ToLocalChecked(); + auto string = + v8::String::NewFromUtf8(isolate, buffer.begin()).ToLocalChecked(); cell_.Reset(isolate, string); metadata_->instance_counter++; } @@ -6841,6 +6829,9 @@ THREADED_TEST(UndetectableObject) { .ToLocalChecked() ->NewInstance(env.local()) .ToLocalChecked(); + + CHECK(obj->IsUndetectable()); + CHECK( env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust()); @@ -8077,9 +8068,7 @@ THREADED_TEST(StringWrite) { // abc<Icelandic eth><Unicode snowman>. v8::Local<String> str2 = v8_str("abc\xC3\xB0\xE2\x98\x83"); v8::Local<String> str3 = - v8::String::NewFromUtf8(context->GetIsolate(), "abc\0def", - v8::NewStringType::kNormal, 7) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(context->GetIsolate(), "abc\0def"); // "ab" + lead surrogate + "wx" + trail surrogate + "yz" uint16_t orphans[8] = {0x61, 0x62, 0xD800, 0x77, 0x78, 0xDC00, 0x79, 0x7A}; v8::Local<String> orphans_str = @@ -8535,14 +8524,10 @@ THREADED_TEST(Utf16Symbol) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); - Local<String> symbol1 = - v8::String::NewFromUtf8(context->GetIsolate(), "abc", - v8::NewStringType::kInternalized) - .ToLocalChecked(); - Local<String> symbol2 = - v8::String::NewFromUtf8(context->GetIsolate(), "abc", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + Local<String> symbol1 = v8::String::NewFromUtf8Literal( + context->GetIsolate(), "abc", v8::NewStringType::kInternalized); + Local<String> symbol2 = v8::String::NewFromUtf8Literal( + context->GetIsolate(), "abc", v8::NewStringType::kInternalized); CHECK(SameSymbol(symbol1, symbol2)); CompileRun( @@ -8560,30 +8545,22 @@ THREADED_TEST(Utf16Symbol) { "if (sym3.charCodeAt(2) != 0xDC07) throw sym1.charCodeAt(2);" "if (sym4.length != 3) throw sym4;" "if (sym4.charCodeAt(2) != 0xDC08) throw sym2.charCodeAt(2);"); - Local<String> sym0 = - v8::String::NewFromUtf8(context->GetIsolate(), "benedictus", - v8::NewStringType::kInternalized) - .ToLocalChecked(); - Local<String> sym0b = - v8::String::NewFromUtf8(context->GetIsolate(), "S\xC3\xB8ren", - v8::NewStringType::kInternalized) - .ToLocalChecked(); - Local<String> sym1 = - v8::String::NewFromUtf8(context->GetIsolate(), "\xED\xA0\x81\xED\xB0\x87", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + Local<String> sym0 = v8::String::NewFromUtf8Literal( + context->GetIsolate(), "benedictus", v8::NewStringType::kInternalized); + Local<String> sym0b = v8::String::NewFromUtf8Literal( + context->GetIsolate(), "S\xC3\xB8ren", v8::NewStringType::kInternalized); + Local<String> sym1 = v8::String::NewFromUtf8Literal( + context->GetIsolate(), "\xED\xA0\x81\xED\xB0\x87", + v8::NewStringType::kInternalized); Local<String> sym2 = - v8::String::NewFromUtf8(context->GetIsolate(), "\xF0\x90\x90\x88", - v8::NewStringType::kInternalized) - .ToLocalChecked(); - Local<String> sym3 = v8::String::NewFromUtf8(context->GetIsolate(), - "x\xED\xA0\x81\xED\xB0\x87", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(context->GetIsolate(), "\xF0\x90\x90\x88", + v8::NewStringType::kInternalized); + Local<String> sym3 = v8::String::NewFromUtf8Literal( + context->GetIsolate(), "x\xED\xA0\x81\xED\xB0\x87", + v8::NewStringType::kInternalized); Local<String> sym4 = - v8::String::NewFromUtf8(context->GetIsolate(), "x\xF0\x90\x90\x88", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(context->GetIsolate(), "x\xF0\x90\x90\x88", + v8::NewStringType::kInternalized); v8::Local<v8::Object> global = context->Global(); Local<Value> s0 = global->Get(context.local(), v8_str("sym0")).ToLocalChecked(); @@ -13747,7 +13724,7 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { const int kIterations = 10; for (int i = 0; i < kIterations; ++i) { LocalContext env(isolate); - i::AlwaysAllocateScope always_allocate(i_isolate); + i::AlwaysAllocateScopeForTesting always_allocate(heap); CompileRun(script); // Keep a strong reference to the code object in the handle scope. @@ -15320,19 +15297,15 @@ THREADED_TEST(ReplaceConstantFunction) { THREADED_TEST(ScriptContextDependence) { LocalContext c1; v8::HandleScope scope(c1->GetIsolate()); - const char *source = "foo"; + const char source[] = "foo"; v8::Local<v8::Script> dep = v8_compile(source); v8::ScriptCompiler::Source script_source( - v8::String::NewFromUtf8(c1->GetIsolate(), source, - v8::NewStringType::kNormal) - .ToLocalChecked()); + v8::String::NewFromUtf8Literal(c1->GetIsolate(), source)); v8::Local<v8::UnboundScript> indep = v8::ScriptCompiler::CompileUnboundScript(c1->GetIsolate(), &script_source) .ToLocalChecked(); c1->Global() - ->Set(c1.local(), v8::String::NewFromUtf8(c1->GetIsolate(), "foo", - v8::NewStringType::kNormal) - .ToLocalChecked(), + ->Set(c1.local(), v8::String::NewFromUtf8Literal(c1->GetIsolate(), "foo"), v8::Integer::New(c1->GetIsolate(), 100)) .FromJust(); CHECK_EQ( @@ -15346,9 +15319,7 @@ THREADED_TEST(ScriptContextDependence) { 100); LocalContext c2; c2->Global() - ->Set(c2.local(), v8::String::NewFromUtf8(c2->GetIsolate(), "foo", - v8::NewStringType::kNormal) - .ToLocalChecked(), + ->Set(c2.local(), v8::String::NewFromUtf8Literal(c2->GetIsolate(), "foo"), v8::Integer::New(c2->GetIsolate(), 101)) .FromJust(); CHECK_EQ( @@ -16444,7 +16415,7 @@ TEST(RecursionWithSourceURLInMessageScriptResourceNameOrSourceURL) { static void CreateGarbageInOldSpace() { i::Factory* factory = CcTest::i_isolate()->factory(); v8::HandleScope scope(CcTest::isolate()); - i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); + i::AlwaysAllocateScopeForTesting always_allocate(CcTest::i_isolate()->heap()); for (int i = 0; i < 1000; i++) { factory->NewFixedArray(1000, i::AllocationType::kOld); } @@ -16764,7 +16735,7 @@ TEST(VisitExternalStrings) { v8::Isolate* isolate = CcTest::isolate(); LocalContext env; v8::HandleScope scope(isolate); - const char* string = "Some string"; + const char string[] = "Some string"; uint16_t* two_byte_string = AsciiToTwoByteString(string); TestResource* resource[4]; resource[0] = new TestResource(two_byte_string); @@ -16778,10 +16749,8 @@ TEST(VisitExternalStrings) { // Externalized symbol. resource[2] = new TestResource(two_byte_string, nullptr, false); - v8::Local<v8::String> string2 = - v8::String::NewFromUtf8(env->GetIsolate(), string, - v8::NewStringType::kInternalized) - .ToLocalChecked(); + v8::Local<v8::String> string2 = v8::String::NewFromUtf8Literal( + env->GetIsolate(), string, v8::NewStringType::kInternalized); CHECK(string2->MakeExternal(resource[2])); // Symbolized External. @@ -17282,8 +17251,7 @@ THREADED_TEST(FunctionGetDebugName) { v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( env->Global() ->Get(env.local(), - v8::String::NewFromUtf8(isolate, functions[i * 2], - v8::NewStringType::kNormal) + v8::String::NewFromUtf8(isolate, functions[i * 2]) .ToLocalChecked()) .ToLocalChecked()); CHECK_EQ(0, strcmp(functions[i * 2 + 1], @@ -18021,9 +17989,7 @@ TEST(ContainsOnlyOneByte) { .ToLocalChecked(); CHECK(!string->IsOneByte() && string->ContainsOnlyOneByte()); // Counter example. - string = String::NewFromTwoByte(isolate, string_contents, - v8::NewStringType::kNormal) - .ToLocalChecked(); + string = String::NewFromTwoByte(isolate, string_contents).ToLocalChecked(); CHECK(string->IsOneByte() && string->ContainsOnlyOneByte()); // Test left right and balanced cons strings. Local<String> base = v8_str("a"); @@ -19319,9 +19285,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGeneration( if (*i == '2') *i = '3'; } return {/* codegen_allowed= */ true, - String::NewFromUtf8(context->GetIsolate(), *utf8, - v8::NewStringType::kNormal) - .ToLocalChecked()}; + String::NewFromUtf8(context->GetIsolate(), *utf8).ToLocalChecked()}; } THREADED_TEST(AllowCodeGenFromStrings) { @@ -19911,7 +19875,7 @@ TEST(RunMicrotasksIgnoresThrownExceptionsFromApi) { CHECK(!isolate->IsExecutionTerminating()); isolate->EnqueueMicrotask(ThrowExceptionMicrotask); isolate->EnqueueMicrotask(IncrementCounterMicrotask); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(1, microtask_callback_count); CHECK(!try_catch.HasCaught()); } @@ -19928,21 +19892,25 @@ TEST(SetAutorunMicrotasks) { v8::HandleScope scope(env->GetIsolate()); env->GetIsolate()->AddMicrotasksCompletedCallback( &MicrotasksCompletedCallback); + + // If the policy is auto, there's a microtask checkpoint at the end of every + // zero-depth API call. CompileRun( "var ext1Calls = 0;" "var ext2Calls = 0;"); CompileRun("1+1;"); CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(0u, microtasks_completed_callback_count); + CHECK_EQ(4u, microtasks_completed_callback_count); env->GetIsolate()->EnqueueMicrotask( Function::New(env.local(), MicrotaskOne).ToLocalChecked()); CompileRun("1+1;"); CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(1u, microtasks_completed_callback_count); + CHECK_EQ(7u, microtasks_completed_callback_count); + // If the policy is explicit, microtask checkpoints are explicitly invoked. env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit); env->GetIsolate()->EnqueueMicrotask( Function::New(env.local(), MicrotaskOne).ToLocalChecked()); @@ -19951,24 +19919,24 @@ TEST(SetAutorunMicrotasks) { CompileRun("1+1;"); CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(1u, microtasks_completed_callback_count); + CHECK_EQ(7u, microtasks_completed_callback_count); - env->GetIsolate()->RunMicrotasks(); + env->GetIsolate()->PerformMicrotaskCheckpoint(); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(2u, microtasks_completed_callback_count); + CHECK_EQ(8u, microtasks_completed_callback_count); env->GetIsolate()->EnqueueMicrotask( Function::New(env.local(), MicrotaskTwo).ToLocalChecked()); CompileRun("1+1;"); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(2u, microtasks_completed_callback_count); + CHECK_EQ(8u, microtasks_completed_callback_count); - env->GetIsolate()->RunMicrotasks(); + env->GetIsolate()->PerformMicrotaskCheckpoint(); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(3u, microtasks_completed_callback_count); + CHECK_EQ(9u, microtasks_completed_callback_count); env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); env->GetIsolate()->EnqueueMicrotask( @@ -19976,7 +19944,7 @@ TEST(SetAutorunMicrotasks) { CompileRun("1+1;"); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(4u, microtasks_completed_callback_count); + CHECK_EQ(12u, microtasks_completed_callback_count); env->GetIsolate()->EnqueueMicrotask( Function::New(env.local(), MicrotaskTwo).ToLocalChecked()); @@ -19985,13 +19953,13 @@ TEST(SetAutorunMicrotasks) { CompileRun("1+1;"); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(4u, microtasks_completed_callback_count); + CHECK_EQ(12u, microtasks_completed_callback_count); } CompileRun("1+1;"); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(4, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(5u, microtasks_completed_callback_count); + CHECK_EQ(15u, microtasks_completed_callback_count); env->GetIsolate()->RemoveMicrotasksCompletedCallback( &MicrotasksCompletedCallback); @@ -20000,7 +19968,7 @@ TEST(SetAutorunMicrotasks) { CompileRun("1+1;"); CHECK_EQ(3, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(4, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); - CHECK_EQ(5u, microtasks_completed_callback_count); + CHECK_EQ(15u, microtasks_completed_callback_count); } @@ -20015,7 +19983,7 @@ TEST(RunMicrotasksWithoutEnteringContext) { isolate->EnqueueMicrotask( Function::New(context, MicrotaskOne).ToLocalChecked()); } - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); { Context::Scope context_scope(context); CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(context).FromJust()); @@ -20039,7 +20007,7 @@ static void Regress808911_CurrentContextWrapper( CHECK(isolate->GetCurrentContext() != isolate->GetEnteredOrMicrotaskContext()); isolate->EnqueueMicrotask(Regress808911_MicrotaskCallback, isolate); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); } THREADED_TEST(Regress808911) { @@ -22507,7 +22475,7 @@ TEST(PromiseThen) { .ToLocalChecked() ->Int32Value(context.local()) .FromJust()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(1, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22533,7 +22501,7 @@ TEST(PromiseThen) { .ToLocalChecked() ->Int32Value(context.local()) .FromJust()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(0, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22553,7 +22521,7 @@ TEST(PromiseThen) { .ToLocalChecked() ->Int32Value(context.local()) .FromJust()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(3, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22602,7 +22570,7 @@ TEST(PromiseThen2) { .ToLocalChecked() ->Int32Value(context.local()) .FromJust()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(1, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22613,7 +22581,7 @@ TEST(PromiseThen2) { .FromJust()); Local<v8::Promise> b = a->Then(context.local(), f3, f2).ToLocalChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(1, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22624,7 +22592,7 @@ TEST(PromiseThen2) { .FromJust()); Local<v8::Promise> c = b->Then(context.local(), f1, f2).ToLocalChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(1, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22635,7 +22603,7 @@ TEST(PromiseThen2) { .FromJust()); v8::Local<v8::Promise> d = c->Then(context.local(), f1, f2).ToLocalChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(103, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22646,7 +22614,7 @@ TEST(PromiseThen2) { .FromJust()); v8::Local<v8::Promise> e = d->Then(context.local(), f3, f2).ToLocalChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(103, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22657,7 +22625,7 @@ TEST(PromiseThen2) { .FromJust()); v8::Local<v8::Promise> f = e->Then(context.local(), f1, f3).ToLocalChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(103, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22668,7 +22636,7 @@ TEST(PromiseThen2) { .FromJust()); f->Then(context.local(), f1, f2).ToLocalChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(103, global->Get(context.local(), v8_str("x1")) .ToLocalChecked() ->Int32Value(context.local()) @@ -22703,12 +22671,8 @@ TEST(ResolvedPromiseReFulfill) { LocalContext context; v8::Isolate* isolate = context->GetIsolate(); v8::HandleScope scope(isolate); - v8::Local<v8::String> value1 = - v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal) - .ToLocalChecked(); - v8::Local<v8::String> value2 = - v8::String::NewFromUtf8(isolate, "bar", v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::Local<v8::String> value1 = v8::String::NewFromUtf8Literal(isolate, "foo"); + v8::Local<v8::String> value2 = v8::String::NewFromUtf8Literal(isolate, "bar"); v8::Local<v8::Promise::Resolver> resolver = v8::Promise::Resolver::New(context.local()).ToLocalChecked(); @@ -22734,12 +22698,8 @@ TEST(RejectedPromiseReFulfill) { LocalContext context; v8::Isolate* isolate = context->GetIsolate(); v8::HandleScope scope(isolate); - v8::Local<v8::String> value1 = - v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal) - .ToLocalChecked(); - v8::Local<v8::String> value2 = - v8::String::NewFromUtf8(isolate, "bar", v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::Local<v8::String> value1 = v8::String::NewFromUtf8Literal(isolate, "foo"); + v8::Local<v8::String> value2 = v8::String::NewFromUtf8Literal(isolate, "bar"); v8::Local<v8::Promise::Resolver> resolver = v8::Promise::Resolver::New(context.local()).ToLocalChecked(); @@ -22988,7 +22948,7 @@ TEST(ScriptPositionInfo) { // Fail when position is larger than script size. CHECK(!script1->GetPositionInfo(220384, &info, script1->NO_OFFSET)); - i::Script::InitLineEnds(script1); + i::Script::InitLineEnds(i_isolate, script1); } } @@ -25577,8 +25537,8 @@ THREADED_TEST(GlobalAccessorInfo) { v8::HandleScope scope(isolate); Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate); global_template->SetAccessor( - v8::String::NewFromUtf8(isolate, "prop", v8::NewStringType::kInternalized) - .ToLocalChecked(), + v8::String::NewFromUtf8Literal(isolate, "prop", + v8::NewStringType::kInternalized), &ensure_receiver_is_global_proxy); LocalContext env(nullptr, global_template); CompileRun("for (var i = 0; i < 10; i++) this.prop"); @@ -25735,7 +25695,7 @@ TEST(DynamicImport) { i::MaybeHandle<i::JSPromise> maybe_promise = i_isolate->RunHostImportModuleDynamicallyCallback(referrer, specifier); i::Handle<i::JSPromise> promise = maybe_promise.ToHandleChecked(); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK(result->Equals(i::String::cast(promise->result()))); } @@ -25884,9 +25844,8 @@ TEST(PrimitiveArray) { array->Set(isolate, 0, symbol); CHECK(array->Get(isolate, 0)->IsSymbol()); - Local<v8::String> string = - v8::String::NewFromUtf8(isolate, "test", v8::NewStringType::kInternalized) - .ToLocalChecked(); + Local<v8::String> string = v8::String::NewFromUtf8Literal( + isolate, "test", v8::NewStringType::kInternalized); array->Set(isolate, 1, string); CHECK(array->Get(isolate, 0)->IsSymbol()); CHECK(array->Get(isolate, 1)->IsString()); @@ -25922,10 +25881,8 @@ TEST(PersistentValueMap) { std::string, v8::Value, v8::DefaultPersistentValueMapTraits<std::string, v8::Value>> map(isolate); - v8::Local<v8::Value> value = - v8::String::NewFromUtf8(isolate, "value", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + v8::Local<v8::Value> value = v8::String::NewFromUtf8Literal( + isolate, "value", v8::NewStringType::kInternalized); map.Set("key", value); } @@ -25979,6 +25936,8 @@ void AtomicsWaitCallbackForTesting( CHECK_EQ(timeout_in_ms, info->expected_timeout); CHECK_EQ(value, info->expected_value); CHECK_EQ(offset_in_bytes, info->expected_offset); + CHECK_EQ(v8::StateTag::ATOMICS_WAIT, + reinterpret_cast<i::Isolate*>(info->isolate)->current_vm_state()); auto ThrowSomething = [&]() { info->isolate->ThrowException(v8::Integer::New(info->isolate, 42)); @@ -26435,7 +26394,7 @@ TEST(MicrotaskContextShouldBeNativeContext) { " await 42;" "})().then(callback);}"); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); } TEST(PreviewSetKeysIteratorEntriesWithDeleted) { @@ -27007,3 +26966,329 @@ UNINITIALIZED_TEST(NestedIsolates) { } #undef THREADED_PROFILED_TEST + +#ifndef V8_LITE_MODE +namespace { +// The following should correspond to Chromium's kV8DOMWrapperObjectIndex. +static const int kV8WrapperTypeIndex = 0; +static const int kV8WrapperObjectIndex = 1; + +template <typename T> +struct GetDeoptValue { + static Maybe<T> Get(v8::Local<v8::Value> value, + v8::Local<v8::Context> context); +}; + +template <> +struct GetDeoptValue<int32_t> { + static Maybe<int32_t> Get(v8::Local<v8::Value> value, + v8::Local<v8::Context> context) { + return value->Int32Value(context); + } +}; + +template <> +struct GetDeoptValue<uint32_t> { + static Maybe<uint32_t> Get(v8::Local<v8::Value> value, + v8::Local<v8::Context> context) { + return value->Uint32Value(context); + } +}; + +template <> +struct GetDeoptValue<int64_t> { + static Maybe<int64_t> Get(v8::Local<v8::Value> value, + v8::Local<v8::Context> context) { + return value->IntegerValue(context); + } +}; + +template <> +struct GetDeoptValue<bool> { + static Maybe<bool> Get(v8::Local<v8::Value> value, + v8::Local<v8::Context> context) { + return v8::Just<bool>(value->BooleanValue(CcTest::isolate())); + } +}; + +template <typename T> +struct ApiNumberChecker { + enum Result { + kNotCalled, + kSlowCalled, + kFastCalled, + }; + + explicit ApiNumberChecker(T value) {} + + static void CheckArgFast(ApiNumberChecker<T>* receiver, T argument) { + CHECK_NE(receiver, nullptr); + receiver->result = kFastCalled; + receiver->fast_value = argument; + } + + static void CheckArgSlow(const v8::FunctionCallbackInfo<v8::Value>& info) { + CHECK_EQ(info.Length(), 1); + + v8::Object* receiver = v8::Object::Cast(*info.Holder()); + ApiNumberChecker<T>* checker = static_cast<ApiNumberChecker<T>*>( + receiver->GetAlignedPointerFromInternalField(kV8WrapperObjectIndex)); + + CHECK_NOT_NULL(checker); + if (checker->result == kSlowCalled) return; + checker->result = kSlowCalled; + + LocalContext env; + checker->slow_value = GetDeoptValue<T>::Get(info[0], env.local()); + } + + T fast_value = T(); + Maybe<T> slow_value = v8::Nothing<T>(); + Result result = kNotCalled; +}; + +enum class Behavior { + kSuccess, // The callback function should be called with the expected value, + // which == initial. + kThrow, // An exception should be thrown by the callback function. +}; + +enum class PathTaken { + kFast, // The fast path is taken after optimization. + kSlow, // The slow path is taken always. +}; + +template <typename T> +void SetupTest(v8::Local<v8::Value> initial_value, LocalContext* env, + ApiNumberChecker<T>* checker) { + v8::Isolate* isolate = CcTest::isolate(); + + v8::CFunction c_func = v8::CFunction::Make(ApiNumberChecker<T>::CheckArgFast); + + Local<v8::FunctionTemplate> checker_templ = v8::FunctionTemplate::New( + isolate, ApiNumberChecker<T>::CheckArgSlow, v8::Local<v8::Value>(), + v8::Local<v8::Signature>(), 1, v8::ConstructorBehavior::kAllow, + v8::SideEffectType::kHasSideEffect, &c_func); + + v8::Local<v8::ObjectTemplate> object_template = + v8::ObjectTemplate::New(isolate); + object_template->SetInternalFieldCount(kV8WrapperObjectIndex + 1); + object_template->Set(v8_str("api_func"), checker_templ); + + v8::Local<v8::Object> object = + object_template->NewInstance(env->local()).ToLocalChecked(); + object->SetAlignedPointerInInternalField(kV8WrapperObjectIndex, + reinterpret_cast<void*>(checker)); + + CHECK((*env) + ->Global() + ->Set(env->local(), v8_str("receiver"), object) + .FromJust()); + CHECK((*env) + ->Global() + ->Set(env->local(), v8_str("value"), initial_value) + .FromJust()); + CompileRun( + "function func(arg) { receiver.api_func(arg); }" + "%PrepareFunctionForOptimization(func);" + "func(value);" + "%OptimizeFunctionOnNextCall(func);" + "func(value);"); +} + +template <typename T> +void CallAndCheck(T expected_value, Behavior expected_behavior, + PathTaken expected_path, v8::Local<v8::Value> initial_value) { + LocalContext env; + v8::TryCatch try_catch(CcTest::isolate()); + ApiNumberChecker<T> checker(expected_value); + + SetupTest<T>(initial_value, &env, &checker); + + if (expected_behavior == Behavior::kThrow) { + CHECK(try_catch.HasCaught()); + CHECK_NE(checker.result, ApiNumberChecker<T>::kFastCalled); + } else { + CHECK_EQ(try_catch.HasCaught(), false); + } + + if (expected_path == PathTaken::kSlow) { + // The slow version callback should have been called twice. + CHECK_EQ(checker.result, ApiNumberChecker<T>::kSlowCalled); + + if (expected_behavior != Behavior::kThrow) { + T slow_value_typed = checker.slow_value.ToChecked(); + CHECK_EQ(slow_value_typed, expected_value); + } + } else if (expected_path == PathTaken::kFast) { + CHECK_EQ(checker.result, ApiNumberChecker<T>::kFastCalled); + CHECK_EQ(checker.fast_value, expected_value); + } +} + +void CallAndDeopt() { + LocalContext env; + v8::Local<v8::Value> initial_value(v8_num(42)); + ApiNumberChecker<int32_t> checker(42); + SetupTest(initial_value, &env, &checker); + + v8::Local<v8::Value> function = CompileRun( + "try { func(BigInt(42)); } catch(e) {}" + "%PrepareFunctionForOptimization(func);" + "%OptimizeFunctionOnNextCall(func);" + "func(value);" + "func;"); + CHECK(function->IsFunction()); + i::Handle<i::JSFunction> ifunction = + i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function)); + CHECK(ifunction->IsOptimized()); +} + +void CallWithLessArguments() { + LocalContext env; + v8::Local<v8::Value> initial_value(v8_num(42)); + ApiNumberChecker<int32_t> checker(42); + SetupTest(initial_value, &env, &checker); + + CompileRun("func();"); + + // Passing not enough arguments should go through the slow path. + CHECK_EQ(checker.result, ApiNumberChecker<int32_t>::kSlowCalled); +} + +void CallWithMoreArguments() { + LocalContext env; + v8::Local<v8::Value> initial_value(v8_num(42)); + ApiNumberChecker<int32_t> checker(42); + SetupTest(initial_value, &env, &checker); + + CompileRun( + "%PrepareFunctionForOptimization(func);" + "%OptimizeFunctionOnNextCall(func);" + "func(value, value);"); + + // Passing too many arguments should just ignore the extra ones. + CHECK_EQ(checker.result, ApiNumberChecker<int32_t>::kFastCalled); +} +} // namespace + +namespace v8 { +template <typename T> +class WrapperTraits<ApiNumberChecker<T>> { + public: + static const void* GetTypeInfo() { + static const int tag = 0; + return reinterpret_cast<const void*>(&tag); + } +}; +} // namespace v8 +#endif // V8_LITE_MODE + +TEST(FastApiCalls) { +#ifndef V8_LITE_MODE + if (i::FLAG_jitless) return; + + i::FLAG_turbo_fast_api_calls = true; + i::FLAG_opt = true; + i::FLAG_allow_natives_syntax = true; + // Disable --always_opt, otherwise we haven't generated the necessary + // feedback to go down the "best optimization" path for the fast call. + i::FLAG_always_opt = false; + + v8::Isolate* isolate = CcTest::isolate(); + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + i_isolate->set_embedder_wrapper_type_index(kV8WrapperTypeIndex); + i_isolate->set_embedder_wrapper_object_index(kV8WrapperObjectIndex); + + v8::HandleScope scope(isolate); + LocalContext env; + + // Main cases (the value fits in the type) + CallAndCheck<int32_t>(-42, Behavior::kSuccess, PathTaken::kFast, v8_num(-42)); + CallAndCheck<uint32_t>(i::Smi::kMaxValue, Behavior::kSuccess, + PathTaken::kFast, v8_num(i::Smi::kMaxValue)); +#ifdef V8_TARGET_ARCH_X64 + CallAndCheck<int64_t>(static_cast<int64_t>(i::Smi::kMaxValue) + 1, + Behavior::kSuccess, PathTaken::kFast, + v8_num(static_cast<int64_t>(i::Smi::kMaxValue) + 1)); +#endif // V8_TARGET_ARCH_X64 + + CallAndCheck<bool>(false, Behavior::kSuccess, PathTaken::kFast, + v8::Boolean::New(isolate, false)); + CallAndCheck<bool>(true, Behavior::kSuccess, PathTaken::kFast, + v8::Boolean::New(isolate, true)); + + // Corner cases (the value is out of bounds or of different type) - int32_t + CallAndCheck<int32_t>(0, Behavior::kSuccess, PathTaken::kFast, v8_num(-0.0)); + CallAndCheck<int32_t>(0, Behavior::kSuccess, PathTaken::kFast, + v8_num(std::numeric_limits<double>::quiet_NaN())); + CallAndCheck<int32_t>(0, Behavior::kSuccess, PathTaken::kFast, + v8_num(std::numeric_limits<double>::infinity())); + CallAndCheck<int32_t>(0, Behavior::kSuccess, PathTaken::kSlow, + v8_str("some_string")); + CallAndCheck<int32_t>(0, Behavior::kSuccess, PathTaken::kSlow, + v8::Object::New(isolate)); + CallAndCheck<int32_t>(0, Behavior::kSuccess, PathTaken::kSlow, + v8::Array::New(isolate)); + CallAndCheck<int32_t>(0, Behavior::kThrow, PathTaken::kSlow, + v8::BigInt::New(isolate, 42)); + CallAndCheck<int32_t>(std::numeric_limits<int32_t>::min(), Behavior::kSuccess, + PathTaken::kFast, + v8_num(std::numeric_limits<int32_t>::min())); + CallAndCheck<int32_t>( + std::numeric_limits<int32_t>::min(), Behavior::kSuccess, PathTaken::kFast, + v8_num(static_cast<double>(std::numeric_limits<int32_t>::max()) + 1)); + + CallAndCheck<int32_t>(3, Behavior::kSuccess, PathTaken::kFast, v8_num(3.14)); + + // Corner cases - uint32_t + CallAndCheck<uint32_t>(0, Behavior::kSuccess, PathTaken::kFast, v8_num(-0.0)); + CallAndCheck<uint32_t>(0, Behavior::kSuccess, PathTaken::kFast, + v8_num(std::numeric_limits<double>::quiet_NaN())); + CallAndCheck<uint32_t>(0, Behavior::kSuccess, PathTaken::kFast, + v8_num(std::numeric_limits<double>::infinity())); + CallAndCheck<uint32_t>(0, Behavior::kSuccess, PathTaken::kSlow, + v8_str("some_string")); + CallAndCheck<uint32_t>(0, Behavior::kSuccess, PathTaken::kSlow, + v8::Object::New(isolate)); + CallAndCheck<uint32_t>(0, Behavior::kSuccess, PathTaken::kSlow, + v8::Array::New(isolate)); + CallAndCheck<uint32_t>(0, Behavior::kThrow, PathTaken::kSlow, + v8::BigInt::New(isolate, 42)); + CallAndCheck<uint32_t>(std::numeric_limits<uint32_t>::min(), + Behavior::kSuccess, PathTaken::kFast, + v8_num(std::numeric_limits<uint32_t>::max() + 1)); + CallAndCheck<uint32_t>(3, Behavior::kSuccess, PathTaken::kFast, v8_num(3.14)); + + // Corner cases - bool + CallAndCheck<bool>(false, Behavior::kSuccess, PathTaken::kFast, + v8::Undefined(isolate)); + CallAndCheck<bool>(false, Behavior::kSuccess, PathTaken::kFast, + v8::Null(isolate)); + CallAndCheck<bool>(false, Behavior::kSuccess, PathTaken::kFast, v8_num(0)); + CallAndCheck<bool>(true, Behavior::kSuccess, PathTaken::kFast, v8_num(42)); + CallAndCheck<bool>(false, Behavior::kSuccess, PathTaken::kFast, v8_str("")); + CallAndCheck<bool>(true, Behavior::kSuccess, PathTaken::kFast, + v8_str("some_string")); + CallAndCheck<bool>(true, Behavior::kSuccess, PathTaken::kFast, + v8::Symbol::New(isolate)); + CallAndCheck<bool>(false, Behavior::kSuccess, PathTaken::kFast, + v8::BigInt::New(isolate, 0)); + CallAndCheck<bool>(true, Behavior::kSuccess, PathTaken::kFast, + v8::BigInt::New(isolate, 42)); + CallAndCheck<bool>(true, Behavior::kSuccess, PathTaken::kFast, + v8::Object::New(isolate)); + + // Check for the deopt loop protection + CallAndDeopt(); + + // Wrong number of arguments + CallWithLessArguments(); + CallWithMoreArguments(); + + // TODO(mslekova): Add corner cases for 64-bit values. + // TODO(mslekova): Add main cases for float and double. + // TODO(mslekova): Restructure the tests so that the fast optimized calls + // are compared against the slow optimized calls. +#endif // V8_LITE_MODE +} diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc index 8813815317..7b9a3ee842 100644 --- a/deps/v8/test/cctest/test-assembler-arm64.cc +++ b/deps/v8/test/cctest/test-assembler-arm64.cc @@ -186,6 +186,7 @@ static void InitializeVM() { #define RESET() \ owned_buf->MakeWritable(); \ __ Reset(); \ + __ CodeEntry(); \ /* Reset the machine state (like simulator.ResetState()). */ \ __ Msr(NZCV, xzr); \ __ Msr(FPCR, xzr); @@ -193,8 +194,8 @@ static void InitializeVM() { #define START_AFTER_RESET() \ __ PushCalleeSavedRegisters(); -#define START() \ - RESET(); \ +#define START() \ + RESET(); \ START_AFTER_RESET(); #define RUN() \ @@ -1649,27 +1650,27 @@ TEST(adr) { __ Adr(x3, &label_1); __ Adr(x4, &label_1); - __ Bind(&label_2); + __ Bind(&label_2, BranchTargetIdentifier::kBtiJump); __ Eor(x5, x2, Operand(x3)); // Ensure that x2,x3 and x4 are identical. __ Eor(x6, x2, Operand(x4)); __ Orr(x0, x0, Operand(x5)); __ Orr(x0, x0, Operand(x6)); __ Br(x2); // label_1, label_3 - __ Bind(&label_3); + __ Bind(&label_3, BranchTargetIdentifier::kBtiJump); __ Adr(x2, &label_3); // Self-reference (offset 0). __ Eor(x1, x1, Operand(x2)); __ Adr(x2, &label_4); // Simple forward reference. __ Br(x2); // label_4 - __ Bind(&label_1); + __ Bind(&label_1, BranchTargetIdentifier::kBtiJump); __ Adr(x2, &label_3); // Multiple reverse references to the same label. __ Adr(x3, &label_3); __ Adr(x4, &label_3); __ Adr(x5, &label_2); // Simple reverse reference. __ Br(x5); // label_2 - __ Bind(&label_4); + __ Bind(&label_4, BranchTargetIdentifier::kBtiJump); END(); RUN(); @@ -1695,11 +1696,11 @@ TEST(adr_far) { __ Adr(x10, &near_forward, MacroAssembler::kAdrFar); __ Br(x10); __ B(&fail); - __ Bind(&near_backward); + __ Bind(&near_backward, BranchTargetIdentifier::kBtiJump); __ Orr(x0, x0, 1 << 1); __ B(&test_far); - __ Bind(&near_forward); + __ Bind(&near_forward, BranchTargetIdentifier::kBtiJump); __ Orr(x0, x0, 1 << 0); __ Adr(x10, &near_backward, MacroAssembler::kAdrFar); __ Br(x10); @@ -1708,7 +1709,7 @@ TEST(adr_far) { __ Adr(x10, &far_forward, MacroAssembler::kAdrFar); __ Br(x10); __ B(&fail); - __ Bind(&far_backward); + __ Bind(&far_backward, BranchTargetIdentifier::kBtiJump); __ Orr(x0, x0, 1 << 3); __ B(&done); @@ -1722,8 +1723,7 @@ TEST(adr_far) { } } - - __ Bind(&far_forward); + __ Bind(&far_forward, BranchTargetIdentifier::kBtiJump); __ Orr(x0, x0, 1 << 2); __ Adr(x10, &far_backward, MacroAssembler::kAdrFar); __ Br(x10); @@ -1832,7 +1832,7 @@ TEST(branch_to_reg) { SETUP(); // Test br. - Label fn1, after_fn1; + Label fn1, after_fn1, after_bl1; START(); __ Mov(x29, lr); @@ -1847,9 +1847,10 @@ TEST(branch_to_reg) { __ Bind(&after_fn1); __ Bl(&fn1); + __ Bind(&after_bl1, BranchTargetIdentifier::kBtiJump); // For Br(x0) in fn1. // Test blr. - Label fn2, after_fn2; + Label fn2, after_fn2, after_bl2; __ Mov(x2, 0); __ B(&after_fn2); @@ -1861,6 +1862,7 @@ TEST(branch_to_reg) { __ Bind(&after_fn2); __ Bl(&fn2); + __ Bind(&after_bl2, BranchTargetIdentifier::kBtiCall); // For Blr(x0) in fn2. __ Mov(x3, lr); __ Mov(lr, x29); @@ -1873,6 +1875,76 @@ TEST(branch_to_reg) { CHECK_EQUAL_64(84, x2); } +static void BtiHelper(Register ipreg) { + SETUP(); + + Label jump_target, jump_call_target, call_target, done; + START(); + UseScratchRegisterScope temps(&masm); + temps.Exclude(ipreg); + __ Adr(x0, &jump_target); + __ Br(x0); + __ Nop(); + __ Bind(&jump_target, BranchTargetIdentifier::kBtiJump); + __ Adr(x0, &call_target); + __ Blr(x0); + __ Adr(ipreg, &jump_call_target); + __ Blr(ipreg); + __ Adr(lr, &done); // Make Ret return to done label. + __ Br(ipreg); + __ Bind(&call_target, BranchTargetIdentifier::kBtiCall); + __ Ret(); + __ Bind(&jump_call_target, BranchTargetIdentifier::kBtiJumpCall); + __ Ret(); + __ Bind(&done); + END(); + +#ifdef USE_SIMULATOR + simulator.SetGuardedPages(true); + RUN(); +#endif // USE_SIMULATOR +} + +TEST(bti) { + BtiHelper(x16); + BtiHelper(x17); +} + +TEST(unguarded_bti_is_nop) { + SETUP(); + + Label start, none, c, j, jc; + START(); + __ B(&start); + __ Bind(&none, BranchTargetIdentifier::kBti); + __ Bind(&c, BranchTargetIdentifier::kBtiCall); + __ Bind(&j, BranchTargetIdentifier::kBtiJump); + __ Bind(&jc, BranchTargetIdentifier::kBtiJumpCall); + CHECK(__ SizeOfCodeGeneratedSince(&none) == 4 * kInstrSize); + __ Ret(); + + Label jump_to_c, call_to_j; + __ Bind(&start); + __ Adr(x0, &none); + __ Adr(lr, &jump_to_c); + __ Br(x0); + + __ Bind(&jump_to_c); + __ Adr(x0, &c); + __ Adr(lr, &call_to_j); + __ Br(x0); + + __ Bind(&call_to_j); + __ Adr(x0, &j); + __ Blr(x0); + END(); + +#ifdef USE_SIMULATOR + simulator.SetGuardedPages(false); + RUN(); +#endif // USE_SIMULATOR +} + TEST(compare_branch) { INIT_V8(); SETUP(); @@ -6631,11 +6703,7 @@ static void LdrLiteralRangeHelper( size_t expected_pool_size = 0; -#if defined(_M_ARM64) && !defined(__clang__) - auto PoolSizeAt = [pool_entries, kEntrySize](int pc_offset) { -#else - auto PoolSizeAt = [unaligned_emission](int pc_offset) { -#endif + auto PoolSizeAt = [&](int pc_offset) { // To determine padding, consider the size of the prologue of the pool, // and the jump around the pool, which we always need. size_t prologue_size = 2 * kInstrSize + kInstrSize; @@ -12121,9 +12189,10 @@ static void PushPopSimpleHelper(int reg_count, int reg_size, // Registers in the TmpList can be used by the macro assembler for debug code // (for example in 'Pop'), so we can't use them here. // x18 is reserved for the platform register. - // Disallow x31 / xzr, to ensure this list has an even number of elements, to - // ensure alignment. - RegList allowed = ~(masm.TmpList()->list() | x18.bit() | x31.bit()); + // For simplicity, exclude LR as well, as we would need to sign it when + // pushing it. This also ensures that the list has an even number of elements, + // which is needed for alignment. + RegList allowed = ~(masm.TmpList()->list() | x18.bit() | lr.bit()); if (reg_count == kPushPopMaxRegCount) { reg_count = CountSetBits(allowed, kNumberOfRegisters); } @@ -12157,7 +12226,8 @@ static void PushPopSimpleHelper(int reg_count, int reg_size, case PushPopByFour: // Push high-numbered registers first (to the highest addresses). for (i = reg_count; i >= 4; i -= 4) { - __ Push(r[i-1], r[i-2], r[i-3], r[i-4]); + __ Push<TurboAssembler::kDontStoreLR>(r[i - 1], r[i - 2], r[i - 3], + r[i - 4]); } // Finish off the leftovers. switch (i) { @@ -12170,7 +12240,7 @@ static void PushPopSimpleHelper(int reg_count, int reg_size, } break; case PushPopRegList: - __ PushSizeRegList(list, reg_size); + __ PushSizeRegList<TurboAssembler::kDontStoreLR>(list, reg_size); break; } @@ -12181,7 +12251,8 @@ static void PushPopSimpleHelper(int reg_count, int reg_size, case PushPopByFour: // Pop low-numbered registers first (from the lowest addresses). for (i = 0; i <= (reg_count-4); i += 4) { - __ Pop(r[i], r[i+1], r[i+2], r[i+3]); + __ Pop<TurboAssembler::kDontLoadLR>(r[i], r[i + 1], r[i + 2], + r[i + 3]); } // Finish off the leftovers. switch (reg_count - i) { @@ -12194,7 +12265,7 @@ static void PushPopSimpleHelper(int reg_count, int reg_size, } break; case PushPopRegList: - __ PopSizeRegList(list, reg_size); + __ PopSizeRegList<TurboAssembler::kDontLoadLR>(list, reg_size); break; } } @@ -12525,10 +12596,10 @@ TEST(push_pop) { __ Claim(2); __ PushXRegList(0); __ PopXRegList(0); - // Don't push/pop x18 (platform register) or xzr (for alignment) - RegList all_regs = 0xFFFFFFFF & ~(x18.bit() | x31.bit()); - __ PushXRegList(all_regs); - __ PopXRegList(all_regs); + // Don't push/pop x18 (platform register) or lr + RegList all_regs = 0xFFFFFFFF & ~(x18.bit() | lr.bit()); + __ PushXRegList<TurboAssembler::kDontStoreLR>(all_regs); + __ PopXRegList<TurboAssembler::kDontLoadLR>(all_regs); __ Drop(12); END(); @@ -13909,7 +13980,7 @@ TEST(blr_lr) { __ Mov(x0, 0xDEADBEEF); __ B(&end); - __ Bind(&target); + __ Bind(&target, BranchTargetIdentifier::kBtiCall); __ Mov(x0, 0xC001C0DE); __ Bind(&end); @@ -14527,13 +14598,11 @@ TEST(near_call_no_relocation) { __ Bind(&test); __ Mov(x0, 0x0); - __ Push(lr, xzr); { Assembler::BlockConstPoolScope scope(&masm); int offset = (function.pos() - __ pc_offset()) / kInstrSize; __ near_call(offset, RelocInfo::NONE); } - __ Pop(xzr, lr); END(); RUN(); @@ -14753,7 +14822,7 @@ TEST(jump_tables_forward) { } for (int i = 0; i < kNumCases; ++i) { - __ Bind(&labels[i]); + __ Bind(&labels[i], BranchTargetIdentifier::kBtiJump); __ Mov(value, values[i]); __ B(&done); } @@ -14801,7 +14870,7 @@ TEST(jump_tables_backward) { __ B(&loop); for (int i = 0; i < kNumCases; ++i) { - __ Bind(&labels[i]); + __ Bind(&labels[i], BranchTargetIdentifier::kBtiJump); __ Mov(value, values[i]); __ B(&done); } @@ -14863,7 +14932,7 @@ TEST(internal_reference_linked) { __ dcptr(&done); __ Tbz(x0, 1, &done); - __ Bind(&done); + __ Bind(&done, BranchTargetIdentifier::kBtiJump); __ Mov(x0, 1); END(); diff --git a/deps/v8/test/cctest/test-code-pages.cc b/deps/v8/test/cctest/test-code-pages.cc index 93eddb0a4c..7fafe62629 100644 --- a/deps/v8/test/cctest/test-code-pages.cc +++ b/deps/v8/test/cctest/test-code-pages.cc @@ -21,10 +21,8 @@ namespace test_code_pages { // 2 - Have code pages. ARM32 only // 3 - Nothing - This feature does not work on other platforms. #if defined(V8_TARGET_ARCH_ARM) -static const bool kHaveCodeRange = false; static const bool kHaveCodePages = true; #else -static const bool kHaveCodeRange = kRequiresCodeRange; static const bool kHaveCodePages = false; #endif // defined(V8_TARGET_ARCH_ARM) @@ -86,11 +84,10 @@ bool PagesContainsAddress(std::vector<MemoryRange>* pages, } // namespace TEST(CodeRangeCorrectContents) { - if (!kHaveCodeRange) return; - LocalContext env; v8::Isolate* isolate = env->GetIsolate(); Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + if (!i_isolate->RequiresCodeRange()) return; std::vector<MemoryRange>* pages = i_isolate->GetCodePages(); @@ -128,12 +125,12 @@ TEST(CodePagesCorrectContents) { } TEST(OptimizedCodeWithCodeRange) { - if (!kHaveCodeRange) return; - FLAG_allow_natives_syntax = true; LocalContext env; v8::Isolate* isolate = env->GetIsolate(); Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + if (!i_isolate->RequiresCodeRange()) return; + HandleScope scope(i_isolate); std::string foo_str = getFooCode(1); @@ -255,7 +252,6 @@ TEST(OptimizedCodeWithCodePages) { } TEST(LargeCodeObject) { - if (!kHaveCodeRange && !kHaveCodePages) return; // We don't want incremental marking to start which could cause the code to // not be collected on the CollectGarbage() call. ManualGCScope manual_gc_scope; @@ -263,6 +259,7 @@ TEST(LargeCodeObject) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + if (!i_isolate->RequiresCodeRange() && !kHaveCodePages) return; // Create a big function that ends up in CODE_LO_SPACE. const int instruction_size = Page::kPageSize + 1; @@ -290,7 +287,7 @@ TEST(LargeCodeObject) { std::vector<MemoryRange>* pages = i_isolate->GetCodePages(); - if (kHaveCodeRange) { + if (i_isolate->RequiresCodeRange()) { CHECK(PagesContainsAddress(pages, foo_code->address())); } else { CHECK(PagesHasExactPage(pages, foo_code->address())); @@ -371,7 +368,6 @@ class SamplingThread : public base::Thread { }; TEST(LargeCodeObjectWithSignalHandler) { - if (!kHaveCodeRange && !kHaveCodePages) return; // We don't want incremental marking to start which could cause the code to // not be collected on the CollectGarbage() call. ManualGCScope manual_gc_scope; @@ -379,6 +375,7 @@ TEST(LargeCodeObjectWithSignalHandler) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + if (!i_isolate->RequiresCodeRange() && !kHaveCodePages) return; // Create a big function that ends up in CODE_LO_SPACE. const int instruction_size = Page::kPageSize + 1; @@ -421,7 +418,7 @@ TEST(LargeCodeObjectWithSignalHandler) { // Check that the page was added. std::vector<MemoryRange> pages = SamplingThread::DoSynchronousSample(isolate); - if (kHaveCodeRange) { + if (i_isolate->RequiresCodeRange()) { CHECK(PagesContainsAddress(&pages, foo_code->address())); } else { CHECK(PagesHasExactPage(&pages, foo_code->address())); @@ -447,7 +444,6 @@ TEST(LargeCodeObjectWithSignalHandler) { } TEST(Sorted) { - if (!kHaveCodeRange && !kHaveCodePages) return; // We don't want incremental marking to start which could cause the code to // not be collected on the CollectGarbage() call. ManualGCScope manual_gc_scope; @@ -455,6 +451,7 @@ TEST(Sorted) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + if (!i_isolate->RequiresCodeRange() && !kHaveCodePages) return; // Create a big function that ends up in CODE_LO_SPACE. const int instruction_size = Page::kPageSize + 1; @@ -507,7 +504,7 @@ TEST(Sorted) { // Check that the pages were added. std::vector<MemoryRange> pages = SamplingThread::DoSynchronousSample(isolate); - if (kHaveCodeRange) { + if (i_isolate->RequiresCodeRange()) { CHECK_EQ(pages.size(), initial_num_pages); } else { CHECK_EQ(pages.size(), initial_num_pages + 3); @@ -528,7 +525,7 @@ TEST(Sorted) { std::vector<MemoryRange> pages = SamplingThread::DoSynchronousSample(isolate); - if (kHaveCodeRange) { + if (i_isolate->RequiresCodeRange()) { CHECK_EQ(pages.size(), initial_num_pages); } else { CHECK_EQ(pages.size(), initial_num_pages + 2); diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 623ff0d0f3..755041e0fb 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -728,10 +728,16 @@ TEST(TryToName) { { // TryToName(<internalized uncacheable number string greater than - // array index>) => is_keyisunique: <internalized string>. + // array index but less than MAX_SAFE_INTEGER>) => 32-bit platforms + // take the if_keyisunique path, 64-bit platforms bail out because they + // let the runtime handle the string-to-size_t parsing. Handle<Object> key = isolate->factory()->InternalizeUtf8String("4294967296"); +#if V8_TARGET_ARCH_64_BIT + ft.CheckTrue(key, expect_bailout); +#else ft.CheckTrue(key, expect_unique, key); +#endif } { @@ -1203,8 +1209,8 @@ TEST(TryHasOwnProperty) { enum Result { kFound, kNotFound, kBailout }; { - Node* object = m.Parameter(0); - Node* unique_name = m.Parameter(1); + TNode<HeapObject> object = m.CAST(m.Parameter(0)); + TNode<Name> unique_name = m.CAST(m.Parameter(1)); TNode<MaybeObject> expected_result = m.UncheckedCast<MaybeObject>(m.Parameter(2)); @@ -2292,7 +2298,8 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler { : CodeStubAssembler(state), kind_(kind) {} void TestAppendJSArrayImpl(Isolate* isolate, CodeAssemblerTester* csa_tester, - Object o1, Object o2, Object o3, Object o4, + Handle<Object> o1, Handle<Object> o2, + Handle<Object> o3, Handle<Object> o4, int initial_size, int result_size) { Handle<JSArray> array = isolate->factory()->NewJSArray( kind_, 2, initial_size, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); @@ -2315,23 +2322,22 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler { FunctionTester ft(csa_tester->GenerateCode(), kNumParams); - Handle<Object> result = - ft.Call(Handle<Object>(o1, isolate), Handle<Object>(o2, isolate), - Handle<Object>(o3, isolate), Handle<Object>(o4, isolate)) - .ToHandleChecked(); + Handle<Object> result = ft.Call(o1, o2, o3, o4).ToHandleChecked(); CHECK_EQ(kind_, array->GetElementsKind()); CHECK_EQ(result_size, Handle<Smi>::cast(result)->value()); CHECK_EQ(result_size, Smi::ToInt(array->length())); - Object obj = *JSObject::GetElement(isolate, array, 2).ToHandleChecked(); - HeapObject undefined_value = ReadOnlyRoots(isolate).undefined_value(); - CHECK_EQ(result_size < 3 ? undefined_value : o1, obj); - obj = *JSObject::GetElement(isolate, array, 3).ToHandleChecked(); - CHECK_EQ(result_size < 4 ? undefined_value : o2, obj); - obj = *JSObject::GetElement(isolate, array, 4).ToHandleChecked(); - CHECK_EQ(result_size < 5 ? undefined_value : o3, obj); - obj = *JSObject::GetElement(isolate, array, 5).ToHandleChecked(); - CHECK_EQ(result_size < 6 ? undefined_value : o4, obj); + Handle<Object> obj = + JSObject::GetElement(isolate, array, 2).ToHandleChecked(); + Handle<HeapObject> undefined_value = + Handle<HeapObject>(ReadOnlyRoots(isolate).undefined_value(), isolate); + CHECK_EQ(result_size < 3 ? *undefined_value : *o1, *obj); + obj = JSObject::GetElement(isolate, array, 3).ToHandleChecked(); + CHECK_EQ(result_size < 4 ? *undefined_value : *o2, *obj); + obj = JSObject::GetElement(isolate, array, 4).ToHandleChecked(); + CHECK_EQ(result_size < 5 ? *undefined_value : *o3, *obj); + obj = JSObject::GetElement(isolate, array, 5).ToHandleChecked(); + CHECK_EQ(result_size < 6 ? *undefined_value : *o4, *obj); } static void TestAppendJSArray(Isolate* isolate, ElementsKind kind, Object o1, @@ -2339,8 +2345,10 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler { int initial_size, int result_size) { CodeAssemblerTester asm_tester(isolate, kNumParams); AppendJSArrayCodeStubAssembler m(asm_tester.state(), kind); - m.TestAppendJSArrayImpl(isolate, &asm_tester, o1, o2, o3, o4, initial_size, - result_size); + m.TestAppendJSArrayImpl( + isolate, &asm_tester, Handle<Object>(o1, isolate), + Handle<Object>(o2, isolate), Handle<Object>(o3, isolate), + Handle<Object>(o4, isolate), initial_size, result_size); } private: @@ -3305,8 +3313,8 @@ TEST(ExtractFixedArrayCOWForceCopy) { CodeStubAssembler m(asm_tester.state()); CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; - m.Return(m.ExtractFixedArray(m.Parameter(0), m.SmiConstant(0), nullptr, - nullptr, flags, + m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.SmiConstant(0), + nullptr, nullptr, flags, CodeStubAssembler::SMI_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3334,8 +3342,8 @@ TEST(ExtractFixedArraySimple) { CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW; - m.Return(m.ExtractFixedArray(m.Parameter(0), m.Parameter(1), m.Parameter(2), - nullptr, flags, + m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.Parameter(1), + m.Parameter(2), nullptr, flags, CodeStubAssembler::SMI_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3361,7 +3369,7 @@ TEST(ExtractFixedArraySimpleSmiConstant) { CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW; - m.Return(m.ExtractFixedArray(m.Parameter(0), m.SmiConstant(1), + m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.SmiConstant(1), m.SmiConstant(2), nullptr, flags, CodeStubAssembler::SMI_PARAMETERS)); } @@ -3385,7 +3393,7 @@ TEST(ExtractFixedArraySimpleIntPtrConstant) { CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW; - m.Return(m.ExtractFixedArray(m.Parameter(0), m.IntPtrConstant(1), + m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.IntPtrConstant(1), m.IntPtrConstant(2), nullptr, flags, CodeStubAssembler::INTPTR_PARAMETERS)); } @@ -3407,8 +3415,8 @@ TEST(ExtractFixedArraySimpleIntPtrConstantNoDoubles) { { CodeStubAssembler m(asm_tester.state()); m.Return(m.ExtractFixedArray( - m.Parameter(0), m.IntPtrConstant(1), m.IntPtrConstant(2), nullptr, - CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays, + m.CAST(m.Parameter(0)), m.IntPtrConstant(1), m.IntPtrConstant(2), + nullptr, CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays, CodeStubAssembler::INTPTR_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3430,7 +3438,8 @@ TEST(ExtractFixedArraySimpleIntPtrParameters) { CodeStubAssembler m(asm_tester.state()); TNode<IntPtrT> p1_untagged = m.SmiUntag(m.Parameter(1)); TNode<IntPtrT> p2_untagged = m.SmiUntag(m.Parameter(2)); - m.Return(m.ExtractFixedArray(m.Parameter(0), p1_untagged, p2_untagged)); + m.Return( + m.ExtractFixedArray(m.CAST(m.Parameter(0)), p1_untagged, p2_untagged)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3622,7 +3631,7 @@ TEST(TestCallBuiltinInlineTrampoline) { const int kContextOffset = 2; Node* str = m.Parameter(0); - Node* context = m.Parameter(kNumParams + kContextOffset); + TNode<Context> context = m.CAST(m.Parameter(kNumParams + kContextOffset)); TNode<Smi> index = m.SmiConstant(2); @@ -3648,7 +3657,7 @@ DISABLED_TEST(TestCallBuiltinIndirectLoad) { const int kContextOffset = 2; Node* str = m.Parameter(0); - Node* context = m.Parameter(kNumParams + kContextOffset); + TNode<Context> context = m.CAST(m.Parameter(kNumParams + kContextOffset)); TNode<Smi> index = m.SmiConstant(2); diff --git a/deps/v8/test/cctest/test-constantpool.cc b/deps/v8/test/cctest/test-constantpool.cc index a861655adc..3d063ac770 100644 --- a/deps/v8/test/cctest/test-constantpool.cc +++ b/deps/v8/test/cctest/test-constantpool.cc @@ -12,7 +12,7 @@ namespace v8 { namespace internal { -#if defined(V8_TARGET_ARCH_PPC) +#if defined(V8_TARGET_ARCH_PPC) || defined(V8_TARGET_ARCH_PPC64) const ConstantPoolEntry::Type kPtrType = ConstantPoolEntry::INTPTR; const ConstantPoolEntry::Type kDblType = ConstantPoolEntry::DOUBLE; @@ -249,7 +249,7 @@ TEST(ConstantPoolNoSharing) { CHECK_EQ(access, kOvflAccess); } -#endif // defined(V8_TARGET_ARCH_PPC) +#endif // defined(V8_TARGET_ARCH_PPC) || defined(V8_TARGET_ARCH_PPC64) } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-debug-helper.cc b/deps/v8/test/cctest/test-debug-helper.cc index 513b9ac1b9..a8b1ecb7a9 100644 --- a/deps/v8/test/cctest/test-debug-helper.cc +++ b/deps/v8/test/cctest/test-debug-helper.cc @@ -122,6 +122,7 @@ class StringResource : public v8::String::ExternalStringResource { TEST(GetObjectProperties) { CcTest::InitializeVM(); v8::Isolate* isolate = CcTest::isolate(); + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); v8::HandleScope scope(isolate); LocalContext context; // Claim we don't know anything about the heap layout. @@ -180,11 +181,8 @@ TEST(GetObjectProperties) { : Contains(props->brief, "maybe EmptyFixedArray")); // Provide a heap first page so the API can be more sure. - heap_addresses.read_only_space_first_page = - reinterpret_cast<uintptr_t>(reinterpret_cast<i::Isolate*>(isolate) - ->heap() - ->read_only_space() - ->first_page()); + heap_addresses.read_only_space_first_page = reinterpret_cast<uintptr_t>( + i_isolate->heap()->read_only_space()->first_page()); props = d::GetObjectProperties(properties_or_hash, &ReadMemory, heap_addresses); CHECK(props->type_check_result == @@ -373,10 +371,25 @@ TEST(GetObjectProperties) { ReadProp<i::Tagged_t>(*props, "shared_function_info"), &ReadMemory, heap_addresses); const d::ObjectProperty& flags = FindProp(*props, "flags"); - CheckStructProp(*flags.struct_fields[0], "v8::internal::FunctionKind", - "function_kind", 0, 5, 0); + CHECK_GE(flags.num_struct_fields, 3); + CheckStructProp(*flags.struct_fields[0], "FunctionKind", "function_kind", 0, + 5, 0); CheckStructProp(*flags.struct_fields[1], "bool", "is_native", 0, 1, 5); CheckStructProp(*flags.struct_fields[2], "bool", "is_strict", 0, 1, 6); + + // Get data about a different bitfield struct which is contained within a smi. + Handle<i::JSFunction> function = Handle<i::JSFunction>::cast(o); + Handle<i::SharedFunctionInfo> shared(function->shared(), i_isolate); + Handle<i::DebugInfo> debug_info = + i_isolate->debug()->GetOrCreateDebugInfo(shared); + props = + d::GetObjectProperties(debug_info->ptr(), &ReadMemory, heap_addresses); + const d::ObjectProperty& debug_flags = FindProp(*props, "flags"); + CHECK_GE(debug_flags.num_struct_fields, 5); + CheckStructProp(*debug_flags.struct_fields[0], "bool", "has_break_info", 0, 1, + i::kSmiTagSize + i::kSmiShiftSize); + CheckStructProp(*debug_flags.struct_fields[4], "bool", "can_break_at_entry", + 0, 1, i::kSmiTagSize + i::kSmiShiftSize + 4); } TEST(ListObjectClasses) { diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 4aae4294da..ed669db806 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -35,6 +35,7 @@ #include "src/debug/debug.h" #include "src/deoptimizer/deoptimizer.h" #include "src/execution/frames.h" +#include "src/execution/microtask-queue.h" #include "src/objects/objects-inl.h" #include "src/snapshot/snapshot.h" #include "src/utils/utils.h" @@ -2932,9 +2933,11 @@ TEST(DebugBreak) { class DebugScopingListener : public v8::debug::DebugDelegate { public: - void BreakProgramRequested( - v8::Local<v8::Context>, - const std::vector<v8::debug::BreakpointId>&) override { + void ExceptionThrown(v8::Local<v8::Context> paused_context, + v8::Local<v8::Value> exception, + v8::Local<v8::Value> promise, bool is_uncaught, + v8::debug::ExceptionType exception_type) override { + break_count_++; auto stack_traces = v8::debug::StackTraceIterator::Create(CcTest::isolate()); v8::debug::Location location = stack_traces->GetSourceLocation(); @@ -2957,6 +2960,10 @@ class DebugScopingListener : public v8::debug::DebugDelegate { scopes->Advance(); CHECK(scopes->Done()); } + unsigned break_count() const { return break_count_; } + + private: + unsigned break_count_ = 0; }; TEST(DebugBreakInWrappedScript) { @@ -2996,6 +3003,7 @@ TEST(DebugBreakInWrappedScript) { // Get rid of the debug event listener. v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CHECK_EQ(1, delegate.break_count()); CheckDebuggerUnloaded(); } @@ -3234,7 +3242,7 @@ TEST(DebugScriptLineEndsAreAscending) { Handle<v8::internal::Script> script = Handle<v8::internal::Script>( v8::internal::Script::cast(instances->get(i)), CcTest::i_isolate()); - v8::internal::Script::InitLineEnds(script); + v8::internal::Script::InitLineEnds(CcTest::i_isolate(), script); v8::internal::FixedArray ends = v8::internal::FixedArray::cast(script->line_ends()); CHECK_GT(ends.length(), 0); @@ -3545,10 +3553,8 @@ TEST(AfterCompileEventOnBindToContext) { ScriptCompiledDelegate delegate; v8::debug::SetDebugDelegate(isolate, &delegate); - const char* source = "var a=1"; v8::ScriptCompiler::Source script_source( - v8::String::NewFromUtf8(isolate, source, v8::NewStringType::kNormal) - .ToLocalChecked()); + v8::String::NewFromUtf8Literal(isolate, "var a=1")); v8::Local<v8::UnboundScript> unbound = v8::ScriptCompiler::CompileUnboundScript(isolate, &script_source) @@ -4955,3 +4961,639 @@ TEST(GetPrivateMethodsAndAccessors) { } } } + +TEST(GetPrivateStaticMethodsAndAccessors) { + i::FLAG_harmony_private_methods = true; + LocalContext env; + v8::Isolate* v8_isolate = CcTest::isolate(); + v8::HandleScope scope(v8_isolate); + v8::Local<v8::Context> context = env.local(); + + v8::Local<v8::String> source = v8_str( + "var X = class {\n" + " static #staticMethod() { }\n" + " static get #staticAccessor() { }\n" + " static set #staticAccessor(val) { }\n" + " static get #staticReadOnly() { }\n" + " static set #staticWriteOnly(val) { }\n" + "}\n"); + CompileRun(source); + v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast( + env->Global() + ->Get(context, v8_str(env->GetIsolate(), "X")) + .ToLocalChecked()); + std::vector<v8::Local<v8::Value>> names; + std::vector<v8::Local<v8::Value>> values; + CHECK(v8::debug::GetPrivateMembers(context, object, &names, &values)); + + CHECK_EQ(names.size(), 4); + for (int i = 0; i < 4; i++) { + v8::Local<v8::Value> name = names[i]; + v8::Local<v8::Value> value = values[i]; + CHECK(name->IsString()); + std::string name_str = FromString(v8_isolate, name.As<v8::String>()); + if (name_str == "#staticMethod") { + CHECK(value->IsFunction()); + } else { + CHECK(v8::debug::AccessorPair::IsAccessorPair(value)); + v8::Local<v8::debug::AccessorPair> accessors = + value.As<v8::debug::AccessorPair>(); + if (name_str == "#staticAccessor") { + CHECK(accessors->getter()->IsFunction()); + CHECK(accessors->setter()->IsFunction()); + } else if (name_str == "#staticReadOnly") { + CHECK(accessors->getter()->IsFunction()); + CHECK(accessors->setter()->IsNull()); + } else { + CHECK_EQ(name_str, "#staticWriteOnly"); + CHECK(accessors->getter()->IsNull()); + CHECK(accessors->setter()->IsFunction()); + } + } + } +} + +TEST(GetPrivateStaticAndInstanceMethodsAndAccessors) { + i::FLAG_harmony_private_methods = true; + LocalContext env; + v8::Isolate* v8_isolate = CcTest::isolate(); + v8::HandleScope scope(v8_isolate); + v8::Local<v8::Context> context = env.local(); + + v8::Local<v8::String> source = v8_str( + "var X = class {\n" + " static #staticMethod() { }\n" + " static get #staticAccessor() { }\n" + " static set #staticAccessor(val) { }\n" + " static get #staticReadOnly() { }\n" + " static set #staticWriteOnly(val) { }\n" + " #method() { }\n" + " get #accessor() { }\n" + " set #accessor(val) { }\n" + " get #readOnly() { }\n" + " set #writeOnly(val) { }\n" + "}\n" + "var x = new X()\n"); + CompileRun(source); + v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast( + env->Global() + ->Get(context, v8_str(env->GetIsolate(), "X")) + .ToLocalChecked()); + std::vector<v8::Local<v8::Value>> names; + std::vector<v8::Local<v8::Value>> values; + CHECK(v8::debug::GetPrivateMembers(context, object, &names, &values)); + + CHECK_EQ(names.size(), 4); + for (int i = 0; i < 4; i++) { + v8::Local<v8::Value> name = names[i]; + v8::Local<v8::Value> value = values[i]; + CHECK(name->IsString()); + std::string name_str = FromString(v8_isolate, name.As<v8::String>()); + if (name_str == "#staticMethod") { + CHECK(value->IsFunction()); + } else { + CHECK(v8::debug::AccessorPair::IsAccessorPair(value)); + v8::Local<v8::debug::AccessorPair> accessors = + value.As<v8::debug::AccessorPair>(); + if (name_str == "#staticAccessor") { + CHECK(accessors->getter()->IsFunction()); + CHECK(accessors->setter()->IsFunction()); + } else if (name_str == "#staticReadOnly") { + CHECK(accessors->getter()->IsFunction()); + CHECK(accessors->setter()->IsNull()); + } else { + CHECK_EQ(name_str, "#staticWriteOnly"); + CHECK(accessors->getter()->IsNull()); + CHECK(accessors->setter()->IsFunction()); + } + } + } + + names.clear(); + values.clear(); + object = v8::Local<v8::Object>::Cast( + env->Global() + ->Get(context, v8_str(env->GetIsolate(), "x")) + .ToLocalChecked()); + CHECK(v8::debug::GetPrivateMembers(context, object, &names, &values)); + + CHECK_EQ(names.size(), 4); + for (int i = 0; i < 4; i++) { + v8::Local<v8::Value> name = names[i]; + v8::Local<v8::Value> value = values[i]; + CHECK(name->IsString()); + std::string name_str = FromString(v8_isolate, name.As<v8::String>()); + if (name_str == "#method") { + CHECK(value->IsFunction()); + } else { + CHECK(v8::debug::AccessorPair::IsAccessorPair(value)); + v8::Local<v8::debug::AccessorPair> accessors = + value.As<v8::debug::AccessorPair>(); + if (name_str == "#accessor") { + CHECK(accessors->getter()->IsFunction()); + CHECK(accessors->setter()->IsFunction()); + } else if (name_str == "#readOnly") { + CHECK(accessors->getter()->IsFunction()); + CHECK(accessors->setter()->IsNull()); + } else { + CHECK_EQ(name_str, "#writeOnly"); + CHECK(accessors->getter()->IsNull()); + CHECK(accessors->setter()->IsFunction()); + } + } + } +} + +namespace { +class SetTerminateOnResumeDelegate : public v8::debug::DebugDelegate { + public: + enum Options { + kNone, + kPerformMicrotaskCheckpointAtBreakpoint, + kRunJavaScriptAtBreakpoint + }; + explicit SetTerminateOnResumeDelegate(Options options = kNone) + : options_(options) {} + void BreakProgramRequested(v8::Local<v8::Context> paused_context, + const std::vector<v8::debug::BreakpointId>& + inspector_break_points_hit) override { + break_count_++; + v8::Isolate* isolate = paused_context->GetIsolate(); + v8::debug::SetTerminateOnResume(isolate); + if (options_ == kPerformMicrotaskCheckpointAtBreakpoint) { + v8::MicrotasksScope::PerformCheckpoint(isolate); + } + if (options_ == kRunJavaScriptAtBreakpoint) { + CompileRun("globalVariable = globalVariable + 1"); + } + } + + void ExceptionThrown(v8::Local<v8::Context> paused_context, + v8::Local<v8::Value> exception, + v8::Local<v8::Value> promise, bool is_uncaught, + v8::debug::ExceptionType exception_type) override { + exception_thrown_count_++; + v8::debug::SetTerminateOnResume(paused_context->GetIsolate()); + } + + int break_count() const { return break_count_; } + int exception_thrown_count() const { return exception_thrown_count_; } + + private: + int break_count_ = 0; + int exception_thrown_count_ = 0; + Options options_; +}; +} // anonymous namespace + +TEST(TerminateOnResumeAtBreakpoint) { + break_point_hit_count = 0; + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + SetTerminateOnResumeDelegate delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + // If the delegate doesn't request termination on resume from breakpoint, + // foo diverges. + v8::Script::Compile( + context, + v8_str(env->GetIsolate(), "function foo(){debugger; while(true){}}")) + .ToLocalChecked() + ->Run(context) + .ToLocalChecked(); + v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( + env->Global() + ->Get(context, v8_str(env->GetIsolate(), "foo")) + .ToLocalChecked()); + + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 1); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +namespace { +bool microtask_one_ran = false; +static void MicrotaskOne(const v8::FunctionCallbackInfo<v8::Value>& info) { + CHECK(v8::MicrotasksScope::IsRunningMicrotasks(info.GetIsolate())); + v8::HandleScope scope(info.GetIsolate()); + v8::MicrotasksScope microtasks(info.GetIsolate(), + v8::MicrotasksScope::kDoNotRunMicrotasks); + ExpectInt32("1 + 1", 2); + microtask_one_ran = true; +} +} // namespace + +TEST(TerminateOnResumeRunMicrotaskAtBreakpoint) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + SetTerminateOnResumeDelegate delegate( + SetTerminateOnResumeDelegate::kPerformMicrotaskCheckpointAtBreakpoint); + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + // Enqueue a microtask that gets run while we are paused at the breakpoint. + env->GetIsolate()->EnqueueMicrotask( + v8::Function::New(env.local(), MicrotaskOne).ToLocalChecked()); + + // If the delegate doesn't request termination on resume from breakpoint, + // foo diverges. + v8::Script::Compile( + context, + v8_str(env->GetIsolate(), "function foo(){debugger; while(true){}}")) + .ToLocalChecked() + ->Run(context) + .ToLocalChecked(); + v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( + env->Global() + ->Get(context, v8_str(env->GetIsolate(), "foo")) + .ToLocalChecked()); + + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 1); + CHECK(microtask_one_ran); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +TEST(TerminateOnResumeRunJavaScriptAtBreakpoint) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + CompileRun("var globalVariable = 0;"); + SetTerminateOnResumeDelegate delegate( + SetTerminateOnResumeDelegate::kRunJavaScriptAtBreakpoint); + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + // If the delegate doesn't request termination on resume from breakpoint, + // foo diverges. + v8::Script::Compile( + context, + v8_str(env->GetIsolate(), "function foo(){debugger; while(true){}}")) + .ToLocalChecked() + ->Run(context) + .ToLocalChecked(); + v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( + env->Global() + ->Get(context, v8_str(env->GetIsolate(), "foo")) + .ToLocalChecked()); + + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 1); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + ExpectInt32("globalVariable", 1); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +TEST(TerminateOnResumeAtException) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + ChangeBreakOnException(true, true); + SetTerminateOnResumeDelegate delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + const char* source = "throw new Error(); while(true){};"; + + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::Local<v8::Function> foo = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 0); + CHECK_EQ(delegate.exception_thrown_count(), 1); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +TEST(TerminateOnResumeAtBreakOnEntry) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + SetTerminateOnResumeDelegate delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + { + v8::TryCatch try_catch(env->GetIsolate()); + v8::Local<v8::Function> builtin = + CompileRun("String.prototype.repeat").As<v8::Function>(); + SetBreakPoint(builtin, 0); + v8::Local<v8::Value> val = CompileRun("'b'.repeat(10)"); + CHECK_EQ(delegate.break_count(), 1); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.exception_thrown_count(), 0); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +TEST(TerminateOnResumeAtBreakOnEntryUserDefinedFunction) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + SetTerminateOnResumeDelegate delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + { + v8::TryCatch try_catch(env->GetIsolate()); + v8::Local<v8::Function> foo = + CompileFunction(&env, "function foo(b) { while (b > 0) {} }", "foo"); + + // Run without breakpoints to compile source to bytecode. + CompileRun("foo(-1)"); + CHECK_EQ(delegate.break_count(), 0); + + SetBreakPoint(foo, 0); + v8::Local<v8::Value> val = CompileRun("foo(1)"); + CHECK_EQ(delegate.break_count(), 1); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.exception_thrown_count(), 0); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +TEST(TerminateOnResumeAtUnhandledRejection) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + ChangeBreakOnException(true, true); + SetTerminateOnResumeDelegate delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + v8::Local<v8::Function> foo = CompileFunction( + &env, "async function foo() { Promise.reject(); while(true) {} }", + "foo"); + + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 0); + CHECK_EQ(delegate.exception_thrown_count(), 1); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +namespace { +void RejectPromiseThroughCpp(const v8::FunctionCallbackInfo<v8::Value>& info) { + auto data = reinterpret_cast<std::pair<v8::Isolate*, LocalContext*>*>( + info.Data().As<v8::External>()->Value()); + + v8::Local<v8::String> value1 = + v8::String::NewFromUtf8Literal(data->first, "foo"); + + v8::Local<v8::Promise::Resolver> resolver = + v8::Promise::Resolver::New(data->second->local()).ToLocalChecked(); + v8::Local<v8::Promise> promise = resolver->GetPromise(); + CHECK_EQ(promise->State(), v8::Promise::PromiseState::kPending); + + resolver->Reject(data->second->local(), value1).ToChecked(); + CHECK_EQ(promise->State(), v8::Promise::PromiseState::kRejected); + // CHECK_EQ(*v8::Utils::OpenHandle(*promise->Result()), + // i::ReadOnlyRoots(CcTest::i_isolate()).exception()); +} +} // namespace + +TEST(TerminateOnResumeAtUnhandledRejectionCppImpl) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(env->GetIsolate()); + ChangeBreakOnException(true, true); + SetTerminateOnResumeDelegate delegate; + auto data = std::make_pair(isolate, &env); + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + { + // We want to trigger a breapoint upon Promise rejection, but we will only + // get the callback if there is at least one JavaScript frame in the stack. + v8::Local<v8::Function> func = + v8::Function::New(env.local(), RejectPromiseThroughCpp, + v8::External::New(isolate, &data)) + .ToLocalChecked(); + CHECK(env->Global() + ->Set(env.local(), v8_str("RejectPromiseThroughCpp"), func) + .FromJust()); + + CompileRun("RejectPromiseThroughCpp(); while (true) {}"); + CHECK_EQ(delegate.break_count(), 0); + CHECK_EQ(delegate.exception_thrown_count(), 1); + } + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +namespace { +static void UnreachableMicrotask( + const v8::FunctionCallbackInfo<v8::Value>& info) { + UNREACHABLE(); +} +} // namespace + +TEST(TerminateOnResumeFromMicrotask) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + SetTerminateOnResumeDelegate delegate( + SetTerminateOnResumeDelegate::kPerformMicrotaskCheckpointAtBreakpoint); + ChangeBreakOnException(true, true); + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + { + v8::TryCatch try_catch(env->GetIsolate()); + // Enqueue a microtask that gets run while we are paused at the breakpoint. + v8::Local<v8::Function> foo = CompileFunction( + &env, "function foo(){ Promise.reject(); while (true) {} }", "foo"); + env->GetIsolate()->EnqueueMicrotask(foo); + env->GetIsolate()->EnqueueMicrotask( + v8::Function::New(env.local(), UnreachableMicrotask).ToLocalChecked()); + + CHECK_EQ(2, + CcTest::i_isolate()->native_context()->microtask_queue()->size()); + + v8::MicrotasksScope::PerformCheckpoint(env->GetIsolate()); + + CHECK_EQ(0, + CcTest::i_isolate()->native_context()->microtask_queue()->size()); + + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 0); + CHECK_EQ(delegate.exception_thrown_count(), 1); + } + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +class FutexInterruptionThread : public v8::base::Thread { + public: + FutexInterruptionThread(v8::Isolate* isolate, v8::base::Semaphore* sem) + : Thread(Options("FutexInterruptionThread")), + isolate_(isolate), + sem_(sem) {} + + void Run() override { + // Wait a bit before terminating. + v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); + sem_->Wait(); + v8::debug::SetTerminateOnResume(isolate_); + } + + private: + v8::Isolate* isolate_; + v8::base::Semaphore* sem_; +}; + +namespace { +class SemaphoreTriggerOnBreak : public v8::debug::DebugDelegate { + public: + SemaphoreTriggerOnBreak() : sem_(0) {} + void BreakProgramRequested(v8::Local<v8::Context> paused_context, + const std::vector<v8::debug::BreakpointId>& + inspector_break_points_hit) override { + break_count_++; + sem_.Signal(); + } + + v8::base::Semaphore* semaphore() { return &sem_; } + int break_count() const { return break_count_; } + + private: + v8::base::Semaphore sem_; + int break_count_ = 0; +}; +} // anonymous namespace + +TEST(TerminateOnResumeFromOtherThread) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + ChangeBreakOnException(true, true); + + SemaphoreTriggerOnBreak delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + + FutexInterruptionThread timeout_thread(env->GetIsolate(), + delegate.semaphore()); + CHECK(timeout_thread.Start()); + + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + const char* source = "debugger; while(true){};"; + + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::Local<v8::Function> foo = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 1); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} + +namespace { +class InterruptionBreakRightNow : public v8::base::Thread { + public: + explicit InterruptionBreakRightNow(v8::Isolate* isolate) + : Thread(Options("FutexInterruptionThread")), isolate_(isolate) {} + + void Run() override { + // Wait a bit before terminating. + v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); + isolate_->RequestInterrupt(BreakRightNow, nullptr); + } + + private: + static void BreakRightNow(v8::Isolate* isolate, void* data) { + v8::debug::BreakRightNow(isolate); + } + v8::Isolate* isolate_; +}; + +} // anonymous namespace + +TEST(TerminateOnResumeAtInterruptFromOtherThread) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + ChangeBreakOnException(true, true); + + SetTerminateOnResumeDelegate delegate; + v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate); + + InterruptionBreakRightNow timeout_thread(env->GetIsolate()); + + v8::Local<v8::Context> context = env.local(); + { + v8::TryCatch try_catch(env->GetIsolate()); + const char* source = "while(true){}"; + + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::Local<v8::Function> foo = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + + CHECK(timeout_thread.Start()); + v8::MaybeLocal<v8::Value> val = + foo->Call(context, env->Global(), 0, nullptr); + CHECK(val.IsEmpty()); + CHECK(try_catch.HasTerminated()); + CHECK_EQ(delegate.break_count(), 1); + } + // Exiting the TryCatch brought the isolate back to a state where JavaScript + // can be executed. + ExpectInt32("1 + 1", 2); + v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); + CheckDebuggerUnloaded(); +} diff --git a/deps/v8/test/cctest/test-decls.cc b/deps/v8/test/cctest/test-decls.cc index 14c30cd362..e2b5772654 100644 --- a/deps/v8/test/cctest/test-decls.cc +++ b/deps/v8/test/cctest/test-decls.cc @@ -147,9 +147,7 @@ void DeclarationContext::Check(const char* source, int get, int set, int query, catcher.SetVerbose(true); Local<Context> context = CcTest::isolate()->GetCurrentContext(); MaybeLocal<Script> script = Script::Compile( - context, - String::NewFromUtf8(CcTest::isolate(), source, v8::NewStringType::kNormal) - .ToLocalChecked()); + context, String::NewFromUtf8(CcTest::isolate(), source).ToLocalChecked()); if (expectations == EXPECT_ERROR) { CHECK(script.IsEmpty()); return; @@ -445,9 +443,8 @@ class SimpleContext { TryCatch catcher(context_->GetIsolate()); catcher.SetVerbose(true); MaybeLocal<Script> script = Script::Compile( - context_, String::NewFromUtf8(context_->GetIsolate(), source, - v8::NewStringType::kNormal) - .ToLocalChecked()); + context_, + String::NewFromUtf8(context_->GetIsolate(), source).ToLocalChecked()); if (expectations == EXPECT_ERROR) { CHECK(script.IsEmpty()); return; @@ -748,14 +745,10 @@ TEST(CrossScriptDynamicLookup) { { SimpleContext context; - Local<String> undefined_string = - String::NewFromUtf8(CcTest::isolate(), "undefined", - v8::NewStringType::kInternalized) - .ToLocalChecked(); - Local<String> number_string = - String::NewFromUtf8(CcTest::isolate(), "number", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + Local<String> undefined_string = String::NewFromUtf8Literal( + CcTest::isolate(), "undefined", v8::NewStringType::kInternalized); + Local<String> number_string = String::NewFromUtf8Literal( + CcTest::isolate(), "number", v8::NewStringType::kInternalized); context.Check( "function f(o) { with(o) { return x; } }" @@ -825,14 +818,10 @@ TEST(CrossScriptStaticLookupUndeclared) { { SimpleContext context; - Local<String> undefined_string = - String::NewFromUtf8(CcTest::isolate(), "undefined", - v8::NewStringType::kInternalized) - .ToLocalChecked(); - Local<String> number_string = - String::NewFromUtf8(CcTest::isolate(), "number", - v8::NewStringType::kInternalized) - .ToLocalChecked(); + Local<String> undefined_string = String::NewFromUtf8Literal( + CcTest::isolate(), "undefined", v8::NewStringType::kInternalized); + Local<String> number_string = String::NewFromUtf8Literal( + CcTest::isolate(), "number", v8::NewStringType::kInternalized); context.Check( "function f(o) { return x; }" diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc index 2b46d7ed11..93a0c9a807 100644 --- a/deps/v8/test/cctest/test-disasm-arm64.cc +++ b/deps/v8/test/cctest/test-disasm-arm64.cc @@ -1874,11 +1874,45 @@ TEST_(system_msr) { TEST_(system_nop) { - SET_UP_ASM(); + { + SET_UP_ASM(); + COMPARE(nop(), "nop"); + CLEANUP(); + } + { + SET_UP_MASM(); + COMPARE(Nop(), "nop"); + CLEANUP(); + } +} - COMPARE(nop(), "nop"); +TEST_(bti) { + { + SET_UP_ASM(); - CLEANUP(); + COMPARE(bti(BranchTargetIdentifier::kBti), "bti"); + COMPARE(bti(BranchTargetIdentifier::kBtiCall), "bti c"); + COMPARE(bti(BranchTargetIdentifier::kBtiJump), "bti j"); + COMPARE(bti(BranchTargetIdentifier::kBtiJumpCall), "bti jc"); + COMPARE(hint(BTI), "bti"); + COMPARE(hint(BTI_c), "bti c"); + COMPARE(hint(BTI_j), "bti j"); + COMPARE(hint(BTI_jc), "bti jc"); + + CLEANUP(); + } + + { + SET_UP_MASM(); + + Label dummy1, dummy2, dummy3, dummy4; + COMPARE(Bind(&dummy1, BranchTargetIdentifier::kBti), "bti"); + COMPARE(Bind(&dummy2, BranchTargetIdentifier::kBtiCall), "bti c"); + COMPARE(Bind(&dummy3, BranchTargetIdentifier::kBtiJump), "bti j"); + COMPARE(Bind(&dummy4, BranchTargetIdentifier::kBtiJumpCall), "bti jc"); + + CLEANUP(); + } } TEST(system_pauth) { diff --git a/deps/v8/test/cctest/test-disasm-ia32.cc b/deps/v8/test/cctest/test-disasm-ia32.cc index 686b1e122e..cc4f5cc296 100644 --- a/deps/v8/test/cctest/test-disasm-ia32.cc +++ b/deps/v8/test/cctest/test-disasm-ia32.cc @@ -592,6 +592,7 @@ TEST(DisasmIa320) { if (CpuFeatures::IsSupported(SSSE3)) { CpuFeatureScope scope(&assm, SSSE3); SSSE3_INSTRUCTION_LIST(EMIT_SSE34_INSTR) + SSSE3_UNOP_INSTRUCTION_LIST(EMIT_SSE34_INSTR) __ palignr(xmm5, xmm1, 5); __ palignr(xmm5, Operand(edx, 4), 5); } @@ -802,6 +803,7 @@ TEST(DisasmIa320) { __ v##instruction(xmm5, xmm1); \ __ v##instruction(xmm5, Operand(edx, 4)); + SSSE3_UNOP_INSTRUCTION_LIST(EMIT_SSE4_RM_AVXINSTR) SSE4_RM_INSTRUCTION_LIST(EMIT_SSE4_RM_AVXINSTR) #undef EMIT_SSE4_RM_AVXINSTR } diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc index 5e85cb5a08..b9cf05bcc9 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -391,8 +391,6 @@ TEST(DisasmX64) { // Move operation __ cvttss2si(rdx, Operand(rbx, rcx, times_4, 10000)); __ cvttss2si(rdx, xmm1); - __ cvtsd2ss(xmm0, xmm1); - __ cvtsd2ss(xmm0, Operand(rbx, rcx, times_4, 10000)); __ cvttps2dq(xmm0, xmm1); __ cvttps2dq(xmm0, Operand(rbx, rcx, times_4, 10000)); __ movaps(xmm0, xmm1); @@ -437,13 +435,6 @@ 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)); - __ pcmpeqd(xmm1, xmm0); __ punpckldq(xmm1, xmm11); @@ -458,6 +449,7 @@ TEST(DisasmX64) { __ instruction(xmm5, Operand(rdx, 4)); SSE2_INSTRUCTION_LIST(EMIT_SSE2_INSTR) + SSE2_UNOP_INSTRUCTION_LIST(EMIT_SSE2_INSTR) SSE2_INSTRUCTION_LIST_SD(EMIT_SSE2_INSTR) #undef EMIT_SSE2_INSTR @@ -514,6 +506,7 @@ TEST(DisasmX64) { __ palignr(xmm5, xmm1, 5); __ palignr(xmm5, Operand(rdx, 4), 5); SSSE3_INSTRUCTION_LIST(EMIT_SSE34_INSTR) + SSSE3_UNOP_INSTRUCTION_LIST(EMIT_SSE34_INSTR) } } @@ -579,7 +572,7 @@ TEST(DisasmX64) { __ blendvpd(xmm5, Operand(rdx, 4)); SSE4_INSTRUCTION_LIST(EMIT_SSE34_INSTR) - SSE4_PMOV_INSTRUCTION_LIST(EMIT_SSE34_INSTR) + SSE4_UNOP_INSTRUCTION_LIST(EMIT_SSE34_INSTR) SSE4_EXTRACT_INSTRUCTION_LIST(EMIT_SSE34_IMM_INSTR) } } @@ -635,29 +628,14 @@ TEST(DisasmX64) { __ vmovdqu(xmm9, Operand(rbx, rcx, times_4, 10000)); __ vmovdqu(Operand(rbx, rcx, times_4, 10000), xmm0); - __ vaddsd(xmm0, xmm1, xmm2); - __ vaddsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vmulsd(xmm0, xmm1, xmm2); - __ vmulsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vsubsd(xmm0, xmm1, xmm2); - __ vsubsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vdivsd(xmm0, xmm1, xmm2); - __ vdivsd(xmm0, xmm1, Operand(rbx, rcx, times_2, 10000)); - __ vminsd(xmm8, xmm1, xmm2); - __ vminsd(xmm9, xmm1, Operand(rbx, rcx, times_8, 10000)); - __ vmaxsd(xmm8, xmm1, xmm2); - __ vmaxsd(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000)); __ vroundss(xmm9, xmm1, xmm2, kRoundDown); __ vroundsd(xmm8, xmm3, xmm0, kRoundDown); - __ vsqrtsd(xmm8, xmm1, xmm2); - __ vsqrtsd(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000)); __ vucomisd(xmm9, xmm1); __ vucomisd(xmm8, Operand(rbx, rdx, times_2, 10981)); __ vcvtss2sd(xmm4, xmm9, xmm11); - __ vcvtsd2ss(xmm9, xmm3, xmm2); __ vcvtss2sd(xmm4, xmm9, Operand(rbx, rcx, times_1, 10000)); - __ vcvtsd2ss(xmm9, xmm3, Operand(rbx, rcx, times_1, 10000)); + __ vcvttps2dq(xmm4, xmm11); __ vcvtlsi2sd(xmm5, xmm9, rcx); __ vcvtlsi2sd(xmm9, xmm3, Operand(rbx, r9, times_4, 10000)); __ vcvtqsi2sd(xmm5, xmm9, r11); @@ -687,13 +665,6 @@ TEST(DisasmX64) { __ vhaddps(xmm0, xmm1, xmm9); __ vhaddps(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vandpd(xmm0, xmm9, xmm2); - __ vandpd(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vorpd(xmm0, xmm1, xmm9); - __ vorpd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vxorpd(xmm0, xmm1, xmm9); - __ vxorpd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000)); - __ vpcmpeqd(xmm0, xmm15, xmm5); __ vpcmpeqd(xmm15, xmm0, Operand(rbx, rcx, times_4, 10000)); @@ -744,23 +715,44 @@ TEST(DisasmX64) { __ v##instruction(xmm10, xmm5, xmm1); \ __ v##instruction(xmm10, xmm5, Operand(rdx, 4)); + SSE2_INSTRUCTION_LIST(EMIT_SSE2_AVXINSTR) +#undef EMIT_SSE2_AVXINSTR + +#define EMIT_SSE2_UNOP_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3) \ + __ v##instruction(xmm10, xmm1); \ + __ v##instruction(xmm10, Operand(rdx, 4)); + + SSE2_UNOP_INSTRUCTION_LIST(EMIT_SSE2_UNOP_AVXINSTR) +#undef EMIT_SSE2_AVXINSTR + +#define EMIT_SSE2_SD_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3) \ + __ v##instruction(xmm10, xmm5, xmm1); \ + __ v##instruction(xmm10, xmm5, Operand(rbx, rcx, times_4, 10000)); + SSE2_INSTRUCTION_LIST_SD(EMIT_SSE2_SD_AVXINSTR) +#undef EMIT_SSE2_SD_AVXINSTR + #define EMIT_SSE34_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3, \ notUsed4) \ __ v##instruction(xmm10, xmm5, xmm1); \ __ v##instruction(xmm10, xmm5, Operand(rdx, 4)); - SSE2_INSTRUCTION_LIST(EMIT_SSE2_AVXINSTR) SSSE3_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR) SSE4_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR) SSE4_2_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR) -#undef EMIT_SSE2_AVXINSTR #undef EMIT_SSE34_AVXINSTR +#define EMIT_SSSE3_UNOP_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3, \ + notUsed4) \ + __ v##instruction(xmm9, xmm3); \ + __ v##instruction(xmm9, Operand(rdx, 5)); + SSSE3_UNOP_INSTRUCTION_LIST(EMIT_SSSE3_UNOP_AVXINSTR) +#undef EMIT_SSSE3_UNOP_AVXINSTR + #define EMIT_SSE4_PMOV_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3, \ notUsed4) \ __ v##instruction(xmm10, xmm1); \ __ v##instruction(xmm10, Operand(rdx, 4)); - SSE4_PMOV_INSTRUCTION_LIST(EMIT_SSE4_PMOV_AVXINSTR) + SSE4_UNOP_INSTRUCTION_LIST(EMIT_SSE4_PMOV_AVXINSTR) #undef EMIT_SSE4_PMOV_AVXINSTR #define EMIT_SSE2_SHIFT_IMM_AVX(instruction, notUsed1, notUsed2, notUsed3, \ @@ -791,8 +783,11 @@ TEST(DisasmX64) { __ vpinsrq(xmm1, xmm2, rax, 9); __ vpinsrq(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 9); __ vpshufd(xmm1, xmm2, 85); + __ vpshufd(xmm1, Operand(rbx, rcx, times_4, 10000), 85); __ vpshuflw(xmm1, xmm2, 85); __ vpshuflw(xmm1, Operand(rbx, rcx, times_4, 10000), 85); + __ vpshufhw(xmm1, xmm2, 85); + __ vpshufhw(xmm1, Operand(rbx, rcx, times_4, 10000), 85); __ vshufps(xmm3, xmm2, xmm3, 3); __ vpblendw(xmm1, xmm2, xmm3, 23); __ vpblendw(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 23); diff --git a/deps/v8/test/cctest/test-factory.cc b/deps/v8/test/cctest/test-factory.cc index 4ed7cb7bca..98823f1ec9 100644 --- a/deps/v8/test/cctest/test-factory.cc +++ b/deps/v8/test/cctest/test-factory.cc @@ -20,7 +20,8 @@ namespace { // This needs to be large enough to create a new nosnap Isolate, but smaller // than kMaximalCodeRangeSize so we can recover from the OOM. constexpr int kInstructionSize = 100 * MB; -STATIC_ASSERT(kInstructionSize < kMaximalCodeRangeSize || !kRequiresCodeRange); +STATIC_ASSERT(kInstructionSize < kMaximalCodeRangeSize || + !kPlatformRequiresCodeRange); size_t NearHeapLimitCallback(void* raw_bool, size_t current_heap_limit, size_t initial_heap_limit) { diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index 91db7e51a5..a15eeff133 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -216,6 +216,39 @@ TEST(VectorCallFeedback) { CHECK_EQ(MONOMORPHIC, nexus.ic_state()); } +TEST(VectorPolymorphicCallFeedback) { + if (!i::FLAG_use_ic) return; + if (i::FLAG_always_opt) return; + FLAG_allow_natives_syntax = true; + FLAG_lazy_feedback_allocation = false; + + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + // Make sure the call feedback of a() in f() becomes polymorphic. + CompileRun( + "function foo_maker() { return () => { return 17; } }" + "a_foo = foo_maker();" + "function f(a) { a(); } f(foo_maker());" + "f(foo_maker());"); + Handle<JSFunction> f = GetFunction("f"); + Handle<JSFunction> a_foo = GetFunction("a_foo"); + // There should be one IC. + Handle<FeedbackVector> feedback_vector = + Handle<FeedbackVector>(f->feedback_vector(), isolate); + FeedbackSlot slot(0); + FeedbackNexus nexus(feedback_vector, slot); + + CHECK_EQ(POLYMORPHIC, nexus.ic_state()); + HeapObject heap_object; + CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object)); + CHECK(heap_object.IsFeedbackCell(isolate)); + // Ensure this is the feedback cell for the closure returned by + // foo_maker. + CHECK_EQ(heap_object, a_foo->raw_feedback_cell()); +} + TEST(VectorCallFeedbackForArray) { if (!i::FLAG_use_ic) return; if (i::FLAG_always_opt) return; diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index 9deb1ff70c..840478a520 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -11,7 +11,7 @@ #include "src/execution/execution.h" #include "src/handles/global-handles.h" -#include "src/heap/factory.h" +#include "src/heap/factory-inl.h" #include "src/ic/stub-cache.h" #include "src/objects/field-type.h" #include "src/objects/heap-number-inl.h" diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc index 73f302f691..ab210ae162 100644 --- a/deps/v8/test/cctest/test-func-name-inference.cc +++ b/deps/v8/test/cctest/test-func-name-inference.cc @@ -94,8 +94,7 @@ static void CheckFunctionName(v8::Local<v8::Script> script, static v8::Local<v8::Script> Compile(v8::Isolate* isolate, const char* src) { return v8::Script::Compile( isolate->GetCurrentContext(), - v8::String::NewFromUtf8(isolate, src, v8::NewStringType::kNormal) - .ToLocalChecked()) + v8::String::NewFromUtf8(isolate, src).ToLocalChecked()) .ToLocalChecked(); } diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc index a3c8fb7bde..b4da8ce544 100644 --- a/deps/v8/test/cctest/test-global-handles.cc +++ b/deps/v8/test/cctest/test-global-handles.cc @@ -98,6 +98,15 @@ void ConstructJSObject(v8::Isolate* isolate, v8::Global<v8::Object>* global) { CHECK(!global->IsEmpty()); } +void ConstructJSObject(v8::Isolate* isolate, + v8::TracedGlobal<v8::Object>* traced) { + v8::HandleScope scope(isolate); + v8::Local<v8::Object> object(v8::Object::New(isolate)); + CHECK(!object.IsEmpty()); + *traced = v8::TracedGlobal<v8::Object>(isolate, object); + CHECK(!traced->IsEmpty()); +} + template <typename HandleContainer> void ConstructJSApiObject(v8::Isolate* isolate, v8::Local<v8::Context> context, HandleContainer* flag_and_persistent) { @@ -437,10 +446,8 @@ TEST(TracedGlobalToJSApiObjectWithModifiedMapSurvivesScavenge) { // Create an API object which does not have the same map as constructor. auto function_template = FunctionTemplate::New(isolate); auto instance_t = function_template->InstanceTemplate(); - instance_t->Set( - v8::String::NewFromUtf8(isolate, "a", NewStringType::kNormal) - .ToLocalChecked(), - v8::Number::New(isolate, 10)); + instance_t->Set(v8::String::NewFromUtf8Literal(isolate, "a"), + v8::Number::New(isolate, 10)); auto function = function_template->GetFunction(context.local()).ToLocalChecked(); auto i = function->NewInstance(context.local()).ToLocalChecked(); @@ -462,14 +469,10 @@ TEST(TracedGlobalTOJsApiObjectWithElementsSurvivesScavenge) { // Create an API object which has elements. auto function_template = FunctionTemplate::New(isolate); auto instance_t = function_template->InstanceTemplate(); - instance_t->Set( - v8::String::NewFromUtf8(isolate, "1", NewStringType::kNormal) - .ToLocalChecked(), - v8::Number::New(isolate, 10)); - instance_t->Set( - v8::String::NewFromUtf8(isolate, "2", NewStringType::kNormal) - .ToLocalChecked(), - v8::Number::New(isolate, 10)); + instance_t->Set(v8::String::NewFromUtf8Literal(isolate, "1"), + v8::Number::New(isolate, 10)); + instance_t->Set(v8::String::NewFromUtf8Literal(isolate, "2"), + v8::Number::New(isolate, 10)); auto function = function_template->GetFunction(context.local()).ToLocalChecked(); auto i = function->NewInstance(context.local()).ToLocalChecked(); @@ -667,5 +670,39 @@ TEST(MoveWeakGlobal) { InvokeMarkSweep(); } +TEST(TotalSizeRegularNode) { + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + Isolate* i_isolate = CcTest::i_isolate(); + v8::HandleScope scope(isolate); + + v8::Global<v8::Object>* global = new Global<v8::Object>(); + CHECK_EQ(i_isolate->global_handles()->TotalSize(), 0); + CHECK_EQ(i_isolate->global_handles()->UsedSize(), 0); + ConstructJSObject(isolate, global); + CHECK_GT(i_isolate->global_handles()->TotalSize(), 0); + CHECK_GT(i_isolate->global_handles()->UsedSize(), 0); + delete global; + CHECK_GT(i_isolate->global_handles()->TotalSize(), 0); + CHECK_EQ(i_isolate->global_handles()->UsedSize(), 0); +} + +TEST(TotalSizeTracedNode) { + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + Isolate* i_isolate = CcTest::i_isolate(); + v8::HandleScope scope(isolate); + + v8::TracedGlobal<v8::Object>* global = new TracedGlobal<v8::Object>(); + CHECK_EQ(i_isolate->global_handles()->TotalSize(), 0); + CHECK_EQ(i_isolate->global_handles()->UsedSize(), 0); + ConstructJSObject(isolate, global); + CHECK_GT(i_isolate->global_handles()->TotalSize(), 0); + CHECK_GT(i_isolate->global_handles()->UsedSize(), 0); + delete global; + CHECK_GT(i_isolate->global_handles()->TotalSize(), 0); + CHECK_EQ(i_isolate->global_handles()->UsedSize(), 0); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 4d70d66724..63c88ae9b2 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -4053,10 +4053,9 @@ TEST(WeakReference) { // Create a FeedbackVector. v8::Local<v8::Script> script = - v8::Script::Compile(isolate->GetCurrentContext(), - v8::String::NewFromUtf8(isolate, "function foo() {}", - v8::NewStringType::kNormal) - .ToLocalChecked()) + v8::Script::Compile( + isolate->GetCurrentContext(), + v8::String::NewFromUtf8Literal(isolate, "function foo() {}")) .ToLocalChecked(); v8::MaybeLocal<v8::Value> value = script->Run(isolate->GetCurrentContext()); CHECK(!value.IsEmpty()); diff --git a/deps/v8/test/cctest/test-icache.cc b/deps/v8/test/cctest/test-icache.cc index 95cc3c7824..e8c89b7232 100644 --- a/deps/v8/test/cctest/test-icache.cc +++ b/deps/v8/test/cctest/test-icache.cc @@ -34,6 +34,7 @@ static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) { __ addl(rax, Immediate(1)); } #elif V8_TARGET_ARCH_ARM64 + __ CodeEntry(); for (int i = 0; i < kNumInstr; ++i) { __ Add(x0, x0, Operand(1)); } @@ -51,7 +52,7 @@ static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) { for (int i = 0; i < kNumInstr; ++i) { __ Addu(v0, v0, Operand(1)); } -#elif V8_TARGET_ARCH_PPC +#elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 for (int i = 0; i < kNumInstr; ++i) { __ addi(r3, r3, Operand(1)); } @@ -73,6 +74,8 @@ static void FloodWithNop(Isolate* isolate, TestingAssemblerBuffer* buffer) { __ mov(eax, Operand(esp, kSystemPointerSize)); #elif V8_TARGET_ARCH_X64 __ movl(rax, arg_reg_1); +#elif V8_TARGET_ARCH_ARM64 + __ CodeEntry(); #elif V8_TARGET_ARCH_MIPS __ mov(v0, a0); #elif V8_TARGET_ARCH_MIPS64 diff --git a/deps/v8/test/cctest/test-inspector.cc b/deps/v8/test/cctest/test-inspector.cc index 2f7e8b1ea1..6dd2aefb9e 100644 --- a/deps/v8/test/cctest/test-inspector.cc +++ b/deps/v8/test/cctest/test-inspector.cc @@ -9,9 +9,7 @@ #include "include/v8-inspector.h" #include "include/v8.h" #include "src/inspector/protocol/Runtime.h" -#include "src/inspector/string-16.h" -using v8_inspector::String16; using v8_inspector::StringBuffer; using v8_inspector::StringView; using v8_inspector::V8ContextInfo; @@ -65,16 +63,3 @@ TEST(WrapInsideWrapOnInterrupt) { isolate->RequestInterrupt(&WrapOnInterrupt, session.get()); session->wrapObject(env.local(), v8::Null(isolate), object_group_view, false); } - -TEST(String16EndianTest) { - const v8_inspector::UChar* expected = - reinterpret_cast<const v8_inspector::UChar*>(u"Hello, \U0001F30E."); - const uint16_t* utf16le = reinterpret_cast<const uint16_t*>( - "H\0e\0l\0l\0o\0,\0 \0\x3c\xd8\x0e\xdf.\0"); // Same text in UTF16LE - // encoding - - String16 utf16_str = String16::fromUTF16LE(utf16le, 10); - String16 expected_str = expected; - - CHECK_EQ(utf16_str, expected_str); -} diff --git a/deps/v8/test/cctest/test-js-weak-refs.cc b/deps/v8/test/cctest/test-js-weak-refs.cc index db43f46e71..6759c37128 100644 --- a/deps/v8/test/cctest/test-js-weak-refs.cc +++ b/deps/v8/test/cctest/test-js-weak-refs.cc @@ -16,23 +16,24 @@ namespace internal { namespace { -Handle<JSFinalizationGroup> ConstructJSFinalizationGroup(Isolate* isolate) { +Handle<JSFinalizationRegistry> ConstructJSFinalizationRegistry( + Isolate* isolate) { Factory* factory = isolate->factory(); - Handle<String> finalization_group_name = - factory->NewStringFromStaticChars("FinalizationGroup"); + Handle<String> finalization_registry_name = + factory->NewStringFromStaticChars("FinalizationRegistry"); Handle<Object> global = handle(isolate->native_context()->global_object(), isolate); - Handle<JSFunction> finalization_group_fun = Handle<JSFunction>::cast( - Object::GetProperty(isolate, global, finalization_group_name) + Handle<JSFunction> finalization_registry_fun = Handle<JSFunction>::cast( + Object::GetProperty(isolate, global, finalization_registry_name) .ToHandleChecked()); - auto finalization_group = Handle<JSFinalizationGroup>::cast( - JSObject::New(finalization_group_fun, finalization_group_fun, + auto finalization_registry = Handle<JSFinalizationRegistry>::cast( + JSObject::New(finalization_registry_fun, finalization_registry_fun, Handle<AllocationSite>::null()) .ToHandleChecked()); #ifdef VERIFY_HEAP - finalization_group->JSFinalizationGroupVerify(isolate); + finalization_registry->JSFinalizationRegistryVerify(isolate); #endif // VERIFY_HEAP - return finalization_group; + return finalization_registry; } Handle<JSWeakRef> ConstructJSWeakRef(Handle<JSReceiver> target, @@ -64,27 +65,28 @@ Handle<JSObject> CreateKey(const char* key_prop_value, Isolate* isolate) { return key; } -Handle<WeakCell> FinalizationGroupRegister( - Handle<JSFinalizationGroup> finalization_group, Handle<JSObject> target, - Handle<Object> holdings, Handle<Object> key, Isolate* isolate) { - JSFinalizationGroup::Register(finalization_group, target, holdings, key, - isolate); - CHECK(finalization_group->active_cells().IsWeakCell()); +Handle<WeakCell> FinalizationRegistryRegister( + Handle<JSFinalizationRegistry> finalization_registry, + Handle<JSObject> target, Handle<Object> holdings, Handle<Object> key, + Isolate* isolate) { + JSFinalizationRegistry::Register(finalization_registry, target, holdings, key, + isolate); + CHECK(finalization_registry->active_cells().IsWeakCell()); Handle<WeakCell> weak_cell = - handle(WeakCell::cast(finalization_group->active_cells()), isolate); + handle(WeakCell::cast(finalization_registry->active_cells()), isolate); #ifdef VERIFY_HEAP weak_cell->WeakCellVerify(isolate); #endif // VERIFY_HEAP return weak_cell; } -Handle<WeakCell> FinalizationGroupRegister( - Handle<JSFinalizationGroup> finalization_group, Handle<JSObject> target, - Isolate* isolate) { +Handle<WeakCell> FinalizationRegistryRegister( + Handle<JSFinalizationRegistry> finalization_registry, + Handle<JSObject> target, Isolate* isolate) { Handle<Object> undefined = handle(ReadOnlyRoots(isolate).undefined_value(), isolate); - return FinalizationGroupRegister(finalization_group, target, undefined, - undefined, isolate); + return FinalizationRegistryRegister(finalization_registry, target, undefined, + undefined, isolate); } void NullifyWeakCell(Handle<WeakCell> weak_cell, Isolate* isolate) { @@ -158,6 +160,17 @@ void VerifyWeakCellKeyChain(Isolate* isolate, SimpleNumberDictionary key_map, va_end(args); } +Handle<JSWeakRef> MakeWeakRefAndKeepDuringJob(Isolate* isolate) { + HandleScope inner_scope(isolate); + + Handle<JSObject> js_object = + isolate->factory()->NewJSObject(isolate->object_function()); + Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate); + isolate->heap()->KeepDuringJob(js_object); + + return inner_scope.CloseAndEscape(inner_weak_ref); +} + } // namespace TEST(TestRegister) { @@ -166,36 +179,36 @@ TEST(TestRegister) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); // Register a weak reference and verify internal data structures. Handle<WeakCell> weak_cell1 = - FinalizationGroupRegister(finalization_group, js_object, isolate); + FinalizationRegistryRegister(finalization_registry, js_object, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 1, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 1, *weak_cell1); CHECK(weak_cell1->key_list_prev().IsUndefined(isolate)); CHECK(weak_cell1->key_list_next().IsUndefined(isolate)); - CHECK(finalization_group->cleared_cells().IsUndefined(isolate)); + CHECK(finalization_registry->cleared_cells().IsUndefined(isolate)); // No key was used during registration, key-based map stays uninitialized. - CHECK(finalization_group->key_map().IsUndefined(isolate)); + CHECK(finalization_registry->key_map().IsUndefined(isolate)); // Register another weak reference and verify internal data structures. Handle<WeakCell> weak_cell2 = - FinalizationGroupRegister(finalization_group, js_object, isolate); + FinalizationRegistryRegister(finalization_registry, js_object, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 2, *weak_cell2, *weak_cell1); CHECK(weak_cell2->key_list_prev().IsUndefined(isolate)); CHECK(weak_cell2->key_list_next().IsUndefined(isolate)); - CHECK(finalization_group->cleared_cells().IsUndefined(isolate)); - CHECK(finalization_group->key_map().IsUndefined(isolate)); + CHECK(finalization_registry->cleared_cells().IsUndefined(isolate)); + CHECK(finalization_registry->key_map().IsUndefined(isolate)); } TEST(TestRegisterWithKey) { @@ -204,8 +217,8 @@ TEST(TestRegisterWithKey) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); @@ -215,36 +228,36 @@ TEST(TestRegisterWithKey) { handle(ReadOnlyRoots(isolate).undefined_value(), isolate); // Register a weak reference with a key and verify internal data structures. - Handle<WeakCell> weak_cell1 = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1 = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 1, *weak_cell1); VerifyWeakCellKeyChain(isolate, key_map, *token2, 0); } // Register another weak reference with a different key and verify internal // data structures. - Handle<WeakCell> weak_cell2 = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2 = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 1, *weak_cell1); VerifyWeakCellKeyChain(isolate, key_map, *token2, 1, *weak_cell2); } // Register another weak reference with token1 and verify internal data // structures. - Handle<WeakCell> weak_cell3 = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell3 = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell3, *weak_cell1); VerifyWeakCellKeyChain(isolate, key_map, *token2, 1, *weak_cell2); @@ -257,29 +270,29 @@ TEST(TestWeakCellNullify1) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); Handle<WeakCell> weak_cell1 = - FinalizationGroupRegister(finalization_group, js_object, isolate); + FinalizationRegistryRegister(finalization_registry, js_object, isolate); Handle<WeakCell> weak_cell2 = - FinalizationGroupRegister(finalization_group, js_object, isolate); + FinalizationRegistryRegister(finalization_registry, js_object, isolate); // Nullify the first WeakCell and verify internal data structures. NullifyWeakCell(weak_cell1, isolate); - CHECK_EQ(finalization_group->active_cells(), *weak_cell2); + CHECK_EQ(finalization_registry->active_cells(), *weak_cell2); CHECK(weak_cell2->prev().IsUndefined(isolate)); CHECK(weak_cell2->next().IsUndefined(isolate)); - CHECK_EQ(finalization_group->cleared_cells(), *weak_cell1); + CHECK_EQ(finalization_registry->cleared_cells(), *weak_cell1); CHECK(weak_cell1->prev().IsUndefined(isolate)); CHECK(weak_cell1->next().IsUndefined(isolate)); // Nullify the second WeakCell and verify internal data structures. NullifyWeakCell(weak_cell2, isolate); - CHECK(finalization_group->active_cells().IsUndefined(isolate)); - CHECK_EQ(finalization_group->cleared_cells(), *weak_cell2); + CHECK(finalization_registry->active_cells().IsUndefined(isolate)); + CHECK_EQ(finalization_registry->cleared_cells(), *weak_cell2); CHECK_EQ(weak_cell2->next(), *weak_cell1); CHECK(weak_cell2->prev().IsUndefined(isolate)); CHECK_EQ(weak_cell1->prev(), *weak_cell2); @@ -292,92 +305,92 @@ TEST(TestWeakCellNullify2) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); Handle<WeakCell> weak_cell1 = - FinalizationGroupRegister(finalization_group, js_object, isolate); + FinalizationRegistryRegister(finalization_registry, js_object, isolate); Handle<WeakCell> weak_cell2 = - FinalizationGroupRegister(finalization_group, js_object, isolate); + FinalizationRegistryRegister(finalization_registry, js_object, isolate); // Like TestWeakCellNullify1 but nullify the WeakCells in opposite order. NullifyWeakCell(weak_cell2, isolate); - CHECK_EQ(finalization_group->active_cells(), *weak_cell1); + CHECK_EQ(finalization_registry->active_cells(), *weak_cell1); CHECK(weak_cell1->prev().IsUndefined(isolate)); CHECK(weak_cell1->next().IsUndefined(isolate)); - CHECK_EQ(finalization_group->cleared_cells(), *weak_cell2); + CHECK_EQ(finalization_registry->cleared_cells(), *weak_cell2); CHECK(weak_cell2->prev().IsUndefined(isolate)); CHECK(weak_cell2->next().IsUndefined(isolate)); NullifyWeakCell(weak_cell1, isolate); - CHECK(finalization_group->active_cells().IsUndefined(isolate)); - CHECK_EQ(finalization_group->cleared_cells(), *weak_cell1); + CHECK(finalization_registry->active_cells().IsUndefined(isolate)); + CHECK_EQ(finalization_registry->cleared_cells(), *weak_cell1); CHECK_EQ(weak_cell1->next(), *weak_cell2); CHECK(weak_cell1->prev().IsUndefined(isolate)); CHECK_EQ(weak_cell2->prev(), *weak_cell1); CHECK(weak_cell2->next().IsUndefined(isolate)); } -TEST(TestJSFinalizationGroupPopClearedCellHoldings1) { +TEST(TestJSFinalizationRegistryPopClearedCellHoldings1) { FLAG_harmony_weak_refs = true; CcTest::InitializeVM(); LocalContext context; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); Handle<Object> undefined = handle(ReadOnlyRoots(isolate).undefined_value(), isolate); Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1"); - Handle<WeakCell> weak_cell1 = FinalizationGroupRegister( - finalization_group, js_object, holdings1, undefined, isolate); + Handle<WeakCell> weak_cell1 = FinalizationRegistryRegister( + finalization_registry, js_object, holdings1, undefined, isolate); Handle<Object> holdings2 = factory->NewStringFromAsciiChecked("holdings2"); - Handle<WeakCell> weak_cell2 = FinalizationGroupRegister( - finalization_group, js_object, holdings2, undefined, isolate); + Handle<WeakCell> weak_cell2 = FinalizationRegistryRegister( + finalization_registry, js_object, holdings2, undefined, isolate); Handle<Object> holdings3 = factory->NewStringFromAsciiChecked("holdings3"); - Handle<WeakCell> weak_cell3 = FinalizationGroupRegister( - finalization_group, js_object, holdings3, undefined, isolate); + Handle<WeakCell> weak_cell3 = FinalizationRegistryRegister( + finalization_registry, js_object, holdings3, undefined, isolate); NullifyWeakCell(weak_cell2, isolate); NullifyWeakCell(weak_cell3, isolate); - CHECK(finalization_group->NeedsCleanup()); - Object cleared1 = - JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate); + CHECK(finalization_registry->NeedsCleanup()); + Object cleared1 = JSFinalizationRegistry::PopClearedCellHoldings( + finalization_registry, isolate); CHECK_EQ(cleared1, *holdings3); CHECK(weak_cell3->prev().IsUndefined(isolate)); CHECK(weak_cell3->next().IsUndefined(isolate)); - CHECK(finalization_group->NeedsCleanup()); - Object cleared2 = - JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate); + CHECK(finalization_registry->NeedsCleanup()); + Object cleared2 = JSFinalizationRegistry::PopClearedCellHoldings( + finalization_registry, isolate); CHECK_EQ(cleared2, *holdings2); CHECK(weak_cell2->prev().IsUndefined(isolate)); CHECK(weak_cell2->next().IsUndefined(isolate)); - CHECK(!finalization_group->NeedsCleanup()); + CHECK(!finalization_registry->NeedsCleanup()); NullifyWeakCell(weak_cell1, isolate); - CHECK(finalization_group->NeedsCleanup()); - Object cleared3 = - JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate); + CHECK(finalization_registry->NeedsCleanup()); + Object cleared3 = JSFinalizationRegistry::PopClearedCellHoldings( + finalization_registry, isolate); CHECK_EQ(cleared3, *holdings1); CHECK(weak_cell1->prev().IsUndefined(isolate)); CHECK(weak_cell1->next().IsUndefined(isolate)); - CHECK(!finalization_group->NeedsCleanup()); - CHECK(finalization_group->active_cells().IsUndefined(isolate)); - CHECK(finalization_group->cleared_cells().IsUndefined(isolate)); + CHECK(!finalization_registry->NeedsCleanup()); + CHECK(finalization_registry->active_cells().IsUndefined(isolate)); + CHECK(finalization_registry->cleared_cells().IsUndefined(isolate)); } -TEST(TestJSFinalizationGroupPopClearedCellHoldings2) { +TEST(TestJSFinalizationRegistryPopClearedCellHoldings2) { // Test that when all WeakCells for a key are popped, the key is removed from // the key map. FLAG_harmony_weak_refs = true; @@ -386,18 +399,18 @@ TEST(TestJSFinalizationGroupPopClearedCellHoldings2) { Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); Handle<JSObject> token1 = CreateKey("token1", isolate); Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1"); - Handle<WeakCell> weak_cell1 = FinalizationGroupRegister( - finalization_group, js_object, holdings1, token1, isolate); + Handle<WeakCell> weak_cell1 = FinalizationRegistryRegister( + finalization_registry, js_object, holdings1, token1, isolate); Handle<Object> holdings2 = factory->NewStringFromAsciiChecked("holdings2"); - Handle<WeakCell> weak_cell2 = FinalizationGroupRegister( - finalization_group, js_object, holdings2, token1, isolate); + Handle<WeakCell> weak_cell2 = FinalizationRegistryRegister( + finalization_registry, js_object, holdings2, token1, isolate); NullifyWeakCell(weak_cell1, isolate); NullifyWeakCell(weak_cell2, isolate); @@ -406,28 +419,28 @@ TEST(TestJSFinalizationGroupPopClearedCellHoldings2) { // active_cells to cleared_cells). { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell2, *weak_cell1); } - Object cleared1 = - JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate); + Object cleared1 = JSFinalizationRegistry::PopClearedCellHoldings( + finalization_registry, isolate); CHECK_EQ(cleared1, *holdings2); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 1, *weak_cell1); } - Object cleared2 = - JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate); + Object cleared2 = JSFinalizationRegistry::PopClearedCellHoldings( + finalization_registry, isolate); CHECK_EQ(cleared2, *holdings1); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 0); } } @@ -438,8 +451,8 @@ TEST(TestUnregisterActiveCells) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); @@ -448,41 +461,41 @@ TEST(TestUnregisterActiveCells) { Handle<Object> undefined = handle(ReadOnlyRoots(isolate).undefined_value(), isolate); - Handle<WeakCell> weak_cell1a = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); - Handle<WeakCell> weak_cell1b = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1a = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1b = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); - Handle<WeakCell> weak_cell2a = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); - Handle<WeakCell> weak_cell2b = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2a = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2b = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 4, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 4, *weak_cell2b, *weak_cell2a, *weak_cell1b, *weak_cell1a); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell1b, *weak_cell1a); VerifyWeakCellKeyChain(isolate, key_map, *token2, 2, *weak_cell2b, *weak_cell2a); } - JSFinalizationGroup::Unregister(finalization_group, token1, isolate); + JSFinalizationRegistry::Unregister(finalization_registry, token1, isolate); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 0); VerifyWeakCellKeyChain(isolate, key_map, *token2, 2, *weak_cell2b, *weak_cell2a); } // Both weak_cell1a and weak_cell1b removed from active_cells. - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 2, *weak_cell2b, *weak_cell2a); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); } TEST(TestUnregisterActiveAndClearedCells) { @@ -491,8 +504,8 @@ TEST(TestUnregisterActiveAndClearedCells) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); @@ -501,40 +514,40 @@ TEST(TestUnregisterActiveAndClearedCells) { Handle<Object> undefined = handle(ReadOnlyRoots(isolate).undefined_value(), isolate); - Handle<WeakCell> weak_cell1a = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); - Handle<WeakCell> weak_cell1b = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1a = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1b = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); - Handle<WeakCell> weak_cell2a = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); - Handle<WeakCell> weak_cell2b = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2a = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2b = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); NullifyWeakCell(weak_cell2a, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 3, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 3, *weak_cell2b, *weak_cell1b, *weak_cell1a); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 1, + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 1, *weak_cell2a); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell1b, *weak_cell1a); VerifyWeakCellKeyChain(isolate, key_map, *token2, 2, *weak_cell2b, *weak_cell2a); } - JSFinalizationGroup::Unregister(finalization_group, token2, isolate); + JSFinalizationRegistry::Unregister(finalization_registry, token2, isolate); // Both weak_cell2a and weak_cell2b removed. - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 2, *weak_cell1b, *weak_cell1a); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell1b, *weak_cell1a); VerifyWeakCellKeyChain(isolate, key_map, *token2, 0); @@ -547,8 +560,8 @@ TEST(TestWeakCellUnregisterTwice) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); @@ -556,35 +569,35 @@ TEST(TestWeakCellUnregisterTwice) { Handle<Object> undefined = handle(ReadOnlyRoots(isolate).undefined_value(), isolate); - Handle<WeakCell> weak_cell1 = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1 = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 1, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 1, *weak_cell1); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 1, *weak_cell1); } - JSFinalizationGroup::Unregister(finalization_group, token1, isolate); + JSFinalizationRegistry::Unregister(finalization_registry, token1, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 0); } - JSFinalizationGroup::Unregister(finalization_group, token1, isolate); + JSFinalizationRegistry::Unregister(finalization_registry, token1, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 0); } } @@ -596,37 +609,37 @@ TEST(TestWeakCellUnregisterPopped) { Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); Handle<JSObject> token1 = CreateKey("token1", isolate); Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1"); - Handle<WeakCell> weak_cell1 = FinalizationGroupRegister( - finalization_group, js_object, holdings1, token1, isolate); + Handle<WeakCell> weak_cell1 = FinalizationRegistryRegister( + finalization_registry, js_object, holdings1, token1, isolate); NullifyWeakCell(weak_cell1, isolate); - CHECK(finalization_group->NeedsCleanup()); - Object cleared1 = - JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate); + CHECK(finalization_registry->NeedsCleanup()); + Object cleared1 = JSFinalizationRegistry::PopClearedCellHoldings( + finalization_registry, isolate); CHECK_EQ(cleared1, *holdings1); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 0); } - JSFinalizationGroup::Unregister(finalization_group, token1, isolate); + JSFinalizationRegistry::Unregister(finalization_registry, token1, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 0); + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 0); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 0); } } @@ -637,11 +650,11 @@ TEST(TestWeakCellUnregisterNonexistentKey) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> token1 = CreateKey("token1", isolate); - JSFinalizationGroup::Unregister(finalization_group, token1, isolate); + JSFinalizationRegistry::Unregister(finalization_registry, token1, isolate); } TEST(TestJSWeakRef) { @@ -715,30 +728,35 @@ TEST(TestJSWeakRefKeepDuringJob) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); HandleScope outer_scope(isolate); - Handle<JSWeakRef> weak_ref; - { - HandleScope inner_scope(isolate); - - Handle<JSObject> js_object = - isolate->factory()->NewJSObject(isolate->object_function()); - Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate); - heap->KeepDuringJob(js_object); + Handle<JSWeakRef> weak_ref = MakeWeakRefAndKeepDuringJob(isolate); + CHECK(!weak_ref->target().IsUndefined(isolate)); + CcTest::CollectAllGarbage(); + CHECK(!weak_ref->target().IsUndefined(isolate)); - weak_ref = inner_scope.CloseAndEscape(inner_weak_ref); - } + // Clears the KeepDuringJob set. + context->GetIsolate()->ClearKeptObjects(); + CcTest::CollectAllGarbage(); + CHECK(weak_ref->target().IsUndefined(isolate)); + weak_ref = MakeWeakRefAndKeepDuringJob(isolate); + CHECK(!weak_ref->target().IsUndefined(isolate)); + CcTest::CollectAllGarbage(); CHECK(!weak_ref->target().IsUndefined(isolate)); + // ClearKeptObjects should be called by PerformMicrotasksCheckpoint. + CcTest::isolate()->PerformMicrotaskCheckpoint(); CcTest::CollectAllGarbage(); + CHECK(weak_ref->target().IsUndefined(isolate)); + weak_ref = MakeWeakRefAndKeepDuringJob(isolate); CHECK(!weak_ref->target().IsUndefined(isolate)); - - // Clears the KeepDuringJob set. - context->GetIsolate()->ClearKeptObjects(); CcTest::CollectAllGarbage(); + CHECK(!weak_ref->target().IsUndefined(isolate)); + // ClearKeptObjects should be called by MicrotasksScope::PerformCheckpoint. + v8::MicrotasksScope::PerformCheckpoint(CcTest::isolate()); + CcTest::CollectAllGarbage(); CHECK(weak_ref->target().IsUndefined(isolate)); } @@ -754,17 +772,7 @@ TEST(TestJSWeakRefKeepDuringJobIncrementalMarking) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); HandleScope outer_scope(isolate); - Handle<JSWeakRef> weak_ref; - { - HandleScope inner_scope(isolate); - - Handle<JSObject> js_object = - isolate->factory()->NewJSObject(isolate->object_function()); - Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate); - heap->KeepDuringJob(js_object); - - weak_ref = inner_scope.CloseAndEscape(inner_weak_ref); - } + Handle<JSWeakRef> weak_ref = MakeWeakRefAndKeepDuringJob(isolate); CHECK(!weak_ref->target().IsUndefined(isolate)); @@ -787,8 +795,8 @@ TEST(TestRemoveUnregisterToken) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); HandleScope outer_scope(isolate); - Handle<JSFinalizationGroup> finalization_group = - ConstructJSFinalizationGroup(isolate); + Handle<JSFinalizationRegistry> finalization_registry = + ConstructJSFinalizationRegistry(isolate); Handle<JSObject> js_object = isolate->factory()->NewJSObject(isolate->object_function()); @@ -797,32 +805,32 @@ TEST(TestRemoveUnregisterToken) { Handle<Object> undefined = handle(ReadOnlyRoots(isolate).undefined_value(), isolate); - Handle<WeakCell> weak_cell1a = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); - Handle<WeakCell> weak_cell1b = FinalizationGroupRegister( - finalization_group, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1a = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); + Handle<WeakCell> weak_cell1b = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token1, isolate); - Handle<WeakCell> weak_cell2a = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); - Handle<WeakCell> weak_cell2b = FinalizationGroupRegister( - finalization_group, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2a = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); + Handle<WeakCell> weak_cell2b = FinalizationRegistryRegister( + finalization_registry, js_object, undefined, token2, isolate); NullifyWeakCell(weak_cell2a, isolate); - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 3, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 3, *weak_cell2b, *weak_cell1b, *weak_cell1a); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 1, + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 1, *weak_cell2a); { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell1b, *weak_cell1a); VerifyWeakCellKeyChain(isolate, key_map, *token2, 2, *weak_cell2b, *weak_cell2a); } - finalization_group->RemoveUnregisterToken( + finalization_registry->RemoveUnregisterToken( JSReceiver::cast(*token2), isolate, [undefined](WeakCell matched_cell) { matched_cell.set_unregister_token(*undefined); @@ -830,15 +838,15 @@ TEST(TestRemoveUnregisterToken) { [](HeapObject, ObjectSlot, Object) {}); // Both weak_cell2a and weak_cell2b remain on the weak cell chains. - VerifyWeakCellChain(isolate, finalization_group->active_cells(), 3, + VerifyWeakCellChain(isolate, finalization_registry->active_cells(), 3, *weak_cell2b, *weak_cell1b, *weak_cell1a); - VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 1, + VerifyWeakCellChain(isolate, finalization_registry->cleared_cells(), 1, *weak_cell2a); // But both weak_cell2a and weak_cell2b are removed from the key chain. { SimpleNumberDictionary key_map = - SimpleNumberDictionary::cast(finalization_group->key_map()); + SimpleNumberDictionary::cast(finalization_registry->key_map()); VerifyWeakCellKeyChain(isolate, key_map, *token1, 2, *weak_cell1b, *weak_cell1a); VerifyWeakCellKeyChain(isolate, key_map, *token2, 0); diff --git a/deps/v8/test/cctest/test-local-handles.cc b/deps/v8/test/cctest/test-local-handles.cc new file mode 100644 index 0000000000..0e4fc5c7d1 --- /dev/null +++ b/deps/v8/test/cctest/test-local-handles.cc @@ -0,0 +1,96 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> + +#include "src/api/api.h" +#include "src/base/platform/condition-variable.h" +#include "src/base/platform/mutex.h" +#include "src/base/platform/semaphore.h" +#include "src/handles/handles-inl.h" +#include "src/handles/local-handles-inl.h" +#include "src/heap/heap.h" +#include "src/heap/local-heap.h" +#include "src/heap/safepoint.h" +#include "src/objects/heap-number.h" +#include "test/cctest/cctest.h" +#include "test/cctest/heap/heap-utils.h" + +namespace v8 { +namespace internal { + +class LocalHandlesThread final : public v8::base::Thread { + public: + LocalHandlesThread(Heap* heap, Address object, base::Semaphore* sema_started, + base::Semaphore* sema_gc_finished) + : v8::base::Thread(base::Thread::Options("ThreadWithLocalHeap")), + heap_(heap), + object_(object), + sema_started_(sema_started), + sema_gc_finished_(sema_gc_finished) {} + + void Run() override { + LocalHeap local_heap(heap_); + LocalHandleScope scope(&local_heap); + + static constexpr int kNumHandles = + kHandleBlockSize * 2 + kHandleBlockSize / 2; + + std::vector<Handle<HeapNumber>> handles; + handles.reserve(kNumHandles); + + for (int i = 0; i < kNumHandles; i++) { + Handle<HeapNumber> number = handle( + HeapNumber::cast(HeapObject::FromAddress(object_)), &local_heap); + handles.push_back(number); + } + + sema_started_->Signal(); + + { + ParkedScope scope(&local_heap); + sema_gc_finished_->Wait(); + } + + for (Handle<HeapNumber> handle : handles) { + CHECK_EQ(42.0, handle->value()); + } + } + + Heap* heap_; + Address object_; + base::Semaphore* sema_started_; + base::Semaphore* sema_gc_finished_; +}; + +TEST(CreateLocalHandles) { + CcTest::InitializeVM(); + FLAG_local_heaps = true; + Isolate* isolate = CcTest::i_isolate(); + + Address object = kNullAddress; + + { + HandleScope handle_scope(isolate); + Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(42.0); + object = (*number).address(); + } + + base::Semaphore sema_started(0); + base::Semaphore sema_gc_finished(0); + + std::unique_ptr<LocalHandlesThread> thread(new LocalHandlesThread( + isolate->heap(), object, &sema_started, &sema_gc_finished)); + CHECK(thread->Start()); + + sema_started.Wait(); + + CcTest::CollectAllGarbage(); + sema_gc_finished.Signal(); + + thread->Join(); +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc index 80a6530dd7..5531b7ec95 100644 --- a/deps/v8/test/cctest/test-log.cc +++ b/deps/v8/test/cctest/test-log.cc @@ -306,9 +306,7 @@ TEST(Issue23768) { .ToLocalChecked(); // Script needs to have a name in order to trigger InitLineEnds execution. v8::Local<v8::String> origin = - v8::String::NewFromUtf8(CcTest::isolate(), "issue-23768-test", - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromUtf8Literal(CcTest::isolate(), "issue-23768-test"); v8::Local<v8::Script> evil_script = CompileWithOrigin(source, origin, v8_bool(false)); CHECK(!evil_script.IsEmpty()); @@ -567,7 +565,7 @@ UNINITIALIZED_TEST(LogAll) { isolate->Dispose(); } -#ifndef V8_TARGET_ARCH_ARM +#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X) UNINITIALIZED_TEST(LogInterpretedFramesNativeStack) { SETUP_FLAGS(); i::FLAG_interpreted_frames_native_stack = true; @@ -652,7 +650,7 @@ UNINITIALIZED_TEST(LogInterpretedFramesNativeStackWithSerialization) { } while (!has_cache); delete cache; } -#endif // V8_TARGET_ARCH_ARM +#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X UNINITIALIZED_TEST(ExternalCodeEventListener) { i::FLAG_log = false; @@ -755,7 +753,7 @@ UNINITIALIZED_TEST(ExternalCodeEventListenerInnerFunctions) { isolate2->Dispose(); } -#ifndef V8_TARGET_ARCH_ARM +#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X) UNINITIALIZED_TEST(ExternalCodeEventListenerWithInterpretedFramesNativeStack) { i::FLAG_log = false; i::FLAG_prof = false; @@ -805,7 +803,7 @@ UNINITIALIZED_TEST(ExternalCodeEventListenerWithInterpretedFramesNativeStack) { } isolate->Dispose(); } -#endif // V8_TARGET_ARCH_ARM +#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X UNINITIALIZED_TEST(TraceMaps) { SETUP_FLAGS(); diff --git a/deps/v8/test/cctest/test-modules.cc b/deps/v8/test/cctest/test-modules.cc index 3d668360bd..13c6a3b7a8 100644 --- a/deps/v8/test/cctest/test-modules.cc +++ b/deps/v8/test/cctest/test-modules.cc @@ -45,147 +45,160 @@ MaybeLocal<Module> ResolveCallback(Local<Context> context, } TEST(ModuleInstantiationFailures1) { - Isolate* isolate = CcTest::isolate(); - HandleScope scope(isolate); - LocalContext env; - v8::TryCatch try_catch(isolate); + bool prev_top_level_await = i::FLAG_harmony_top_level_await; + for (auto top_level_await : {true, false}) { + i::FLAG_harmony_top_level_await = top_level_await; + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + v8::TryCatch try_catch(isolate); - Local<Module> module; - { - Local<String> source_text = v8_str( - "import './foo.js';\n" - "export {} from './bar.js';"); - ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - CHECK_EQ(2, module->GetModuleRequestsLength()); - CHECK(v8_str("./foo.js")->StrictEquals(module->GetModuleRequest(0))); - v8::Location loc = module->GetModuleRequestLocation(0); - CHECK_EQ(0, loc.GetLineNumber()); - CHECK_EQ(7, loc.GetColumnNumber()); - CHECK(v8_str("./bar.js")->StrictEquals(module->GetModuleRequest(1))); - loc = module->GetModuleRequestLocation(1); - CHECK_EQ(1, loc.GetLineNumber()); - CHECK_EQ(15, loc.GetColumnNumber()); - } + Local<Module> module; + { + Local<String> source_text = v8_str( + "import './foo.js';\n" + "export {} from './bar.js';"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK_EQ(2, module->GetModuleRequestsLength()); + CHECK(v8_str("./foo.js")->StrictEquals(module->GetModuleRequest(0))); + v8::Location loc = module->GetModuleRequestLocation(0); + CHECK_EQ(0, loc.GetLineNumber()); + CHECK_EQ(7, loc.GetColumnNumber()); + CHECK(v8_str("./bar.js")->StrictEquals(module->GetModuleRequest(1))); + loc = module->GetModuleRequestLocation(1); + CHECK_EQ(1, loc.GetLineNumber()); + CHECK_EQ(15, loc.GetColumnNumber()); + } - // Instantiation should fail. - { - v8::TryCatch inner_try_catch(isolate); - CHECK(module->InstantiateModule(env.local(), ResolveCallback).IsNothing()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - } + // Instantiation should fail. + { + v8::TryCatch inner_try_catch(isolate); + CHECK( + module->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + } - // Start over again... - { - Local<String> source_text = v8_str( - "import './dep1.js';\n" - "export {} from './bar.js';"); - ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + // Start over again... + { + Local<String> source_text = v8_str( + "import './dep1.js';\n" + "export {} from './bar.js';"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - // dep1.js - { - Local<String> source_text = v8_str(""); - ScriptOrigin origin = ModuleOrigin(v8_str("dep1.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - dep1 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + // dep1.js + { + Local<String> source_text = v8_str(""); + ScriptOrigin origin = ModuleOrigin(v8_str("dep1.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep1 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - // Instantiation should fail because a sub-module fails to resolve. - { - v8::TryCatch inner_try_catch(isolate); - CHECK(module->InstantiateModule(env.local(), ResolveCallback).IsNothing()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - } + // Instantiation should fail because a sub-module fails to resolve. + { + v8::TryCatch inner_try_catch(isolate); + CHECK( + module->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + } - CHECK(!try_catch.HasCaught()); + CHECK(!try_catch.HasCaught()); + } + i::FLAG_harmony_top_level_await = prev_top_level_await; } TEST(ModuleInstantiationFailures2) { - Isolate* isolate = CcTest::isolate(); - HandleScope scope(isolate); - LocalContext env; - v8::TryCatch try_catch(isolate); + bool prev_top_level_await = i::FLAG_harmony_top_level_await; + for (auto top_level_await : {true, false}) { + i::FLAG_harmony_top_level_await = top_level_await; - // root1.js - Local<Module> root; - { - Local<String> source_text = - v8_str("import './dep1.js'; import './dep2.js'"); - ScriptOrigin origin = ModuleOrigin(v8_str("root1.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - root = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + v8::TryCatch try_catch(isolate); - // dep1.js - { - Local<String> source_text = v8_str("export let x = 42"); - ScriptOrigin origin = ModuleOrigin(v8_str("dep1.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - dep1 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + // root1.js + Local<Module> root; + { + Local<String> source_text = + v8_str("import './dep1.js'; import './dep2.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("root1.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + root = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - // dep2.js - { - Local<String> source_text = v8_str("import {foo} from './dep3.js'"); - ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + // dep1.js + { + Local<String> source_text = v8_str("export let x = 42"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep1.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep1 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - { - v8::TryCatch inner_try_catch(isolate); - CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kUninstantiated, root->GetStatus()); - CHECK_EQ(Module::kUninstantiated, dep1->GetStatus()); - CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); - } + // dep2.js + { + Local<String> source_text = v8_str("import {foo} from './dep3.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - // Change dep2.js - { - Local<String> source_text = v8_str("import {foo} from './dep2.js'"); - ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + { + v8::TryCatch inner_try_catch(isolate); + CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, root->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep1->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + } - { - v8::TryCatch inner_try_catch(isolate); - CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); - CHECK(inner_try_catch.HasCaught()); - CHECK(!inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kUninstantiated, root->GetStatus()); - CHECK_EQ(Module::kInstantiated, dep1->GetStatus()); - CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); - } + // Change dep2.js + { + Local<String> source_text = v8_str("import {foo} from './dep2.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - // Change dep2.js again - { - Local<String> source_text = v8_str("import {foo} from './dep3.js'"); - ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - } + { + v8::TryCatch inner_try_catch(isolate); + CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(!inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, root->GetStatus()); + CHECK_EQ(Module::kInstantiated, dep1->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + } - { - v8::TryCatch inner_try_catch(isolate); - CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kUninstantiated, root->GetStatus()); - CHECK_EQ(Module::kInstantiated, dep1->GetStatus()); - CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + // Change dep2.js again + { + Local<String> source_text = v8_str("import {foo} from './dep3.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + { + v8::TryCatch inner_try_catch(isolate); + CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, root->GetStatus()); + CHECK_EQ(Module::kInstantiated, dep1->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + } } + i::FLAG_harmony_top_level_await = prev_top_level_await; } static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( @@ -726,7 +739,7 @@ TEST(ModuleEvaluationTopLevelAwaitError) { CHECK(promise->Result()->StrictEquals(v8_str("boom"))); CHECK(module->GetException()->StrictEquals(v8_str("boom"))); - // TODO(joshualitt) I am not sure, but this might not be supposed to throw + // TODO(cbruni) I am not sure, but this might not be supposed to throw // because it is async. CHECK(!try_catch.HasCaught()); } @@ -830,7 +843,7 @@ TEST(ModuleEvaluationTopLevelAwaitDynamicImport) { CHECK_EQ(promise->State(), v8::Promise::kPending); CHECK(!try_catch.HasCaught()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(promise->State(), v8::Promise::kFulfilled); } i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value; @@ -874,7 +887,7 @@ TEST(ModuleEvaluationTopLevelAwaitDynamicImportError) { CHECK_EQ(promise->State(), v8::Promise::kPending); CHECK(!try_catch.HasCaught()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK_EQ(Module::kErrored, module->GetStatus()); CHECK_EQ(promise->State(), v8::Promise::kRejected); CHECK(promise->Result()->StrictEquals(v8_str("boom"))); diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc index 9104e850db..04e47eb7bd 100644 --- a/deps/v8/test/cctest/test-object.cc +++ b/deps/v8/test/cctest/test-object.cc @@ -255,6 +255,29 @@ TEST(EnumCache) { } } +TEST(ObjectMethodsThatTruncateMinusZero) { + LocalContext env; + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + v8::HandleScope scope(env->GetIsolate()); + + Handle<Object> minus_zero = factory->NewNumber(-1.0 * 0.0); + CHECK(minus_zero->IsMinusZero()); + + Handle<Object> result = + Object::ToInteger(isolate, minus_zero).ToHandleChecked(); + CHECK(result->IsZero()); + + result = Object::ToLength(isolate, minus_zero).ToHandleChecked(); + CHECK(result->IsZero()); + + // Choose an error message template, doesn't matter which. + result = Object::ToIndex(isolate, minus_zero, + MessageTemplate::kInvalidAtomicAccessIndex) + .ToHandleChecked(); + CHECK(result->IsZero()); +} + #define TEST_FUNCTION_KIND(Name) \ TEST(Name) { \ for (int i = 0; i < FunctionKind::kLastFunctionKind; i++) { \ diff --git a/deps/v8/test/cctest/test-orderedhashtable.cc b/deps/v8/test/cctest/test-orderedhashtable.cc index 189f950b2e..f3887bdacd 100644 --- a/deps/v8/test/cctest/test-orderedhashtable.cc +++ b/deps/v8/test/cctest/test-orderedhashtable.cc @@ -1950,7 +1950,7 @@ TEST(OrderedNameDictionarySetEntry) { Handle<String> other_value = isolate->factory()->InternalizeUtf8String("baz"); PropertyDetails other_details = PropertyDetails(kAccessor, READ_ONLY, PropertyCellType::kNoCell); - dict->SetEntry(isolate, entry, *key, *other_value, other_details); + dict->SetEntry(entry, *key, *other_value, other_details); entry = dict->FindEntry(isolate, *key); CHECK_EQ(0, entry); @@ -1995,7 +1995,7 @@ TEST(SmallOrderedNameDictionarySetEntry) { Handle<String> other_value = factory->InternalizeUtf8String("baz"); PropertyDetails other_details = PropertyDetails(kAccessor, READ_ONLY, PropertyCellType::kNoCell); - dict->SetEntry(isolate, entry, *key, *other_value, other_details); + dict->SetEntry(entry, *key, *other_value, other_details); entry = dict->FindEntry(isolate, *key); CHECK_EQ(0, entry); diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 2decf108ac..fd75f263ca 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -907,7 +907,7 @@ void TestScanRegExp(const char* re_source, const char* expected) { HashSeed(CcTest::i_isolate())); const i::AstRawString* current_symbol = scanner.CurrentSymbol(&ast_value_factory); - ast_value_factory.Internalize(CcTest::i_isolate()->factory()); + ast_value_factory.Internalize(CcTest::i_isolate()); i::Handle<i::String> val = current_symbol->string(); i::DisallowHeapAllocation no_alloc; i::String::FlatContent content = val->GetFlatContent(no_alloc); @@ -1061,7 +1061,7 @@ TEST(ScopeUsesArgumentsSuperThis) { info.set_allow_lazy_parsing(false); CHECK(i::parsing::ParseProgram(&info, script, isolate)); CHECK(i::Rewriter::Rewrite(&info)); - info.ast_value_factory()->Internalize(isolate->factory()); + info.ast_value_factory()->Internalize(isolate); CHECK(i::DeclarationScope::Analyze(&info)); i::DeclarationScope::AllocateScopeInfos(&info, isolate); CHECK_NOT_NULL(info.literal()); @@ -3214,15 +3214,11 @@ TEST(FuncNameInferrerTwoByte) { // Make it really non-Latin1 (replace the Xs with a non-Latin1 character). two_byte_source[14] = two_byte_source[78] = two_byte_name[6] = 0x010D; v8::Local<v8::String> source = - v8::String::NewFromTwoByte(isolate, two_byte_source, - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromTwoByte(isolate, two_byte_source).ToLocalChecked(); v8::Local<v8::Value> result = CompileRun(source); CHECK(result->IsString()); v8::Local<v8::String> expected_name = - v8::String::NewFromTwoByte(isolate, two_byte_name, - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromTwoByte(isolate, two_byte_name).ToLocalChecked(); CHECK(result->Equals(isolate->GetCurrentContext(), expected_name).FromJust()); i::DeleteArray(two_byte_source); i::DeleteArray(two_byte_name); @@ -3243,40 +3239,17 @@ TEST(FuncNameInferrerEscaped) { // Fix to correspond to the non-ASCII name in two_byte_source. two_byte_name[6] = 0x010D; v8::Local<v8::String> source = - v8::String::NewFromTwoByte(isolate, two_byte_source, - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromTwoByte(isolate, two_byte_source).ToLocalChecked(); v8::Local<v8::Value> result = CompileRun(source); CHECK(result->IsString()); v8::Local<v8::String> expected_name = - v8::String::NewFromTwoByte(isolate, two_byte_name, - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromTwoByte(isolate, two_byte_name).ToLocalChecked(); CHECK(result->Equals(isolate->GetCurrentContext(), expected_name).FromJust()); i::DeleteArray(two_byte_source); i::DeleteArray(two_byte_name); } -TEST(RegressionLazyFunctionWithErrorWithArg) { - // Test only applies when lazy parsing. - if (!i::FLAG_lazy) return; - - // The bug occurred when a lazy function had an error which requires a - // parameter (such as "unknown label" here). The error message was processed - // before the AstValueFactory containing the error message string was - // internalized. - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - LocalContext env; - i::FLAG_lazy = true; - CompileRun("function this_is_lazy() {\n" - " break p;\n" - "}\n" - "this_is_lazy();\n"); -} - - TEST(SerializationOfMaybeAssignmentFlag) { i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); @@ -3312,7 +3285,7 @@ TEST(SerializationOfMaybeAssignmentFlag) { i::AstValueFactory avf(&zone, isolate->ast_string_constants(), HashSeed(isolate)); const i::AstRawString* name = avf.GetOneByteString("result"); - avf.Internalize(isolate->factory()); + avf.Internalize(isolate); i::Handle<i::String> str = name->string(); CHECK(str->IsInternalizedString()); i::DeclarationScope* script_scope = @@ -3362,7 +3335,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { i::AstValueFactory avf(&zone, isolate->ast_string_constants(), HashSeed(isolate)); const i::AstRawString* name_x = avf.GetOneByteString("x"); - avf.Internalize(isolate->factory()); + avf.Internalize(isolate); i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone, &avf); diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index 907c89fa0c..ce916c9c7a 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -76,7 +76,7 @@ static void CheckParseEq(const char* input, const char* expected, CHECK(v8::internal::RegExpParser::ParseRegExp(CcTest::i_isolate(), &zone, &reader, flags, &result)); CHECK_NOT_NULL(result.tree); - CHECK(result.error.is_null()); + CHECK(result.error == RegExpError::kNone); std::ostringstream os; result.tree->Print(os, &zone); if (strcmp(expected, os.str().c_str()) != 0) { @@ -94,7 +94,7 @@ static bool CheckSimple(const char* input) { CHECK(v8::internal::RegExpParser::ParseRegExp( CcTest::i_isolate(), &zone, &reader, JSRegExp::kNone, &result)); CHECK_NOT_NULL(result.tree); - CHECK(result.error.is_null()); + CHECK(result.error == RegExpError::kNone); return result.simple; } @@ -112,7 +112,7 @@ static MinMaxPair CheckMinMaxMatch(const char* input) { CHECK(v8::internal::RegExpParser::ParseRegExp( CcTest::i_isolate(), &zone, &reader, JSRegExp::kNone, &result)); CHECK_NOT_NULL(result.tree); - CHECK(result.error.is_null()); + CHECK(result.error == RegExpError::kNone); int min_match = result.tree->min_match(); int max_match = result.tree->max_match(); MinMaxPair pair = { min_match, max_match }; @@ -428,9 +428,8 @@ static void ExpectError(const char* input, const char* expected, CHECK(!v8::internal::RegExpParser::ParseRegExp(isolate, &zone, &reader, flags, &result)); CHECK_NULL(result.tree); - CHECK(!result.error.is_null()); - std::unique_ptr<char[]> str = result.error->ToCString(ALLOW_NULLS); - CHECK_EQ(0, strcmp(expected, str.get())); + CHECK(result.error != RegExpError::kNone); + CHECK_EQ(0, strcmp(expected, RegExpErrorString(result.error))); } @@ -468,7 +467,7 @@ TEST(Errors) { ExpectError("\\k<a", kInvalidCaptureName, true); const char* kDuplicateCaptureName = "Duplicate capture group name"; ExpectError("(?<a>.)(?<a>.)", kDuplicateCaptureName, true); - const char* kInvalidUnicodeEscape = "Invalid Unicode escape sequence"; + const char* kInvalidUnicodeEscape = "Invalid Unicode escape"; ExpectError("(?<\\u{FISK}", kInvalidUnicodeEscape, true); const char* kInvalidCaptureReferenced = "Invalid named capture referenced"; ExpectError("\\k<a>", kInvalidCaptureReferenced, true); @@ -607,7 +606,7 @@ using ArchRegExpMacroAssembler = RegExpMacroAssemblerARM; using ArchRegExpMacroAssembler = RegExpMacroAssemblerARM64; #elif V8_TARGET_ARCH_S390 using ArchRegExpMacroAssembler = RegExpMacroAssemblerS390; -#elif V8_TARGET_ARCH_PPC +#elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 using ArchRegExpMacroAssembler = RegExpMacroAssemblerPPC; #elif V8_TARGET_ARCH_MIPS using ArchRegExpMacroAssembler = RegExpMacroAssemblerMIPS; @@ -721,9 +720,9 @@ TEST(MacroAssemblerNativeSimple) { m.AdvanceCurrentPosition(3); m.PushBacktrack(&backtrack); m.Succeed(); - m.Bind(&backtrack); + m.BindJumpTarget(&backtrack); m.Backtrack(); - m.Bind(&fail); + m.BindJumpTarget(&fail); m.Fail(); Handle<String> source = factory->NewStringFromStaticChars("^foo"); @@ -780,9 +779,9 @@ TEST(MacroAssemblerNativeSimpleUC16) { m.AdvanceCurrentPosition(3); m.PushBacktrack(&backtrack); m.Succeed(); - m.Bind(&backtrack); + m.BindJumpTarget(&backtrack); m.Backtrack(); - m.Bind(&fail); + m.BindJumpTarget(&fail); m.Fail(); Handle<String> source = factory->NewStringFromStaticChars("^foo"); @@ -835,11 +834,11 @@ TEST(MacroAssemblerNativeBacktrack) { Label backtrack; m.LoadCurrentCharacter(10, &fail); m.Succeed(); - m.Bind(&fail); + m.BindJumpTarget(&fail); m.PushBacktrack(&backtrack); m.LoadCurrentCharacter(10, nullptr); m.Succeed(); - m.Bind(&backtrack); + m.BindJumpTarget(&backtrack); m.Fail(); Handle<String> source = factory->NewStringFromStaticChars(".........."); @@ -967,7 +966,7 @@ TEST(MacroAssemblernativeAtStart) { m.CheckNotAtStart(0, ¬_at_start); // Check that prevchar = '\n' and current = 'f'. m.CheckCharacter('\n', &newline); - m.Bind(&fail); + m.BindJumpTarget(&fail); m.Fail(); m.Bind(&newline); m.LoadCurrentCharacter(0, &fail); @@ -1021,16 +1020,16 @@ TEST(MacroAssemblerNativeBackRefNoCase) { m.WriteCurrentPositionToRegister(2, 0); m.AdvanceCurrentPosition(3); m.WriteCurrentPositionToRegister(3, 0); - m.CheckNotBackReferenceIgnoreCase(2, false, false, &fail); // Match "AbC". - m.CheckNotBackReferenceIgnoreCase(2, false, false, &fail); // Match "ABC". + m.CheckNotBackReferenceIgnoreCase(2, false, &fail); // Match "AbC". + m.CheckNotBackReferenceIgnoreCase(2, false, &fail); // Match "ABC". Label expected_fail; - m.CheckNotBackReferenceIgnoreCase(2, false, false, &expected_fail); - m.Bind(&fail); + m.CheckNotBackReferenceIgnoreCase(2, false, &expected_fail); + m.BindJumpTarget(&fail); m.Fail(); m.Bind(&expected_fail); m.AdvanceCurrentPosition(3); // Skip "xYz" - m.CheckNotBackReferenceIgnoreCase(2, false, false, &succ); + m.CheckNotBackReferenceIgnoreCase(2, false, &succ); m.Fail(); m.Bind(&succ); @@ -1094,7 +1093,7 @@ TEST(MacroAssemblerNativeRegisters) { m.AdvanceCurrentPosition(2); m.PopCurrentPosition(); - m.Bind(&backtrack); + m.BindJumpTarget(&backtrack); m.PopRegister(out1); m.ReadCurrentPositionFromRegister(out1); m.AdvanceCurrentPosition(3); @@ -1131,7 +1130,7 @@ TEST(MacroAssemblerNativeRegisters) { m.Succeed(); - m.Bind(&fail); + m.BindJumpTarget(&fail); m.Fail(); Handle<String> source = factory->NewStringFromStaticChars("<loop test>"); @@ -1265,10 +1264,10 @@ TEST(MacroAssembler) { m.AdvanceCurrentPosition(3); m.PushBacktrack(&backtrack); m.Succeed(); - m.Bind(&backtrack); + m.BindJumpTarget(&backtrack); m.ClearRegisters(2, 3); m.Backtrack(); - m.Bind(&fail); + m.BindJumpTarget(&fail); m.PopRegister(0); m.Fail(); diff --git a/deps/v8/test/cctest/test-roots.cc b/deps/v8/test/cctest/test-roots.cc index f3d1a56543..26002621b6 100644 --- a/deps/v8/test/cctest/test-roots.cc +++ b/deps/v8/test/cctest/test-roots.cc @@ -44,7 +44,6 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) { V(builtins_constants_table) \ V(current_microtask) \ V(detached_contexts) \ - V(dirty_js_finalization_groups) \ V(feedback_vectors_for_profiling_tools) \ V(shared_wasm_memories) \ V(materialized_objects) \ diff --git a/deps/v8/test/cctest/test-sampler-api.cc b/deps/v8/test/cctest/test-sampler-api.cc index 3c8f352551..7197101d41 100644 --- a/deps/v8/test/cctest/test-sampler-api.cc +++ b/deps/v8/test/cctest/test-sampler-api.cc @@ -7,7 +7,6 @@ #include <map> #include <string> #include "include/v8.h" -#include "src/execution/simulator.h" #include "src/flags/flags.h" #include "test/cctest/cctest.h" @@ -31,68 +30,6 @@ class Sample { }; -#if defined(USE_SIMULATOR) -class SimulatorHelper { - public: - inline bool Init(v8::Isolate* isolate) { - simulator_ = reinterpret_cast<v8::internal::Isolate*>(isolate) - ->thread_local_top() - ->simulator_; - // Check if there is active simulator. - return simulator_ != nullptr; - } - - inline void FillRegisters(v8::RegisterState* state) { -#if V8_TARGET_ARCH_ARM - state->pc = reinterpret_cast<void*>(simulator_->get_pc()); - state->sp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::sp)); - state->fp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::r11)); - state->lr = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::lr)); -#elif V8_TARGET_ARCH_ARM64 - if (simulator_->sp() == 0 || simulator_->fp() == 0) { - // It's possible that the simulator is interrupted while it is updating - // the sp or fp register. ARM64 simulator does this in two steps: - // first setting it to zero and then setting it to a new value. - // Bailout if sp/fp doesn't contain the new value. - return; - } - state->pc = reinterpret_cast<void*>(simulator_->pc()); - state->sp = reinterpret_cast<void*>(simulator_->sp()); - state->fp = reinterpret_cast<void*>(simulator_->fp()); - state->lr = reinterpret_cast<void*>(simulator_->lr()); -#elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 - state->pc = reinterpret_cast<void*>(simulator_->get_pc()); - state->sp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::sp)); - state->fp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::fp)); -#elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 - state->pc = reinterpret_cast<void*>(simulator_->get_pc()); - state->sp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::sp)); - state->fp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::fp)); - state->lr = reinterpret_cast<void*>(simulator_->get_lr()); -#elif V8_TARGET_ARCH_S390 || V8_TARGET_ARCH_S390X - state->pc = reinterpret_cast<void*>(simulator_->get_pc()); - state->sp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::sp)); - state->fp = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::fp)); - state->lr = reinterpret_cast<void*>( - simulator_->get_register(v8::internal::Simulator::ra)); -#endif - } - - private: - v8::internal::Simulator* simulator_; -}; -#endif // USE_SIMULATOR - - class SamplingTestHelper { public: struct CodeEventEntry { diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index f37b623504..7ce8ef7152 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -53,6 +53,7 @@ #include "src/snapshot/partial-serializer.h" #include "src/snapshot/read-only-deserializer.h" #include "src/snapshot/read-only-serializer.h" +#include "src/snapshot/snapshot-compression.h" #include "src/snapshot/snapshot.h" #include "src/snapshot/startup-deserializer.h" #include "src/snapshot/startup-serializer.h" @@ -414,6 +415,24 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, ReadOnlyHeap::ClearSharedHeapForTest(); } +UNINITIALIZED_TEST(SnapshotCompression) { + DisableAlwaysOpt(); + Vector<const byte> startup_blob; + Vector<const byte> read_only_blob; + Vector<const byte> partial_blob; + PartiallySerializeContext(&startup_blob, &read_only_blob, &partial_blob); + SnapshotData original_snapshot_data(partial_blob); + SnapshotData compressed = + i::SnapshotCompression::Compress(&original_snapshot_data); + SnapshotData decompressed = + i::SnapshotCompression::Decompress(compressed.RawData()); + CHECK_EQ(partial_blob, decompressed.RawData()); + + startup_blob.Dispose(); + read_only_blob.Dispose(); + partial_blob.Dispose(); +} + UNINITIALIZED_TEST(PartialSerializerContext) { DisableAlwaysOpt(); Vector<const byte> startup_blob; @@ -888,7 +907,8 @@ void TestInt32Expectations(const Int32Expectations& expectations) { void TypedArrayTestHelper( const char* code, const Int32Expectations& expectations, const char* code_to_run_after_restore = nullptr, - const Int32Expectations& after_restore_expectations = Int32Expectations()) { + const Int32Expectations& after_restore_expectations = Int32Expectations(), + v8::ArrayBuffer::Allocator* allocator = nullptr) { DisableAlwaysOpt(); i::FLAG_allow_natives_syntax = true; DisableEmbeddedBlobRefcounting(); @@ -914,7 +934,8 @@ void TypedArrayTestHelper( ReadOnlyHeap::ClearSharedHeapForTest(); v8::Isolate::CreateParams create_params; create_params.snapshot_blob = &blob; - create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + create_params.array_buffer_allocator = + allocator != nullptr ? allocator : CcTest::array_buffer_allocator(); v8::Isolate* isolate = TestSerializer::NewIsolate(create_params); { v8::Isolate::Scope i_scope(isolate); @@ -1010,6 +1031,46 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobDataView) { TypedArrayTestHelper(code, expectations); } +namespace { +class AlternatingArrayBufferAllocator : public v8::ArrayBuffer::Allocator { + public: + AlternatingArrayBufferAllocator() + : allocation_fails_(false), + allocator_(v8::ArrayBuffer::Allocator::NewDefaultAllocator()) {} + ~AlternatingArrayBufferAllocator() { delete allocator_; } + void* Allocate(size_t length) override { + allocation_fails_ = !allocation_fails_; + if (allocation_fails_) return nullptr; + return allocator_->Allocate(length); + } + + void* AllocateUninitialized(size_t length) override { + return this->Allocate(length); + } + + void Free(void* data, size_t size) override { allocator_->Free(data, size); } + + void* Reallocate(void* data, size_t old_length, size_t new_length) override { + return allocator_->Reallocate(data, old_length, new_length); + } + + private: + bool allocation_fails_; + v8::ArrayBuffer::Allocator* allocator_; +}; +} // anonymous namespace + +UNINITIALIZED_TEST(CustomSnapshotManyArrayBuffers) { + const char* code = + "var buffers = [];" + "for (let i = 0; i < 70; i++) buffers.push(new Uint8Array(1000));"; + Int32Expectations expectations = {std::make_tuple("buffers.length", 70)}; + std::unique_ptr<v8::ArrayBuffer::Allocator> allocator( + new AlternatingArrayBufferAllocator()); + TypedArrayTestHelper(code, expectations, nullptr, Int32Expectations(), + allocator.get()); +} + UNINITIALIZED_TEST(CustomSnapshotDataBlobDetachedArrayBuffer) { const char* code = "var x = new Int16Array([12, 24, 48]);" @@ -1611,7 +1672,7 @@ void TestCodeSerializerOnePlusOneImpl(bool verify_builtins_count = true) { TEST(CodeSerializerOnePlusOne) { TestCodeSerializerOnePlusOneImpl(); } // See bug v8:9122 -#ifndef V8_TARGET_ARCH_ARM +#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X) TEST(CodeSerializerOnePlusOneWithInterpretedFramesNativeStack) { FLAG_interpreted_frames_native_stack = true; // We pass false because this test will create IET copies (which are @@ -1810,7 +1871,7 @@ TEST(CodeSerializerLargeCodeObjectWithIncrementalMarking) { Handle<String> moving_object; Page* ec_page; { - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(heap); heap::SimulateFullSpace(heap->old_space()); moving_object = isolate->factory()->InternalizeString( isolate->factory()->NewStringFromAsciiChecked("happy_hippo")); @@ -2455,8 +2516,10 @@ TEST(CodeSerializerBitFlip) { const char* source = "function f() { return 'abc'; }; f() + 'def'"; v8::ScriptCompiler::CachedData* cache = CompileRunAndProduceCache(source); - // Random bit flip. - const_cast<uint8_t*>(cache->data)[337] ^= 0x40; + // Arbitrary bit flip. + int arbitrary_spot = 337; + CHECK_LT(arbitrary_spot, cache->length); + const_cast<uint8_t*>(cache->data)[arbitrary_spot] ^= 0x40; v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index a3f3b89347..2a6843b892 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -686,7 +686,7 @@ void TestStringCharacterStream(BuildString build, int test_cases) { for (int i = 0; i < test_cases; i++) { printf("%d\n", i); HandleScope inner_scope(isolate); - AlwaysAllocateScope always_allocate(isolate); + AlwaysAllocateScopeForTesting always_allocate(isolate->heap()); // Build flat version of cons string. Handle<String> flat_string = build(i, &data); ConsStringStats flat_string_stats; @@ -1347,10 +1347,9 @@ TEST(CachedHashOverflow) { const char* line = lines[i]; printf("%s\n", line); v8::Local<v8::Value> result = - v8::Script::Compile(context, - v8::String::NewFromUtf8(CcTest::isolate(), line, - v8::NewStringType::kNormal) - .ToLocalChecked()) + v8::Script::Compile( + context, + v8::String::NewFromUtf8(CcTest::isolate(), line).ToLocalChecked()) .ToLocalChecked() ->Run(context) .ToLocalChecked(); @@ -1873,11 +1872,6 @@ void TestString(i::Isolate* isolate, const IndexData& data) { uint32_t index; CHECK(s->AsArrayIndex(&index)); CHECK_EQ(data.array_index, index); - // AsArrayIndex only forces hash computation for cacheable indices; - // so trigger hash computation for longer strings manually. - if (s->length() > String::kMaxCachedArrayIndexLength) s->Hash(); - CHECK_EQ(0, s->hash_field() & String::kIsNotArrayIndexMask); - CHECK(s->HasHashCode()); } if (data.is_integer_index) { size_t index; @@ -1889,9 +1883,6 @@ void TestString(i::Isolate* isolate, const IndexData& data) { } if (!s->HasHashCode()) s->Hash(); CHECK(s->HasHashCode()); - if (!data.is_array_index) { - CHECK_NE(0, s->hash_field() & String::kIsNotArrayIndexMask); - } if (!data.is_integer_index) { CHECK_NE(0, s->hash_field() & String::kIsNotIntegerIndexMask); } @@ -1942,21 +1933,13 @@ TEST(StringEquals) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); - auto foo_str = - v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal) - .ToLocalChecked(); - auto bar_str = - v8::String::NewFromUtf8(isolate, "bar", v8::NewStringType::kNormal) - .ToLocalChecked(); - auto foo_str2 = - v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal) - .ToLocalChecked(); + auto foo_str = v8::String::NewFromUtf8Literal(isolate, "foo"); + auto bar_str = v8::String::NewFromUtf8Literal(isolate, "bar"); + auto foo_str2 = v8::String::NewFromUtf8Literal(isolate, "foo"); uint16_t* two_byte_source = AsciiToTwoByteString("foo"); auto foo_two_byte_str = - v8::String::NewFromTwoByte(isolate, two_byte_source, - v8::NewStringType::kNormal) - .ToLocalChecked(); + v8::String::NewFromTwoByte(isolate, two_byte_source).ToLocalChecked(); i::DeleteArray(two_byte_source); CHECK(foo_str->StringEquals(foo_str)); diff --git a/deps/v8/test/cctest/test-sync-primitives-arm64.cc b/deps/v8/test/cctest/test-sync-primitives-arm64.cc index f5f19f0687..c6f0d2c2f5 100644 --- a/deps/v8/test/cctest/test-sync-primitives-arm64.cc +++ b/deps/v8/test/cctest/test-sync-primitives-arm64.cc @@ -200,7 +200,7 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1, AssembleLoadExcl(&masm, access1, w1, x1); AssembleMemoryAccess(&masm, access2, w3, w2, x1); AssembleStoreExcl(&masm, access3, w0, w3, x1); - __ br(lr); + __ Ret(); CodeDesc desc; masm.GetCode(isolate, &desc); @@ -271,7 +271,7 @@ int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, HandleScope scope(isolate); MacroAssembler masm(isolate, v8::internal::CodeObjectRequired::kYes); AssembleMemoryAccess(&masm, access, w0, w2, x1); - __ br(lr); + __ Ret(); CodeDesc desc; masm.GetCode(isolate, &desc); diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc index f7cd09848e..b371cd8d3c 100644 --- a/deps/v8/test/cctest/test-thread-termination.cc +++ b/deps/v8/test/cctest/test-thread-termination.cc @@ -492,10 +492,11 @@ TEST(TerminateFromOtherThreadWhileMicrotaskRunning) { isolate->EnqueueMicrotask( v8::Function::New(isolate->GetCurrentContext(), MicrotaskShouldNotRun) .ToLocalChecked()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); isolate->CancelTerminateExecution(); - isolate->RunMicrotasks(); // should not run MicrotaskShouldNotRun + // Should not run MicrotaskShouldNotRun. + isolate->PerformMicrotaskCheckpoint(); thread.Join(); delete semaphore; @@ -913,7 +914,7 @@ TEST(TerminateInMicrotask) { CHECK(context2 == isolate->GetCurrentContext()); CHECK(context2 == isolate->GetEnteredOrMicrotaskContext()); CHECK(!isolate->IsExecutionTerminating()); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK(context2 == isolate->GetCurrentContext()); CHECK(context2 == isolate->GetEnteredOrMicrotaskContext()); CHECK(try_catch.HasCaught()); @@ -948,7 +949,7 @@ TEST(TerminateInApiMicrotask) { CHECK(!isolate->IsExecutionTerminating()); isolate->EnqueueMicrotask(TerminationMicrotask); isolate->EnqueueMicrotask(UnreachableMicrotask); - isolate->RunMicrotasks(); + isolate->PerformMicrotaskCheckpoint(); CHECK(try_catch.HasCaught()); CHECK(try_catch.HasTerminated()); CHECK(isolate->IsExecutionTerminating()); diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc index fc213b5bf9..0b05dff6b8 100644 --- a/deps/v8/test/cctest/test-types.cc +++ b/deps/v8/test/cctest/test-types.cc @@ -180,20 +180,22 @@ struct Tests { // Constructor for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { Handle<i::Object> value = *vt; - Type type = T.NewConstant(value); - CHECK(type.IsHeapConstant() || type.IsOtherNumberConstant() || - type.IsRange()); + Type type = T.Constant(value); + CHECK(type.IsBitset() || type.IsHeapConstant() || + type.IsOtherNumberConstant() || type.IsRange()); } // Value attribute for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { Handle<i::Object> value = *vt; - Type type = T.NewConstant(value); + Type type = T.Constant(value); if (type.IsHeapConstant()) { CHECK(value.address() == type.AsHeapConstant()->Value().address()); } else if (type.IsOtherNumberConstant()) { CHECK(value->IsHeapNumber()); CHECK(value->Number() == type.AsOtherNumberConstant()->Value()); + } else if (type.IsBitset()) { + CHECK(type.IsSingleton()); } else { CHECK(type.IsRange()); double v = value->Number(); @@ -206,8 +208,8 @@ struct Tests { for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { Handle<i::Object> value1 = *vt1; Handle<i::Object> value2 = *vt2; - Type type1 = T.NewConstant(value1); - Type type2 = T.NewConstant(value2); + Type type1 = T.Constant(value1); + Type type2 = T.Constant(value2); if (type1.IsOtherNumberConstant() && type2.IsOtherNumberConstant()) { CHECK(Equal(type1, type2) == (type1.AsOtherNumberConstant()->Value() == @@ -224,62 +226,70 @@ struct Tests { // Typing of numbers Factory* fac = isolate->factory(); - CHECK(T.NewConstant(fac->NewNumber(0)).Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(1)).Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(0x3FFFFFFF)).Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(-1)).Is(T.Negative31)); - CHECK(T.NewConstant(fac->NewNumber(-0x3FFFFFFF)).Is(T.Negative31)); - CHECK(T.NewConstant(fac->NewNumber(-0x40000000)).Is(T.Negative31)); - CHECK(T.NewConstant(fac->NewNumber(0x40000000)).Is(T.Unsigned31)); - CHECK(!T.NewConstant(fac->NewNumber(0x40000000)).Is(T.Unsigned30)); - CHECK(T.NewConstant(fac->NewNumber(0x7FFFFFFF)).Is(T.Unsigned31)); - CHECK(!T.NewConstant(fac->NewNumber(0x7FFFFFFF)).Is(T.Unsigned30)); - CHECK(T.NewConstant(fac->NewNumber(-0x40000001)).Is(T.Negative32)); - CHECK(!T.NewConstant(fac->NewNumber(-0x40000001)).Is(T.Negative31)); - CHECK(T.NewConstant(fac->NewNumber(-0x7FFFFFFF)).Is(T.Negative32)); - CHECK(!T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 1)).Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(0)).Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(1)).Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(42)).Equals(T.Range(42, 42))); + CHECK(T.Constant(fac->NewNumber(0x3FFFFFFF)).Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(-1)).Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(-0x3FFFFFFF)).Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(-0x40000000)).Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(0x40000000)).Is(T.Unsigned31)); + CHECK(!T.Constant(fac->NewNumber(0x40000000)).Is(T.Unsigned30)); + CHECK(T.Constant(fac->NewNumber(0x7FFFFFFF)).Is(T.Unsigned31)); + CHECK(!T.Constant(fac->NewNumber(0x7FFFFFFF)).Is(T.Unsigned30)); + CHECK(T.Constant(fac->NewNumber(-0x40000001)).Is(T.Negative32)); + CHECK(!T.Constant(fac->NewNumber(-0x40000001)).Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(-0x7FFFFFFF)).Is(T.Negative32)); + CHECK(!T.Constant(fac->NewNumber(-0x7FFFFFFF - 1)).Is(T.Negative31)); if (SmiValuesAre31Bits()) { - CHECK(!T.NewConstant(fac->NewNumber(0x40000000)).Is(T.UnsignedSmall)); - CHECK(!T.NewConstant(fac->NewNumber(0x7FFFFFFF)).Is(T.UnsignedSmall)); - CHECK(!T.NewConstant(fac->NewNumber(-0x40000001)).Is(T.SignedSmall)); - CHECK(!T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 1)).Is(T.SignedSmall)); + CHECK(!T.Constant(fac->NewNumber(0x40000000)).Is(T.UnsignedSmall)); + CHECK(!T.Constant(fac->NewNumber(0x7FFFFFFF)).Is(T.UnsignedSmall)); + CHECK(!T.Constant(fac->NewNumber(-0x40000001)).Is(T.SignedSmall)); + CHECK(!T.Constant(fac->NewNumber(-0x7FFFFFFF - 1)).Is(T.SignedSmall)); } else { CHECK(SmiValuesAre32Bits()); - CHECK(T.NewConstant(fac->NewNumber(0x40000000)).Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(0x7FFFFFFF)).Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(-0x40000001)).Is(T.SignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 1)).Is(T.SignedSmall)); - } - CHECK(T.NewConstant(fac->NewNumber(0x80000000u)).Is(T.Unsigned32)); - CHECK(!T.NewConstant(fac->NewNumber(0x80000000u)).Is(T.Unsigned31)); - CHECK(T.NewConstant(fac->NewNumber(0xFFFFFFFFu)).Is(T.Unsigned32)); - CHECK(!T.NewConstant(fac->NewNumber(0xFFFFFFFFu)).Is(T.Unsigned31)); - CHECK(T.NewConstant(fac->NewNumber(0xFFFFFFFFu + 1.0)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(0xFFFFFFFFu + 1.0)).Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 2.0)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 2.0)).Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(0.1)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(0.1)).Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(-10.1)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(-10.1)).Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(10e60)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(10e60)).Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(-1.0 * 0.0)).Is(T.MinusZero)); - CHECK( - T.NewConstant(fac->NewNumber(std::numeric_limits<double>::quiet_NaN())) - .Is(T.NaN)); - CHECK(T.NewConstant(fac->NewNumber(V8_INFINITY)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(V8_INFINITY)).Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(-V8_INFINITY)).Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(-V8_INFINITY)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(0x40000000)).Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(0x7FFFFFFF)).Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(-0x40000001)).Is(T.SignedSmall)); + CHECK(T.Constant(fac->NewNumber(-0x7FFFFFFF - 1)).Is(T.SignedSmall)); + } + CHECK(T.Constant(fac->NewNumber(0x80000000u)).Is(T.Unsigned32)); + CHECK(!T.Constant(fac->NewNumber(0x80000000u)).Is(T.Unsigned31)); + CHECK(T.Constant(fac->NewNumber(0xFFFFFFFFu)).Is(T.Unsigned32)); + CHECK(!T.Constant(fac->NewNumber(0xFFFFFFFFu)).Is(T.Unsigned31)); + CHECK(T.Constant(fac->NewNumber(0xFFFFFFFFu + 1.0)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(0xFFFFFFFFu + 1.0)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-0x7FFFFFFF - 2.0)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(-0x7FFFFFFF - 2.0)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(0.1)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(0.1)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-10.1)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(-10.1)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(10e60)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(10e60)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-1.0 * 0.0)).Is(T.MinusZero)); + CHECK(T.Constant(fac->NewNumber(V8_INFINITY)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(V8_INFINITY)).Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-V8_INFINITY)).Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(-V8_INFINITY)).Is(T.Integral32)); // Typing of Strings Handle<String> s1 = fac->NewStringFromAsciiChecked("a"); - CHECK(T.NewConstant(s1).Is(T.InternalizedString)); + CHECK(T.Constant(s1).Is(T.InternalizedString)); const uc16 two_byte[1] = {0x2603}; Handle<String> s2 = fac->NewTwoByteInternalizedString(Vector<const uc16>(two_byte, 1), 1); - CHECK(T.NewConstant(s2).Is(T.InternalizedString)); + CHECK(T.Constant(s2).Is(T.InternalizedString)); + + // Typing of special constants + CHECK(T.Constant(fac->the_hole_value()).Equals(T.Hole)); + CHECK(T.Constant(fac->null_value()).Equals(T.Null)); + CHECK(T.Constant(fac->undefined_value()).Equals(T.Undefined)); + CHECK(T.Constant(fac->minus_zero_value()).Equals(T.MinusZero)); + CHECK(T.Constant(fac->NewNumber(-0.0)).Equals(T.MinusZero)); + CHECK(T.Constant(fac->nan_value()).Equals(T.NaN)); + CHECK(T.Constant(fac->NewNumber(std::numeric_limits<double>::quiet_NaN())) + .Equals(T.NaN)); } void Range() { @@ -545,8 +555,8 @@ struct Tests { for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { Handle<i::Object> value1 = *vt1; Handle<i::Object> value2 = *vt2; - Type const_type1 = T.NewConstant(value1); - Type const_type2 = T.NewConstant(value2); + Type const_type1 = T.Constant(value1); + Type const_type2 = T.Constant(value2); if (const_type1.IsOtherNumberConstant() && const_type2.IsOtherNumberConstant()) { CHECK(const_type1.Is(const_type2) == @@ -686,8 +696,8 @@ struct Tests { for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { Handle<i::Object> value1 = *vt1; Handle<i::Object> value2 = *vt2; - Type const_type1 = T.NewConstant(value1); - Type const_type2 = T.NewConstant(value2); + Type const_type1 = T.Constant(value1); + Type const_type2 = T.Constant(value2); if (const_type1.IsOtherNumberConstant() && const_type2.IsOtherNumberConstant()) { CHECK(const_type1.Maybe(const_type2) == @@ -1045,37 +1055,21 @@ struct Tests { } // namespace TEST(IsSomeType) { Tests().IsSomeType(); } - TEST(BitsetType) { Tests().Bitset(); } - TEST(ConstantType) { Tests().Constant(); } - TEST(RangeType) { Tests().Range(); } - TEST(MinMax) { Tests().MinMax(); } - TEST(BitsetGlb) { Tests().BitsetGlb(); } - TEST(BitsetLub) { Tests().BitsetLub(); } - TEST(Is1) { Tests().Is1(); } - TEST(Is2) { Tests().Is2(); } - TEST(Maybe) { Tests().Maybe(); } - TEST(Union1) { Tests().Union1(); } - TEST(Union2) { Tests().Union2(); } - TEST(Union3) { Tests().Union3(); } - TEST(Union4) { Tests().Union4(); } - TEST(Intersect) { Tests().Intersect(); } - TEST(Distributivity) { Tests().Distributivity(); } - TEST(GetRange) { Tests().GetRange(); } } // namespace compiler diff --git a/deps/v8/test/cctest/test-unwinder-code-pages.cc b/deps/v8/test/cctest/test-unwinder-code-pages.cc index 6177be6de8..fc023e4145 100644 --- a/deps/v8/test/cctest/test-unwinder-code-pages.cc +++ b/deps/v8/test/cctest/test-unwinder-code-pages.cc @@ -591,6 +591,80 @@ TEST(PCIsInV8_LargeCodeObject_CodePagesAPI) { CHECK(v8::Unwinder::PCIsInV8(pages_length, code_pages, pc)); } +#ifdef USE_SIMULATOR +// TODO(v8:10026): Make this also work without the simulator. The part that +// needs modifications is getting the RegisterState. +class UnwinderTestHelper { + public: + explicit UnwinderTestHelper(const std::string& test_function) + : isolate_(CcTest::isolate()) { + CHECK(!instance_); + instance_ = this; + v8::HandleScope scope(isolate_); + v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); + global->Set(v8_str("TryUnwind"), + v8::FunctionTemplate::New(isolate_, TryUnwind)); + LocalContext env(isolate_, nullptr, global); + CompileRun(v8_str(test_function.c_str())); + } + + ~UnwinderTestHelper() { instance_ = nullptr; } + + private: + static void TryUnwind(const v8::FunctionCallbackInfo<v8::Value>& args) { + instance_->DoTryUnwind(); + } + + void DoTryUnwind() { + // Set up RegisterState. + v8::RegisterState register_state; + SimulatorHelper simulator_helper; + if (!simulator_helper.Init(isolate_)) return; + simulator_helper.FillRegisters(®ister_state); + // At this point, the PC will point to a Redirection object, which is not + // in V8 as far as the unwinder is concerned. To make this work, point to + // the return address, which is in V8, instead. + register_state.pc = register_state.lr; + + JSEntryStubs entry_stubs = isolate_->GetJSEntryStubs(); + MemoryRange code_pages[v8::Isolate::kMinCodePagesBufferSize]; + size_t pages_length = + isolate_->CopyCodePages(arraysize(code_pages), code_pages); + CHECK_LE(pages_length, arraysize(code_pages)); + + void* stack_base = reinterpret_cast<void*>(0xffffffffffffffffL); + bool unwound = v8::Unwinder::TryUnwindV8Frames( + entry_stubs, pages_length, code_pages, ®ister_state, stack_base); + // Check that we have successfully unwound past js_entry_sp. + CHECK(unwound); + CHECK_GT(register_state.sp, + reinterpret_cast<void*>(CcTest::i_isolate()->js_entry_sp())); + } + + v8::Isolate* isolate_; + + static UnwinderTestHelper* instance_; +}; + +UnwinderTestHelper* UnwinderTestHelper::instance_; + +TEST(Unwind_TwoNestedFunctions_CodePagesAPI) { + i::FLAG_allow_natives_syntax = true; + const char* test_script = + "function test_unwinder_api_inner() {" + " TryUnwind();" + " return 0;" + "}" + "function test_unwinder_api_outer() {" + " return test_unwinder_api_inner();" + "}" + "%NeverOptimizeFunction(test_unwinder_api_inner);" + "%NeverOptimizeFunction(test_unwinder_api_outer);" + "test_unwinder_api_outer();"; + + UnwinderTestHelper helper(test_script); +} +#endif } // namespace test_unwinder_code_pages } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-unwinder.cc b/deps/v8/test/cctest/test-unwinder.cc index ffe46f4ca2..59c8708767 100644 --- a/deps/v8/test/cctest/test-unwinder.cc +++ b/deps/v8/test/cctest/test-unwinder.cc @@ -7,6 +7,7 @@ #include "src/api/api-inl.h" #include "src/builtins/builtins.h" #include "src/execution/isolate.h" +#include "src/execution/pointer-authentication.h" #include "src/heap/spaces.h" #include "src/objects/code-inl.h" #include "test/cctest/cctest.h" @@ -38,6 +39,11 @@ TEST(Unwind_BadState_Fail) { CHECK_NULL(register_state.pc); } +void StorePc(uintptr_t stack[], int index, uintptr_t pc) { + Address sp = reinterpret_cast<Address>(&stack[index]) + kSystemPointerSize; + stack[index] = PointerAuthentication::SignPCWithSP(pc, sp); +} + TEST(Unwind_BuiltinPCInMiddle_Success) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -49,7 +55,7 @@ TEST(Unwind_BuiltinPCInMiddle_Success) { uintptr_t stack[3]; void* stack_base = stack + arraysize(stack); stack[0] = reinterpret_cast<uintptr_t>(stack + 2); // saved FP (rbp). - stack[1] = 202; // Return address into C++ code. + StorePc(stack, 1, 202); // Return address into C++ code. stack[2] = 303; // The SP points here in the caller's frame. register_state.sp = stack; @@ -93,9 +99,9 @@ TEST(Unwind_BuiltinPCAtStart_Success) { stack[0] = 101; // Return address into JS code. It doesn't matter that this is not actually in // JSEntry, because we only check that for the top frame. - stack[1] = reinterpret_cast<uintptr_t>(code + 10); + StorePc(stack, 1, reinterpret_cast<uintptr_t>(code + 10)); stack[2] = reinterpret_cast<uintptr_t>(stack + 5); // saved FP (rbp). - stack[3] = 303; // Return address into C++ code. + StorePc(stack, 3, 303); // Return address into C++ code. stack[4] = 404; stack[5] = 505; @@ -145,7 +151,7 @@ TEST(Unwind_CodeObjectPCInMiddle_Success) { uintptr_t stack[3]; void* stack_base = stack + arraysize(stack); stack[0] = reinterpret_cast<uintptr_t>(stack + 2); // saved FP (rbp). - stack[1] = 202; // Return address into C++ code. + StorePc(stack, 1, 202); // Return address into C++ code. stack[2] = 303; // The SP points here in the caller's frame. register_state.sp = stack; @@ -213,7 +219,7 @@ TEST(Unwind_JSEntryBeforeFrame_Fail) { stack[3] = 131; stack[4] = 141; stack[5] = 151; - stack[6] = 100; // Return address into C++ code. + StorePc(stack, 6, 100); // Return address into C++ code. stack[7] = 303; // The SP points here in the caller's frame. stack[8] = 404; stack[9] = 505; @@ -267,7 +273,7 @@ TEST(Unwind_OneJSFrame_Success) { stack[3] = 131; stack[4] = 141; stack[5] = reinterpret_cast<uintptr_t>(stack + 9); // saved FP (rbp). - stack[6] = 100; // Return address into C++ code. + StorePc(stack, 6, 100); // Return address into C++ code. stack[7] = 303; // The SP points here in the caller's frame. stack[8] = 404; stack[9] = 505; @@ -311,10 +317,10 @@ TEST(Unwind_TwoJSFrames_Success) { stack[1] = 111; stack[2] = reinterpret_cast<uintptr_t>(stack + 5); // saved FP (rbp). // The fake return address is in the JS code range. - stack[3] = reinterpret_cast<uintptr_t>(code + 10); + StorePc(stack, 3, reinterpret_cast<uintptr_t>(code + 10)); stack[4] = 141; stack[5] = reinterpret_cast<uintptr_t>(stack + 9); // saved FP (rbp). - stack[6] = 100; // Return address into C++ code. + StorePc(stack, 6, 100); // Return address into C++ code. stack[7] = 303; // The SP points here in the caller's frame. stack[8] = 404; stack[9] = 505; @@ -371,7 +377,7 @@ TEST(Unwind_StackBounds_Basic) { uintptr_t stack[3]; stack[0] = reinterpret_cast<uintptr_t>(stack + 2); // saved FP (rbp). - stack[1] = 202; // Return address into C++ code. + StorePc(stack, 1, 202); // Return address into C++ code. stack[2] = 303; // The SP points here in the caller's frame. register_state.sp = stack; @@ -414,12 +420,12 @@ TEST(Unwind_StackBounds_WithUnwinding) { stack[3] = 131; stack[4] = 141; stack[5] = reinterpret_cast<uintptr_t>(stack + 9); // saved FP (rbp). - stack[6] = reinterpret_cast<uintptr_t>(code + 20); // JS code. + StorePc(stack, 6, reinterpret_cast<uintptr_t>(code + 20)); // JS code. stack[7] = 303; // The SP points here in the caller's frame. stack[8] = 404; stack[9] = reinterpret_cast<uintptr_t>(stack) + (12 * sizeof(uintptr_t)); // saved FP (OOB). - stack[10] = reinterpret_cast<uintptr_t>(code + 20); // JS code. + StorePc(stack, 10, reinterpret_cast<uintptr_t>(code + 20)); // JS code. register_state.sp = stack; register_state.fp = stack + 5; @@ -435,7 +441,7 @@ TEST(Unwind_StackBounds_WithUnwinding) { // Change the return address so that it is not in range. We will not range // check the stack[9] FP value because we have finished unwinding and the // contents of rbp does not necessarily have to be the FP in this case. - stack[10] = 202; + StorePc(stack, 10, 202); unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, ®ister_state, stack_base); CHECK(unwound); @@ -549,6 +555,76 @@ TEST(PCIsInV8_LargeCodeObject) { CHECK(v8::Unwinder::PCIsInV8(unwind_state, pc)); } +#ifdef USE_SIMULATOR +// TODO(v8:10026): Make this also work without the simulator. The part that +// needs modifications is getting the RegisterState. +class UnwinderTestHelper { + public: + explicit UnwinderTestHelper(const std::string& test_function) + : isolate_(CcTest::isolate()) { + CHECK(!instance_); + instance_ = this; + v8::HandleScope scope(isolate_); + v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); + global->Set(v8_str("TryUnwind"), + v8::FunctionTemplate::New(isolate_, TryUnwind)); + LocalContext env(isolate_, nullptr, global); + CompileRun(v8_str(test_function.c_str())); + } + + ~UnwinderTestHelper() { instance_ = nullptr; } + + private: + static void TryUnwind(const v8::FunctionCallbackInfo<v8::Value>& args) { + instance_->DoTryUnwind(); + } + + void DoTryUnwind() { + // Set up RegisterState. + v8::RegisterState register_state; + SimulatorHelper simulator_helper; + if (!simulator_helper.Init(isolate_)) return; + simulator_helper.FillRegisters(®ister_state); + // At this point, the PC will point to a Redirection object, which is not + // in V8 as far as the unwinder is concerned. To make this work, point to + // the return address, which is in V8, instead. + register_state.pc = register_state.lr; + + UnwindState unwind_state = isolate_->GetUnwindState(); + void* stack_base = reinterpret_cast<void*>(0xffffffffffffffffL); + bool unwound = v8::Unwinder::TryUnwindV8Frames(unwind_state, + ®ister_state, stack_base); + // Check that we have successfully unwound past js_entry_sp. + CHECK(unwound); + CHECK_GT(register_state.sp, + reinterpret_cast<void*>(CcTest::i_isolate()->js_entry_sp())); + } + + v8::Isolate* isolate_; + + static UnwinderTestHelper* instance_; +}; + +UnwinderTestHelper* UnwinderTestHelper::instance_; + +TEST(Unwind_TwoNestedFunctions) { + i::FLAG_allow_natives_syntax = true; + const char* test_script = + "function test_unwinder_api_inner() {" + " TryUnwind();" + " return 0;" + "}" + "function test_unwinder_api_outer() {" + " return test_unwinder_api_inner();" + "}" + "%NeverOptimizeFunction(test_unwinder_api_inner);" + "%NeverOptimizeFunction(test_unwinder_api_outer);" + "test_unwinder_api_outer();"; + + UnwinderTestHelper helper(test_script); +} +#endif + #if __clang__ #pragma clang diagnostic pop #endif diff --git a/deps/v8/test/cctest/test-usecounters.cc b/deps/v8/test/cctest/test-usecounters.cc index 2c4d007c4b..589a90c245 100644 --- a/deps/v8/test/cctest/test-usecounters.cc +++ b/deps/v8/test/cctest/test-usecounters.cc @@ -115,6 +115,42 @@ TEST(RegExpMatchIsFalseishOnJSRegExp) { CHECK_EQ(1, use_counts[v8::Isolate::kRegExpMatchIsFalseishOnJSRegExp]); } +TEST(ObjectPrototypeHasElements) { + 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); + + CompileRun("var o = {}; o[1] = 2;"); + CHECK_EQ(0, use_counts[v8::Isolate::kObjectPrototypeHasElements]); + + CompileRun("var o = {}; var p = {}; o.__proto__ = p; p[1] = 2;"); + CHECK_EQ(0, use_counts[v8::Isolate::kObjectPrototypeHasElements]); + + CompileRun("Object.prototype[1] = 2;"); + CHECK_EQ(1, use_counts[v8::Isolate::kObjectPrototypeHasElements]); +} + +TEST(ArrayPrototypeHasElements) { + 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); + + CompileRun("var a = []; a[1] = 2;"); + CHECK_EQ(0, use_counts[v8::Isolate::kArrayPrototypeHasElements]); + + CompileRun("var a = []; var p = []; a.__proto__ = p; p[1] = 2;"); + CHECK_EQ(0, use_counts[v8::Isolate::kArrayPrototypeHasElements]); + + CompileRun("Array.prototype[1] = 2;"); + CHECK_EQ(1, use_counts[v8::Isolate::kArrayPrototypeHasElements]); +} + } // namespace test_usecounters } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-v8windbg.cc b/deps/v8/test/cctest/test-v8windbg.cc new file mode 100644 index 0000000000..57f259a377 --- /dev/null +++ b/deps/v8/test/cctest/test-v8windbg.cc @@ -0,0 +1,14 @@ +// Copyright 2020 the V8 project 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/cctest.h" +#include "tools/v8windbg/test/v8windbg-test.h" + +namespace v8 { +namespace internal { + +UNINITIALIZED_TEST(V8windbg) { v8windbg_test::RunTests(); } + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc index 4e94fe21f0..9442dab6f5 100644 --- a/deps/v8/test/cctest/torque/test-torque.cc +++ b/deps/v8/test/cctest/torque/test-torque.cc @@ -736,6 +736,35 @@ TEST(TestTestParentFrameArguments) { asm_tester.GenerateCode(); } +TEST(TestFullyGeneratedClassFromCpp) { + CcTest::InitializeVM(); + Isolate* isolate(CcTest::i_isolate()); + i::HandleScope scope(isolate); + CodeAssemblerTester asm_tester(isolate, 1); + TestTorqueAssembler m(asm_tester.state()); + { m.Return(m.TestFullyGeneratedClassFromCpp()); } + FunctionTester ft(asm_tester.GenerateCode(), 0); + Handle<ExportedSubClass> result = + Handle<ExportedSubClass>::cast(ft.Call().ToHandleChecked()); + CHECK_EQ(result->c_field(), 7); + CHECK_EQ(result->d_field(), 8); + CHECK_EQ(result->e_field(), 9); +} + +TEST(TestFullyGeneratedClassWithElements) { + CcTest::InitializeVM(); + Isolate* isolate(CcTest::i_isolate()); + i::HandleScope scope(isolate); + CodeAssemblerTester asm_tester(isolate, 1); + TestTorqueAssembler m(asm_tester.state()); + { + m.TestFullyGeneratedClassWithElements(); + m.Return(m.UndefinedConstant()); + } + FunctionTester ft(asm_tester.GenerateCode(), 0); + ft.Call(); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/trace-extension.cc b/deps/v8/test/cctest/trace-extension.cc index df24e83f39..9aa2f380f6 100644 --- a/deps/v8/test/cctest/trace-extension.cc +++ b/deps/v8/test/cctest/trace-extension.cc @@ -45,24 +45,16 @@ const char* TraceExtension::kSource = v8::Local<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate( v8::Isolate* isolate, v8::Local<v8::String> name) { - if (name->StrictEquals( - v8::String::NewFromUtf8(isolate, "trace", v8::NewStringType::kNormal) - .ToLocalChecked())) { + if (name->StrictEquals(v8::String::NewFromUtf8Literal(isolate, "trace"))) { return v8::FunctionTemplate::New(isolate, TraceExtension::Trace); } else if (name->StrictEquals( - v8::String::NewFromUtf8(isolate, "js_trace", - v8::NewStringType::kNormal) - .ToLocalChecked())) { + v8::String::NewFromUtf8Literal(isolate, "js_trace"))) { return v8::FunctionTemplate::New(isolate, TraceExtension::JSTrace); } else if (name->StrictEquals( - v8::String::NewFromUtf8(isolate, "js_entry_sp", - v8::NewStringType::kNormal) - .ToLocalChecked())) { + v8::String::NewFromUtf8Literal(isolate, "js_entry_sp"))) { return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySP); - } else if (name->StrictEquals( - v8::String::NewFromUtf8(isolate, "js_entry_sp_level2", - v8::NewStringType::kNormal) - .ToLocalChecked())) { + } else if (name->StrictEquals(v8::String::NewFromUtf8Literal( + isolate, "js_entry_sp_level2"))) { return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySPLevel2); } UNREACHABLE(); diff --git a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc index ab8545bf5d..2ac9151684 100644 --- a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc +++ b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc @@ -81,7 +81,7 @@ class CWasmEntryArgTester { WasmRunner<ReturnType, Args...> runner_; Isolate* isolate_; std::function<ReturnType(Args...)> expected_fn_; - FunctionSig* sig_; + const FunctionSig* sig_; Handle<Code> c_wasm_entry_; WasmCode* wasm_code_; }; diff --git a/deps/v8/test/cctest/wasm/test-compilation-cache.cc b/deps/v8/test/cctest/wasm/test-compilation-cache.cc index 416b4e9df2..f4831fa8d1 100644 --- a/deps/v8/test/cctest/wasm/test-compilation-cache.cc +++ b/deps/v8/test/cctest/wasm/test-compilation-cache.cc @@ -5,6 +5,7 @@ #include "src/api/api-inl.h" #include "src/init/v8.h" +#include "src/wasm/streaming-decoder.h" #include "src/wasm/wasm-code-manager.h" #include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-module-builder.h" @@ -43,6 +44,35 @@ class TestResolver : public CompilationResultResolver { std::atomic<int>* pending_; }; +class StreamTester { + public: + explicit StreamTester(std::shared_ptr<TestResolver> test_resolver) + : internal_scope_(CcTest::i_isolate()), test_resolver_(test_resolver) { + i::Isolate* i_isolate = CcTest::i_isolate(); + + Handle<Context> context = i_isolate->native_context(); + + stream_ = i_isolate->wasm_engine()->StartStreamingCompilation( + i_isolate, WasmFeatures::All(), context, + "WebAssembly.compileStreaming()", test_resolver_); + } + + void OnBytesReceived(const uint8_t* start, size_t length) { + stream_->OnBytesReceived(Vector<const uint8_t>(start, length)); + } + + void FinishStream() { stream_->Finish(); } + + void SetCompiledModuleBytes(const uint8_t* start, size_t length) { + stream_->SetCompiledModuleBytes(Vector<const uint8_t>(start, length)); + } + + private: + i::HandleScope internal_scope_; + std::shared_ptr<StreamingDecoder> stream_; + std::shared_ptr<TestResolver> test_resolver_; +}; + // Create a valid module such that the bytes depend on {n}. ZoneBuffer GetValidModuleBytes(Zone* zone, int n) { ZoneBuffer buffer(zone); @@ -57,11 +87,51 @@ ZoneBuffer GetValidModuleBytes(Zone* zone, int n) { return buffer; } +std::shared_ptr<NativeModule> SyncCompile(Vector<const uint8_t> bytes) { + ErrorThrower thrower(CcTest::i_isolate(), "Test"); + auto enabled_features = WasmFeatures::FromIsolate(CcTest::i_isolate()); + auto wire_bytes = ModuleWireBytes(bytes.begin(), bytes.end()); + Handle<WasmModuleObject> module = + CcTest::i_isolate() + ->wasm_engine() + ->SyncCompile(CcTest::i_isolate(), enabled_features, &thrower, + wire_bytes) + .ToHandleChecked(); + return module->shared_native_module(); +} + +// Shared prefix. +constexpr uint8_t kPrefix[] = { + WASM_MODULE_HEADER, // module header + kTypeSectionCode, // section code + U32V_1(1 + SIZEOF_SIG_ENTRY_v_v), // section size + U32V_1(1), // type count + SIG_ENTRY_v_v, // signature entry + kFunctionSectionCode, // section code + U32V_1(2), // section size + U32V_1(1), // functions count + 0, // signature index + kCodeSectionCode, // section code + U32V_1(7), // section size + U32V_1(1), // functions count + 5, // body size +}; + +constexpr uint8_t kFunctionA[] = { + U32V_1(0), kExprI32Const, U32V_1(0), kExprDrop, kExprEnd, +}; +constexpr uint8_t kFunctionB[] = { + U32V_1(0), kExprI32Const, U32V_1(1), kExprDrop, kExprEnd, +}; + +constexpr size_t kPrefixSize = arraysize(kPrefix); +constexpr size_t kFunctionSize = arraysize(kFunctionA); + } // namespace TEST(TestAsyncCache) { CcTest::InitializeVM(); - i::HandleScope internal_scope_(CcTest::i_isolate()); + i::HandleScope internal_scope(CcTest::i_isolate()); AccountingAllocator allocator; Zone zone(&allocator, "CompilationCacheTester"); @@ -95,6 +165,74 @@ TEST(TestAsyncCache) { CHECK_NE(resolverA1->native_module(), resolverB->native_module()); } +TEST(TestStreamingCache) { + CcTest::InitializeVM(); + + std::atomic<int> pending(3); + auto resolverA1 = std::make_shared<TestResolver>(&pending); + auto resolverA2 = std::make_shared<TestResolver>(&pending); + auto resolverB = std::make_shared<TestResolver>(&pending); + + StreamTester testerA1(resolverA1); + StreamTester testerA2(resolverA2); + StreamTester testerB(resolverB); + + // Start receiving kPrefix bytes. + testerA1.OnBytesReceived(kPrefix, kPrefixSize); + testerA2.OnBytesReceived(kPrefix, kPrefixSize); + testerB.OnBytesReceived(kPrefix, kPrefixSize); + + // Receive function bytes and start streaming compilation. + testerA1.OnBytesReceived(kFunctionA, kFunctionSize); + testerA1.FinishStream(); + testerA2.OnBytesReceived(kFunctionA, kFunctionSize); + testerA2.FinishStream(); + testerB.OnBytesReceived(kFunctionB, kFunctionSize); + testerB.FinishStream(); + + while (pending > 0) { + v8::platform::PumpMessageLoop(i::V8::GetCurrentPlatform(), + CcTest::isolate()); + } + + std::shared_ptr<NativeModule> native_module_A1 = resolverA1->native_module(); + std::shared_ptr<NativeModule> native_module_A2 = resolverA2->native_module(); + std::shared_ptr<NativeModule> native_module_B = resolverB->native_module(); + CHECK_EQ(native_module_A1, native_module_A2); + CHECK_NE(native_module_A1, native_module_B); +} + +TEST(TestStreamingAndSyncCache) { + CcTest::InitializeVM(); + + std::atomic<int> pending(1); + auto resolver = std::make_shared<TestResolver>(&pending); + StreamTester tester(resolver); + + tester.OnBytesReceived(kPrefix, kPrefixSize); + + // Compile the same module synchronously to make sure we don't deadlock + // waiting for streaming compilation to finish. + auto full_bytes = OwnedVector<uint8_t>::New(kPrefixSize + kFunctionSize); + memcpy(full_bytes.begin(), kPrefix, kPrefixSize); + memcpy(full_bytes.begin() + kPrefixSize, kFunctionA, kFunctionSize); + auto native_module_sync = SyncCompile(full_bytes.as_vector()); + + // Streaming compilation should just discard its native module now and use the + // one inserted in the cache by sync compilation. + tester.OnBytesReceived(kFunctionA, kFunctionSize); + tester.FinishStream(); + + while (pending > 0) { + v8::platform::PumpMessageLoop(i::V8::GetCurrentPlatform(), + CcTest::isolate()); + } + + std::shared_ptr<NativeModule> native_module_streaming = + resolver->native_module(); + CHECK_EQ(native_module_streaming, native_module_sync); +} + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/wasm/test-grow-memory.cc b/deps/v8/test/cctest/wasm/test-grow-memory.cc index a188707cae..0bf85c2b40 100644 --- a/deps/v8/test/cctest/wasm/test-grow-memory.cc +++ b/deps/v8/test/cctest/wasm/test-grow-memory.cc @@ -113,7 +113,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { ManuallyExternalizedBuffer external2( handle(memory_object->array_buffer(), isolate)); - // Grow using an internal WASM bytecode. + // Grow using an internal Wasm bytecode. result = testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr); CHECK_EQ(26, result); CHECK(external2.buffer_->was_detached()); // growing always detaches diff --git a/deps/v8/test/cctest/wasm/test-liftoff-inspection.cc b/deps/v8/test/cctest/wasm/test-liftoff-inspection.cc index 3bbc639ca5..4984bf4524 100644 --- a/deps/v8/test/cctest/wasm/test-liftoff-inspection.cc +++ b/deps/v8/test/cctest/wasm/test-liftoff-inspection.cc @@ -61,18 +61,69 @@ class LiftoffCompileEnvironment { CHECK_EQ(detected1, detected2); } - DebugSideTable GenerateDebugSideTable( + std::unique_ptr<DebugSideTable> GenerateDebugSideTable( std::initializer_list<ValueType> return_types, std::initializer_list<ValueType> param_types, - std::initializer_list<uint8_t> raw_function_bytes) { + std::initializer_list<uint8_t> raw_function_bytes, + std::vector<int> breakpoints = {}) { auto test_func = AddFunction(return_types, param_types, raw_function_bytes); - CompilationEnv env = module_builder_.CreateCompilationEnv(); - return GenerateLiftoffDebugSideTable(CcTest::i_isolate()->allocator(), &env, - test_func.body); + CompilationEnv env = module_builder_.CreateCompilationEnv( + breakpoints.empty() ? TestingModuleBuilder::kNoDebug + : TestingModuleBuilder::kDebug); + WasmFeatures detected; + std::unique_ptr<DebugSideTable> debug_side_table_via_compilation; + ExecuteLiftoffCompilation( + CcTest::i_isolate()->allocator(), &env, test_func.body, 0, nullptr, + &detected, VectorOf(breakpoints), &debug_side_table_via_compilation); + + // If there are no breakpoint, then {ExecuteLiftoffCompilation} should + // provide the same debug side table. + if (breakpoints.empty()) { + std::unique_ptr<DebugSideTable> debug_side_table = + GenerateLiftoffDebugSideTable(CcTest::i_isolate()->allocator(), &env, + test_func.body); + CheckTableEquals(*debug_side_table, *debug_side_table_via_compilation); + } + + return debug_side_table_via_compilation; } private: + static void CheckTableEquals(const DebugSideTable& a, + const DebugSideTable& b) { + CHECK_EQ(a.num_locals(), b.num_locals()); + CHECK(std::equal(a.entries().begin(), a.entries().end(), + b.entries().begin(), b.entries().end(), + &CheckEntryEquals)); + } + + static bool CheckEntryEquals(const DebugSideTable::Entry& a, + const DebugSideTable::Entry& b) { + CHECK_EQ(a.pc_offset(), b.pc_offset()); + CHECK(std::equal(a.values().begin(), a.values().end(), b.values().begin(), + b.values().end(), &CheckValueEquals)); + return true; + } + + static bool CheckValueEquals(const DebugSideTable::Entry::Value& a, + const DebugSideTable::Entry::Value& b) { + CHECK_EQ(a.type, b.type); + CHECK_EQ(a.kind, b.kind); + switch (a.kind) { + case DebugSideTable::Entry::kConstant: + CHECK_EQ(a.i32_const, b.i32_const); + break; + case DebugSideTable::Entry::kRegister: + CHECK_EQ(a.reg_code, b.reg_code); + break; + case DebugSideTable::Entry::kStack: + CHECK_EQ(a.stack_offset, b.stack_offset); + break; + } + return true; + } + OwnedVector<uint8_t> GenerateFunctionBody( std::initializer_list<uint8_t> raw_function_bytes) { // Build the function bytes by prepending the locals decl and appending an @@ -122,30 +173,52 @@ class LiftoffCompileEnvironment { }; struct DebugSideTableEntry { - std::vector<ValueType> stack_types; - std::vector<std::pair<int, int>> constants; + std::vector<DebugSideTable::Entry::Value> values; + + // Construct via vector or implicitly via initializer list. + explicit DebugSideTableEntry(std::vector<DebugSideTable::Entry::Value> values) + : values(std::move(values)) {} + DebugSideTableEntry( + std::initializer_list<DebugSideTable::Entry::Value> values) + : values(values) {} bool operator==(const DebugSideTableEntry& other) const { - return stack_types == other.stack_types && constants == other.constants; + if (values.size() != other.values.size()) return false; + for (size_t i = 0; i < values.size(); ++i) { + if (values[i].type != other.values[i].type) return false; + if (values[i].kind != other.values[i].kind) return false; + // Stack offsets and register codes are platform dependent, so only check + // constants here. + if (values[i].kind == DebugSideTable::Entry::kConstant && + values[i].i32_const != other.values[i].i32_const) { + return false; + } + } + return true; } }; // Debug builds will print the vector of DebugSideTableEntry. #ifdef DEBUG std::ostream& operator<<(std::ostream& out, const DebugSideTableEntry& entry) { - out << "{stack types ["; + out << "{"; const char* comma = ""; - for (ValueType type : entry.stack_types) { - out << comma << ValueTypes::TypeName(type); - comma = ", "; - } - comma = ""; - out << "], constants: ["; - for (auto& c : entry.constants) { - out << comma << "<" << c.first << ", " << c.second << ">"; + for (auto& v : entry.values) { + out << comma << v.type.type_name() << " "; + switch (v.kind) { + case DebugSideTable::Entry::kConstant: + out << "const:" << v.i32_const; + break; + case DebugSideTable::Entry::kRegister: + out << "reg"; + break; + case DebugSideTable::Entry::kStack: + out << "stack"; + break; + } comma = ", "; } - return out << "]}"; + return out << "}"; } std::ostream& operator<<(std::ostream& out, @@ -154,28 +227,36 @@ std::ostream& operator<<(std::ostream& out, } #endif // DEBUG -void CheckDebugSideTable(std::vector<ValueType> expected_local_types, - std::vector<DebugSideTableEntry> expected_entries, - const wasm::DebugSideTable& debug_side_table) { - std::vector<ValueType> local_types; - for (int i = 0; i < debug_side_table.num_locals(); ++i) { - local_types.push_back(debug_side_table.local_type(i)); - } +// Named constructors to make the tests more readable. +DebugSideTable::Entry::Value Constant(ValueType type, int32_t constant) { + DebugSideTable::Entry::Value value; + value.type = type; + value.kind = DebugSideTable::Entry::kConstant; + value.i32_const = constant; + return value; +} +DebugSideTable::Entry::Value Register(ValueType type) { + DebugSideTable::Entry::Value value; + value.type = type; + value.kind = DebugSideTable::Entry::kRegister; + return value; +} +DebugSideTable::Entry::Value Stack(ValueType type) { + DebugSideTable::Entry::Value value; + value.type = type; + value.kind = DebugSideTable::Entry::kStack; + return value; +} + +void CheckDebugSideTable(std::vector<DebugSideTableEntry> expected_entries, + const wasm::DebugSideTable* debug_side_table) { std::vector<DebugSideTableEntry> entries; - for (auto& entry : debug_side_table.entries()) { - std::vector<ValueType> stack_types; - for (int i = 0; i < entry.stack_height(); ++i) { - stack_types.push_back(entry.stack_type(i)); - } - std::vector<std::pair<int, int>> constants; - int locals_plus_stack = - debug_side_table.num_locals() + entry.stack_height(); - for (int i = 0; i < locals_plus_stack; ++i) { - if (entry.IsConstant(i)) constants.emplace_back(i, entry.GetConstant(i)); - } - entries.push_back({std::move(stack_types), std::move(constants)}); + for (auto& entry : debug_side_table->entries()) { + auto values = entry.values(); + entries.push_back( + DebugSideTableEntry{std::vector<DebugSideTable::Entry::Value>{ + values.begin(), values.end()}}); } - CHECK_EQ(expected_local_types, local_types); CHECK_EQ(expected_entries, entries); } @@ -223,12 +304,12 @@ TEST(Liftoff_debug_side_table_simple) { auto debug_side_table = env.GenerateDebugSideTable( {kWasmI32}, {kWasmI32, kWasmI32}, {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); - CheckDebugSideTable({kWasmI32, kWasmI32}, - { - // OOL stack check, stack: {} - {{}, {}}, - }, - debug_side_table); + CheckDebugSideTable( + { + // OOL stack check, locals spilled, stack empty. + {Stack(kWasmI32), Stack(kWasmI32)}, + }, + debug_side_table.get()); } TEST(Liftoff_debug_side_table_call) { @@ -237,14 +318,14 @@ TEST(Liftoff_debug_side_table_call) { {kWasmI32}, {kWasmI32}, {WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0))}); - CheckDebugSideTable({kWasmI32}, - { - // call, stack: {} - {{}, {}}, - // OOL stack check, stack: {} - {{}, {}}, - }, - debug_side_table); + CheckDebugSideTable( + { + // call, local spilled, stack empty. + {Stack(kWasmI32)}, + // OOL stack check, local spilled, stack empty. + {Stack(kWasmI32)}, + }, + debug_side_table.get()); } TEST(Liftoff_debug_side_table_call_const) { @@ -255,14 +336,14 @@ TEST(Liftoff_debug_side_table_call_const) { {WASM_SET_LOCAL(0, WASM_I32V_1(kConst)), WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0))}); - CheckDebugSideTable({kWasmI32}, - { - // call, stack: {}, local0 is kConst - {{}, {{0, kConst}}}, - // OOL stack check, stack: {} - {{}, {}}, - }, - debug_side_table); + CheckDebugSideTable( + { + // call, local is kConst. + {Constant(kWasmI32, kConst)}, + // OOL stack check, local spilled. + {Stack(kWasmI32)}, + }, + debug_side_table.get()); } TEST(Liftoff_debug_side_table_indirect_call) { @@ -272,18 +353,18 @@ TEST(Liftoff_debug_side_table_indirect_call) { {kWasmI32}, {kWasmI32}, {WASM_I32_ADD(WASM_CALL_INDIRECT(0, WASM_I32V_1(47), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0))}); - CheckDebugSideTable({kWasmI32}, - { - // indirect call, stack: {} - {{}, {}}, - // OOL stack check, stack: {} - {{}, {}}, - // OOL trap (invalid index), stack: {kConst} - {{kWasmI32}, {{1, kConst}}}, - // OOL trap (sig mismatch), stack: {kConst} - {{kWasmI32}, {{1, kConst}}}, - }, - debug_side_table); + CheckDebugSideTable( + { + // indirect call, local spilled, stack empty. + {Stack(kWasmI32)}, + // OOL stack check, local spilled, stack empty. + {Stack(kWasmI32)}, + // OOL trap (invalid index), local spilled, stack has {kConst}. + {Stack(kWasmI32), Constant(kWasmI32, kConst)}, + // OOL trap (sig mismatch), local spilled, stack has {kConst}. + {Stack(kWasmI32), Constant(kWasmI32, kConst)}, + }, + debug_side_table.get()); } TEST(Liftoff_debug_side_table_loop) { @@ -292,14 +373,14 @@ TEST(Liftoff_debug_side_table_loop) { auto debug_side_table = env.GenerateDebugSideTable( {kWasmI32}, {kWasmI32}, {WASM_I32V_1(kConst), WASM_LOOP(WASM_BR_IF(0, WASM_GET_LOCAL(0)))}); - CheckDebugSideTable({kWasmI32}, - { - // OOL stack check, stack: {} - {{}, {}}, - // OOL loop stack check, stack: {kConst} - {{kWasmI32}, {{1, kConst}}}, - }, - debug_side_table); + CheckDebugSideTable( + { + // OOL stack check, local spilled, stack empty. + {Stack(kWasmI32)}, + // OOL loop stack check, local spilled, stack has {kConst}. + {Stack(kWasmI32), Constant(kWasmI32, kConst)}, + }, + debug_side_table.get()); } TEST(Liftoff_debug_side_table_trap) { @@ -307,16 +388,39 @@ TEST(Liftoff_debug_side_table_trap) { auto debug_side_table = env.GenerateDebugSideTable( {kWasmI32}, {kWasmI32, kWasmI32}, {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); - CheckDebugSideTable({kWasmI32, kWasmI32}, - { - // OOL stack check, stack: {} - {{}, {}}, - // OOL trap (div by zero), stack: {} - {{}, {}}, - // OOL trap (result unrepresentable), stack: {} - {{}, {}}, - }, - debug_side_table); + CheckDebugSideTable( + { + // OOL stack check, local spilled, stack empty. + {Stack(kWasmI32), Stack(kWasmI32)}, + // OOL trap (div by zero), locals spilled, stack empty. + {Stack(kWasmI32), Stack(kWasmI32)}, + // OOL trap (result unrepresentable), locals spilled, stack empty. + {Stack(kWasmI32), Stack(kWasmI32)}, + }, + debug_side_table.get()); +} + +TEST(Liftoff_breakpoint_simple) { + LiftoffCompileEnvironment env; + // Set two breakpoints. At both locations, values are live in registers. + auto debug_side_table = env.GenerateDebugSideTable( + {kWasmI32}, {kWasmI32, kWasmI32}, + {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}, + { + 1, // break at beginning of function (first local.get) + 5 // break at i32.add + }); + CheckDebugSideTable( + { + // First break point, locals in registers. + {Register(kWasmI32), Register(kWasmI32)}, + // Second break point, locals and two stack values in registers. + {Register(kWasmI32), Register(kWasmI32), Register(kWasmI32), + Register(kWasmI32)}, + // OOL stack check, locals spilled, stack empty. + {Stack(kWasmI32), Stack(kWasmI32)}, + }, + debug_side_table.get()); } } // namespace wasm 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 94fa0a31b2..f6cdff61ba 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -1419,7 +1419,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob_i64) { WASM_LOAD_MEM(machineTypes[m], WASM_ZERO)), WASM_ZERO); - byte memsize = ValueTypes::MemSize(machineTypes[m]); + byte memsize = machineTypes[m].MemSize(); uint32_t boundary = num_bytes - 8 - memsize; CHECK_EQ(0, r.Call(boundary)); // in bounds. CHECK_EQ(0, memcmp(&memory[0], &memory[8 + boundary], memsize)); @@ -1536,9 +1536,9 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { // Build the selector function. // ========================================================================= FunctionSig::Builder b(&zone, 1, num_params); - b.AddReturn(ValueTypes::ValueTypeFor(result)); + b.AddReturn(ValueType::For(result)); for (int i = 0; i < num_params; i++) { - b.AddParam(ValueTypes::ValueTypeFor(memtypes[i])); + b.AddParam(ValueType::For(memtypes[i])); } WasmFunctionCompiler& t = r.NewFunction(b.Build()); BUILD(t, WASM_GET_LOCAL(which)); @@ -1558,7 +1558,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { ADD_CODE(code, WASM_CALL_FUNCTION0(t.function_index())); // Store the result in a local. - byte local_index = r.AllocateLocal(ValueTypes::ValueTypeFor(result)); + byte local_index = r.AllocateLocal(ValueType::For(result)); ADD_CODE(code, kExprLocalSet, local_index); // Store the result in memory. @@ -1575,7 +1575,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { r.builder().RandomizeMemory(); CHECK_EQ(kExpected, r.Call()); - int size = ValueTypes::MemSize(result); + int size = result.MemSize(); for (int i = 0; i < size; i++) { int base = (which + 1) * kElemSize; byte expected = r.builder().raw_mem_at<byte>(base + i); diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc index 082c5d07c9..178f86bac9 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc @@ -752,6 +752,52 @@ WASM_EXEC_TEST(I64AtomicAddUseOnlyHighWord) { CHECK_EQ(0x12345678, r.Call()); } +WASM_EXEC_TEST(I64AtomicCompareExchangeUseOnlyLowWord) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint32_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + memory[1] = 0x1234567890abcdeful; + r.builder().SetHasSharedMemory(); + // Test that we can use just the low word of an I64AtomicLoad. + BUILD(r, WASM_I32_CONVERT_I64(WASM_ATOMICS_TERNARY_OP( + kExprI64AtomicCompareExchange, WASM_I32V(8), WASM_I64V(1), + WASM_I64V(memory[1]), MachineRepresentation::kWord64))); + CHECK_EQ(0x90abcdef, r.Call()); +} + +WASM_EXEC_TEST(I64AtomicCompareExchangeUseOnlyHighWord) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint32_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + memory[1] = 0x1234567890abcdeful; + r.builder().SetHasSharedMemory(); + // Test that we can use just the high word of an I64AtomicLoad. + BUILD(r, WASM_I32_CONVERT_I64(WASM_I64_ROR( + WASM_ATOMICS_TERNARY_OP( + kExprI64AtomicCompareExchange, WASM_I32V(8), WASM_I64V(1), + WASM_I64V(memory[1]), MachineRepresentation::kWord64), + WASM_I64V(32)))); + CHECK_EQ(0x12345678, r.Call()); +} + +WASM_EXEC_TEST(I64AtomicCompareExchange32UZeroExtended) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint32_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + memory[1] = 0; + r.builder().SetHasSharedMemory(); + // Test that the high word of the expected value is cleared in the return + // value. + BUILD(r, WASM_I64_EQZ(WASM_ATOMICS_TERNARY_OP( + kExprI64AtomicCompareExchange32U, WASM_I32V(8), + WASM_I64V(0x1234567800000000), WASM_I64V(0), + MachineRepresentation::kWord32))); + CHECK_EQ(1, r.Call()); +} + } // namespace test_run_wasm_atomics_64 } // namespace wasm } // namespace internal diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc b/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc index 745196210a..cddc6f7468 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc @@ -160,17 +160,15 @@ WASM_EXEC_TEST(TryCatchTrapTypeError) { namespace { -// TODO(8729): The semantics of this are not yet specified and might change, -// this test aims at keeping semantics of various execution tiers consistent. -void TestTryCatchTrap(byte* code, size_t code_size, - ExecutionTier execution_tier) { +void TestTrapNotCaught(byte* code, size_t code_size, + ExecutionTier execution_tier) { TestSignatures sigs; EXPERIMENTAL_FLAG_SCOPE(eh); - WasmRunner<uint32_t, uint32_t> r(execution_tier, nullptr, "main", - kRuntimeExceptionSupport); + WasmRunner<uint32_t> r(execution_tier, nullptr, "main", + kRuntimeExceptionSupport); r.builder().AddMemory(kWasmPageSize); - constexpr uint32_t kResult0 = 23; - constexpr uint32_t kResult1 = 42; + constexpr uint32_t kResultSuccess = 23; + constexpr uint32_t kResultCaught = 47; // Build a trapping helper function. WasmFunctionCompiler& trap_func = r.NewFunction(sigs.i_ii()); @@ -179,39 +177,36 @@ void TestTryCatchTrap(byte* code, size_t code_size, // Build the main test function. BUILD(r, WASM_TRY_CATCH_T( kWasmI32, - WASM_STMTS(WASM_I32V(kResult1), - WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)), - WASM_STMTS(WASM_CALL_FUNCTION( - trap_func.function_index(), - WASM_I32V(7), WASM_I32V(9)), - WASM_DROP))), - WASM_STMTS(WASM_DROP, WASM_I32V(kResult0)))); + WASM_STMTS(WASM_I32V(kResultSuccess), + WASM_CALL_FUNCTION(trap_func.function_index(), + WASM_I32V(7), WASM_I32V(9)), + WASM_DROP), + WASM_STMTS(WASM_DROP, WASM_I32V(kResultCaught)))); // Need to call through JS to allow for creation of stack traces. - r.CheckCallViaJS(kResult0, 0); - r.CheckCallViaJS(kResult1, 1); + r.CheckCallViaJSTraps(); } } // namespace WASM_EXEC_TEST(TryCatchTrapUnreachable) { byte code[] = {WASM_UNREACHABLE}; - TestTryCatchTrap(code, arraysize(code), execution_tier); + TestTrapNotCaught(code, arraysize(code), execution_tier); } WASM_EXEC_TEST(TryCatchTrapMemOutOfBounds) { byte code[] = {WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(-1))}; - TestTryCatchTrap(code, arraysize(code), execution_tier); + TestTrapNotCaught(code, arraysize(code), execution_tier); } WASM_EXEC_TEST(TryCatchTrapDivByZero) { byte code[] = {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(0))}; - TestTryCatchTrap(code, arraysize(code), execution_tier); + TestTrapNotCaught(code, arraysize(code), execution_tier); } WASM_EXEC_TEST(TryCatchTrapRemByZero) { byte code[] = {WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(0))}; - TestTryCatchTrap(code, arraysize(code), execution_tier); + TestTrapNotCaught(code, arraysize(code), execution_tier); } } // namespace test_run_wasm_exceptions diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc index c8cc836b87..23ab076e4a 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc @@ -48,23 +48,6 @@ using Int8ShiftOp = int8_t (*)(int8_t, int); EXPERIMENTAL_FLAG_SCOPE(simd); \ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kTurbofan); \ } \ - TEST(RunWasm_##name##_interpreter) { \ - EXPERIMENTAL_FLAG_SCOPE(simd); \ - RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kInterpreter); \ - } \ - TEST(RunWasm_##name##_simd_lowered) { \ - EXPERIMENTAL_FLAG_SCOPE(simd); \ - RunWasm_##name##_Impl(kLowerSimd, ExecutionTier::kTurbofan); \ - } \ - void RunWasm_##name##_Impl(LowerSimd lower_simd, ExecutionTier execution_tier) - -#define WASM_SIMD_TEST_WITH_LIFTOFF(name) \ - void RunWasm_##name##_Impl(LowerSimd lower_simd, \ - ExecutionTier execution_tier); \ - TEST(RunWasm_##name##_turbofan) { \ - EXPERIMENTAL_FLAG_SCOPE(simd); \ - RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kTurbofan); \ - } \ TEST(RunWasm_##name##_liftoff) { \ EXPERIMENTAL_FLAG_SCOPE(simd); \ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kLiftoff); \ @@ -305,6 +288,11 @@ T AndNot(T a, T b) { return a & ~b; } +template <typename T> +T Abs(T a) { + return std::abs(a); +} + // only used for F64x2 tests below int64_t Equal(double a, double b) { return a == b ? -1 : 0; } @@ -318,7 +306,7 @@ int64_t Less(double a, double b) { return a < b ? -1 : 0; } int64_t LessEqual(double a, double b) { return a <= b ? -1 : 0; } -#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X // Only used for qfma and qfms tests below. // FMOperation holds the params (a, b, c) for a Multiply-Add or @@ -393,15 +381,17 @@ static constexpr Vector<const FMOperation<T>> qfms_vector() { return ArrayVector(qfms_array<T>); } -// Fused results only when fma3 feature is enabled, and running on TurboFan. +// Fused results only when fma3 feature is enabled, and running on TurboFan or +// Liftoff (which can fall back to TurboFan if FMA is not implemented). bool ExpectFused(ExecutionTier tier) { #ifdef V8_TARGET_ARCH_X64 - return CpuFeatures::IsSupported(FMA3) && (tier == ExecutionTier::kTurbofan); + return CpuFeatures::IsSupported(FMA3) && + (tier == ExecutionTier::kTurbofan || tier == ExecutionTier::kLiftoff); #else - return (tier == ExecutionTier::kTurbofan); + return (tier == ExecutionTier::kTurbofan || tier == ExecutionTier::kLiftoff); #endif } -#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X } // namespace @@ -419,6 +409,9 @@ bool ExpectFused(ExecutionTier tier) { WASM_RETURN1(WASM_ZERO)) #define TO_BYTE(val) static_cast<byte>(val) +// TODO(v8:10258): We have support for emitting multi-byte opcodes now, so this +// can change to simply, op, once the decoder is fixed to decode multi byte +// opcodes. #define WASM_SIMD_OP(op) kSimdPrefix, TO_BYTE(op) #define WASM_SIMD_SPLAT(Type, ...) __VA_ARGS__, WASM_SIMD_OP(kExpr##Type##Splat) #define WASM_SIMD_UNOP(op, x) x, WASM_SIMD_OP(op) @@ -519,6 +512,11 @@ bool ExpectFused(ExecutionTier tier) { EXPERIMENTAL_FLAG_SCOPE(simd); \ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kTurbofan); \ } \ + TEST(RunWasm_##name##_liftoff) { \ + if (!CpuFeatures::SupportsWasmSimd128()) return; \ + EXPERIMENTAL_FLAG_SCOPE(simd); \ + RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kLiftoff); \ + } \ TEST(RunWasm_##name##_interpreter) { \ EXPERIMENTAL_FLAG_SCOPE(simd); \ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kInterpreter); \ @@ -550,7 +548,7 @@ WASM_SIMD_TEST(S128Globals) { // Set up a global to hold input and output vectors. int32_t* g0 = r.builder().AddGlobal<int32_t>(kWasmS128); int32_t* g1 = r.builder().AddGlobal<int32_t>(kWasmS128); - BUILD(r, WASM_SET_GLOBAL(1, WASM_GET_GLOBAL(0)), WASM_ONE); + BUILD_V(r, WASM_SET_GLOBAL(1, WASM_GET_GLOBAL(0)), WASM_ONE); FOR_INT32_INPUTS(x) { for (int i = 0; i < 4; i++) { @@ -565,7 +563,7 @@ WASM_SIMD_TEST(S128Globals) { } } -WASM_SIMD_TEST_WITH_LIFTOFF(F32x4Splat) { +WASM_SIMD_TEST(F32x4Splat) { WasmRunner<int32_t, float> r(execution_tier, lower_simd); // Set up a global to hold output vector. float* g = r.builder().AddGlobal<float>(kWasmS128); @@ -753,11 +751,13 @@ WASM_SIMD_TEST(F32x4Sqrt) { } WASM_SIMD_TEST(F32x4RecipApprox) { + FLAG_SCOPE(wasm_simd_post_mvp); RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipApprox, base::Recip, false /* !exact */); } WASM_SIMD_TEST(F32x4RecipSqrtApprox) { + FLAG_SCOPE(wasm_simd_post_mvp); RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipSqrtApprox, base::RecipSqrt, false /* !exact */); } @@ -883,8 +883,9 @@ WASM_SIMD_TEST(F32x4Le) { RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Le, LessEqual); } -#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(F32x4Qfma) { + FLAG_SCOPE(wasm_simd_post_mvp); WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd); // Set up global to hold mask output. float* g = r.builder().AddGlobal<float>(kWasmS128); @@ -909,6 +910,7 @@ WASM_SIMD_TEST_NO_LOWERING(F32x4Qfma) { } WASM_SIMD_TEST_NO_LOWERING(F32x4Qfms) { + FLAG_SCOPE(wasm_simd_post_mvp); WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd); // Set up global to hold mask output. float* g = r.builder().AddGlobal<float>(kWasmS128); @@ -931,15 +933,15 @@ WASM_SIMD_TEST_NO_LOWERING(F32x4Qfms) { } } } -#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(I64x2Splat) { WasmRunner<int32_t, int64_t> r(execution_tier, lower_simd); // Set up a global to hold output vector. int64_t* g = r.builder().AddGlobal<int64_t>(kWasmS128); byte param1 = 0; - BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(param1))), - WASM_ONE); + BUILD_V(r, WASM_SET_GLOBAL(0, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(param1))), + WASM_ONE); FOR_INT64_INPUTS(x) { r.Call(x); @@ -1014,22 +1016,28 @@ void RunI64x2ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, // Intentionally shift by 64, should be no-op. for (int shift = 1; shift <= 64; shift++) { WasmRunner<int32_t, int64_t> r(execution_tier, lower_simd); - int64_t* g = r.builder().AddGlobal<int64_t>(kWasmS128); + int32_t* memory = r.builder().AddMemoryElems<int32_t>(1); + int64_t* g_imm = r.builder().AddGlobal<int64_t>(kWasmS128); + int64_t* g_mem = r.builder().AddGlobal<int64_t>(kWasmS128); byte value = 0; - byte shift_index = r.AllocateLocal(kWasmI32); - byte simd1 = r.AllocateLocal(kWasmS128); - BUILD(r, - WASM_SET_LOCAL(simd1, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(value))), - WASM_SET_LOCAL(shift_index, WASM_I32V(shift)), - WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd1), - WASM_GET_LOCAL(shift_index))), - WASM_ONE); + byte simd = r.AllocateLocal(kWasmS128); + // Shift using an immediate, and shift using a value loaded from memory. + BUILD( + r, WASM_SET_LOCAL(simd, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(value))), + WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd), + WASM_I32V(shift))), + WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP( + opcode, WASM_GET_LOCAL(simd), + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))), + WASM_ONE); + r.builder().WriteMemory(&memory[0], shift); FOR_INT64_INPUTS(x) { r.Call(x); int64_t expected = expected_op(x, shift); for (int i = 0; i < 2; i++) { - CHECK_EQ(expected, ReadLittleEndianValue<int64_t>(&g[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int64_t>(&g_imm[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int64_t>(&g_mem[i])); } } } @@ -1052,6 +1060,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2ShrU) { void RunI64x2BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, Int64BinOp expected_op) { + FLAG_SCOPE(wasm_simd_post_mvp); WasmRunner<int32_t, int64_t, int64_t> r(execution_tier, lower_simd); // Global to hold output. int64_t* g = r.builder().AddGlobal<int64_t>(kWasmS128); @@ -1086,7 +1095,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2Sub) { base::SubWithWraparound); } -#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(I64x2Eq) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2Eq, Equal); } @@ -1128,7 +1137,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2GeU) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2GeU, UnsignedGreaterEqual); } -#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(F64x2Splat) { WasmRunner<int32_t, double> r(execution_tier, lower_simd); @@ -1197,7 +1206,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2ReplaceLane) { CHECK_EQ(1., ReadLittleEndianValue<double>(&g1[1])); } -#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(F64x2ExtractLaneWithI64x2) { WasmRunner<int64_t> r(execution_tier, lower_simd); BUILD(r, WASM_IF_ELSE_L( @@ -1217,7 +1226,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2ExtractWithF64x2) { WASM_I64V(1), WASM_I64V(0))); CHECK_EQ(1, r.Call()); } -#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X bool IsExtreme(double x) { double abs_x = std::fabs(x); @@ -1480,7 +1489,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2Mul) { base::MulWithWraparound); } -#if V8_TARGET_ARCH_X64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(I64x2MinS) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2MinS, Minimum); } @@ -1498,10 +1507,11 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2MaxU) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2MaxU, UnsignedMaximum); } -#endif // V8_TARGET_ARCH_X64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_S390X -#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST_NO_LOWERING(F64x2Qfma) { + FLAG_SCOPE(wasm_simd_post_mvp); WasmRunner<int32_t, double, double, double> r(execution_tier, lower_simd); // Set up global to hold mask output. double* g = r.builder().AddGlobal<double>(kWasmS128); @@ -1526,6 +1536,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Qfma) { } WASM_SIMD_TEST_NO_LOWERING(F64x2Qfms) { + FLAG_SCOPE(wasm_simd_post_mvp); WasmRunner<int32_t, double, double, double> r(execution_tier, lower_simd); // Set up global to hold mask output. double* g = r.builder().AddGlobal<double>(kWasmS128); @@ -1548,7 +1559,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Qfms) { } } } -#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X WASM_SIMD_TEST(I32x4Splat) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); @@ -1650,6 +1661,68 @@ WASM_SIMD_TEST(I16x8ReplaceLane) { } } +#if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_ARM +WASM_SIMD_TEST_NO_LOWERING(I8x16BitMask) { + FLAG_SCOPE(wasm_simd_post_mvp); + WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); + byte value1 = r.AllocateLocal(kWasmS128); + + BUILD(r, WASM_SET_LOCAL(value1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(0))), + WASM_SET_LOCAL(value1, WASM_SIMD_I8x16_REPLACE_LANE( + 0, WASM_GET_LOCAL(value1), WASM_I32V(0))), + WASM_SET_LOCAL(value1, WASM_SIMD_I8x16_REPLACE_LANE( + 1, WASM_GET_LOCAL(value1), WASM_I32V(-1))), + WASM_SIMD_UNOP(kExprI8x16BitMask, WASM_GET_LOCAL(value1))); + + FOR_INT8_INPUTS(x) { + int32_t actual = r.Call(x); + // Lane 0 is always 0 (positive), lane 1 is always -1. + int32_t expected = std::signbit(static_cast<double>(x)) ? 0xFFFE : 0x0002; + CHECK_EQ(actual, expected); + } +} + +WASM_SIMD_TEST_NO_LOWERING(I16x8BitMask) { + FLAG_SCOPE(wasm_simd_post_mvp); + WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); + byte value1 = r.AllocateLocal(kWasmS128); + + BUILD(r, WASM_SET_LOCAL(value1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(0))), + WASM_SET_LOCAL(value1, WASM_SIMD_I16x8_REPLACE_LANE( + 0, WASM_GET_LOCAL(value1), WASM_I32V(0))), + WASM_SET_LOCAL(value1, WASM_SIMD_I16x8_REPLACE_LANE( + 1, WASM_GET_LOCAL(value1), WASM_I32V(-1))), + WASM_SIMD_UNOP(kExprI16x8BitMask, WASM_GET_LOCAL(value1))); + + FOR_INT16_INPUTS(x) { + int32_t actual = r.Call(x); + // Lane 0 is always 0 (positive), lane 1 is always -1. + int32_t expected = std::signbit(static_cast<double>(x)) ? 0xFE : 2; + CHECK_EQ(actual, expected); + } +} + +WASM_SIMD_TEST_NO_LOWERING(I32x4BitMask) { + FLAG_SCOPE(wasm_simd_post_mvp); + WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); + byte value1 = r.AllocateLocal(kWasmS128); + + BUILD(r, WASM_SET_LOCAL(value1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), + WASM_SET_LOCAL(value1, WASM_SIMD_I32x4_REPLACE_LANE( + 0, WASM_GET_LOCAL(value1), WASM_I32V(0))), + WASM_SET_LOCAL(value1, WASM_SIMD_I32x4_REPLACE_LANE( + 1, WASM_GET_LOCAL(value1), WASM_I32V(-1))), + WASM_SIMD_UNOP(kExprI32x4BitMask, WASM_GET_LOCAL(value1))); + + FOR_INT32_INPUTS(x) { + int32_t actual = r.Call(x); + // Lane 0 is always 0 (positive), lane 1 is always -1. + int32_t expected = std::signbit(static_cast<double>(x)) ? 0xE : 2; + CHECK_EQ(actual, expected); + } +} +#endif // V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_ARM + WASM_SIMD_TEST(I8x16Splat) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); // Set up a global to hold output vector. @@ -1828,6 +1901,10 @@ WASM_SIMD_TEST(I32x4Neg) { base::NegateWithWraparound); } +WASM_SIMD_TEST(I32x4Abs) { + RunI32x4UnOpTest(execution_tier, lower_simd, kExprI32x4Abs, Abs); +} + WASM_SIMD_TEST(S128Not) { RunI32x4UnOpTest(execution_tier, lower_simd, kExprS128Not, Not); } @@ -1955,21 +2032,28 @@ void RunI32x4ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, // Intentionally shift by 32, should be no-op. for (int shift = 1; shift <= 32; shift++) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); - int32_t* g = r.builder().AddGlobal<int32_t>(kWasmS128); + int32_t* memory = r.builder().AddMemoryElems<int32_t>(1); + int32_t* g_imm = r.builder().AddGlobal<int32_t>(kWasmS128); + int32_t* g_mem = r.builder().AddGlobal<int32_t>(kWasmS128); byte value = 0; - byte shift_index = r.AllocateLocal(kWasmI32); - byte simd1 = r.AllocateLocal(kWasmS128); - BUILD(r, WASM_SET_LOCAL(shift_index, WASM_I32V(shift)), - WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(value))), - WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd1), - WASM_GET_LOCAL(shift_index))), - WASM_ONE); + byte simd = r.AllocateLocal(kWasmS128); + // Shift using an immediate, and shift using a value loaded from memory. + BUILD( + r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(value))), + WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd), + WASM_I32V(shift))), + WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP( + opcode, WASM_GET_LOCAL(simd), + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))), + WASM_ONE); + r.builder().WriteMemory(&memory[0], shift); FOR_INT32_INPUTS(x) { r.Call(x); int32_t expected = expected_op(x, shift); for (int i = 0; i < 4; i++) { - CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(&g[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(&g_imm[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(&g_mem[i])); } } } @@ -2080,6 +2164,10 @@ WASM_SIMD_TEST(I16x8Neg) { base::NegateWithWraparound); } +WASM_SIMD_TEST(I16x8Abs) { + RunI16x8UnOpTest(execution_tier, lower_simd, kExprI16x8Abs, Abs); +} + template <typename T = int16_t, typename OpType = T (*)(T, T)> void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, OpType expected_op) { @@ -2202,7 +2290,7 @@ WASM_SIMD_TEST(I16x8LeU) { UnsignedLessEqual); } -WASM_SIMD_TEST_NO_LOWERING(I16x8RoundingAverageU) { +WASM_SIMD_TEST(I16x8RoundingAverageU) { RunI16x8BinOpTest<uint16_t>(execution_tier, lower_simd, kExprI16x8RoundingAverageU, base::RoundingAverageUnsigned); @@ -2213,22 +2301,28 @@ void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, // Intentionally shift by 16, should be no-op. for (int shift = 1; shift <= 16; shift++) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); - int16_t* g = r.builder().AddGlobal<int16_t>(kWasmS128); + int32_t* memory = r.builder().AddMemoryElems<int32_t>(1); + int16_t* g_imm = r.builder().AddGlobal<int16_t>(kWasmS128); + int16_t* g_mem = r.builder().AddGlobal<int16_t>(kWasmS128); byte value = 0; - byte simd1 = r.AllocateLocal(kWasmS128); - byte shift_index = r.AllocateLocal(kWasmI32); - BUILD(r, - WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(value))), - WASM_SET_LOCAL(shift_index, WASM_I32V(shift)), - WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd1), - WASM_GET_LOCAL(shift_index))), - WASM_ONE); + byte simd = r.AllocateLocal(kWasmS128); + // Shift using an immediate, and shift using a value loaded from memory. + BUILD( + r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(value))), + WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd), + WASM_I32V(shift))), + WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP( + opcode, WASM_GET_LOCAL(simd), + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))), + WASM_ONE); + r.builder().WriteMemory(&memory[0], shift); FOR_INT16_INPUTS(x) { r.Call(x); int16_t expected = expected_op(x, shift); for (int i = 0; i < 8; i++) { - CHECK_EQ(expected, ReadLittleEndianValue<int16_t>(&g[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int16_t>(&g_imm[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int16_t>(&g_mem[i])); } } } @@ -2275,6 +2369,10 @@ WASM_SIMD_TEST(I8x16Neg) { base::NegateWithWraparound); } +WASM_SIMD_TEST(I8x16Abs) { + RunI8x16UnOpTest(execution_tier, lower_simd, kExprI8x16Abs, Abs); +} + // Tests both signed and unsigned conversion from I16x8 (packing). WASM_SIMD_TEST(I8x16ConvertI16x8) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); @@ -2426,7 +2524,7 @@ WASM_SIMD_TEST(I8x16Mul) { base::MulWithWraparound); } -WASM_SIMD_TEST_NO_LOWERING(I8x16RoundingAverageU) { +WASM_SIMD_TEST(I8x16RoundingAverageU) { RunI8x16BinOpTest<uint8_t>(execution_tier, lower_simd, kExprI8x16RoundingAverageU, base::RoundingAverageUnsigned); @@ -2437,22 +2535,28 @@ void RunI8x16ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, // Intentionally shift by 8, should be no-op. for (int shift = 1; shift <= 8; shift++) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); - int8_t* g = r.builder().AddGlobal<int8_t>(kWasmS128); + int32_t* memory = r.builder().AddMemoryElems<int32_t>(1); + int8_t* g_imm = r.builder().AddGlobal<int8_t>(kWasmS128); + int8_t* g_mem = r.builder().AddGlobal<int8_t>(kWasmS128); byte value = 0; - byte simd1 = r.AllocateLocal(kWasmS128); - byte shift_index = r.AllocateLocal(kWasmI32); - BUILD(r, - WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(value))), - WASM_SET_LOCAL(shift_index, WASM_I32V(shift)), - WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd1), - WASM_GET_LOCAL(shift_index))), - WASM_ONE); + byte simd = r.AllocateLocal(kWasmS128); + // Shift using an immediate, and shift using a value loaded from memory. + BUILD( + r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(value))), + WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_GET_LOCAL(simd), + WASM_I32V(shift))), + WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP( + opcode, WASM_GET_LOCAL(simd), + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))), + WASM_ONE); + r.builder().WriteMemory(&memory[0], shift); FOR_INT8_INPUTS(x) { r.Call(x); int8_t expected = expected_op(x, shift); for (int i = 0; i < 16; i++) { - CHECK_EQ(expected, ReadLittleEndianValue<int8_t>(&g[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int8_t>(&g_imm[i])); + CHECK_EQ(expected, ReadLittleEndianValue<int8_t>(&g_mem[i])); } } } @@ -2585,18 +2689,21 @@ void RunBinaryLaneOpTest( } WASM_SIMD_TEST(I32x4AddHoriz) { + FLAG_SCOPE(wasm_simd_post_mvp); // Inputs are [0 1 2 3] and [4 5 6 7]. RunBinaryLaneOpTest<int32_t>(execution_tier, lower_simd, kExprI32x4AddHoriz, {{1, 5, 9, 13}}); } WASM_SIMD_TEST(I16x8AddHoriz) { + FLAG_SCOPE(wasm_simd_post_mvp); // Inputs are [0 1 2 3 4 5 6 7] and [8 9 10 11 12 13 14 15]. RunBinaryLaneOpTest<int16_t>(execution_tier, lower_simd, kExprI16x8AddHoriz, {{1, 5, 9, 13, 17, 21, 25, 29}}); } WASM_SIMD_TEST(F32x4AddHoriz) { + FLAG_SCOPE(wasm_simd_post_mvp); // Inputs are [0.0f 1.0f 2.0f 3.0f] and [4.0f 5.0f 6.0f 7.0f]. RunBinaryLaneOpTest<float>(execution_tier, lower_simd, kExprF32x4AddHoriz, {{1.0f, 5.0f, 9.0f, 13.0f}}); @@ -2932,6 +3039,7 @@ WASM_SIMD_COMPILED_TEST(S8x16MultiShuffleFuzz) { // test inputs. Test inputs with all true, all false, one true, and one false. #define WASM_SIMD_BOOL_REDUCTION_TEST(format, lanes, int_type) \ WASM_SIMD_TEST(ReductionTest##lanes) { \ + FLAG_SCOPE(wasm_simd_post_mvp); \ WasmRunner<int32_t> r(execution_tier, lower_simd); \ if (lanes == 2 && lower_simd == kLowerSimd) return; \ byte zero = r.AllocateLocal(kWasmS128); \ @@ -3320,15 +3428,15 @@ void RunLoadSplatTest(ExecutionTier execution_tier, LowerSimd lower_simd, } } -WASM_SIMD_TEST_NO_LOWERING(S8x16LoadSplat) { +WASM_SIMD_TEST(S8x16LoadSplat) { RunLoadSplatTest<int8_t>(execution_tier, lower_simd, kExprS8x16LoadSplat); } -WASM_SIMD_TEST_NO_LOWERING(S16x8LoadSplat) { +WASM_SIMD_TEST(S16x8LoadSplat) { RunLoadSplatTest<int16_t>(execution_tier, lower_simd, kExprS16x8LoadSplat); } -WASM_SIMD_TEST_NO_LOWERING(S32x4LoadSplat) { +WASM_SIMD_TEST(S32x4LoadSplat) { RunLoadSplatTest<int32_t>(execution_tier, lower_simd, kExprS32x4LoadSplat); } @@ -3360,21 +3468,21 @@ void RunLoadExtendTest(ExecutionTier execution_tier, LowerSimd lower_simd, } } -WASM_SIMD_TEST_NO_LOWERING(I16x8Load8x8U) { +WASM_SIMD_TEST(I16x8Load8x8U) { RunLoadExtendTest<uint8_t, uint16_t>(execution_tier, lower_simd, kExprI16x8Load8x8U); } -WASM_SIMD_TEST_NO_LOWERING(I16x8Load8x8S) { +WASM_SIMD_TEST(I16x8Load8x8S) { RunLoadExtendTest<int8_t, int16_t>(execution_tier, lower_simd, kExprI16x8Load8x8S); } -WASM_SIMD_TEST_NO_LOWERING(I32x4Load16x4U) { +WASM_SIMD_TEST(I32x4Load16x4U) { RunLoadExtendTest<uint16_t, uint32_t>(execution_tier, lower_simd, kExprI32x4Load16x4U); } -WASM_SIMD_TEST_NO_LOWERING(I32x4Load16x4S) { +WASM_SIMD_TEST(I32x4Load16x4S) { RunLoadExtendTest<int16_t, int32_t>(execution_tier, lower_simd, kExprI32x4Load16x4S); } @@ -3390,9 +3498,10 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2Load32x2S) { } #if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \ - V8_TARGET_ARCH_ARM + V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_S390X #define WASM_SIMD_ANYTRUE_TEST(format, lanes, max, param_type) \ WASM_SIMD_TEST(S##format##AnyTrue) { \ + FLAG_SCOPE(wasm_simd_post_mvp); \ WasmRunner<int32_t, param_type> r(execution_tier, lower_simd); \ if (lanes == 2 && lower_simd == kLowerSimd) return; \ byte simd = r.AllocateLocal(kWasmS128); \ @@ -3413,6 +3522,7 @@ WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff, int32_t) #define WASM_SIMD_ALLTRUE_TEST(format, lanes, max, param_type) \ WASM_SIMD_TEST(S##format##AllTrue) { \ + FLAG_SCOPE(wasm_simd_post_mvp); \ WasmRunner<int32_t, param_type> r(execution_tier, lower_simd); \ if (lanes == 2 && lower_simd == kLowerSimd) return; \ byte simd = r.AllocateLocal(kWasmS128); \ @@ -3431,7 +3541,7 @@ WASM_SIMD_ALLTRUE_TEST(32x4, 4, 0xffffffff, int32_t) WASM_SIMD_ALLTRUE_TEST(16x8, 8, 0xffff, int32_t) WASM_SIMD_ALLTRUE_TEST(8x16, 16, 0xff, int32_t) #endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || - // V8_TARGET_ARCH_ARM + // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_S390X WASM_SIMD_TEST(BitSelect) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); @@ -3564,7 +3674,6 @@ WASM_EXTRACT_I16x8_TEST(S, UINT16) WASM_EXTRACT_I16x8_TEST(I, INT16) #undef WASM_EXTRACT_I8x16_TEST #undef WASM_SIMD_TEST -#undef WASM_SIMD_TEST_WITH_LIFTOFF #undef WASM_SIMD_CHECK_LANE_S #undef WASM_SIMD_CHECK_LANE_U #undef TO_BYTE diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index b84322f190..1aebac3c76 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -1571,8 +1571,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) { r.builder().RandomizeMemory(1116 + static_cast<int>(m)); constexpr byte offset = 8; - uint32_t boundary = - num_bytes - offset - ValueTypes::MemSize(machineTypes[m]); + uint32_t boundary = num_bytes - offset - machineTypes[m].MemSize(); BUILD(r, WASM_LOAD_MEM_OFFSET(machineTypes[m], offset, WASM_GET_LOCAL(0)), WASM_DROP, WASM_ZERO); @@ -1718,7 +1717,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob) { WASM_LOAD_MEM(machineTypes[m], WASM_ZERO)), WASM_ZERO); - byte memsize = ValueTypes::MemSize(machineTypes[m]); + byte memsize = machineTypes[m].MemSize(); uint32_t boundary = num_bytes - 8 - memsize; CHECK_EQ(0, r.Call(boundary)); // in bounds. CHECK_EQ(0, memcmp(&memory[0], &memory[8 + boundary], memsize)); @@ -2009,7 +2008,7 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { compiler::Graph graph(&zone); compiler::JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); - FunctionSig* sig = WasmOpcodes::Signature(opcode); + const FunctionSig* sig = WasmOpcodes::Signature(opcode); if (sig->parameter_count() == 1) { byte code[] = {WASM_NO_LOCALS, kExprLocalGet, 0, static_cast<byte>(opcode), @@ -2643,9 +2642,9 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { // Build the selector function. // ========================================================================= FunctionSig::Builder b(&zone, 1, num_params); - b.AddReturn(ValueTypes::ValueTypeFor(result)); + b.AddReturn(ValueType::For(result)); for (int i = 0; i < num_params; ++i) { - b.AddParam(ValueTypes::ValueTypeFor(memtypes[i])); + b.AddParam(ValueType::For(memtypes[i])); } WasmFunctionCompiler& t = r.NewFunction(b.Build()); BUILD(t, WASM_GET_LOCAL(which)); @@ -2665,7 +2664,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { ADD_CODE(code, WASM_CALL_FUNCTION0(t.function_index())); // Store the result in a local. - byte local_index = r.AllocateLocal(ValueTypes::ValueTypeFor(result)); + byte local_index = r.AllocateLocal(ValueType::For(result)); ADD_CODE(code, kExprLocalSet, local_index); // Store the result in memory. @@ -2682,7 +2681,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { r.builder().RandomizeMemory(); CHECK_EQ(kExpected, r.Call()); - int size = ValueTypes::MemSize(result); + int size = result.MemSize(); for (int i = 0; i < size; ++i) { int base = (which + 1) * kElemSize; byte expected = r.builder().raw_mem_at<byte>(base + i); @@ -2740,7 +2739,7 @@ WASM_EXEC_TEST(MultiReturnSub) { template <typename T> void RunMultiReturnSelect(ExecutionTier execution_tier, const T* inputs) { EXPERIMENTAL_FLAG_SCOPE(mv); - ValueType type = ValueTypes::ValueTypeFor(MachineTypeForC<T>()); + ValueType type = ValueType::For(MachineTypeForC<T>()); ValueType storage[] = {type, type, type, type, type, type}; const size_t kNumReturns = 2; const size_t kNumParams = arraysize(storage) - kNumReturns; @@ -3498,7 +3497,7 @@ void BinOpOnDifferentRegisters( for (int i = 0; i < num_locals; ++i) { ADD_CODE( init_locals_code, - WASM_SET_LOCAL(i, WASM_LOAD_MEM(ValueTypes::MachineTypeFor(type), + WASM_SET_LOCAL(i, WASM_LOAD_MEM(type.machine_type(), WASM_I32V_2(sizeof(ctype) * i)))); } // {write_locals_code} is shared by all code generated in the loop below. @@ -3506,7 +3505,7 @@ void BinOpOnDifferentRegisters( // Write locals back into memory, shifted by one element to the right. for (int i = 0; i < num_locals; ++i) { ADD_CODE(write_locals_code, - WASM_STORE_MEM(ValueTypes::MachineTypeFor(type), + WASM_STORE_MEM(type.machine_type(), WASM_I32V_2(sizeof(ctype) * (i + 1)), WASM_GET_LOCAL(i))); } @@ -3521,7 +3520,7 @@ void BinOpOnDifferentRegisters( std::vector<byte> code(init_locals_code); ADD_CODE(code, // Store the result of the binary operation at memory[0]. - WASM_STORE_MEM(ValueTypes::MachineTypeFor(type), WASM_ZERO, + WASM_STORE_MEM(type.machine_type(), WASM_ZERO, WASM_BINOP(opcode, WASM_GET_LOCAL(lhs), WASM_GET_LOCAL(rhs))), // Return 0. @@ -3753,9 +3752,9 @@ TEST(Liftoff_tier_up) { memcpy(buffer.get(), sub_code->instructions().begin(), sub_size); desc.buffer = buffer.get(); desc.instr_size = static_cast<int>(sub_size); - std::unique_ptr<WasmCode> new_code = native_module->AddCode( - add.function_index(), desc, 0, 0, {}, OwnedVector<byte>(), - WasmCode::kFunction, ExecutionTier::kTurbofan); + std::unique_ptr<WasmCode> new_code = + native_module->AddCode(add.function_index(), desc, 0, 0, {}, {}, + WasmCode::kFunction, ExecutionTier::kTurbofan); native_module->PublishCode(std::move(new_code)); // Second run should now execute {sub}. diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc index 08c0c1dd46..4d3f83daff 100644 --- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc +++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc @@ -1215,6 +1215,39 @@ STREAM_TEST(TestCompileErrorFunctionName) { } } +STREAM_TEST(TestSetModuleCodeSection) { + StreamTester tester; + + uint8_t code[] = { + U32V_1(1), // functions count + U32V_1(4), // body size + U32V_1(0), // locals count + kExprLocalGet, 0, kExprEnd // body + }; + + const uint8_t bytes[] = { + WASM_MODULE_HEADER, // module header + kTypeSectionCode, // section code + U32V_1(1 + SIZEOF_SIG_ENTRY_x_x), // section size + U32V_1(1), // type count + SIG_ENTRY_x_x(kLocalI32, kLocalI32), // signature entry + kFunctionSectionCode, // section code + U32V_1(1 + 1), // section size + U32V_1(1), // functions count + 0, // signature index + kCodeSectionCode, // section code + U32V_1(arraysize(code)), // section size + }; + + tester.OnBytesReceived(bytes, arraysize(bytes)); + tester.OnBytesReceived(code, arraysize(code)); + tester.FinishStream(); + tester.RunCompilerTasks(); + CHECK_EQ(tester.native_module()->module()->code.offset(), arraysize(bytes)); + CHECK_EQ(tester.native_module()->module()->code.length(), arraysize(code)); + CHECK(tester.IsPromiseFulfilled()); +} + #undef STREAM_TEST } // namespace wasm diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc index 79c4c8eaec..9f011ecf38 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc @@ -139,6 +139,7 @@ class BreakHandler : public debug::DebugDelegate { Handle<BreakPoint> SetBreakpoint(WasmRunnerBase* runner, int function_index, int byte_offset, int expected_set_byte_offset = -1) { + runner->TierDown(); int func_offset = runner->builder().GetFunctionAt(function_index)->code.offset(); int code_offset = func_offset + byte_offset; @@ -190,17 +191,17 @@ struct WasmValWrapper { // Only needed in debug builds. Avoid unused warning otherwise. #ifdef DEBUG std::ostream& operator<<(std::ostream& out, const WasmValWrapper& wrapper) { - switch (wrapper.val.type()) { - case kWasmI32: + switch (wrapper.val.type().kind()) { + case ValueType::kI32: out << "i32: " << wrapper.val.to<int32_t>(); break; - case kWasmI64: + case ValueType::kI64: out << "i64: " << wrapper.val.to<int64_t>(); break; - case kWasmF32: + case ValueType::kF32: out << "f32: " << wrapper.val.to<float>(); break; - case kWasmF64: + case ValueType::kF64: out << "f64: " << wrapper.val.to<double>(); break; default: diff --git a/deps/v8/test/cctest/wasm/test-wasm-debug-evaluate.cc b/deps/v8/test/cctest/wasm/test-wasm-debug-evaluate.cc new file mode 100644 index 0000000000..5a7b2bc201 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-wasm-debug-evaluate.cc @@ -0,0 +1,315 @@ +// Copyright 2020 the V8 project 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 <initializer_list> + +#include "src/api/api-inl.h" +#include "src/base/macros.h" +#include "src/codegen/assembler-inl.h" +#include "src/compiler/heap-refs.h" +#include "src/debug/debug-evaluate.h" +#include "src/debug/debug-interface.h" +#include "src/diagnostics/disassembler.h" +#include "src/execution/frames-inl.h" +#include "src/execution/frames.h" +#include "src/objects/js-objects.h" +#include "src/objects/property-descriptor.h" +#include "src/utils/utils.h" +#include "src/utils/vector.h" +#include "src/wasm/compilation-environment.h" +#include "src/wasm/module-decoder.h" +#include "src/wasm/value-type.h" +#include "src/wasm/wasm-constants.h" +#include "src/wasm/wasm-debug-evaluate.h" +#include "src/wasm/wasm-debug.h" +#include "src/wasm/wasm-interpreter.h" +#include "src/wasm/wasm-module-builder.h" +#include "src/wasm/wasm-module.h" +#include "src/wasm/wasm-objects-inl.h" +#include "src/wasm/wasm-opcodes.h" +#include "src/wasm/wasm-tier.h" +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" +#include "test/common/wasm/wasm-macro-gen.h" + +namespace v8 { +namespace internal { +namespace wasm { + +namespace { +template <typename... FunctionArgsT> +class TestCode { + public: + TestCode(WasmRunnerBase* runner, std::initializer_list<byte> code) + : compiler_(&runner->NewFunction<FunctionArgsT...>()), code_(code) { + compiler_->Build(code.begin(), code.end()); + } + + Handle<BreakPoint> BreakOnReturn(WasmRunnerBase* runner) { + runner->TierDown(); + uint32_t return_offset_in_function = FindReturn(); + + int function_index = compiler_->function_index(); + int function_offset = + runner->builder().GetFunctionAt(function_index)->code.offset(); + int return_offset_in_module = function_offset + return_offset_in_function; + + Handle<WasmInstanceObject> instance = runner->builder().instance_object(); + Handle<Script> script(instance->module_object().script(), + runner->main_isolate()); + static int break_index = 0; + Handle<BreakPoint> break_point = + runner->main_isolate()->factory()->NewBreakPoint( + break_index++, runner->main_isolate()->factory()->empty_string()); + CHECK(WasmScript::SetBreakPoint(script, &return_offset_in_module, + break_point)); + int set_breakpoint_offset = return_offset_in_module - function_offset; + // Also set breakpoint on the debug info of the instance directly, since + // the instance chain is not set up properly in tests. + Handle<WasmDebugInfo> debug_info = + WasmInstanceObject::GetOrCreateDebugInfo(instance); + WasmDebugInfo::SetBreakpoint(debug_info, function_index, + set_breakpoint_offset); + + return break_point; + } + + MaybeHandle<Object> Run(WasmRunnerBase* runner) { + Isolate* isolate = runner->main_isolate(); + Handle<JSFunction> fun_wrapper = + runner->builder().WrapCode(compiler_->function_index()); + Handle<Object> global(isolate->context().global_object(), isolate); + return Execution::Call(isolate, fun_wrapper, global, 0, nullptr); + } + + private: + uint32_t FindReturn() const { + for (auto i = code_.begin(); i != code_.end(); + i += OpcodeLength(&*i, &*code_.end())) { + if (*i == kExprReturn) { + return static_cast<uint32_t>(std::distance(code_.begin(), i)); + } + } + UNREACHABLE(); + } + + WasmFunctionCompiler* compiler_; + std::vector<byte> code_; +}; + +class WasmEvaluatorBuilder { + public: + explicit WasmEvaluatorBuilder(ExecutionTier execution_tier, + uint32_t min_memory = 1, + uint32_t max_memory = 1) + : zone_(&allocator_, ZONE_NAME), builder_(&zone_) { + get_memory_function_index = AddImport<void, uint32_t, uint32_t, uint32_t>( + CStrVector("__getMemory")); + wasm_format_function = + builder_.AddFunction(WasmRunnerBase::CreateSig<uint32_t>(&zone_)); + wasm_format_function->SetName(CStrVector("wasm_format")); + builder_.AddExport(CStrVector("wasm_format"), wasm_format_function); + builder_.SetMinMemorySize(min_memory); + builder_.SetMaxMemorySize(max_memory); + } + + template <typename ReturnT, typename... ArgTs> + uint32_t AddImport(Vector<const char> name) { + return builder_.AddImport( + name, WasmRunnerBase::CreateSig<ReturnT, ArgTs...>(&zone_)); + } + + void push_back(std::initializer_list<byte> code) { + wasm_format_function->EmitCode(code.begin(), + static_cast<uint32_t>(code.size())); + } + + void CallGetMemory(std::initializer_list<byte> args) { + push_back(args); + push_back({WASM_CALL_FUNCTION0(wasm_format_function->func_index())}); + } + + ZoneBuffer bytes() { + ZoneBuffer bytes(&zone_); + builder_.WriteTo(&bytes); + return bytes; + } + + private: + v8::internal::AccountingAllocator allocator_; + Zone zone_; + WasmModuleBuilder builder_; + uint32_t get_memory_function_index = 0; + WasmFunctionBuilder* wasm_format_function = nullptr; +}; + +class WasmBreakHandler : public debug::DebugDelegate { + public: + struct EvaluationResult { + Maybe<std::string> result = Nothing<std::string>(); + Maybe<std::string> error = Nothing<std::string>(); + }; + + WasmBreakHandler(Isolate* isolate, ZoneBuffer evaluator_bytes) + : isolate_(isolate), + evaluator_bytes_(std::move(evaluator_bytes)), + result_(Nothing<EvaluationResult>()) { + v8::debug::SetDebugDelegate(reinterpret_cast<v8::Isolate*>(isolate_), this); + } + + ~WasmBreakHandler() override { + v8::debug::SetDebugDelegate(reinterpret_cast<v8::Isolate*>(isolate_), + nullptr); + } + + const Maybe<EvaluationResult>& result() const { return result_; } + + private: + Isolate* isolate_; + ZoneBuffer evaluator_bytes_; + Maybe<EvaluationResult> result_; + + Maybe<std::string> GetPendingExceptionAsString() { + if (!isolate_->has_pending_exception()) return Nothing<std::string>(); + Handle<Object> exception(isolate_->pending_exception(), isolate_); + isolate_->clear_pending_exception(); + + Handle<String> exception_string; + if (!Object::ToString(isolate_, exception).ToHandle(&exception_string)) { + return Just<std::string>(""); + } + return Just<std::string>(exception_string->ToCString().get()); + } + + void BreakProgramRequested(v8::Local<v8::Context> paused_context, + const std::vector<int>&) override { + // Check the current position. + StackTraceFrameIterator frame_it(isolate_); + + FrameSummary::WasmInterpretedFrameSummary summary = + FrameSummary::GetTop(frame_it.frame()).AsWasmInterpreted(); + Handle<WasmInstanceObject> instance = summary.wasm_instance(); + WasmInterpreter::FramePtr frame = + instance->debug_info().GetInterpretedFrame(frame_it.frame()->fp(), 0); + + MaybeHandle<String> result_handle = v8::internal::wasm::DebugEvaluate( + {evaluator_bytes_.begin(), evaluator_bytes_.size()}, instance, + std::move(frame)); + + Maybe<std::string> error_message = GetPendingExceptionAsString(); + Maybe<std::string> result_message = + result_handle.is_null() + ? Nothing<std::string>() + : Just<std::string>( + result_handle.ToHandleChecked()->ToCString().get()); + + isolate_->clear_pending_exception(); + result_ = Just<EvaluationResult>({result_message, error_message}); + } +}; + +WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_CompileFailed) { + WasmRunner<int> runner(execution_tier); + + TestCode<int> code(&runner, {WASM_RETURN1(WASM_I32V_1(32))}); + code.BreakOnReturn(&runner); + + WasmEvaluatorBuilder evaluator(execution_tier); + // Create a module that doesn't compile by missing the END bytecode + evaluator.push_back({WASM_RETURN1(WASM_I32V_1(33))}); + + Isolate* isolate = runner.main_isolate(); + WasmBreakHandler break_handler(isolate, evaluator.bytes()); + CHECK(!code.Run(&runner).is_null()); + + WasmBreakHandler::EvaluationResult result = + break_handler.result().ToChecked(); + CHECK(result.result.IsNothing()); + CHECK_NE(result.error.ToChecked().find( + "function body must end with \"end\" opcode"), + std::string::npos); +} + +WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_MissingEntrypoint) { + WasmRunner<int> runner(execution_tier); + + TestCode<int> code(&runner, {WASM_RETURN1(WASM_I32V_1(32))}); + code.BreakOnReturn(&runner); + + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + WasmModuleBuilder evaluator(&zone); + ZoneBuffer evaluator_bytes(&zone); + evaluator.WriteTo(&evaluator_bytes); + + Isolate* isolate = runner.main_isolate(); + WasmBreakHandler break_handler(isolate, std::move(evaluator_bytes)); + CHECK(!code.Run(&runner).is_null()); + + WasmBreakHandler::EvaluationResult result = + break_handler.result().ToChecked(); + CHECK(result.result.IsNothing()); + CHECK_NE(result.error.ToChecked().find("Missing export: \"wasm_format\""), + std::string::npos); +} + +WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_ExecuteFailed_SEGV) { + WasmRunner<int> runner(execution_tier); + runner.builder().AddMemoryElems<int32_t>(64); + + TestCode<int> code(&runner, {WASM_RETURN1(WASM_I32V_1(32))}); + + // Create a module that doesn't compile by missing the END bytecode + WasmEvaluatorBuilder evaluator(execution_tier); + code.BreakOnReturn(&runner); + + // Load 1 byte from an address that's too high + evaluator.CallGetMemory( + {WASM_I32V_1(32), WASM_I32V_1(1), WASM_I32V_3((1 << 16) + 1)}); + evaluator.push_back({WASM_RETURN1(WASM_I32V_1(33)), WASM_END}); + + Isolate* isolate = runner.main_isolate(); + WasmBreakHandler break_handler(isolate, evaluator.bytes()); + CHECK(!code.Run(&runner).is_null()); + + WasmBreakHandler::EvaluationResult result = + break_handler.result().ToChecked(); + CHECK(result.result.IsNothing()); + CHECK_NE( + result.error.ToChecked().find("Illegal access to out-of-bounds memory"), + std::string::npos); +} + +WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_LinearMemory) { + WasmRunner<int> runner(execution_tier); + runner.builder().AddMemoryElems<int32_t>(64); + + TestCode<int> code( + &runner, + {WASM_STORE_MEM(MachineType::Int32(), WASM_I32V_1(32), WASM_I32V_2('A')), + WASM_RETURN1(WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(32)))}); + code.BreakOnReturn(&runner); + + WasmEvaluatorBuilder evaluator(execution_tier); + // Load 4 bytes from debuggee memory at address 32, and store at the offset 33 + // of the linear memory. + evaluator.CallGetMemory({WASM_I32V_1(32), WASM_I32V_1(4), WASM_I32V_1(33)}); + evaluator.push_back({WASM_RETURN1(WASM_I32V_1(33)), WASM_END}); + + Isolate* isolate = runner.main_isolate(); + WasmBreakHandler break_handler(isolate, evaluator.bytes()); + CHECK(!code.Run(&runner).is_null()); + + WasmBreakHandler::EvaluationResult result = + break_handler.result().ToChecked(); + CHECK(result.error.IsNothing()); + CHECK_EQ(result.result.ToChecked(), "A"); +} + +} // namespace +} // namespace wasm +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc index 1ee1b3dfc6..864b8885a2 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-stack.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc @@ -4,6 +4,7 @@ #include "src/api/api-inl.h" #include "src/codegen/assembler-inl.h" +#include "src/objects/stack-frame-info-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" @@ -151,6 +152,63 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_ExplicitThrowFromJs) { expected_exceptions); } +// Trigger a trap in wasm, stack should contain a source url. +WASM_EXEC_TEST(CollectDetailedWasmStack_WasmUrl) { + // Create a WasmRunner with stack checks and traps enabled. + WasmRunner<int> r(execution_tier, nullptr, "main", kRuntimeExceptionSupport); + + std::vector<byte> code(1, kExprUnreachable); + r.Build(code.data(), code.data() + code.size()); + + WasmFunctionCompiler& f = r.NewFunction<int>("call_main"); + BUILD(f, WASM_CALL_FUNCTION0(0)); + uint32_t wasm_index = f.function_index(); + + Handle<JSFunction> js_wasm_wrapper = r.builder().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); + + // Set the wasm script source url. + const char* url = "http://example.com/example.wasm"; + const Handle<String> source_url = + isolate->factory()->InternalizeUtf8String(url); + r.builder().instance_object()->module_object().script().set_source_url( + *source_url); + + // Run the js wrapper. + 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, + Execution::MessageHandling::kReport, &maybe_exc); + + CHECK(maybe_return_obj.is_null()); + Handle<Object> exception = maybe_exc.ToHandleChecked(); + + // Extract stack trace from the exception. + Handle<FixedArray> stack_trace_object = + isolate->GetDetailedStackTrace(Handle<JSObject>::cast(exception)); + CHECK(!stack_trace_object.is_null()); + Handle<StackTraceFrame> stack_frame = Handle<StackTraceFrame>::cast( + handle(stack_trace_object->get(0), isolate)); + + MaybeHandle<String> maybe_stack_trace_str = + SerializeStackTraceFrame(isolate, stack_frame); + CHECK(!maybe_stack_trace_str.is_null()); + Handle<String> stack_trace_str = maybe_stack_trace_str.ToHandleChecked(); + + // Check if the source_url is part of the stack trace. + CHECK_NE(std::string(stack_trace_str->ToCString().get()).find(url), + std::string::npos); +} + // Trigger a trap in wasm, stack should be JS -> wasm -> wasm. WASM_EXEC_TEST(CollectDetailedWasmStack_WasmError) { for (int pos_shift = 0; pos_shift < 3; ++pos_shift) { diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc index e2e6458da8..96980e6df7 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc @@ -8,14 +8,45 @@ #include "src/diagnostics/code-tracer.h" #include "src/heap/heap-inl.h" #include "src/wasm/graph-builder-interface.h" +#include "src/wasm/leb-helper.h" #include "src/wasm/module-compiler.h" #include "src/wasm/wasm-import-wrapper-cache.h" #include "src/wasm/wasm-objects-inl.h" +#include "src/wasm/wasm-opcodes.h" namespace v8 { namespace internal { namespace wasm { +template <> +void AppendSingle(std::vector<byte>* code, WasmOpcode op) { + // We do not yet have opcodes that take up more than 2 byte (decoded). But if + // that changes, this will need to be updated. + DCHECK_EQ(0, op >> 16); + byte prefix = (op >> 8) & 0xff; + byte opcode = op & 0xff; + + if (!prefix) { + code->push_back(opcode); + return; + } + + // Ensure the prefix is really one of the supported prefixed opcodes. + DCHECK(WasmOpcodes::IsPrefixOpcode(static_cast<WasmOpcode>(prefix))); + code->push_back(prefix); + + // Decoded opcodes fit in a byte (0x00-0xff). + DCHECK_LE(LEBHelper::sizeof_u32v(opcode), 2); + // Therefore, the encoding needs max 2 bytes. + uint8_t encoded[2]; + uint8_t* d = encoded; + // d is updated to after the last uint8_t written. + LEBHelper::write_u32v(&d, opcode); + for (uint8_t* p = encoded; p < d; p++) { + code->push_back(*p); + } +} + TestingModuleBuilder::TestingModuleBuilder( Zone* zone, ManuallyImportedJSFunction* maybe_import, ExecutionTier tier, RuntimeExceptionSupport exception_support, LowerSimd lower_simd) @@ -69,6 +100,12 @@ TestingModuleBuilder::TestingModuleBuilder( } } +TestingModuleBuilder::~TestingModuleBuilder() { + // When the native module dies and is erased from the cache, it is expected to + // have either valid bytes or no bytes at all. + native_module_->SetWireBytes({}); +} + byte* TestingModuleBuilder::AddMemory(uint32_t size, SharedFlag shared) { CHECK(!test_module_->has_memory); CHECK_NULL(mem_start_); @@ -99,7 +136,8 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size, SharedFlag shared) { return mem_start_; } -uint32_t TestingModuleBuilder::AddFunction(FunctionSig* sig, const char* name, +uint32_t TestingModuleBuilder::AddFunction(const FunctionSig* sig, + const char* name, FunctionType type) { if (test_module_->functions.size() == 0) { // TODO(titzer): Reserving space here to avoid the underlying WasmFunction @@ -107,7 +145,13 @@ uint32_t TestingModuleBuilder::AddFunction(FunctionSig* sig, const char* name, test_module_->functions.reserve(kMaxFunctions); } uint32_t index = static_cast<uint32_t>(test_module_->functions.size()); - test_module_->functions.push_back({sig, index, 0, {0, 0}, false, false}); + test_module_->functions.push_back({sig, // sig + index, // func_index + 0, // sig_index + {0, 0}, // code + false, // imported + false, // exported + false}); // declared if (type == kImport) { DCHECK_EQ(0, test_module_->num_declared_functions); ++test_module_->num_imported_functions; @@ -131,8 +175,9 @@ uint32_t TestingModuleBuilder::AddFunction(FunctionSig* sig, const char* name, sig); std::unique_ptr<wasm::WasmCode> code = native_module_->AddCode( index, result.code_desc, result.frame_slot_count, - result.tagged_parameter_slots, std::move(result.protected_instructions), - std::move(result.source_positions), wasm::WasmCode::kInterpreterEntry, + result.tagged_parameter_slots, + result.protected_instructions_data.as_vector(), + result.source_positions.as_vector(), wasm::WasmCode::kInterpreterEntry, wasm::ExecutionTier::kInterpreter); native_module_->PublishCode(std::move(code)); } @@ -228,7 +273,7 @@ uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) { return bytes_offset; } -uint32_t TestingModuleBuilder::AddException(FunctionSig* sig) { +uint32_t TestingModuleBuilder::AddException(const FunctionSig* sig) { DCHECK_EQ(0, sig->return_count()); uint32_t index = static_cast<uint32_t>(test_module_->exceptions.size()); test_module_->exceptions.push_back(WasmException{sig}); @@ -283,7 +328,7 @@ uint32_t TestingModuleBuilder::AddPassiveElementSegment( uint32_t index = static_cast<uint32_t>(test_module_->elem_segments.size()); DCHECK_EQ(index, dropped_elem_segments_.size()); - test_module_->elem_segments.emplace_back(); + test_module_->elem_segments.emplace_back(false); auto& elem_segment = test_module_->elem_segments.back(); elem_segment.entries = entries; @@ -293,18 +338,22 @@ uint32_t TestingModuleBuilder::AddPassiveElementSegment( return index; } -CompilationEnv TestingModuleBuilder::CreateCompilationEnv() { +CompilationEnv TestingModuleBuilder::CreateCompilationEnv( + AssumeDebugging debug) { // This is a hack so we don't need to call // trap_handler::IsTrapHandlerEnabled(). const bool is_trap_handler_enabled = V8_TRAP_HANDLER_SUPPORTED && i::FLAG_wasm_trap_handler; return {test_module_ptr_, is_trap_handler_enabled ? kUseTrapHandler : kNoTrapHandler, - runtime_exception_support_, enabled_features_, lower_simd()}; + runtime_exception_support_, + enabled_features_, + lower_simd(), + debug}; } const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) { - byte size = ValueTypes::MemSize(ValueTypes::MachineTypeFor(type)); + byte size = type.element_size_bytes(); global_offset = (global_offset + size - 1) & ~(size - 1); // align test_module_->globals.push_back( {type, true, WasmInitExpr(), {global_offset}, false, false}); @@ -342,7 +391,7 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() { } void TestBuildingGraphWithBuilder(compiler::WasmGraphBuilder* builder, - Zone* zone, FunctionSig* sig, + Zone* zone, const FunctionSig* sig, const byte* start, const byte* end) { WasmFeatures unused_detected_features; FunctionBody body(sig, 0, start, end); @@ -369,7 +418,7 @@ void TestBuildingGraphWithBuilder(compiler::WasmGraphBuilder* builder, } void TestBuildingGraph(Zone* zone, compiler::JSGraph* jsgraph, - CompilationEnv* module, FunctionSig* sig, + CompilationEnv* module, const FunctionSig* sig, compiler::SourcePositionTable* source_position_table, const byte* start, const byte* end) { compiler::WasmGraphBuilder builder(module, zone, jsgraph, sig, @@ -542,7 +591,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) { if (WasmCode::ShouldBeLogged(isolate())) code->LogCode(isolate()); } -WasmFunctionCompiler::WasmFunctionCompiler(Zone* zone, FunctionSig* sig, +WasmFunctionCompiler::WasmFunctionCompiler(Zone* zone, const FunctionSig* sig, TestingModuleBuilder* builder, const char* name) : GraphAndBuilders(zone), @@ -561,23 +610,24 @@ WasmFunctionCompiler::WasmFunctionCompiler(Zone* zone, FunctionSig* sig, WasmFunctionCompiler::~WasmFunctionCompiler() = default; -FunctionSig* WasmRunnerBase::CreateSig(MachineType return_type, +/* static */ +FunctionSig* WasmRunnerBase::CreateSig(Zone* zone, MachineType return_type, Vector<MachineType> param_types) { int return_count = return_type.IsNone() ? 0 : 1; int param_count = param_types.length(); // Allocate storage array in zone. - ValueType* sig_types = zone_.NewArray<ValueType>(return_count + param_count); + ValueType* sig_types = zone->NewArray<ValueType>(return_count + param_count); // Convert machine types to local types, and check that there are no // MachineType::None()'s in the parameters. int idx = 0; - if (return_count) sig_types[idx++] = ValueTypes::ValueTypeFor(return_type); + if (return_count) sig_types[idx++] = ValueType::For(return_type); for (MachineType param : param_types) { CHECK_NE(MachineType::None(), param); - sig_types[idx++] = ValueTypes::ValueTypeFor(param); + sig_types[idx++] = ValueType::For(param); } - return new (&zone_) FunctionSig(return_count, param_count, sig_types); + return new (zone) FunctionSig(return_count, param_count, sig_types); } // static diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index b66f6ffa36..d1bc9293b6 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -75,9 +75,45 @@ using compiler::Node; r.Build(code, code + arraysize(code)); \ } while (false) +template <typename T> +void AppendSingle(std::vector<byte>* code, T t) { + static_assert(std::is_integral<T>::value, + "Special types need specializations"); + code->push_back(t); +} + +// Specialized for WasmOpcode. +template <> +void AppendSingle<WasmOpcode>(std::vector<byte>* code, WasmOpcode op); + +template <typename... T> +void Append(std::vector<byte>* code, T... ts) { + static_assert(sizeof...(ts) == 0, "Base case for appending bytes to code."); +} + +template <typename First, typename... Rest> +void Append(std::vector<byte>* code, First first, Rest... rest) { + AppendSingle(code, first); + Append(code, rest...); +} + +// Like BUILD but pushes code bytes into a std::vector instead of an array +// initializer. This is useful for opcodes (like SIMD), that are LEB128 +// (variable-sized). We use recursive template instantiations with variadic +// template arguments, so that the Append calls can handle either bytes or +// opcodes. AppendSingle is specialized for WasmOpcode, and appends multiple +// bytes. This allows existing callers to swap out the BUILD macro for BUILD_V +// macro without changes. Also see https://crbug.com/v8/10258. +#define BUILD_V(r, ...) \ + do { \ + std::vector<byte> code; \ + Append(&code, __VA_ARGS__); \ + r.Build(code.data(), code.data() + code.size()); \ + } while (false) + // For tests that must manually import a JSFunction with source code. struct ManuallyImportedJSFunction { - FunctionSig* sig; + const FunctionSig* sig; Handle<JSFunction> js_function; }; @@ -89,6 +125,7 @@ class TestingModuleBuilder { public: TestingModuleBuilder(Zone*, ManuallyImportedJSFunction*, ExecutionTier, RuntimeExceptionSupport, LowerSimd); + ~TestingModuleBuilder(); void ChangeOriginToAsmjs() { test_module_->origin = kAsmJsSloppyOrigin; } @@ -103,13 +140,12 @@ class TestingModuleBuilder { } template <typename T> - T* AddGlobal( - ValueType type = ValueTypes::ValueTypeFor(MachineTypeForC<T>())) { + T* AddGlobal(ValueType type = ValueType::For(MachineTypeForC<T>())) { const WasmGlobal* global = AddGlobal(type); return reinterpret_cast<T*>(globals_data_ + global->offset); } - byte AddSignature(FunctionSig* sig) { + byte AddSignature(const FunctionSig* sig) { DCHECK_EQ(test_module_->signatures.size(), test_module_->signature_ids.size()); test_module_->signatures.push_back(sig); @@ -180,7 +216,8 @@ class TestingModuleBuilder { void SetHasSharedMemory() { test_module_->has_shared_memory = true; } enum FunctionType { kImport, kWasm }; - uint32_t AddFunction(FunctionSig* sig, const char* name, FunctionType type); + uint32_t AddFunction(const FunctionSig* sig, const char* name, + FunctionType type); // Freezes the signature map of the module and allocates the storage for // export wrappers. @@ -196,7 +233,7 @@ class TestingModuleBuilder { uint32_t AddBytes(Vector<const byte> bytes); - uint32_t AddException(FunctionSig* sig); + uint32_t AddException(const FunctionSig* sig); uint32_t AddPassiveDataSegment(Vector<const byte> bytes); uint32_t AddPassiveElementSegment(const std::vector<uint32_t>& entries); @@ -221,7 +258,10 @@ class TestingModuleBuilder { void SetExecutable() { native_module_->SetExecutable(true); } - CompilationEnv CreateCompilationEnv(); + void TierDown() { native_module_->TierDown(isolate_); } + + enum AssumeDebugging : bool { kDebug = true, kNoDebug = false }; + CompilationEnv CreateCompilationEnv(AssumeDebugging = kNoDebug); ExecutionTier execution_tier() const { return execution_tier_; } @@ -257,7 +297,7 @@ class TestingModuleBuilder { }; void TestBuildingGraph(Zone* zone, compiler::JSGraph* jsgraph, - CompilationEnv* module, FunctionSig* sig, + CompilationEnv* module, const FunctionSig* sig, compiler::SourcePositionTable* source_position_table, const byte* start, const byte* end); @@ -336,11 +376,11 @@ class WasmFunctionCompiler : public compiler::GraphAndBuilders { private: friend class WasmRunnerBase; - WasmFunctionCompiler(Zone* zone, FunctionSig* sig, + WasmFunctionCompiler(Zone* zone, const FunctionSig* sig, TestingModuleBuilder* builder, const char* name); compiler::JSGraph jsgraph; - FunctionSig* sig; + const FunctionSig* sig; // The call descriptor is initialized when the function is compiled. CallDescriptor* descriptor_; TestingModuleBuilder* builder_; @@ -382,7 +422,7 @@ class WasmRunnerBase : public HandleAndZoneScope { // Resets the state for building the next function. // The main function called will be the last generated function. // Returns the index of the previously built function. - WasmFunctionCompiler& NewFunction(FunctionSig* sig, + WasmFunctionCompiler& NewFunction(const FunctionSig* sig, const char* name = nullptr) { functions_.emplace_back( new WasmFunctionCompiler(&zone_, sig, &builder_, name)); @@ -406,18 +446,25 @@ class WasmRunnerBase : public HandleAndZoneScope { bool interpret() { return builder_.interpret(); } + void TierDown() { builder_.TierDown(); } + template <typename ReturnType, typename... ParamTypes> FunctionSig* CreateSig() { + return WasmRunnerBase::CreateSig<ReturnType, ParamTypes...>(&zone_); + } + + template <typename ReturnType, typename... ParamTypes> + static FunctionSig* CreateSig(Zone* zone) { std::array<MachineType, sizeof...(ParamTypes)> param_machine_types{ {MachineTypeForC<ParamTypes>()...}}; Vector<MachineType> param_vec(param_machine_types.data(), param_machine_types.size()); - return CreateSig(MachineTypeForC<ReturnType>(), param_vec); + return CreateSig(zone, MachineTypeForC<ReturnType>(), param_vec); } private: - FunctionSig* CreateSig(MachineType return_type, - Vector<MachineType> param_types); + static FunctionSig* CreateSig(Zone* zone, MachineType return_type, + Vector<MachineType> param_types); protected: v8::internal::AccountingAllocator allocator_; @@ -559,6 +606,10 @@ class WasmRunner : public WasmRunnerBase { CheckCallApplyViaJS(expected, function()->func_index, buffer, sizeof...(p)); } + void CheckCallViaJSTraps(ParamTypes... p) { + CheckCallViaJS(static_cast<double>(0xDEADBEEF), p...); + } + void CheckUsedExecutionTier(ExecutionTier expected_tier) { // Liftoff can fail and fallback to Turbofan, so check that the function // gets compiled by the tier requested, to guard against accidental success. |