diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:39:11 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:46:25 +0100 |
commit | 6ca81ad72a3c6fdf16c683335be748f22aaa9a0d (patch) | |
tree | 33c8ee75f729aed76c2c0b89c63f9bf1b4dd66aa /deps/v8/test | |
parent | 1eee0b8bf8bba39b600fb16a9223e545e3bac2bc (diff) | |
download | node-new-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.gz |
deps: update V8 to 7.9.317.20
PR-URL: https://github.com/nodejs/node/pull/30020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/test')
555 files changed, 13140 insertions, 6742 deletions
diff --git a/deps/v8/test/benchmarks/benchmarks.status b/deps/v8/test/benchmarks/benchmarks.status index d176e35312..4941ac2be6 100644 --- a/deps/v8/test/benchmarks/benchmarks.status +++ b/deps/v8/test/benchmarks/benchmarks.status @@ -35,6 +35,7 @@ # Slow tests. 'kraken/imaging-gaussian-blur': [PASS, SLOW], 'octane/typescript': [PASS, SLOW], + 'octane/box2d': [PASS, SLOW], }], # ALWAYS # Slow variants. @@ -42,7 +43,6 @@ # Slow tests. 'kraken/ai-astar': [PASS, SLOW], 'kraken/imaging-desaturate': [PASS, SLOW], - 'octane/box2d': [PASS, SLOW], 'octane/code-load': [PASS, SLOW], 'octane/crypto': [PASS, SLOW], 'octane/gbemu-part1': [PASS, SLOW], @@ -64,6 +64,12 @@ 'octane/zlib': [SKIP], }], +['variant == stress_incremental_marking', { + # Too slow for stress_incremental_marking. + 'octane/box2d': [SKIP], + 'octane/typescript': [SKIP], +}], + ['gc_fuzzer', { # Too slow for gc fuzzing. 'octane/earley-boyer' : [PASS, SLOW, ['mode == debug', SKIP]], diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index d0934c9977..6d6bcdcd67 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -161,6 +161,7 @@ v8_source_set("cctest_sources") { "interpreter/test-source-positions.cc", "libplatform/test-tracing.cc", "libsampler/test-sampler.cc", + "manually-externalized-buffer.h", "parsing/test-parse-decision.cc", "parsing/test-preparser.cc", "parsing/test-scanner-streams.cc", @@ -185,6 +186,7 @@ v8_source_set("cctest_sources") { "test-api.h", "test-array-list.cc", "test-atomicops.cc", + "test-backing-store.cc", "test-bignum-dtoa.cc", "test-bignum.cc", "test-bit-vector.cc", @@ -267,6 +269,7 @@ v8_source_set("cctest_sources") { "unicode-helpers.cc", "unicode-helpers.h", "wasm/test-c-wasm-entry.cc", + "wasm/test-grow-memory.cc", "wasm/test-jump-table-assembler.cc", "wasm/test-run-wasm-64.cc", "wasm/test-run-wasm-asmjs.cc", diff --git a/deps/v8/test/cctest/DEPS b/deps/v8/test/cctest/DEPS index 7373012870..06ae6f87f6 100644 --- a/deps/v8/test/cctest/DEPS +++ b/deps/v8/test/cctest/DEPS @@ -1,6 +1,7 @@ include_rules = [ + "+perfetto", + "+protos/perfetto", "+src", "+tools", "+torque-generated", - "+perfetto", -]
\ No newline at end of file +] diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index dcfca2b2df..6adf2041cf 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -327,9 +327,9 @@ int main(int argc, char* argv[]) { CcTest::set_array_buffer_allocator( v8::ArrayBuffer::Allocator::NewDefaultAllocator()); - v8::RegisterExtension(v8::base::make_unique<i::PrintExtension>()); - v8::RegisterExtension(v8::base::make_unique<i::ProfilerExtension>()); - v8::RegisterExtension(v8::base::make_unique<i::TraceExtension>()); + v8::RegisterExtension(std::make_unique<i::PrintExtension>()); + v8::RegisterExtension(std::make_unique<i::ProfilerExtension>()); + v8::RegisterExtension(std::make_unique<i::TraceExtension>()); int tests_run = 0; bool print_run_count = true; diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index b1a7b5c101..430ca647b7 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -151,6 +151,8 @@ # Pass but take too long with the simulator. 'test-api/ExternalArrays': [PASS, SLOW], 'test-api/Threading*': [SKIP], + 'test-cpu-profiler/MultipleIsolates': [PASS, SLOW], + 'test-debug/DebugBreakStackTrace': [PASS, SLOW], }], # 'arch == arm64 and simulator_run' ############################################################################## @@ -227,6 +229,7 @@ # operations. 'test-run-wasm-atomics/*': [SKIP], 'test-run-wasm-atomics64/*': [SKIP], + 'test-regexp/Peephole*': [SKIP], }], # 'byteorder == big' ############################################################################## @@ -259,6 +262,7 @@ ['arch == arm and simulator_run', { # Pass but take too long with the simulator. 'test-api/Threading*': [SKIP], + 'test-cpu-profiler/MultipleIsolates': [PASS, SLOW], }], # 'arch == arm and simulator_run' ############################################################################## @@ -471,8 +475,10 @@ 'test-api/WasmI32AtomicWaitCallback': [SKIP], 'test-api/WasmI64AtomicWaitCallback': [SKIP], 'test-api/WasmStreaming*': [SKIP], + 'test-backing-store/Run_WasmModule_Buffer_Externalized_Regression_UseAfterFree': [SKIP], 'test-c-wasm-entry/*': [SKIP], 'test-jump-table-assembler/*': [SKIP], + 'test-grow-memory/*': [SKIP], 'test-run-wasm-64/*': [SKIP], 'test-run-wasm-asmjs/*': [SKIP], 'test-run-wasm-atomics64/*': [SKIP], @@ -610,4 +616,12 @@ '*': [SKIP], }], # variant == jitless and not embedded_builtins +############################################################################## +['variant == turboprop', { + # Require inlining. + 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [SKIP], + 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [SKIP], + 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], +}], # variant == turboprop + ] diff --git a/deps/v8/test/cctest/compiler/serializer-tester.cc b/deps/v8/test/cctest/compiler/serializer-tester.cc index 338d1bcbfb..01979a2201 100644 --- a/deps/v8/test/cctest/compiler/serializer-tester.cc +++ b/deps/v8/test/cctest/compiler/serializer-tester.cc @@ -52,17 +52,19 @@ SerializerTester::SerializerTester(const char* source) TEST(SerializeEmptyFunction) { SerializerTester tester( "function f() {}; %EnsureFeedbackVectorForFunction(f); return f;"); - CHECK(tester.function().IsSerializedForCompilation()); + JSFunctionRef function = tester.function(); + CHECK( + function.shared().IsSerializedForCompilation(function.feedback_vector())); } -// This helper function allows for testing weather an inlinee candidate +// This helper function allows for testing whether an inlinee candidate // was properly serialized. It expects that the top-level function (that is // run through the SerializerTester) will return its inlinee candidate. void CheckForSerializedInlinee(const char* source, int argc = 0, Handle<Object> argv[] = {}) { SerializerTester tester(source); JSFunctionRef f = tester.function(); - CHECK(f.IsSerializedForCompilation()); + CHECK(f.shared().IsSerializedForCompilation(f.feedback_vector())); MaybeHandle<Object> g_obj = Execution::Call( tester.isolate(), tester.function().object(), diff --git a/deps/v8/test/cctest/compiler/serializer-tester.h b/deps/v8/test/cctest/compiler/serializer-tester.h index 7c8016ef81..fe5f93895f 100644 --- a/deps/v8/test/cctest/compiler/serializer-tester.h +++ b/deps/v8/test/cctest/compiler/serializer-tester.h @@ -5,6 +5,8 @@ #ifndef V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_ #define V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_ +#include <memory> + #include "src/compiler/js-heap-broker.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/compiler/test-code-assembler.cc b/deps/v8/test/cctest/compiler/test-code-assembler.cc index 9e6318ee88..56628ffde4 100644 --- a/deps/v8/test/cctest/compiler/test-code-assembler.cc +++ b/deps/v8/test/cctest/compiler/test-code-assembler.cc @@ -18,38 +18,33 @@ namespace compiler { namespace { -using Label = CodeAssemblerLabel; using Variable = CodeAssemblerVariable; -Node* SmiTag(CodeAssembler& m, // NOLINT(runtime/references) - Node* value) { +Node* SmiTag(CodeAssembler* m, Node* value) { int32_t constant_value; - if (m.ToInt32Constant(value, &constant_value) && + if (m->ToInt32Constant(value, &constant_value) && Smi::IsValid(constant_value)) { - return m.SmiConstant(Smi::FromInt(constant_value)); + return m->SmiConstant(Smi::FromInt(constant_value)); } - return m.WordShl(value, m.IntPtrConstant(kSmiShiftSize + kSmiTagSize)); + return m->WordShl(value, m->IntPtrConstant(kSmiShiftSize + kSmiTagSize)); } -Node* UndefinedConstant(CodeAssembler& m) { // NOLINT(runtime/references) - return m.LoadRoot(RootIndex::kUndefinedValue); +Node* UndefinedConstant(CodeAssembler* m) { + return m->LoadRoot(RootIndex::kUndefinedValue); } -Node* SmiFromInt32(CodeAssembler& m, // NOLINT(runtime/references) - Node* value) { - value = m.ChangeInt32ToIntPtr(value); - return m.BitcastWordToTaggedSigned( - m.WordShl(value, kSmiShiftSize + kSmiTagSize)); +Node* SmiFromInt32(CodeAssembler* m, Node* value) { + value = m->ChangeInt32ToIntPtr(value); + return m->BitcastWordToTaggedSigned( + m->WordShl(value, kSmiShiftSize + kSmiTagSize)); } -Node* LoadObjectField(CodeAssembler& m, // NOLINT(runtime/references) - Node* object, int offset, +Node* LoadObjectField(CodeAssembler* m, Node* object, int offset, MachineType type = MachineType::AnyTagged()) { - return m.Load(type, object, m.IntPtrConstant(offset - kHeapObjectTag)); + return m->Load(type, object, m->IntPtrConstant(offset - kHeapObjectTag)); } -Node* LoadMap(CodeAssembler& m, // NOLINT(runtime/references) - Node* object) { +Node* LoadMap(CodeAssembler* m, Node* object) { return LoadObjectField(m, object, JSObject::kMapOffset); } @@ -59,7 +54,7 @@ TEST(SimpleSmiReturn) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); - m.Return(SmiTag(m, m.Int32Constant(37))); + m.Return(SmiTag(&m, m.Int32Constant(37))); FunctionTester ft(asm_tester.GenerateCode()); CHECK_EQ(37, ft.CallChecked<Smi>()->value()); } @@ -91,7 +86,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)); + Node* 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( @@ -104,7 +99,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)); + Node* b = SmiTag(&m, m.Int32Constant(0)); m.TailCallRuntime(Runtime::kIsSmi, context, b); FunctionTester ft(asm_tester.GenerateCode()); CHECK(ft.CallChecked<Oddball>().is_identical_to( @@ -117,8 +112,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)); + Node* a = SmiTag(&m, m.Int32Constant(2)); + Node* 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()); @@ -130,8 +125,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)); + Node* a = SmiTag(&m, m.Int32Constant(2)); + Node* 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()); @@ -139,8 +134,7 @@ TEST(SimpleTailCallRuntime2Arg) { namespace { -Handle<JSFunction> CreateSumAllArgumentsFunction( - FunctionTester& ft) { // NOLINT(runtime/references) +Handle<JSFunction> CreateSumAllArgumentsFunction(FunctionTester* ft) { const char* source = "(function() {\n" " var sum = 0 + this;\n" @@ -149,7 +143,7 @@ Handle<JSFunction> CreateSumAllArgumentsFunction( " }\n" " return sum;\n" "})"; - return ft.NewFunction(source); + return ft->NewFunction(source); } } // namespace @@ -163,7 +157,7 @@ TEST(SimpleCallJSFunction0Arg) { Node* function = m.Parameter(0); Node* context = m.Parameter(kNumParams + 2); - Node* receiver = SmiTag(m, m.Int32Constant(42)); + Node* receiver = SmiTag(&m, m.Int32Constant(42)); Callable callable = CodeFactory::Call(isolate); Node* result = m.CallJS(callable, context, function, receiver); @@ -171,7 +165,7 @@ TEST(SimpleCallJSFunction0Arg) { } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); - Handle<JSFunction> sum = CreateSumAllArgumentsFunction(ft); + Handle<JSFunction> sum = CreateSumAllArgumentsFunction(&ft); MaybeHandle<Object> result = ft.Call(sum); CHECK_EQ(Smi::FromInt(42), *result.ToHandleChecked()); } @@ -185,8 +179,8 @@ TEST(SimpleCallJSFunction1Arg) { Node* function = m.Parameter(0); Node* context = m.Parameter(1); - Node* receiver = SmiTag(m, m.Int32Constant(42)); - Node* a = SmiTag(m, m.Int32Constant(13)); + Node* receiver = SmiTag(&m, m.Int32Constant(42)); + Node* a = SmiTag(&m, m.Int32Constant(13)); Callable callable = CodeFactory::Call(isolate); Node* result = m.CallJS(callable, context, function, receiver, a); @@ -194,7 +188,7 @@ TEST(SimpleCallJSFunction1Arg) { } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); - Handle<JSFunction> sum = CreateSumAllArgumentsFunction(ft); + Handle<JSFunction> sum = CreateSumAllArgumentsFunction(&ft); MaybeHandle<Object> result = ft.Call(sum); CHECK_EQ(Smi::FromInt(55), *result.ToHandleChecked()); } @@ -208,9 +202,9 @@ TEST(SimpleCallJSFunction2Arg) { Node* function = m.Parameter(0); Node* context = m.Parameter(1); - Node* receiver = SmiTag(m, m.Int32Constant(42)); - Node* a = SmiTag(m, m.Int32Constant(13)); - Node* b = SmiTag(m, m.Int32Constant(153)); + Node* receiver = SmiTag(&m, m.Int32Constant(42)); + Node* a = SmiTag(&m, m.Int32Constant(13)); + Node* b = SmiTag(&m, m.Int32Constant(153)); Callable callable = CodeFactory::Call(isolate); Node* result = m.CallJS(callable, context, function, receiver, a, b); @@ -218,7 +212,7 @@ TEST(SimpleCallJSFunction2Arg) { } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); - Handle<JSFunction> sum = CreateSumAllArgumentsFunction(ft); + Handle<JSFunction> sum = CreateSumAllArgumentsFunction(&ft); MaybeHandle<Object> result = ft.Call(sum); CHECK_EQ(Smi::FromInt(208), *result.ToHandleChecked()); } @@ -228,7 +222,7 @@ TEST(VariableMerge1) { CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); Variable var1(&m, MachineRepresentation::kTagged); - Label l1(&m), l2(&m), merge(&m); + CodeAssemblerLabel l1(&m), l2(&m), merge(&m); TNode<Int32T> temp = m.Int32Constant(0); var1.Bind(temp); m.Branch(m.Int32Constant(1), &l1, &l2); @@ -247,7 +241,7 @@ TEST(VariableMerge2) { CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); Variable var1(&m, MachineRepresentation::kTagged); - Label l1(&m), l2(&m), merge(&m); + CodeAssemblerLabel l1(&m), l2(&m), merge(&m); TNode<Int32T> temp = m.Int32Constant(0); var1.Bind(temp); m.Branch(m.Int32Constant(1), &l1, &l2); @@ -269,7 +263,7 @@ TEST(VariableMerge3) { CodeAssembler m(asm_tester.state()); Variable var1(&m, MachineRepresentation::kTagged); Variable var2(&m, MachineRepresentation::kTagged); - Label l1(&m), l2(&m), merge(&m); + CodeAssemblerLabel l1(&m), l2(&m), merge(&m); TNode<Int32T> temp = m.Int32Constant(0); var1.Bind(temp); var2.Bind(temp); @@ -293,7 +287,7 @@ TEST(VariableMergeBindFirst) { CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); Variable var1(&m, MachineRepresentation::kTagged); - Label l1(&m), l2(&m), merge(&m, &var1), end(&m); + CodeAssemblerLabel l1(&m), l2(&m), merge(&m, &var1), end(&m); TNode<Int32T> temp = m.Int32Constant(0); var1.Bind(temp); m.Branch(m.Int32Constant(1), &l1, &l2); @@ -319,8 +313,8 @@ TEST(VariableMergeSwitch) { CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); Variable var1(&m, MachineRepresentation::kTagged); - Label l1(&m), l2(&m), default_label(&m); - Label* labels[] = {&l1, &l2}; + CodeAssemblerLabel l1(&m), l2(&m), default_label(&m); + CodeAssemblerLabel* labels[] = {&l1, &l2}; int32_t values[] = {1, 2}; TNode<Smi> temp1 = m.SmiConstant(0); var1.Bind(temp1); @@ -345,7 +339,7 @@ TEST(SplitEdgeBranchMerge) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); - Label l1(&m), merge(&m); + CodeAssemblerLabel l1(&m), merge(&m); m.Branch(m.Int32Constant(1), &l1, &merge); m.Bind(&l1); m.Goto(&merge); @@ -357,8 +351,8 @@ TEST(SplitEdgeSwitchMerge) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); - Label l1(&m), l2(&m), l3(&m), default_label(&m); - Label* labels[] = {&l1, &l2}; + CodeAssemblerLabel l1(&m), l2(&m), l3(&m), default_label(&m); + CodeAssemblerLabel* labels[] = {&l1, &l2}; int32_t values[] = {1, 2}; m.Branch(m.Int32Constant(1), &l3, &l1); m.Bind(&l3); @@ -389,11 +383,11 @@ TEST(TestToConstant) { CHECK(m.ToInt32Constant(a, &value32)); CHECK(m.ToInt64Constant(a, &value64)); - a = UndefinedConstant(m); + a = UndefinedConstant(&m); CHECK(!m.ToInt32Constant(a, &value32)); CHECK(!m.ToInt64Constant(a, &value64)); - a = UndefinedConstant(m); + a = UndefinedConstant(&m); CHECK(!m.ToInt32Constant(a, &value32)); CHECK(!m.ToInt64Constant(a, &value64)); } @@ -402,17 +396,17 @@ TEST(DeferredCodePhiHints) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); - Label block1(&m, Label::kDeferred); + CodeAssemblerLabel block1(&m, CodeAssemblerLabel::kDeferred); m.Goto(&block1); m.Bind(&block1); { Variable var_object(&m, MachineRepresentation::kTagged); - Label loop(&m, &var_object); + CodeAssemblerLabel loop(&m, &var_object); var_object.Bind(m.SmiConstant(0)); m.Goto(&loop); m.Bind(&loop); { - Node* map = LoadMap(m, var_object.value()); + Node* map = LoadMap(&m, var_object.value()); var_object.Bind(map); m.Goto(&loop); } @@ -424,10 +418,10 @@ TEST(TestOutOfScopeVariable) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeAssembler m(asm_tester.state()); - Label block1(&m); - Label block2(&m); - Label block3(&m); - Label block4(&m); + CodeAssemblerLabel block1(&m); + CodeAssemblerLabel block2(&m); + CodeAssemblerLabel block3(&m); + CodeAssemblerLabel block4(&m); m.Branch(m.WordEqual(m.UncheckedCast<IntPtrT>(m.Parameter(0)), m.IntPtrConstant(0)), &block1, &block4); @@ -463,7 +457,7 @@ TEST(GotoIfException) { m.HeapConstant(isolate->factory()->to_string_tag_symbol()); Variable exception(&m, MachineRepresentation::kTagged); - Label exception_handler(&m); + 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); @@ -498,9 +492,9 @@ TEST(GotoIfExceptionMultiple) { Node* second_value = m.Parameter(1); Node* third_value = m.Parameter(2); - Label exception_handler1(&m); - Label exception_handler2(&m); - Label exception_handler3(&m); + CodeAssemblerLabel exception_handler1(&m); + CodeAssemblerLabel exception_handler2(&m); + CodeAssemblerLabel exception_handler3(&m); Variable return_value(&m, MachineRepresentation::kWord32); Variable error(&m, MachineRepresentation::kTagged); @@ -515,20 +509,20 @@ TEST(GotoIfExceptionMultiple) { // try { ToString(param2); return 7 } catch (e) { ... } m.Bind(&exception_handler1); return_value.Bind(m.Int32Constant(7)); - error.Bind(UndefinedConstant(m)); + 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())); + 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)); + 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, m.Word32And(return_value.value(), + m.Word32Xor(m.Int32Constant(2), m.Int32Constant(-1))))); m.Bind(&exception_handler3); m.Return(error.value()); @@ -578,7 +572,7 @@ TEST(ExceptionHandler) { CodeAssembler m(asm_tester.state()); CodeAssembler::TVariable<Object> var(m.SmiConstant(0), &m); - Label exception(&m, {&var}, Label::kDeferred); + CodeAssemblerLabel exception(&m, {&var}, CodeAssemblerLabel::kDeferred); { CodeAssemblerScopedExceptionHandler handler(&m, &exception, &var); TNode<Context> context = diff --git a/deps/v8/test/cctest/compiler/test-gap-resolver.cc b/deps/v8/test/cctest/compiler/test-gap-resolver.cc index ca26e0b49f..a7b6514c1f 100644 --- a/deps/v8/test/cctest/compiler/test-gap-resolver.cc +++ b/deps/v8/test/cctest/compiler/test-gap-resolver.cc @@ -353,7 +353,7 @@ class ParallelMoveCreator : public HandleAndZoneScope { }; int index = rng_->NextInt(kMaxIndex); // destination can't be Constant. - switch (rng_->NextInt(is_source ? 5 : 4)) { + switch (rng_->NextInt(is_source ? 3 : 2)) { case 0: return AllocatedOperand(LocationOperand::STACK_SLOT, rep, GetValidSlotIndex(rep, index)); @@ -361,12 +361,6 @@ class ParallelMoveCreator : public HandleAndZoneScope { return AllocatedOperand(LocationOperand::REGISTER, rep, GetValidRegisterCode(rep, index)); case 2: - return ExplicitOperand(LocationOperand::REGISTER, rep, - GetValidRegisterCode(rep, 1)); - case 3: - return ExplicitOperand(LocationOperand::STACK_SLOT, rep, - GetValidSlotIndex(rep, index)); - case 4: return ConstantOperand(index); } UNREACHABLE(); diff --git a/deps/v8/test/cctest/compiler/test-jump-threading.cc b/deps/v8/test/cctest/compiler/test-jump-threading.cc index 44bee022b3..7440da7fb0 100644 --- a/deps/v8/test/cctest/compiler/test-jump-threading.cc +++ b/deps/v8/test/cctest/compiler/test-jump-threading.cc @@ -109,16 +109,16 @@ class TestCode : public HandleAndZoneScope { } }; -void VerifyForwarding(TestCode& code, // NOLINT(runtime/references) - int count, int* expected) { +void VerifyForwarding(TestCode* code, int count, int* expected) { v8::internal::AccountingAllocator allocator; Zone local_zone(&allocator, ZONE_NAME); ZoneVector<RpoNumber> result(&local_zone); - JumpThreading::ComputeForwarding(&local_zone, result, &code.sequence_, true); + JumpThreading::ComputeForwarding(&local_zone, &result, &code->sequence_, + true); CHECK(count == static_cast<int>(result.size())); for (int i = 0; i < count; i++) { - CHECK(expected[i] == result[i].ToInt()); + CHECK_EQ(expected[i], result[i].ToInt()); } } @@ -133,7 +133,7 @@ TEST(FwEmpty1) { code.End(); static int expected[] = {2, 2, 2}; - VerifyForwarding(code, 3, expected); + VerifyForwarding(&code, 3, expected); } @@ -150,7 +150,7 @@ TEST(FwEmptyN) { code.End(); static int expected[] = {2, 2, 2}; - VerifyForwarding(code, 3, expected); + VerifyForwarding(&code, 3, expected); } } @@ -162,7 +162,7 @@ TEST(FwNone1) { code.End(); static int expected[] = {0}; - VerifyForwarding(code, 1, expected); + VerifyForwarding(&code, 1, expected); } @@ -174,7 +174,7 @@ TEST(FwMoves1) { code.End(); static int expected[] = {0}; - VerifyForwarding(code, 1, expected); + VerifyForwarding(&code, 1, expected); } @@ -188,7 +188,7 @@ TEST(FwMoves2) { code.End(); static int expected[] = {1, 1}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -202,7 +202,7 @@ TEST(FwMoves2b) { code.End(); static int expected[] = {0, 1}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -216,7 +216,7 @@ TEST(FwOther2) { code.End(); static int expected[] = {0, 1}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -229,7 +229,7 @@ TEST(FwNone2a) { code.End(); static int expected[] = {1, 1}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -242,7 +242,7 @@ TEST(FwNone2b) { code.End(); static int expected[] = {1, 1}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -253,7 +253,7 @@ TEST(FwLoop1) { code.Jump(0); static int expected[] = {0}; - VerifyForwarding(code, 1, expected); + VerifyForwarding(&code, 1, expected); } @@ -266,7 +266,7 @@ TEST(FwLoop2) { code.Jump(0); static int expected[] = {0, 0}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -281,7 +281,7 @@ TEST(FwLoop3) { code.Jump(0); static int expected[] = {0, 0, 0}; - VerifyForwarding(code, 3, expected); + VerifyForwarding(&code, 3, expected); } @@ -294,7 +294,7 @@ TEST(FwLoop1b) { code.Jump(1); static int expected[] = {1, 1}; - VerifyForwarding(code, 2, expected); + VerifyForwarding(&code, 2, expected); } @@ -309,7 +309,7 @@ TEST(FwLoop2b) { code.Jump(1); static int expected[] = {1, 1, 1}; - VerifyForwarding(code, 3, expected); + VerifyForwarding(&code, 3, expected); } @@ -326,7 +326,7 @@ TEST(FwLoop3b) { code.Jump(1); static int expected[] = {1, 1, 1, 1}; - VerifyForwarding(code, 4, expected); + VerifyForwarding(&code, 4, expected); } @@ -345,7 +345,7 @@ TEST(FwLoop2_1a) { code.Jump(2); static int expected[] = {1, 1, 1, 1, 1}; - VerifyForwarding(code, 5, expected); + VerifyForwarding(&code, 5, expected); } @@ -364,7 +364,7 @@ TEST(FwLoop2_1b) { code.Jump(2); static int expected[] = {2, 2, 2, 2, 2}; - VerifyForwarding(code, 5, expected); + VerifyForwarding(&code, 5, expected); } @@ -383,7 +383,7 @@ TEST(FwLoop2_1c) { code.Jump(1); static int expected[] = {1, 1, 1, 1, 1}; - VerifyForwarding(code, 5, expected); + VerifyForwarding(&code, 5, expected); } @@ -402,7 +402,7 @@ TEST(FwLoop2_1d) { code.Jump(1); static int expected[] = {1, 1, 1, 1, 1}; - VerifyForwarding(code, 5, expected); + VerifyForwarding(&code, 5, expected); } @@ -423,7 +423,7 @@ TEST(FwLoop3_1a) { code.Jump(0); static int expected[] = {2, 2, 2, 2, 2, 2}; - VerifyForwarding(code, 6, expected); + VerifyForwarding(&code, 6, expected); } @@ -443,7 +443,7 @@ TEST(FwDiamonds) { code.End(); int expected[] = {0, i ? 1 : 3, j ? 2 : 3, 3}; - VerifyForwarding(code, 4, expected); + VerifyForwarding(&code, 4, expected); } } } @@ -470,7 +470,7 @@ TEST(FwDiamonds2) { int merge = k ? 3 : 4; int expected[] = {0, i ? 1 : merge, j ? 2 : merge, merge, 4}; - VerifyForwarding(code, 5, expected); + VerifyForwarding(&code, 5, expected); } } } @@ -504,7 +504,7 @@ TEST(FwDoubleDiamonds) { int expected[] = {0, i ? 1 : 3, j ? 2 : 3, 3, x ? 4 : 6, y ? 5 : 6, 6}; - VerifyForwarding(code, 7, expected); + VerifyForwarding(&code, 7, expected); } } } @@ -568,7 +568,7 @@ void RunPermutedChain(int* permutation, int size) { int expected[] = {size + 1, size + 1, size + 1, size + 1, size + 1, size + 1, size + 1}; - VerifyForwarding(code, size + 2, expected); + VerifyForwarding(&code, size + 2, expected); } @@ -604,55 +604,50 @@ void RunPermutedDiamond(int* permutation, int size) { int expected[] = {br, 5, 5, 5, 5, 5}; expected[br] = br; - VerifyForwarding(code, 6, expected); + VerifyForwarding(&code, 6, expected); } TEST(FwPermuted_diamond) { RunAllPermutations<4>(RunPermutedDiamond); } -void ApplyForwarding(TestCode& code, // NOLINT(runtime/references) - int size, int* forward) { - code.sequence_.RecomputeAssemblyOrderForTesting(); - ZoneVector<RpoNumber> vector(code.main_zone()); +void ApplyForwarding(TestCode* code, int size, int* forward) { + code->sequence_.RecomputeAssemblyOrderForTesting(); + ZoneVector<RpoNumber> vector(code->main_zone()); for (int i = 0; i < size; i++) { vector.push_back(RpoNumber::FromInt(forward[i])); } - JumpThreading::ApplyForwarding(code.main_zone(), vector, &code.sequence_); + JumpThreading::ApplyForwarding(code->main_zone(), vector, &code->sequence_); } -void CheckJump(TestCode& code, // NOLINT(runtime/references) - int pos, int target) { - Instruction* instr = code.sequence_.InstructionAt(pos); +void CheckJump(TestCode* code, int pos, int target) { + Instruction* instr = code->sequence_.InstructionAt(pos); CHECK_EQ(kArchJmp, instr->arch_opcode()); CHECK_EQ(1, static_cast<int>(instr->InputCount())); CHECK_EQ(0, static_cast<int>(instr->OutputCount())); CHECK_EQ(0, static_cast<int>(instr->TempCount())); - CHECK_EQ(target, code.sequence_.InputRpo(instr, 0).ToInt()); + CHECK_EQ(target, code->sequence_.InputRpo(instr, 0).ToInt()); } -void CheckNop(TestCode& code, // NOLINT(runtime/references) - int pos) { - Instruction* instr = code.sequence_.InstructionAt(pos); +void CheckNop(TestCode* code, int pos) { + Instruction* instr = code->sequence_.InstructionAt(pos); CHECK_EQ(kArchNop, instr->arch_opcode()); CHECK_EQ(0, static_cast<int>(instr->InputCount())); CHECK_EQ(0, static_cast<int>(instr->OutputCount())); CHECK_EQ(0, static_cast<int>(instr->TempCount())); } -void CheckBranch(TestCode& code, // NOLINT(runtime/references) - int pos, int t1, int t2) { - Instruction* instr = code.sequence_.InstructionAt(pos); +void CheckBranch(TestCode* code, int pos, int t1, int t2) { + Instruction* instr = code->sequence_.InstructionAt(pos); CHECK_EQ(2, static_cast<int>(instr->InputCount())); CHECK_EQ(0, static_cast<int>(instr->OutputCount())); CHECK_EQ(0, static_cast<int>(instr->TempCount())); - CHECK_EQ(t1, code.sequence_.InputRpo(instr, 0).ToInt()); - CHECK_EQ(t2, code.sequence_.InputRpo(instr, 1).ToInt()); + CHECK_EQ(t1, code->sequence_.InputRpo(instr, 0).ToInt()); + CHECK_EQ(t2, code->sequence_.InputRpo(instr, 1).ToInt()); } -void CheckAssemblyOrder(TestCode& code, // NOLINT(runtime/references) - int size, int* expected) { +void CheckAssemblyOrder(TestCode* code, int size, int* expected) { int i = 0; - for (auto const block : code.sequence_.instruction_blocks()) { + for (auto const block : code->sequence_.instruction_blocks()) { CHECK_EQ(expected[i++], block->ao_number().ToInt()); } } @@ -668,12 +663,12 @@ TEST(Rewire1) { code.End(); static int forward[] = {2, 2, 2}; - ApplyForwarding(code, 3, forward); - CheckJump(code, j1, 2); - CheckNop(code, j2); + ApplyForwarding(&code, 3, forward); + CheckJump(&code, j1, 2); + CheckNop(&code, j2); static int assembly[] = {0, 1, 1}; - CheckAssemblyOrder(code, 3, assembly); + CheckAssemblyOrder(&code, 3, assembly); } @@ -691,13 +686,13 @@ TEST(Rewire1_deferred) { code.End(); static int forward[] = {3, 3, 3, 3}; - ApplyForwarding(code, 4, forward); - CheckJump(code, j1, 3); - CheckNop(code, j2); - CheckNop(code, j3); + ApplyForwarding(&code, 4, forward); + CheckJump(&code, j1, 3); + CheckNop(&code, j2); + CheckNop(&code, j3); static int assembly[] = {0, 1, 2, 1}; - CheckAssemblyOrder(code, 4, assembly); + CheckAssemblyOrder(&code, 4, assembly); } @@ -717,12 +712,12 @@ TEST(Rewire2_deferred) { code.End(); static int forward[] = {0, 1, 2, 3}; - ApplyForwarding(code, 4, forward); - CheckJump(code, j1, 1); - CheckJump(code, j2, 3); + ApplyForwarding(&code, 4, forward); + CheckJump(&code, j1, 1); + CheckJump(&code, j2, 3); static int assembly[] = {0, 2, 3, 1}; - CheckAssemblyOrder(code, 4, assembly); + CheckAssemblyOrder(&code, 4, assembly); } @@ -742,18 +737,18 @@ TEST(Rewire_diamond) { code.End(); int forward[] = {0, 1, i ? 4 : 2, j ? 4 : 3, 4}; - ApplyForwarding(code, 5, forward); - CheckJump(code, j1, 1); - CheckBranch(code, b1, i ? 4 : 2, j ? 4 : 3); + ApplyForwarding(&code, 5, forward); + CheckJump(&code, j1, 1); + CheckBranch(&code, b1, i ? 4 : 2, j ? 4 : 3); if (i) { - CheckNop(code, j2); + CheckNop(&code, j2); } else { - CheckJump(code, j2, 4); + CheckJump(&code, j2, 4); } if (j) { - CheckNop(code, j3); + CheckNop(&code, j3); } else { - CheckJump(code, j3, 4); + CheckJump(&code, j3, 4); } int assembly[] = {0, 1, 2, 3, 4}; @@ -763,7 +758,7 @@ TEST(Rewire_diamond) { if (j) { for (int k = 4; k < 5; k++) assembly[k]--; } - CheckAssemblyOrder(code, 5, assembly); + CheckAssemblyOrder(&code, 5, assembly); } } } diff --git a/deps/v8/test/cctest/compiler/test-loop-analysis.cc b/deps/v8/test/cctest/compiler/test-loop-analysis.cc index 231a3ada5a..38ce2f3463 100644 --- a/deps/v8/test/cctest/compiler/test-loop-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-analysis.cc @@ -201,9 +201,9 @@ struct While { } void chain(Node* control) { loop->ReplaceInput(0, control); } - void nest(While& that) { // NOLINT(runtime/references) - that.loop->ReplaceInput(1, exit); - this->loop->ReplaceInput(0, that.if_true); + void nest(While* that) { + that->loop->ReplaceInput(1, exit); + this->loop->ReplaceInput(0, that->if_true); } }; @@ -214,17 +214,17 @@ struct Counter { Node* phi; Node* add; - Counter(While& w, // NOLINT(runtime/references) - int32_t b, int32_t k) - : base(w.t.jsgraph.Int32Constant(b)), inc(w.t.jsgraph.Int32Constant(k)) { + Counter(While* w, int32_t b, int32_t k) + : base(w->t.jsgraph.Int32Constant(b)), + inc(w->t.jsgraph.Int32Constant(k)) { Build(w); } - Counter(While& w, Node* b, Node* k) : base(b), inc(k) { Build(w); } + Counter(While* w, Node* b, Node* k) : base(b), inc(k) { Build(w); } - void Build(While& w) { - phi = w.t.graph.NewNode(w.t.op(2, false), base, base, w.loop); - add = w.t.graph.NewNode(&kIntAdd, phi, inc); + void Build(While* w) { + phi = w->t.graph.NewNode(w->t.op(2, false), base, base, w->loop); + add = w->t.graph.NewNode(&kIntAdd, phi, inc); phi->ReplaceInput(1, add); } }; @@ -236,16 +236,16 @@ struct StoreLoop { Node* phi; Node* store; - explicit StoreLoop(While& w) // NOLINT(runtime/references) - : base(w.t.graph.start()), val(w.t.jsgraph.Int32Constant(13)) { + explicit StoreLoop(While* w) + : base(w->t.graph.start()), val(w->t.jsgraph.Int32Constant(13)) { Build(w); } - StoreLoop(While& w, Node* b, Node* v) : base(b), val(v) { Build(w); } + StoreLoop(While* w, Node* b, Node* v) : base(b), val(v) { Build(w); } - void Build(While& w) { - phi = w.t.graph.NewNode(w.t.op(2, true), base, base, w.loop); - store = w.t.graph.NewNode(&kStore, val, phi, w.loop); + void Build(While* w) { + phi = w->t.graph.NewNode(w->t.op(2, true), base, base, w->loop); + store = w->t.graph.NewNode(&kStore, val, phi, w->loop); phi->ReplaceInput(1, store); } }; @@ -287,7 +287,7 @@ TEST(LaLoop1c) { // One loop with a counter. LoopFinderTester t; While w(t, t.p0); - Counter c(w, 0, 1); + Counter c(&w, 0, 1); t.Return(c.phi, t.start, w.exit); Node* chain[] = {w.loop}; @@ -303,7 +303,7 @@ TEST(LaLoop1e) { // One loop with an effect phi. LoopFinderTester t; While w(t, t.p0); - StoreLoop c(w); + StoreLoop c(&w); t.Return(t.p0, c.phi, w.exit); Node* chain[] = {w.loop}; @@ -319,8 +319,8 @@ TEST(LaLoop1d) { // One loop with two counters. LoopFinderTester t; While w(t, t.p0); - Counter c1(w, 0, 1); - Counter c2(w, 1, 1); + Counter c1(&w, 0, 1); + Counter c2(&w, 1, 1); t.Return(t.graph.NewNode(&kIntAdd, c1.phi, c2.phi), t.start, w.exit); Node* chain[] = {w.loop}; @@ -365,8 +365,8 @@ TEST(LaLoop2c) { LoopFinderTester t; While w1(t, t.p0); While w2(t, t.p0); - Counter c1(w1, 0, 1); - Counter c2(w2, 0, 1); + Counter c1(&w1, 0, 1); + Counter c2(&w2, 0, 1); w2.chain(w1.exit); t.Return(t.graph.NewNode(&kIntAdd, c1.phi, c2.phi), t.start, w2.exit); @@ -396,10 +396,10 @@ TEST(LaLoop2cc) { LoopFinderTester t; While w1(t, t.p0); While w2(t, t.p0); - Counter c1(w1, 0, 1); + Counter c1(&w1, 0, 1); // various usage scenarios for the second loop. - Counter c2(w2, i & 1 ? t.p0 : c1.phi, i & 2 ? t.p0 : c1.phi); + Counter c2(&w2, i & 1 ? t.p0 : c1.phi, i & 2 ? t.p0 : c1.phi); if (i & 3) w2.branch->ReplaceInput(0, c1.phi); w2.chain(w1.exit); @@ -431,7 +431,7 @@ TEST(LaNestedLoop1) { LoopFinderTester t; While w1(t, t.p0); While w2(t, t.p0); - w2.nest(w1); + w2.nest(&w1); t.Return(t.p0, t.start, w1.exit); Node* chain[] = {w1.loop, w2.loop}; @@ -452,10 +452,10 @@ TEST(LaNestedLoop1c) { LoopFinderTester t; While w1(t, t.p0); While w2(t, t.p0); - Counter c1(w1, 0, 1); - Counter c2(w2, 0, 1); + Counter c1(&w1, 0, 1); + Counter c2(&w2, 0, 1); w2.branch->ReplaceInput(0, c2.phi); - w2.nest(w1); + w2.nest(&w1); t.Return(c1.phi, t.start, w1.exit); Node* chain[] = {w1.loop, w2.loop}; @@ -477,7 +477,7 @@ TEST(LaNestedLoop1x) { LoopFinderTester t; While w1(t, t.p0); While w2(t, t.p0); - w2.nest(w1); + w2.nest(&w1); const Operator* op = t.common.Phi(MachineRepresentation::kWord32, 2); Node* p1a = t.graph.NewNode(op, t.p0, t.p0, w1.loop); @@ -513,8 +513,8 @@ TEST(LaNestedLoop2) { While w1(t, t.p0); While w2(t, t.p0); While w3(t, t.p0); - w2.nest(w1); - w3.nest(w1); + w2.nest(&w1); + w3.nest(&w1); w3.chain(w2.exit); t.Return(t.p0, t.start, w1.exit); @@ -573,11 +573,11 @@ TEST(LaNestedLoop3c) { // Three nested loops with counters. LoopFinderTester t; While w1(t, t.p0); - Counter c1(w1, 0, 1); + Counter c1(&w1, 0, 1); While w2(t, t.p0); - Counter c2(w2, 0, 1); + Counter c2(&w2, 0, 1); While w3(t, t.p0); - Counter c3(w3, 0, 1); + Counter c3(&w3, 0, 1); w2.loop->ReplaceInput(0, w1.if_true); w3.loop->ReplaceInput(0, w2.if_true); w2.loop->ReplaceInput(1, w3.exit); diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index c054e7654a..ad1c7efbd7 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -43,81 +43,76 @@ CallDescriptor* CreateCallDescriptor(Zone* zone, int return_count, return compiler::GetWasmCallDescriptor(zone, builder.Build()); } -Node* MakeConstant(RawMachineAssembler& m, // NOLINT(runtime/references) - MachineType type, int value) { +Node* MakeConstant(RawMachineAssembler* m, MachineType type, int value) { switch (type.representation()) { case MachineRepresentation::kWord32: - return m.Int32Constant(static_cast<int32_t>(value)); + return m->Int32Constant(static_cast<int32_t>(value)); case MachineRepresentation::kWord64: - return m.Int64Constant(static_cast<int64_t>(value)); + return m->Int64Constant(static_cast<int64_t>(value)); case MachineRepresentation::kFloat32: - return m.Float32Constant(static_cast<float>(value)); + return m->Float32Constant(static_cast<float>(value)); case MachineRepresentation::kFloat64: - return m.Float64Constant(static_cast<double>(value)); + return m->Float64Constant(static_cast<double>(value)); default: UNREACHABLE(); } } -Node* Add(RawMachineAssembler& m, // NOLINT(runtime/references) - MachineType type, Node* a, Node* b) { +Node* Add(RawMachineAssembler* m, MachineType type, Node* a, Node* b) { switch (type.representation()) { case MachineRepresentation::kWord32: - return m.Int32Add(a, b); + return m->Int32Add(a, b); case MachineRepresentation::kWord64: - return m.Int64Add(a, b); + return m->Int64Add(a, b); case MachineRepresentation::kFloat32: - return m.Float32Add(a, b); + return m->Float32Add(a, b); case MachineRepresentation::kFloat64: - return m.Float64Add(a, b); + return m->Float64Add(a, b); default: UNREACHABLE(); } } -Node* Sub(RawMachineAssembler& m, // NOLINT(runtime/references) - MachineType type, Node* a, Node* b) { +Node* Sub(RawMachineAssembler* m, MachineType type, Node* a, Node* b) { switch (type.representation()) { case MachineRepresentation::kWord32: - return m.Int32Sub(a, b); + return m->Int32Sub(a, b); case MachineRepresentation::kWord64: - return m.Int64Sub(a, b); + return m->Int64Sub(a, b); case MachineRepresentation::kFloat32: - return m.Float32Sub(a, b); + return m->Float32Sub(a, b); case MachineRepresentation::kFloat64: - return m.Float64Sub(a, b); + return m->Float64Sub(a, b); default: UNREACHABLE(); } } -Node* Mul(RawMachineAssembler& m, // NOLINT(runtime/references) - MachineType type, Node* a, Node* b) { +Node* Mul(RawMachineAssembler* m, MachineType type, Node* a, Node* b) { switch (type.representation()) { case MachineRepresentation::kWord32: - return m.Int32Mul(a, b); + return m->Int32Mul(a, b); case MachineRepresentation::kWord64: - return m.Int64Mul(a, b); + return m->Int64Mul(a, b); case MachineRepresentation::kFloat32: - return m.Float32Mul(a, b); + return m->Float32Mul(a, b); case MachineRepresentation::kFloat64: - return m.Float64Mul(a, b); + return m->Float64Mul(a, b); default: UNREACHABLE(); } } -Node* ToInt32(RawMachineAssembler& m, // NOLINT(runtime/references) - MachineType type, Node* a) { +Node* ToInt32(RawMachineAssembler* m, MachineType type, Node* a) { switch (type.representation()) { case MachineRepresentation::kWord32: return a; case MachineRepresentation::kWord64: - return m.TruncateInt64ToInt32(a); + return m->TruncateInt64ToInt32(a); case MachineRepresentation::kFloat32: - return m.TruncateFloat32ToInt32(a); + return m->TruncateFloat32ToInt32(a); case MachineRepresentation::kFloat64: - return m.RoundFloat64ToInt32(a); + return m->RoundFloat64ToInt32(a); default: UNREACHABLE(); } @@ -159,9 +154,9 @@ void TestReturnMultipleValues(MachineType type) { using Node_ptr = Node*; std::unique_ptr<Node_ptr[]> returns(new Node_ptr[count]); for (int i = 0; i < count; ++i) { - if (i % 3 == 0) returns[i] = Add(m, type, p0, p1); - if (i % 3 == 1) returns[i] = Sub(m, type, p0, p1); - if (i % 3 == 2) returns[i] = Mul(m, type, p0, p1); + if (i % 3 == 0) returns[i] = Add(&m, type, p0, p1); + if (i % 3 == 1) returns[i] = Sub(&m, type, p0, p1); + if (i % 3 == 2) returns[i] = Mul(&m, type, p0, p1); } m.Return(count, returns.get()); @@ -175,7 +170,7 @@ void TestReturnMultipleValues(MachineType type) { #ifdef ENABLE_DISASSEMBLER if (FLAG_print_code) { StdoutStream os; - code->Disassemble("multi_value", os); + code->Disassemble("multi_value", os, handles.main_isolate()); } #endif @@ -201,29 +196,29 @@ void TestReturnMultipleValues(MachineType type) { // WasmContext dummy call_inputs[1] = mt.PointerConstant(nullptr); // Special inputs for the test. - call_inputs[2] = MakeConstant(mt, type, a); - call_inputs[3] = MakeConstant(mt, type, b); + call_inputs[2] = MakeConstant(&mt, type, a); + call_inputs[3] = MakeConstant(&mt, type, b); for (int i = 2; i < param_count; i++) { - call_inputs[2 + i] = MakeConstant(mt, type, i); + call_inputs[2 + i] = MakeConstant(&mt, type, i); } Node* ret_multi = mt.AddNode(mt.common()->Call(desc), input_count, call_inputs); - Node* ret = MakeConstant(mt, type, 0); + Node* ret = MakeConstant(&mt, type, 0); bool sign = false; for (int i = 0; i < count; ++i) { Node* x = (count == 1) ? ret_multi : mt.AddNode(mt.common()->Projection(i), ret_multi); - ret = sign ? Sub(mt, type, ret, x) : Add(mt, type, ret, x); + ret = sign ? Sub(&mt, type, ret, x) : Add(&mt, type, ret, x); if (i % 4 == 0) sign = !sign; } - mt.Return(ToInt32(mt, type, ret)); + mt.Return(ToInt32(&mt, type, ret)); #ifdef ENABLE_DISASSEMBLER Handle<Code> code2 = mt.GetCode(); if (FLAG_print_code) { StdoutStream os; - code2->Disassemble("multi_value_call", os); + code2->Disassemble("multi_value_call", os, handles.main_isolate()); } #endif CHECK_EQ(expect, mt.Call()); @@ -265,7 +260,7 @@ void ReturnLastValue(MachineType type) { std::unique_ptr<Node* []> returns(new Node*[return_count]); for (int i = 0; i < return_count; ++i) { - returns[i] = MakeConstant(m, type, i); + returns[i] = MakeConstant(&m, type, i); } m.Return(return_count, returns.get()); @@ -292,8 +287,9 @@ void ReturnLastValue(MachineType type) { Node* call = mt.AddNode(mt.common()->Call(desc), 2, inputs); - mt.Return(ToInt32( - mt, type, mt.AddNode(mt.common()->Projection(return_count - 1), call))); + mt.Return( + ToInt32(&mt, type, + mt.AddNode(mt.common()->Projection(return_count - 1), call))); CHECK_EQ(expect, mt.Call()); } @@ -327,7 +323,7 @@ void ReturnSumOfReturns(MachineType type) { std::unique_ptr<Node* []> returns(new Node*[return_count]); for (int i = 0; i < return_count; ++i) { - returns[i] = MakeConstant(m, type, i); + returns[i] = MakeConstant(&m, type, i); } m.Return(return_count, returns.get()); @@ -360,7 +356,7 @@ void ReturnSumOfReturns(MachineType type) { expect += i; result = mt.Int32Add( result, - ToInt32(mt, type, mt.AddNode(mt.common()->Projection(i), call))); + ToInt32(&mt, type, mt.AddNode(mt.common()->Projection(i), call))); } mt.Return(result); 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 3a8e9d61d4..6f52f339f3 100644 --- a/deps/v8/test/cctest/compiler/test-run-load-store.cc +++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc @@ -37,6 +37,11 @@ enum TestAlignment { #define A_GIG (1024ULL * 1024ULL * 1024ULL) namespace { +byte* ComputeOffset(void* real_address, int32_t offset) { + return reinterpret_cast<byte*>(reinterpret_cast<Address>(real_address) - + offset); +} + void RunLoadInt32(const TestAlignment t) { RawMachineAssemblerTester<int32_t> m; @@ -65,7 +70,7 @@ void RunLoadInt32Offset(TestAlignment t) { for (size_t i = 0; i < arraysize(offsets); i++) { RawMachineAssemblerTester<int32_t> m; int32_t offset = offsets[i]; - byte* pointer = reinterpret_cast<byte*>(&p1) - offset; + byte* pointer = ComputeOffset(&p1, offset); // generate load [#base + #index] if (t == TestAlignment::kAligned) { @@ -93,8 +98,8 @@ void RunLoadStoreFloat32Offset(TestAlignment t) { base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3)); RawMachineAssemblerTester<int32_t> m; int32_t offset = i; - byte* from = reinterpret_cast<byte*>(&p1) - offset; - byte* to = reinterpret_cast<byte*>(&p2) - offset; + byte* from = ComputeOffset(&p1, offset); + byte* to = ComputeOffset(&p2, offset); // generate load [#base + #index] if (t == TestAlignment::kAligned) { Node* load = m.Load(MachineType::Float32(), m.PointerConstant(from), @@ -131,8 +136,8 @@ void RunLoadStoreFloat64Offset(TestAlignment t) { base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3)); RawMachineAssemblerTester<int32_t> m; int32_t offset = i; - byte* from = reinterpret_cast<byte*>(&p1) - offset; - byte* to = reinterpret_cast<byte*>(&p2) - offset; + byte* from = ComputeOffset(&p1, offset); + byte* to = ComputeOffset(&p2, offset); // generate load [#base + #index] if (t == TestAlignment::kAligned) { Node* load = m.Load(MachineType::Float64(), m.PointerConstant(from), @@ -259,7 +264,7 @@ 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 = &buffer[0] - offset; + void* base_pointer = ComputeOffset(&buffer[0], offset * sizeof(CType)); #ifdef V8_COMPRESS_POINTERS if (type.IsTagged()) { // When pointer compression is enabled then we need to access only diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc index 1e5a73389e..ccc05ce11b 100644 --- a/deps/v8/test/cctest/compiler/test-run-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-machops.cc @@ -10,9 +10,10 @@ #include "src/base/ieee754.h" #include "src/base/overflowing-math.h" #include "src/base/utils/random-number-generator.h" +#include "src/common/ptr-compr-inl.h" +#include "src/objects/objects-inl.h" #include "src/utils/boxed-float.h" #include "src/utils/utils.h" -#include "src/objects/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" #include "test/cctest/compiler/value-helper.h" @@ -410,12 +411,15 @@ TEST(CompressDecompressTaggedAnyPointer) { } TEST(CompressDecompressTaggedAnySigned) { - RawMachineAssemblerTester<int64_t> m; + RawMachineAssemblerTester<void*> m; Smi smi = Smi::FromInt(123); - int64_t smiPointer = static_cast<int64_t>(smi.ptr()); - Node* node = m.Int64Constant(smiPointer); + Node* node = m.Int64Constant(static_cast<int64_t>(smi.ptr())); m.Return(m.ChangeCompressedToTagged(m.ChangeTaggedToCompressed(node))); - CHECK_EQ(smiPointer, m.Call()); + + Object result = Object(reinterpret_cast<Address>(m.Call())); + Address smiPointer = + DecompressTaggedAny(m.isolate(), CompressTagged(smi.ptr())); + CHECK_EQ(smiPointer, result.ptr()); } TEST(CompressDecompressTaggedPointer) { @@ -432,13 +436,15 @@ TEST(CompressDecompressTaggedPointer) { } TEST(CompressDecompressTaggedSigned) { - RawMachineAssemblerTester<int64_t> m; + RawMachineAssemblerTester<void*> m; Smi smi = Smi::FromInt(123); - int64_t smiPointer = static_cast<int64_t>(smi.ptr()); - Node* node = m.Int64Constant(smiPointer); + Address smiPointer = smi.ptr(); + Node* node = m.Int64Constant(static_cast<int64_t>(smiPointer)); m.Return(m.ChangeCompressedSignedToTaggedSigned( m.ChangeTaggedSignedToCompressedSigned(node))); - CHECK_EQ(smiPointer, m.Call()); + + Object result = Object(reinterpret_cast<Address>(m.Call())); + CHECK_EQ(smiPointer, result.ptr()); } #endif // V8_COMPRESS_POINTERS diff --git a/deps/v8/test/cctest/compiler/test-run-native-calls.cc b/deps/v8/test/cctest/compiler/test-run-native-calls.cc index 026e8307ae..6ab480743b 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -254,7 +254,7 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* call_descriptor, #ifdef ENABLE_DISASSEMBLER if (FLAG_print_opt_code) { StdoutStream os; - code->Disassemble(name, os); + code->Disassemble(name, os, isolate); } #endif return code; @@ -327,38 +327,32 @@ class ArgsBuffer { return kTypes; } - Node* MakeConstant(RawMachineAssembler& raw, // NOLINT(runtime/references) - int32_t value) { - return raw.Int32Constant(value); + Node* MakeConstant(RawMachineAssembler* raw, int32_t value) { + return raw->Int32Constant(value); } - Node* MakeConstant(RawMachineAssembler& raw, // NOLINT(runtime/references) - int64_t value) { - return raw.Int64Constant(value); + Node* MakeConstant(RawMachineAssembler* raw, int64_t value) { + return raw->Int64Constant(value); } - Node* MakeConstant(RawMachineAssembler& raw, // NOLINT(runtime/references) - float32 value) { - return raw.Float32Constant(value); + Node* MakeConstant(RawMachineAssembler* raw, float32 value) { + return raw->Float32Constant(value); } - Node* MakeConstant(RawMachineAssembler& raw, // NOLINT(runtime/references) - float64 value) { - return raw.Float64Constant(value); + Node* MakeConstant(RawMachineAssembler* raw, float64 value) { + return raw->Float64Constant(value); } - Node* LoadInput(RawMachineAssembler& raw, // NOLINT(runtime/references) - Node* base, int index) { - Node* offset = raw.Int32Constant(index * sizeof(CType)); - return raw.Load(MachineTypeForC<CType>(), base, offset); + Node* LoadInput(RawMachineAssembler* raw, Node* base, int index) { + Node* offset = raw->Int32Constant(index * sizeof(CType)); + return raw->Load(MachineTypeForC<CType>(), base, offset); } - Node* StoreOutput(RawMachineAssembler& raw, // NOLINT(runtime/references) - Node* value) { - Node* base = raw.PointerConstant(&output); - Node* offset = raw.Int32Constant(0); - return raw.Store(MachineTypeForC<CType>().representation(), base, offset, - value, kNoWriteBarrier); + Node* StoreOutput(RawMachineAssembler* raw, Node* value) { + Node* base = raw->PointerConstant(&output); + Node* offset = raw->Int32Constant(0); + return raw->Store(MachineTypeForC<CType>().representation(), base, offset, + value, kNoWriteBarrier); } // Computes the next set of inputs by updating the {input} array. @@ -425,7 +419,7 @@ template <typename CType> class Computer { public: static void Run(CallDescriptor* desc, - void (*build)(CallDescriptor*, RawMachineAssembler&), + void (*build)(CallDescriptor*, RawMachineAssembler*), CType (*compute)(CallDescriptor*, CType* inputs), int seed = 1) { int num_params = ParamCount(desc); @@ -438,7 +432,7 @@ class Computer { Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); RawMachineAssembler raw(isolate, &graph, desc); - build(desc, raw); + build(desc, &raw); inner = CompileGraph("Compute", desc, &graph, raw.ExportForTest()); } @@ -459,11 +453,11 @@ class Computer { int input_count = 0; inputs[input_count++] = target; for (int i = 0; i < num_params; i++) { - inputs[input_count++] = io.MakeConstant(raw, io.input[i]); + inputs[input_count++] = io.MakeConstant(&raw, io.input[i]); } Node* call = raw.CallN(desc, input_count, inputs); - Node* store = io.StoreOutput(raw, call); + Node* store = io.StoreOutput(&raw, call); USE(store); raw.Return(raw.Int32Constant(seed)); wrapper = CompileGraph("Compute-wrapper-const", cdesc, &graph, @@ -494,11 +488,11 @@ class Computer { int input_count = 0; inputs[input_count++] = target; for (int i = 0; i < num_params; i++) { - inputs[input_count++] = io.LoadInput(raw, base, i); + inputs[input_count++] = io.LoadInput(&raw, base, i); } Node* call = raw.CallN(desc, input_count, inputs); - Node* store = io.StoreOutput(raw, call); + Node* store = io.StoreOutput(&raw, call); USE(store); raw.Return(raw.Int32Constant(seed)); wrapper = @@ -704,28 +698,25 @@ TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { } } - template <typename CType> static void Run_Computation( - CallDescriptor* desc, void (*build)(CallDescriptor*, RawMachineAssembler&), + CallDescriptor* desc, void (*build)(CallDescriptor*, RawMachineAssembler*), CType (*compute)(CallDescriptor*, CType* inputs), int seed = 1) { Computer<CType>::Run(desc, build, compute, seed); } - static uint32_t coeff[] = {1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113}; -static void Build_Int32_WeightedSum( - CallDescriptor* desc, - RawMachineAssembler& raw) { // NOLINT(runtime/references) - Node* result = raw.Int32Constant(0); +static void Build_Int32_WeightedSum(CallDescriptor* desc, + RawMachineAssembler* raw) { + Node* result = raw->Int32Constant(0); for (int i = 0; i < ParamCount(desc); i++) { - Node* term = raw.Int32Mul(raw.Parameter(i), raw.Int32Constant(coeff[i])); - result = raw.Int32Add(result, term); + Node* term = raw->Int32Mul(raw->Parameter(i), raw->Int32Constant(coeff[i])); + result = raw->Int32Add(result, term); } - raw.Return(result); + raw->Return(result); } static int32_t Compute_Int32_WeightedSum(CallDescriptor* desc, int32_t* input) { @@ -774,10 +765,8 @@ TEST_INT32_WEIGHTEDSUM(17) TEST_INT32_WEIGHTEDSUM(19) template <int which> -static void Build_Select( - CallDescriptor* desc, - RawMachineAssembler& raw) { // NOLINT(runtime/references) - raw.Return(raw.Parameter(which)); +static void Build_Select(CallDescriptor* desc, RawMachineAssembler* raw) { + raw->Return(raw->Parameter(which)); } template <typename CType, int which> @@ -950,9 +939,8 @@ TEST(Float64Select_stack_params_return_reg) { } template <typename CType, int which> -static void Build_Select_With_Call( - CallDescriptor* desc, - RawMachineAssembler& raw) { // NOLINT(runtime/references) +static void Build_Select_With_Call(CallDescriptor* desc, + RawMachineAssembler* raw) { Handle<Code> inner = Handle<Code>::null(); int num_params = ParamCount(desc); CHECK_LE(num_params, kMaxParamCount); @@ -971,16 +959,16 @@ static void Build_Select_With_Call( { // Build a call to the function that does the select. - Node* target = raw.HeapConstant(inner); - Node** inputs = raw.zone()->NewArray<Node*>(num_params + 1); + Node* target = raw->HeapConstant(inner); + Node** inputs = raw->zone()->NewArray<Node*>(num_params + 1); int input_count = 0; inputs[input_count++] = target; for (int i = 0; i < num_params; i++) { - inputs[input_count++] = raw.Parameter(i); + inputs[input_count++] = raw->Parameter(i); } - Node* call = raw.CallN(desc, input_count, inputs); - raw.Return(call); + Node* call = raw->CallN(desc, input_count, inputs); + raw->Return(call); } } diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h index 6f6cfb46b5..0b47665a78 100644 --- a/deps/v8/test/cctest/heap/heap-tester.h +++ b/deps/v8/test/cctest/heap/heap-tester.h @@ -14,6 +14,7 @@ V(CompactionFullAbortedPage) \ V(CompactionPartiallyAbortedPage) \ V(CompactionPartiallyAbortedPageIntraAbortedPointers) \ + V(CompactionPartiallyAbortedPageWithInvalidatedSlots) \ V(CompactionPartiallyAbortedPageWithStoreBufferEntries) \ V(CompactionSpaceDivideMultiplePages) \ V(CompactionSpaceDivideSinglePage) \ @@ -102,6 +103,7 @@ class HeapTester { // test-heap.cc static AllocationResult AllocateByteArrayForTest(Heap* heap, int length, AllocationType allocation); + static bool CodeEnsureLinearAllocationArea(Heap* heap, int size_in_bytes); // test-mark-compact.cc static AllocationResult AllocateMapForTest(v8::internal::Isolate* isolate); diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc index 8b53dab9c5..3fa2714a61 100644 --- a/deps/v8/test/cctest/heap/heap-utils.cc +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -98,11 +98,15 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, allocate_memory = free_memory; length = FixedArrayLenFromSize(allocate_memory); if (length <= 0) { - // Not enough room to create another fixed array. Let's create a filler. - if (free_memory > (2 * kTaggedSize)) { + // Not enough room to create another FixedArray, so create a filler. + if (allocation == i::AllocationType::kOld) { heap->CreateFillerObjectAt( *heap->old_space()->allocation_top_address(), free_memory, ClearRecordedSlots::kNo); + } else { + heap->CreateFillerObjectAt( + *heap->new_space()->allocation_top_address(), free_memory, + ClearRecordedSlots::kNo); } break; } @@ -127,8 +131,9 @@ void AllocateAllButNBytes(v8::internal::NewSpace* space, int extra_bytes, if (new_linear_size == 0) return; std::vector<Handle<FixedArray>> handles = heap::CreatePadding( space->heap(), new_linear_size, i::AllocationType::kYoung); - if (out_handles != nullptr) + if (out_handles != nullptr) { out_handles->insert(out_handles->end(), handles.begin(), handles.end()); + } } void FillCurrentPage(v8::internal::NewSpace* space, @@ -144,8 +149,9 @@ bool FillUpOnePage(v8::internal::NewSpace* space, if (space_remaining == 0) return false; std::vector<Handle<FixedArray>> handles = heap::CreatePadding( space->heap(), space_remaining, i::AllocationType::kYoung); - if (out_handles != nullptr) + if (out_handles != nullptr) { out_handles->insert(out_handles->end(), handles.begin(), handles.end()); + } return true; } 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 b4122c9619..66354cab7f 100644 --- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc +++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc @@ -193,8 +193,8 @@ TEST(ArrayBuffer_UnregisterDuringSweep) { // barriers and proper synchronization this will trigger a data race on // TSAN. v8::ArrayBuffer::Contents contents = ab->Externalize(); - heap->isolate()->array_buffer_allocator()->Free(contents.Data(), - contents.ByteLength()); + contents.Deleter()(contents.Data(), contents.ByteLength(), + contents.DeleterData()); } } diff --git a/deps/v8/test/cctest/heap/test-compaction.cc b/deps/v8/test/cctest/heap/test-compaction.cc index 35bd9225ea..96eca0f5ae 100644 --- a/deps/v8/test/cctest/heap/test-compaction.cc +++ b/deps/v8/test/cctest/heap/test-compaction.cc @@ -6,6 +6,7 @@ #include "src/heap/factory.h" #include "src/heap/heap-inl.h" #include "src/heap/mark-compact.h" +#include "src/heap/remembered-set.h" #include "src/objects/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" @@ -31,9 +32,8 @@ void CheckInvariantsOfAbortedPage(Page* page) { CHECK(!page->IsFlagSet(Page::COMPACTION_WAS_ABORTED)); } -void CheckAllObjectsOnPage( - std::vector<Handle<FixedArray>>& handles, // NOLINT(runtime/references) - Page* page) { +void CheckAllObjectsOnPage(const std::vector<Handle<FixedArray>>& handles, + Page* page) { for (Handle<FixedArray> fixed_array : handles) { CHECK(Page::FromHeapObject(*fixed_array) == page); } @@ -85,6 +85,18 @@ HEAP_TEST(CompactionFullAbortedPage) { } } +namespace { + +int GetObjectSize(int objects_per_page) { + int allocatable = + static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()); + // Make sure that object_size is a multiple of kTaggedSize. + int object_size = + ((allocatable / kTaggedSize) / objects_per_page) * kTaggedSize; + return Min(kMaxRegularHeapObjectSize, object_size); +} + +} // namespace HEAP_TEST(CompactionPartiallyAbortedPage) { if (FLAG_never_compact) return; @@ -97,10 +109,7 @@ HEAP_TEST(CompactionPartiallyAbortedPage) { FLAG_manual_evacuation_candidates_selection = true; const int objects_per_page = 10; - const int object_size = - Min(kMaxRegularHeapObjectSize, - static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) / - objects_per_page); + const int object_size = GetObjectSize(objects_per_page); CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -163,6 +172,81 @@ HEAP_TEST(CompactionPartiallyAbortedPage) { } } +HEAP_TEST(CompactionPartiallyAbortedPageWithInvalidatedSlots) { + if (FLAG_never_compact) return; + // Test evacuating a page partially when it contains recorded + // slots and invalidated objects. + + // Disable concurrent sweeping to ensure memory is in an expected state, i.e., + // we can reach the state of a half aborted page. + ManualGCScope manual_gc_scope; + FLAG_manual_evacuation_candidates_selection = true; + + const int objects_per_page = 10; + const int object_size = GetObjectSize(objects_per_page); + + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + { + HandleScope scope1(isolate); + + heap::SealCurrentObjects(heap); + + { + HandleScope scope2(isolate); + // Fill another page with objects of size {object_size} (last one is + // properly adjusted). + CHECK(heap->old_space()->Expand()); + auto compaction_page_handles = heap::CreatePadding( + heap, + static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()), + AllocationType::kOld, object_size); + Page* to_be_aborted_page = + Page::FromHeapObject(*compaction_page_handles.front()); + for (Handle<FixedArray> object : compaction_page_handles) { + CHECK_EQ(Page::FromHeapObject(*object), to_be_aborted_page); + + for (int i = 0; i < object->length(); i++) { + RememberedSet<OLD_TO_NEW>::Insert<AccessMode::ATOMIC>( + to_be_aborted_page, object->RawFieldOfElementAt(i).address()); + } + } + // First object is going to be evacuated. + to_be_aborted_page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>( + *compaction_page_handles.front()); + // Last object is NOT going to be evacuated. + // This happens since not all objects fit on the only other page in the + // old space, the GC isn't allowed to allocate another page. + to_be_aborted_page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>( + *compaction_page_handles.back()); + to_be_aborted_page->SetFlag( + MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + + { + // Add another page that is filled with {num_objects} objects of size + // {object_size}. + HandleScope scope3(isolate); + CHECK(heap->old_space()->Expand()); + const int num_objects = 3; + std::vector<Handle<FixedArray>> page_to_fill_handles = + heap::CreatePadding(heap, object_size * num_objects, + AllocationType::kOld, object_size); + Page* page_to_fill = + Page::FromAddress(page_to_fill_handles.front()->address()); + + heap->set_force_oom(true); + CcTest::CollectAllGarbage(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); + + CHECK_EQ(Page::FromHeapObject(*compaction_page_handles.front()), + page_to_fill); + CHECK_EQ(Page::FromHeapObject(*compaction_page_handles.back()), + to_be_aborted_page); + } + } + } +} HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { if (FLAG_never_compact) return; @@ -177,10 +261,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { FLAG_manual_evacuation_candidates_selection = true; const int objects_per_page = 10; - const int object_size = - Min(kMaxRegularHeapObjectSize, - static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) / - objects_per_page); + const int object_size = GetObjectSize(objects_per_page); CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -271,10 +352,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { FLAG_manual_evacuation_candidates_selection = true; const int objects_per_page = 10; - const int object_size = - Min(kMaxRegularHeapObjectSize, - static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) / - objects_per_page); + const int object_size = GetObjectSize(objects_per_page); CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); diff --git a/deps/v8/test/cctest/heap/test-embedder-tracing.cc b/deps/v8/test/cctest/heap/test-embedder-tracing.cc index 28553266ff..8ff4acc05b 100644 --- a/deps/v8/test/cctest/heap/test-embedder-tracing.cc +++ b/deps/v8/test/cctest/heap/test-embedder-tracing.cc @@ -17,12 +17,6 @@ namespace v8 { -// See test below: TracedGlobalNoDestructor. -template <> -struct TracedGlobalTrait<v8::TracedGlobal<v8::Value>> { - static constexpr bool kRequiresExplicitDestruction = false; -}; - namespace internal { namespace heap { @@ -68,7 +62,7 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer { bool AdvanceTracing(double deadline_in_ms) final { for (auto global : to_register_with_v8_) { - RegisterEmbedderReference(global->As<v8::Value>()); + RegisterEmbedderReference(global->As<v8::Data>()); } to_register_with_v8_.clear(); return true; @@ -293,13 +287,14 @@ void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context, CHECK(!global->IsEmpty()); } +template <typename T> void ConstructJSApiObject(v8::Isolate* isolate, v8::Local<v8::Context> context, - v8::TracedGlobal<v8::Object>* global) { + T* global) { v8::HandleScope scope(isolate); v8::Local<v8::Object> object( ConstructTraceableJSApiObject(context, nullptr, nullptr)); CHECK(!object.IsEmpty()); - *global = v8::TracedGlobal<v8::Object>(isolate, object); + *global = T(isolate, object); CHECK(!global->IsEmpty()); } @@ -360,10 +355,6 @@ TEST(TracedGlobalCopyWithDestructor) { v8::HandleScope scope(isolate); i::GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); - static_assert(TracedGlobalTrait< - v8::TracedGlobal<v8::Object>>::kRequiresExplicitDestruction, - "destructor expected"); - const size_t initial_count = global_handles->handles_count(); v8::TracedGlobal<v8::Object> global1; { @@ -401,18 +392,14 @@ TEST(TracedGlobalCopyNoDestructor) { v8::HandleScope scope(isolate); i::GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); - static_assert(!TracedGlobalTrait< - v8::TracedGlobal<v8::Value>>::kRequiresExplicitDestruction, - "no destructor expected"); - const size_t initial_count = global_handles->handles_count(); - v8::TracedGlobal<v8::Value> global1; + v8::TracedReference<v8::Value> global1; { v8::HandleScope scope(isolate); global1.Reset(isolate, v8::Object::New(isolate)); } - v8::TracedGlobal<v8::Value> global2(global1); - v8::TracedGlobal<v8::Value> global3; + v8::TracedReference<v8::Value> global2(global1); + v8::TracedReference<v8::Value> global3; global3 = global2; CHECK_EQ(initial_count + 3, global_handles->handles_count()); CHECK(!global1.IsEmpty()); @@ -500,7 +487,7 @@ TEST(TracedGlobalToUnmodifiedJSApiObjectSurvivesScavengePerDefault) { heap::TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer); tracer.ConsiderTracedGlobalAsRoot(true); TracedGlobalTest( - CcTest::isolate(), ConstructJSApiObject, + CcTest::isolate(), ConstructJSApiObject<TracedGlobal<v8::Object>>, [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge, SurvivalMode::kSurvives); } @@ -513,7 +500,7 @@ TEST(TracedGlobalToUnmodifiedJSApiObjectDiesOnScavengeWhenExcludedFromRoots) { heap::TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer); tracer.ConsiderTracedGlobalAsRoot(false); TracedGlobalTest( - CcTest::isolate(), ConstructJSApiObject, + CcTest::isolate(), ConstructJSApiObject<TracedGlobal<v8::Object>>, [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge, SurvivalMode::kDies); } @@ -671,9 +658,6 @@ TEST(TracedGlobalWithDestructor) { CHECK(!traced->IsEmpty()); CHECK_EQ(initial_count + 1, global_handles->handles_count()); } - static_assert(TracedGlobalTrait< - v8::TracedGlobal<v8::Object>>::kRequiresExplicitDestruction, - "destructor expected"); delete traced; CHECK_EQ(initial_count, global_handles->handles_count()); // GC should not need to clear the handle. @@ -691,21 +675,18 @@ TEST(TracedGlobalNoDestructor) { i::GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); const size_t initial_count = global_handles->handles_count(); - char* memory = new char[sizeof(v8::TracedGlobal<v8::Value>)]; - auto* traced = new (memory) v8::TracedGlobal<v8::Value>(); + char* memory = new char[sizeof(v8::TracedReference<v8::Value>)]; + auto* traced = new (memory) v8::TracedReference<v8::Value>(); { v8::HandleScope scope(isolate); v8::Local<v8::Value> object(ConstructTraceableJSApiObject( isolate->GetCurrentContext(), nullptr, nullptr)); CHECK(traced->IsEmpty()); - *traced = v8::TracedGlobal<v8::Value>(isolate, object); + *traced = v8::TracedReference<v8::Value>(isolate, object); CHECK(!traced->IsEmpty()); CHECK_EQ(initial_count + 1, global_handles->handles_count()); } - static_assert(!TracedGlobalTrait< - v8::TracedGlobal<v8::Value>>::kRequiresExplicitDestruction, - "no destructor expected"); - traced->~TracedGlobal<v8::Value>(); + traced->~TracedReference<v8::Value>(); CHECK_EQ(initial_count + 1, global_handles->handles_count()); // GC should clear the handle. heap::InvokeMarkSweep(); @@ -759,18 +740,19 @@ class EmbedderHeapTracerNoDestructorNonTracingClearing final uint16_t class_id_to_optimize) : class_id_to_optimize_(class_id_to_optimize) {} - bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle) final { + bool IsRootForNonTracingGC( + const v8::TracedReference<v8::Value>& handle) final { return handle.WrapperClassId() != class_id_to_optimize_; } void ResetHandleInNonTracingGC( - const v8::TracedGlobal<v8::Value>& handle) final { + const v8::TracedReference<v8::Value>& handle) final { if (handle.WrapperClassId() != class_id_to_optimize_) return; // Convention (for test): Objects that are optimized have their first field // set as a back pointer. - TracedGlobal<v8::Value>* original_handle = - reinterpret_cast<TracedGlobal<v8::Value>*>( + TracedReferenceBase<v8::Value>* original_handle = + reinterpret_cast<TracedReferenceBase<v8::Value>*>( v8::Object::GetAlignedPointerFromInternalField( handle.As<v8::Object>(), 0)); original_handle->Reset(); @@ -781,23 +763,23 @@ class EmbedderHeapTracerNoDestructorNonTracingClearing final }; template <typename T> -void SetupOptimizedAndNonOptimizedHandle( - v8::Isolate* isolate, uint16_t optimized_class_id, - v8::TracedGlobal<T>* optimized_handle, - v8::TracedGlobal<T>* non_optimized_handle) { +void SetupOptimizedAndNonOptimizedHandle(v8::Isolate* isolate, + uint16_t optimized_class_id, + T* optimized_handle, + T* non_optimized_handle) { v8::HandleScope scope(isolate); v8::Local<v8::Object> optimized_object(ConstructTraceableJSApiObject( isolate->GetCurrentContext(), optimized_handle, nullptr)); CHECK(optimized_handle->IsEmpty()); - *optimized_handle = v8::TracedGlobal<T>(isolate, optimized_object); + *optimized_handle = T(isolate, optimized_object); CHECK(!optimized_handle->IsEmpty()); optimized_handle->SetWrapperClassId(optimized_class_id); v8::Local<v8::Object> non_optimized_object(ConstructTraceableJSApiObject( isolate->GetCurrentContext(), nullptr, nullptr)); CHECK(non_optimized_handle->IsEmpty()); - *non_optimized_handle = v8::TracedGlobal<T>(isolate, non_optimized_object); + *non_optimized_handle = T(isolate, non_optimized_object); CHECK(!non_optimized_handle->IsEmpty()); } @@ -813,9 +795,6 @@ TEST(TracedGlobalDestructorReclaimedOnScavenge) { heap::TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer); i::GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); - static_assert(TracedGlobalTrait< - v8::TracedGlobal<v8::Object>>::kRequiresExplicitDestruction, - "destructor expected"); const size_t initial_count = global_handles->handles_count(); auto* optimized_handle = new v8::TracedGlobal<v8::Object>(); auto* non_optimized_handle = new v8::TracedGlobal<v8::Object>(); @@ -841,12 +820,9 @@ TEST(TracedGlobalNoDestructorReclaimedOnScavenge) { heap::TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer); i::GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); - static_assert(!TracedGlobalTrait< - v8::TracedGlobal<v8::Value>>::kRequiresExplicitDestruction, - "no destructor expected"); const size_t initial_count = global_handles->handles_count(); - auto* optimized_handle = new v8::TracedGlobal<v8::Value>(); - auto* non_optimized_handle = new v8::TracedGlobal<v8::Value>(); + auto* optimized_handle = new v8::TracedReference<v8::Value>(); + auto* non_optimized_handle = new v8::TracedReference<v8::Value>(); SetupOptimizedAndNonOptimizedHandle(isolate, kClassIdToOptimize, optimized_handle, non_optimized_handle); CHECK_EQ(initial_count + 2, global_handles->handles_count()); diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index fd17c0f063..03f98c6453 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -1791,7 +1791,7 @@ TEST(HeapNumberAlignment) { AlignOldSpace(required_alignment, offset); Handle<Object> number_old = - factory->NewNumber(1.000321, AllocationType::kOld); + factory->NewNumber<AllocationType::kOld>(1.000321); CHECK(number_old->IsHeapNumber()); CHECK(heap->InOldSpace(*number_old)); CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_old).address(), @@ -3663,9 +3663,58 @@ TEST(DeferredHandles) { DeferredHandleScope deferred(isolate); DummyVisitor visitor; isolate->handle_scope_implementer()->Iterate(&visitor); - delete deferred.Detach(); + deferred.Detach(); } +static void TestFillersFromDeferredHandles(bool promote) { + // We assume that the fillers can only arise when left-trimming arrays. + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate)); + + const size_t n = 10; + Handle<FixedArray> array = isolate->factory()->NewFixedArray(n); + + if (promote) { + // Age the array so it's ready for promotion on next GC. + CcTest::CollectGarbage(NEW_SPACE); + } + CHECK(Heap::InYoungGeneration(*array)); + + DeferredHandleScope deferred_scope(isolate); + + // Trim the array three times to different sizes so all kinds of fillers are + // created and tracked by the deferred handles. + Handle<FixedArrayBase> filler_1 = Handle<FixedArrayBase>(*array, isolate); + Handle<FixedArrayBase> filler_2 = + Handle<FixedArrayBase>(heap->LeftTrimFixedArray(*filler_1, 1), isolate); + Handle<FixedArrayBase> filler_3 = + Handle<FixedArrayBase>(heap->LeftTrimFixedArray(*filler_2, 2), isolate); + Handle<FixedArrayBase> tail = + Handle<FixedArrayBase>(heap->LeftTrimFixedArray(*filler_3, 3), isolate); + + std::unique_ptr<DeferredHandles> deferred_handles(deferred_scope.Detach()); + + // GC should retain the trimmed array but drop all of the three fillers. + CcTest::CollectGarbage(NEW_SPACE); + if (promote) { + CHECK(heap->InOldSpace(*tail)); + } else { + CHECK(Heap::InYoungGeneration(*tail)); + } + CHECK_EQ(n - 6, (*tail).length()); + CHECK(!filler_1->IsHeapObject()); + CHECK(!filler_2->IsHeapObject()); + CHECK(!filler_3->IsHeapObject()); +} + +TEST(DoNotEvacuateFillersFromDeferredHandles) { + TestFillersFromDeferredHandles(false /*promote*/); +} + +TEST(DoNotPromoteFillersFromDeferredHandles) { + TestFillersFromDeferredHandles(true /*promote*/); +} TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) { if (!FLAG_incremental_marking) return; @@ -5269,34 +5318,6 @@ TEST(ScriptIterator) { CHECK_EQ(0, script_count); } - -TEST(SharedFunctionInfoIterator) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = CcTest::heap(); - LocalContext context; - - CcTest::CollectAllGarbage(); - CcTest::CollectAllGarbage(); - - int sfi_count = 0; - { - HeapObjectIterator it(heap); - for (HeapObject obj = it.Next(); !obj.is_null(); obj = it.Next()) { - if (!obj.IsSharedFunctionInfo()) continue; - sfi_count++; - } - } - - { - SharedFunctionInfo::GlobalIterator iterator(isolate); - while (!iterator.Next().is_null()) sfi_count--; - } - - CHECK_EQ(0, sfi_count); -} - // This is the same as Factory::NewByteArray, except it doesn't retry on // allocation failure. AllocationResult HeapTester::AllocateByteArrayForTest( @@ -5316,6 +5337,11 @@ AllocationResult HeapTester::AllocateByteArrayForTest( return result; } +bool HeapTester::CodeEnsureLinearAllocationArea(Heap* heap, int size_in_bytes) { + return heap->code_space()->EnsureLinearAllocationArea( + size_in_bytes, AllocationOrigin::kRuntime); +} + HEAP_TEST(Regress587004) { ManualGCScope manual_gc_scope; #ifdef VERIFY_HEAP @@ -5995,6 +6021,173 @@ TEST(UncommitUnusedLargeObjectMemory) { CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory()); } +template <RememberedSetType direction> +static size_t GetRememberedSetSize(HeapObject obj) { + size_t count = 0; + auto chunk = MemoryChunk::FromHeapObject(obj); + RememberedSet<direction>::Iterate( + chunk, + [&count](MaybeObjectSlot slot) { + count++; + return KEEP_SLOT; + }, + SlotSet::KEEP_EMPTY_BUCKETS); + return count; +} + +TEST(RememberedSet_InsertOnWriteBarrier) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + Heap* heap = isolate->heap(); + heap::SealCurrentObjects(heap); + HandleScope scope(isolate); + + // Allocate an object in old space. + Handle<FixedArray> arr = factory->NewFixedArray(3, AllocationType::kOld); + + // Add into 'arr' references to young objects. + { + HandleScope scope_inner(isolate); + Handle<Object> number = factory->NewHeapNumber(42); + arr->set(0, *number); + arr->set(1, *number); + arr->set(2, *number); + Handle<Object> number_other = factory->NewHeapNumber(24); + arr->set(2, *number_other); + } + // Remembered sets track *slots* pages with cross-generational pointers, so + // must have recorded three of them each exactly once. + CHECK_EQ(3, GetRememberedSetSize<OLD_TO_NEW>(*arr)); +} + +TEST(RememberedSet_InsertInLargePage) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + Heap* heap = isolate->heap(); + heap::SealCurrentObjects(heap); + HandleScope scope(isolate); + + // Allocate an object in Large space. + const int count = Max(FixedArray::kMaxRegularLength + 1, 128 * KB); + Handle<FixedArray> arr = factory->NewFixedArray(count, AllocationType::kOld); + CHECK(heap->lo_space()->Contains(*arr)); + CHECK_EQ(0, GetRememberedSetSize<OLD_TO_NEW>(*arr)); + + // Create OLD_TO_NEW references from the large object so that the + // corresponding slots end up in different SlotSets. + { + HandleScope short_lived(isolate); + Handle<Object> number = factory->NewHeapNumber(42); + arr->set(0, *number); + arr->set(count - 1, *number); + } + CHECK_EQ(2, GetRememberedSetSize<OLD_TO_NEW>(*arr)); +} + +TEST(RememberedSet_InsertOnPromotingObjectToOld) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + Heap* heap = isolate->heap(); + heap::SealCurrentObjects(heap); + HandleScope scope(isolate); + + // Create a young object and age it one generation inside the new space. + Handle<FixedArray> arr = factory->NewFixedArray(1); + CcTest::CollectGarbage(i::NEW_SPACE); + CHECK(Heap::InYoungGeneration(*arr)); + + // Add into 'arr' a reference to an object one generation younger. + { + HandleScope scope_inner(isolate); + Handle<Object> number = factory->NewHeapNumber(42); + arr->set(0, *number); + } + + // Promote 'arr' into old, its element is still in new, the old to new + // refs are inserted into the remembered sets during GC. + CcTest::CollectGarbage(i::NEW_SPACE); + + CHECK(heap->InOldSpace(*arr)); + CHECK_EQ(1, GetRememberedSetSize<OLD_TO_NEW>(*arr)); +} + +TEST(RememberedSet_RemoveStaleOnScavenge) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + Heap* heap = isolate->heap(); + heap::SealCurrentObjects(heap); + HandleScope scope(isolate); + + // Allocate an object in old space and add into it references to young. + Handle<FixedArray> arr = factory->NewFixedArray(3, AllocationType::kOld); + { + HandleScope scope_inner(isolate); + Handle<Object> number = factory->NewHeapNumber(42); + arr->set(0, *number); // will be trimmed away + arr->set(1, *number); // will be replaced with #undefined + arr->set(2, *number); // will be promoted into old + } + CHECK_EQ(3, GetRememberedSetSize<OLD_TO_NEW>(*arr)); + + // Run scavenger once so the young object becomes ready for promotion on the + // next pass. + CcTest::CollectGarbage(i::NEW_SPACE); + arr->set(1, ReadOnlyRoots(CcTest::heap()).undefined_value()); + Handle<FixedArrayBase> tail = + Handle<FixedArrayBase>(heap->LeftTrimFixedArray(*arr, 1), isolate); + + // None of the actions above should have updated the remembered set. + CHECK_EQ(3, GetRememberedSetSize<OLD_TO_NEW>(*tail)); + + // Run GC to promote the remaining young object and fixup the stale entries in + // the remembered set. + CcTest::CollectGarbage(i::NEW_SPACE); + CHECK_EQ(0, GetRememberedSetSize<OLD_TO_NEW>(*tail)); +} + +// The OLD_TO_OLD remembered set is created temporary by GC and is cleared at +// the end of the pass. There is no way to observe it so the test only checks +// that compaction has happened and otherwise relies on code's self-validation. +TEST(RememberedSet_OldToOld) { + if (FLAG_stress_incremental_marking) return; + + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + Heap* heap = isolate->heap(); + heap::SealCurrentObjects(heap); + HandleScope scope(isolate); + + Handle<FixedArray> arr = factory->NewFixedArray(10, AllocationType::kOld); + { + HandleScope short_lived(isolate); + factory->NewFixedArray(100, AllocationType::kOld); + } + Handle<Object> ref = factory->NewFixedArray(100, AllocationType::kOld); + arr->set(0, *ref); + + // To force compaction of the old space, fill it with garbage and start a new + // page (so that the page with 'arr' becomes subject to compaction). + { + HandleScope short_lived(isolate); + heap::SimulateFullSpace(heap->old_space()); + factory->NewFixedArray(100, AllocationType::kOld); + } + + FLAG_manual_evacuation_candidates_selection = true; + heap::ForceEvacuationCandidate(Page::FromHeapObject(*arr)); + const auto prev_location = *arr; + + // This GC pass will evacuate the page with 'arr'/'ref' so it will have to + // create OLD_TO_OLD remembered set to track the reference. + CcTest::CollectAllGarbage(); + CHECK_NE(prev_location, *arr); +} + TEST(RememberedSetRemoveRange) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -6016,59 +6209,64 @@ TEST(RememberedSetRemoveRange) { slots[chunk->area_end() - kTaggedSize] = true; for (auto x : slots) { - RememberedSet<OLD_TO_NEW>::Insert(chunk, x.first); + RememberedSet<OLD_TO_NEW>::Insert<AccessMode::ATOMIC>(chunk, x.first); } - RememberedSet<OLD_TO_NEW>::Iterate(chunk, - [&slots](MaybeObjectSlot slot) { - CHECK(slots[slot.address()]); - return KEEP_SLOT; - }, - SlotSet::PREFREE_EMPTY_BUCKETS); + RememberedSet<OLD_TO_NEW>::Iterate( + chunk, + [&slots](MaybeObjectSlot slot) { + CHECK(slots[slot.address()]); + return KEEP_SLOT; + }, + SlotSet::FREE_EMPTY_BUCKETS); RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, start + kTaggedSize, SlotSet::FREE_EMPTY_BUCKETS); slots[start] = false; - RememberedSet<OLD_TO_NEW>::Iterate(chunk, - [&slots](MaybeObjectSlot slot) { - CHECK(slots[slot.address()]); - return KEEP_SLOT; - }, - SlotSet::PREFREE_EMPTY_BUCKETS); + RememberedSet<OLD_TO_NEW>::Iterate( + chunk, + [&slots](MaybeObjectSlot slot) { + CHECK(slots[slot.address()]); + return KEEP_SLOT; + }, + SlotSet::FREE_EMPTY_BUCKETS); RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start + kTaggedSize, start + Page::kPageSize, SlotSet::FREE_EMPTY_BUCKETS); slots[start + kTaggedSize] = false; slots[start + Page::kPageSize - kTaggedSize] = false; - RememberedSet<OLD_TO_NEW>::Iterate(chunk, - [&slots](MaybeObjectSlot slot) { - CHECK(slots[slot.address()]); - return KEEP_SLOT; - }, - SlotSet::PREFREE_EMPTY_BUCKETS); + RememberedSet<OLD_TO_NEW>::Iterate( + chunk, + [&slots](MaybeObjectSlot slot) { + CHECK(slots[slot.address()]); + return KEEP_SLOT; + }, + SlotSet::FREE_EMPTY_BUCKETS); RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, start + Page::kPageSize + kTaggedSize, SlotSet::FREE_EMPTY_BUCKETS); slots[start + Page::kPageSize] = false; - RememberedSet<OLD_TO_NEW>::Iterate(chunk, - [&slots](MaybeObjectSlot slot) { - CHECK(slots[slot.address()]); - return KEEP_SLOT; - }, - SlotSet::PREFREE_EMPTY_BUCKETS); + RememberedSet<OLD_TO_NEW>::Iterate( + chunk, + [&slots](MaybeObjectSlot slot) { + CHECK(slots[slot.address()]); + return KEEP_SLOT; + }, + SlotSet::FREE_EMPTY_BUCKETS); RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, chunk->area_end() - kTaggedSize, chunk->area_end(), SlotSet::FREE_EMPTY_BUCKETS); slots[chunk->area_end() - kTaggedSize] = false; - RememberedSet<OLD_TO_NEW>::Iterate(chunk, - [&slots](MaybeObjectSlot slot) { - CHECK(slots[slot.address()]); - return KEEP_SLOT; - }, - SlotSet::PREFREE_EMPTY_BUCKETS); + RememberedSet<OLD_TO_NEW>::Iterate( + chunk, + [&slots](MaybeObjectSlot slot) { + CHECK(slots[slot.address()]); + return KEEP_SLOT; + }, + SlotSet::FREE_EMPTY_BUCKETS); } HEAP_TEST(Regress670675) { @@ -6164,53 +6362,6 @@ HEAP_TEST(Regress5831) { CHECK(chunk->NeverEvacuate()); } -TEST(Regress6800) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - HandleScope handle_scope(isolate); - - const int kRootLength = 1000; - Handle<FixedArray> root = - isolate->factory()->NewFixedArray(kRootLength, AllocationType::kOld); - { - HandleScope inner_scope(isolate); - Handle<FixedArray> new_space_array = isolate->factory()->NewFixedArray(1); - for (int i = 0; i < kRootLength; i++) { - root->set(i, *new_space_array); - } - for (int i = 0; i < kRootLength; i++) { - root->set(i, ReadOnlyRoots(CcTest::heap()).undefined_value()); - } - } - CcTest::CollectGarbage(NEW_SPACE); - CHECK_EQ(0, RememberedSet<OLD_TO_NEW>::NumberOfPreFreedEmptyBuckets( - MemoryChunk::FromHeapObject(*root))); -} - -TEST(Regress6800LargeObject) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - HandleScope handle_scope(isolate); - - const int kRootLength = i::kMaxRegularHeapObjectSize / kTaggedSize; - Handle<FixedArray> root = - isolate->factory()->NewFixedArray(kRootLength, AllocationType::kOld); - CcTest::heap()->lo_space()->Contains(*root); - { - HandleScope inner_scope(isolate); - Handle<FixedArray> new_space_array = isolate->factory()->NewFixedArray(1); - for (int i = 0; i < kRootLength; i++) { - root->set(i, *new_space_array); - } - for (int i = 0; i < kRootLength; i++) { - root->set(i, ReadOnlyRoots(CcTest::heap()).undefined_value()); - } - } - CcTest::CollectGarbage(OLD_SPACE); - CHECK_EQ(0, RememberedSet<OLD_TO_NEW>::NumberOfPreFreedEmptyBuckets( - MemoryChunk::FromHeapObject(*root))); -} - HEAP_TEST(RegressMissingWriteBarrierInAllocate) { if (!FLAG_incremental_marking) return; ManualGCScope manual_gc_scope; @@ -6631,6 +6782,19 @@ HEAP_TEST(MemoryReducerActivationForSmallHeaps) { CHECK_EQ(heap->memory_reducer()->state_.action, MemoryReducer::Action::kWait); } +TEST(AllocateExternalBackingStore) { + ManualGCScope manual_gc_scope; + LocalContext env; + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + int initial_ms_count = heap->ms_count(); + void* result = + heap->AllocateExternalBackingStore([](size_t) { return nullptr; }, 10); + CHECK_NULL(result); + // At least two GCs should happen. + CHECK_LE(2, heap->ms_count() - initial_ms_count); +} + TEST(CodeObjectRegistry) { // We turn off compaction to ensure that code is not moving. FLAG_never_compact = true; @@ -6642,11 +6806,13 @@ TEST(CodeObjectRegistry) { HandleScope outer_scope(heap->isolate()); Address code2_address; { + // Ensure that both code objects end up on the same page. + CHECK(HeapTester::CodeEnsureLinearAllocationArea( + heap, kMaxRegularHeapObjectSize)); code1 = DummyOptimizedCode(isolate); Handle<Code> code2 = DummyOptimizedCode(isolate); code2_address = code2->address(); - // If this check breaks, change the allocation to ensure that both code - // objects are on the same page. + CHECK_EQ(MemoryChunk::FromHeapObject(*code1), MemoryChunk::FromHeapObject(*code2)); CHECK(MemoryChunk::FromHeapObject(*code1)->Contains(code1->address())); diff --git a/deps/v8/test/cctest/heap/test-invalidated-slots.cc b/deps/v8/test/cctest/heap/test-invalidated-slots.cc index af42503f86..861c48d69d 100644 --- a/deps/v8/test/cctest/heap/test-invalidated-slots.cc +++ b/deps/v8/test/cctest/heap/test-invalidated-slots.cc @@ -70,8 +70,7 @@ HEAP_TEST(InvalidatedSlotsSomeInvalidatedRanges) { Page* page = AllocateByteArraysOnPage(heap, &byte_arrays); // Register every second byte arrays as invalidated. for (size_t i = 0; i < byte_arrays.size(); i += 2) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i]); } InvalidatedSlotsFilter filter = InvalidatedSlotsFilter::OldToOld(page); for (size_t i = 0; i < byte_arrays.size(); i++) { @@ -95,8 +94,7 @@ HEAP_TEST(InvalidatedSlotsAllInvalidatedRanges) { Page* page = AllocateByteArraysOnPage(heap, &byte_arrays); // Register the all byte arrays as invalidated. for (size_t i = 0; i < byte_arrays.size(); i++) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i]); } InvalidatedSlotsFilter filter = InvalidatedSlotsFilter::OldToOld(page); for (size_t i = 0; i < byte_arrays.size(); i++) { @@ -117,8 +115,7 @@ HEAP_TEST(InvalidatedSlotsAfterTrimming) { Page* page = AllocateByteArraysOnPage(heap, &byte_arrays); // Register the all byte arrays as invalidated. for (size_t i = 0; i < byte_arrays.size(); i++) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i]); } // Trim byte arrays and check that the slots outside the byte arrays are // considered invalid if the old space page was swept. @@ -145,8 +142,7 @@ HEAP_TEST(InvalidatedSlotsEvacuationCandidate) { // This should be no-op because the page is marked as evacuation // candidate. for (size_t i = 0; i < byte_arrays.size(); i++) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i]); } // All slots must still be valid. InvalidatedSlotsFilter filter = InvalidatedSlotsFilter::OldToOld(page); @@ -169,8 +165,7 @@ HEAP_TEST(InvalidatedSlotsResetObjectRegression) { heap->RightTrimFixedArray(byte_arrays[0], byte_arrays[0].length() - 8); // Register the all byte arrays as invalidated. for (size_t i = 0; i < byte_arrays.size(); i++) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_OLD>(byte_arrays[i]); } // All slots must still be invalid. InvalidatedSlotsFilter filter = InvalidatedSlotsFilter::OldToOld(page); @@ -359,8 +354,7 @@ HEAP_TEST(InvalidatedSlotsCleanupFull) { Page* page = AllocateByteArraysOnPage(heap, &byte_arrays); // Register all byte arrays as invalidated. for (size_t i = 0; i < byte_arrays.size(); i++) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>(byte_arrays[i]); } // Mark full page as free @@ -379,8 +373,7 @@ HEAP_TEST(InvalidatedSlotsCleanupEachObject) { Page* page = AllocateByteArraysOnPage(heap, &byte_arrays); // Register all byte arrays as invalidated. for (size_t i = 0; i < byte_arrays.size(); i++) { - page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>(byte_arrays[i], - byte_arrays[i].Size()); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>(byte_arrays[i]); } // Mark each object as free on page @@ -405,11 +398,9 @@ HEAP_TEST(InvalidatedSlotsCleanupRightTrim) { CHECK_GT(byte_arrays.size(), 1); ByteArray& invalidated = byte_arrays[1]; - int invalidated_size = invalidated.Size(); heap->RightTrimFixedArray(invalidated, invalidated.length() - 8); - page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>(invalidated, - invalidated_size); + page->RegisterObjectWithInvalidatedSlots<OLD_TO_NEW>(invalidated); // Free memory at end of invalidated object InvalidatedSlotsCleanup cleanup = InvalidatedSlotsCleanup::OldToNew(page); @@ -418,8 +409,6 @@ HEAP_TEST(InvalidatedSlotsCleanupRightTrim) { // After cleanup the invalidated object should be smaller InvalidatedSlots* invalidated_slots = page->invalidated_slots<OLD_TO_NEW>(); - CHECK_GE((*invalidated_slots)[HeapObject::FromAddress(invalidated.address())], - invalidated.Size()); CHECK_EQ(invalidated_slots->size(), 1); } diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc index df6211826e..c31fc39c2e 100644 --- a/deps/v8/test/cctest/heap/test-page-promotion.cc +++ b/deps/v8/test/cctest/heap/test-page-promotion.cc @@ -43,8 +43,7 @@ v8::Isolate* NewIsolateForPagePromotion(int min_semi_space_size = 8, return isolate; } -Page* FindLastPageInNewSpace( - std::vector<Handle<FixedArray>>& handles) { // NOLINT(runtime/references) +Page* FindLastPageInNewSpace(const std::vector<Handle<FixedArray>>& handles) { for (auto rit = handles.rbegin(); rit != handles.rend(); ++rit) { // One deref gets the Handle, the second deref gets the FixedArray. Page* candidate = Page::FromHeapObject(**rit); @@ -146,8 +145,10 @@ UNINITIALIZED_TEST(PagePromotion_NewToNewJSArrayBuffer) { heap::FillCurrentPage(heap->new_space()); // Allocate a buffer we would like to check against. Handle<JSArrayBuffer> buffer = - i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); - CHECK(JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, 100)); + i_isolate->factory() + ->NewJSArrayBufferAndBackingStore(100, + InitializedFlag::kZeroInitialized) + .ToHandleChecked(); std::vector<Handle<FixedArray>> handles; // Simulate a full space, filling the interesting page with live objects. heap::SimulateFullSpace(heap->new_space(), &handles); @@ -188,8 +189,10 @@ UNINITIALIZED_TEST(PagePromotion_NewToOldJSArrayBuffer) { heap::FillCurrentPage(heap->new_space()); // Allocate a buffer we would like to check against. Handle<JSArrayBuffer> buffer = - i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); - CHECK(JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, 100)); + i_isolate->factory() + ->NewJSArrayBufferAndBackingStore(100, + InitializedFlag::kZeroInitialized) + .ToHandleChecked(); std::vector<Handle<FixedArray>> handles; // Simulate a full space, filling the interesting page with live objects. heap::SimulateFullSpace(heap->new_space(), &handles); diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc index 370c5d8131..a271df4f67 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc @@ -132,24 +132,24 @@ BytecodeExpectationsPrinter::GetBytecodeArrayOfCallee( } void BytecodeExpectationsPrinter::PrintEscapedString( - std::ostream& stream, const std::string& string) const { + std::ostream* stream, const std::string& string) const { for (char c : string) { switch (c) { case '"': - stream << "\\\""; + *stream << "\\\""; break; case '\\': - stream << "\\\\"; + *stream << "\\\\"; break; default: - stream << c; + *stream << c; break; } } } void BytecodeExpectationsPrinter::PrintBytecodeOperand( - std::ostream& stream, const BytecodeArrayIterator& bytecode_iterator, + std::ostream* stream, const BytecodeArrayIterator& bytecode_iterator, const Bytecode& bytecode, int op_index, int parameter_count) const { OperandType op_type = Bytecodes::GetOperandType(bytecode, op_index); OperandSize op_size = Bytecodes::GetOperandSize( @@ -172,207 +172,207 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( if (Bytecodes::IsRegisterOperandType(op_type)) { Register register_value = bytecode_iterator.GetRegisterOperand(op_index); - stream << 'R'; - if (op_size != OperandSize::kByte) stream << size_tag; + *stream << 'R'; + if (op_size != OperandSize::kByte) *stream << size_tag; if (register_value.is_current_context()) { - stream << "(context)"; + *stream << "(context)"; } else if (register_value.is_function_closure()) { - stream << "(closure)"; + *stream << "(closure)"; } else if (register_value.is_parameter()) { int parameter_index = register_value.ToParameterIndex(parameter_count); if (parameter_index == 0) { - stream << "(this)"; + *stream << "(this)"; } else { - stream << "(arg" << (parameter_index - 1) << ')'; + *stream << "(arg" << (parameter_index - 1) << ')'; } } else { - stream << '(' << register_value.index() << ')'; + *stream << '(' << register_value.index() << ')'; } } else { switch (op_type) { case OperandType::kFlag8: - stream << 'U' << size_tag << '('; - stream << bytecode_iterator.GetFlagOperand(op_index); + *stream << 'U' << size_tag << '('; + *stream << bytecode_iterator.GetFlagOperand(op_index); break; case OperandType::kIdx: { - stream << 'U' << size_tag << '('; - stream << bytecode_iterator.GetIndexOperand(op_index); + *stream << 'U' << size_tag << '('; + *stream << bytecode_iterator.GetIndexOperand(op_index); break; } case OperandType::kUImm: - stream << 'U' << size_tag << '('; - stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index); + *stream << 'U' << size_tag << '('; + *stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index); break; case OperandType::kImm: - stream << 'I' << size_tag << '('; - stream << bytecode_iterator.GetImmediateOperand(op_index); + *stream << 'I' << size_tag << '('; + *stream << bytecode_iterator.GetImmediateOperand(op_index); break; case OperandType::kRegCount: - stream << 'U' << size_tag << '('; - stream << bytecode_iterator.GetRegisterCountOperand(op_index); + *stream << 'U' << size_tag << '('; + *stream << bytecode_iterator.GetRegisterCountOperand(op_index); break; case OperandType::kRuntimeId: { - stream << 'U' << size_tag << '('; + *stream << 'U' << size_tag << '('; Runtime::FunctionId id = bytecode_iterator.GetRuntimeIdOperand(op_index); - stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; + *stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; break; } case OperandType::kIntrinsicId: { - stream << 'U' << size_tag << '('; + *stream << 'U' << size_tag << '('; Runtime::FunctionId id = bytecode_iterator.GetIntrinsicIdOperand(op_index); - stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; + *stream << "Runtime::k" << i::Runtime::FunctionForId(id)->name; break; } case OperandType::kNativeContextIndex: { - stream << 'U' << size_tag << '('; + *stream << 'U' << size_tag << '('; uint32_t idx = bytecode_iterator.GetNativeContextIndexOperand(op_index); - stream << "%" << NameForNativeContextIntrinsicIndex(idx); + *stream << "%" << NameForNativeContextIntrinsicIndex(idx); break; } default: UNREACHABLE(); } - stream << ')'; + *stream << ')'; } } void BytecodeExpectationsPrinter::PrintBytecode( - std::ostream& stream, const BytecodeArrayIterator& bytecode_iterator, + std::ostream* stream, const BytecodeArrayIterator& bytecode_iterator, int parameter_count) const { Bytecode bytecode = bytecode_iterator.current_bytecode(); OperandScale operand_scale = bytecode_iterator.current_operand_scale(); if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale)) { Bytecode prefix = Bytecodes::OperandScaleToPrefixBytecode(operand_scale); - stream << "B(" << Bytecodes::ToString(prefix) << "), "; + *stream << "B(" << Bytecodes::ToString(prefix) << "), "; } - stream << "B(" << Bytecodes::ToString(bytecode) << ')'; + *stream << "B(" << Bytecodes::ToString(bytecode) << ')'; int operands_count = Bytecodes::NumberOfOperands(bytecode); for (int op_index = 0; op_index < operands_count; ++op_index) { - stream << ", "; + *stream << ", "; PrintBytecodeOperand(stream, bytecode_iterator, bytecode, op_index, parameter_count); } } void BytecodeExpectationsPrinter::PrintSourcePosition( - std::ostream& stream, SourcePositionTableIterator& source_iterator, + std::ostream* stream, SourcePositionTableIterator* source_iterator, int bytecode_offset) const { static const size_t kPositionWidth = 4; - if (!source_iterator.done() && - source_iterator.code_offset() == bytecode_offset) { - stream << "/* " << std::setw(kPositionWidth) - << source_iterator.source_position().ScriptOffset(); - if (source_iterator.is_statement()) { - stream << " S> */ "; + if (!source_iterator->done() && + source_iterator->code_offset() == bytecode_offset) { + *stream << "/* " << std::setw(kPositionWidth) + << source_iterator->source_position().ScriptOffset(); + if (source_iterator->is_statement()) { + *stream << " S> */ "; } else { - stream << " E> */ "; + *stream << " E> */ "; } - source_iterator.Advance(); + source_iterator->Advance(); } else { - stream << " " << std::setw(kPositionWidth) << ' ' << " "; + *stream << " " << std::setw(kPositionWidth) << ' ' << " "; } } -void BytecodeExpectationsPrinter::PrintV8String(std::ostream& stream, +void BytecodeExpectationsPrinter::PrintV8String(std::ostream* stream, i::String string) const { - stream << '"'; + *stream << '"'; for (int i = 0, length = string.length(); i < length; ++i) { - stream << i::AsEscapedUC16ForJSON(string.Get(i)); + *stream << i::AsEscapedUC16ForJSON(string.Get(i)); } - stream << '"'; + *stream << '"'; } void BytecodeExpectationsPrinter::PrintConstant( - std::ostream& stream, i::Handle<i::Object> constant) const { + std::ostream* stream, i::Handle<i::Object> constant) const { if (constant->IsSmi()) { - stream << "Smi ["; - i::Smi::cast(*constant).SmiPrint(stream); - stream << "]"; + *stream << "Smi ["; + i::Smi::cast(*constant).SmiPrint(*stream); + *stream << "]"; } else { - stream << i::HeapObject::cast(*constant).map().instance_type(); + *stream << i::HeapObject::cast(*constant).map().instance_type(); if (constant->IsHeapNumber()) { - stream << " ["; - i::HeapNumber::cast(*constant).HeapNumberPrint(stream); - stream << "]"; + *stream << " ["; + i::HeapNumber::cast(*constant).HeapNumberPrint(*stream); + *stream << "]"; } else if (constant->IsString()) { - stream << " ["; + *stream << " ["; PrintV8String(stream, i::String::cast(*constant)); - stream << "]"; + *stream << "]"; } } } void BytecodeExpectationsPrinter::PrintFrameSize( - std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const { + std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const { int32_t frame_size = bytecode_array->frame_size(); DCHECK(IsAligned(frame_size, kSystemPointerSize)); - stream << "frame size: " << frame_size / kSystemPointerSize - << "\nparameter count: " << bytecode_array->parameter_count() << '\n'; + *stream << "frame size: " << frame_size / kSystemPointerSize + << "\nparameter count: " << bytecode_array->parameter_count() << '\n'; } void BytecodeExpectationsPrinter::PrintBytecodeSequence( - std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const { - stream << "bytecode array length: " << bytecode_array->length() - << "\nbytecodes: [\n"; + std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const { + *stream << "bytecode array length: " << bytecode_array->length() + << "\nbytecodes: [\n"; SourcePositionTableIterator source_iterator( bytecode_array->SourcePositionTable()); BytecodeArrayIterator bytecode_iterator(bytecode_array); for (; !bytecode_iterator.done(); bytecode_iterator.Advance()) { - stream << kIndent; - PrintSourcePosition(stream, source_iterator, + *stream << kIndent; + PrintSourcePosition(stream, &source_iterator, bytecode_iterator.current_offset()); PrintBytecode(stream, bytecode_iterator, bytecode_array->parameter_count()); - stream << ",\n"; + *stream << ",\n"; } - stream << "]\n"; + *stream << "]\n"; } void BytecodeExpectationsPrinter::PrintConstantPool( - std::ostream& stream, i::FixedArray constant_pool) const { - stream << "constant pool: [\n"; + std::ostream* stream, i::FixedArray constant_pool) const { + *stream << "constant pool: [\n"; int num_constants = constant_pool.length(); if (num_constants > 0) { for (int i = 0; i < num_constants; ++i) { - stream << kIndent; + *stream << kIndent; PrintConstant(stream, i::FixedArray::get(constant_pool, i, i_isolate())); - stream << ",\n"; + *stream << ",\n"; } } - stream << "]\n"; + *stream << "]\n"; } void BytecodeExpectationsPrinter::PrintCodeSnippet( - std::ostream& stream, const std::string& body) const { - stream << "snippet: \"\n"; + std::ostream* stream, const std::string& body) const { + *stream << "snippet: \"\n"; std::stringstream body_stream(body); std::string body_line; while (std::getline(body_stream, body_line)) { - stream << kIndent; + *stream << kIndent; PrintEscapedString(stream, body_line); - stream << '\n'; + *stream << '\n'; } - stream << "\"\n"; + *stream << "\"\n"; } void BytecodeExpectationsPrinter::PrintHandlers( - std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const { - stream << "handlers: [\n"; + std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const { + *stream << "handlers: [\n"; HandlerTable table(*bytecode_array); for (int i = 0, num_entries = table.NumberOfRangeEntries(); i < num_entries; ++i) { - stream << " [" << table.GetRangeStart(i) << ", " << table.GetRangeEnd(i) - << ", " << table.GetRangeHandler(i) << "],\n"; + *stream << " [" << table.GetRangeStart(i) << ", " << table.GetRangeEnd(i) + << ", " << table.GetRangeHandler(i) << "],\n"; } - stream << "]\n"; + *stream << "]\n"; } void BytecodeExpectationsPrinter::PrintBytecodeArray( - std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const { + std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const { PrintFrameSize(stream, bytecode_array); PrintBytecodeSequence(stream, bytecode_array); PrintConstantPool(stream, bytecode_array->constant_pool()); @@ -380,7 +380,7 @@ void BytecodeExpectationsPrinter::PrintBytecodeArray( } void BytecodeExpectationsPrinter::PrintExpectation( - std::ostream& stream, const std::string& snippet) const { + std::ostream* stream, const std::string& snippet) const { std::string source_code = wrap_ ? WrapCodeInFunction(test_function_name_.c_str(), snippet) : snippet; @@ -404,10 +404,10 @@ void BytecodeExpectationsPrinter::PrintExpectation( } } - stream << "---\n"; + *stream << "---\n"; PrintCodeSnippet(stream, snippet); PrintBytecodeArray(stream, bytecode_array); - stream << '\n'; + *stream << '\n'; } } // namespace interpreter diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h index dc51e5fb7a..6a469461d5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h @@ -36,8 +36,7 @@ class BytecodeExpectationsPrinter final { oneshot_opt_(false), test_function_name_(kDefaultTopFunctionName) {} - void PrintExpectation(std::ostream& stream, // NOLINT - const std::string& snippet) const; + void PrintExpectation(std::ostream* stream, const std::string& snippet) const; void set_module(bool module) { module_ = module; } bool module() const { return module_; } @@ -60,34 +59,30 @@ class BytecodeExpectationsPrinter final { std::string test_function_name() const { return test_function_name_; } private: - void PrintEscapedString(std::ostream& stream, // NOLINT + void PrintEscapedString(std::ostream* stream, const std::string& string) const; - void PrintBytecodeOperand(std::ostream& stream, // NOLINT + void PrintBytecodeOperand(std::ostream* stream, const BytecodeArrayIterator& bytecode_iterator, const Bytecode& bytecode, int op_index, int parameter_count) const; - void PrintBytecode(std::ostream& stream, // NOLINT + void PrintBytecode(std::ostream* stream, const BytecodeArrayIterator& bytecode_iterator, int parameter_count) const; - void PrintSourcePosition(std::ostream& stream, // NOLINT - SourcePositionTableIterator& - source_iterator, // NOLINT(runtime/references) + void PrintSourcePosition(std::ostream* stream, + SourcePositionTableIterator* source_iterator, int bytecode_offset) const; - void PrintV8String(std::ostream& stream, // NOLINT - i::String string) const; - void PrintConstant(std::ostream& stream, // NOLINT - i::Handle<i::Object> constant) const; - void PrintFrameSize(std::ostream& stream, // NOLINT + void PrintV8String(std::ostream* stream, i::String string) const; + void PrintConstant(std::ostream* stream, i::Handle<i::Object> constant) const; + void PrintFrameSize(std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const; - void PrintBytecodeSequence(std::ostream& stream, // NOLINT + void PrintBytecodeSequence(std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const; - void PrintConstantPool(std::ostream& stream, // NOLINT + void PrintConstantPool(std::ostream* stream, i::FixedArray constant_pool) const; - void PrintCodeSnippet(std::ostream& stream, // NOLINT - const std::string& body) const; - void PrintBytecodeArray(std::ostream& stream, // NOLINT + void PrintCodeSnippet(std::ostream* stream, const std::string& body) const; + void PrintBytecodeArray(std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const; - void PrintHandlers(std::ostream& stream, // NOLINT + void PrintHandlers(std::ostream* stream, i::Handle<i::BytecodeArray> bytecode_array) const; v8::Local<v8::String> V8StringFromUTF8(const char* data) const; diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden index d6097e938d..7b1de53911 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden @@ -141,9 +141,9 @@ handlers: [ snippet: " var a = [ 1, 2 ]; return [ 0, ...a ]; " -frame size: 7 +frame size: 6 parameter count: 1 -bytecode array length: 80 +bytecode array length: 68 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), @@ -152,11 +152,7 @@ bytecodes: [ B(Star), R(2), B(LdaConstant), U8(2), /* 67 S> */ B(Star), R(1), - B(GetIterator), R(0), U8(2), - B(Star), R(6), - B(CallProperty0), R(6), R(0), U8(4), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(0), U8(2), U8(4), B(Star), R(4), B(LdaNamedProperty), R(4), U8(3), U8(6), B(Star), R(3), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden index 1dbb999371..0e7cac1ad9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden @@ -214,7 +214,7 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 369 +bytecode array length: 357 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), @@ -238,11 +238,7 @@ bytecodes: [ B(JumpConstant), U8(15), /* 36 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37), B(Star), R(10), - B(GetIterator), R(10), U8(1), - B(Star), R(11), - B(CallProperty0), R(11), R(10), U8(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(10), U8(1), U8(3), B(Star), R(9), B(LdaNamedProperty), R(9), U8(5), U8(5), B(Star), R(8), @@ -376,7 +372,7 @@ bytecodes: [ ] constant pool: [ Smi [30], - Smi [148], + Smi [136], Smi [16], Smi [7], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, @@ -390,16 +386,16 @@ constant pool: [ Smi [6], Smi [9], SCOPE_INFO_TYPE, - Smi [274], + Smi [262], Smi [6], Smi [9], Smi [23], ] handlers: [ - [20, 315, 323], - [23, 279, 281], - [92, 179, 187], - [211, 244, 246], + [20, 303, 311], + [23, 267, 269], + [80, 167, 175], + [199, 232, 234], ] --- @@ -410,7 +406,7 @@ snippet: " " frame size: 17 parameter count: 1 -bytecode array length: 466 +bytecode array length: 467 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(5), B(Mov), R(closure), R(1), @@ -431,7 +427,7 @@ bytecodes: [ B(LdaSmi), I8(1), B(Star), R(1), B(Mov), R(5), R(2), - B(JumpConstant), U8(17), + B(JumpConstant), U8(18), /* 49 S> */ B(LdaGlobal), U8(7), U8(0), B(Star), R(9), /* 56 E> */ B(CallUndefinedReceiver0), R(9), U8(2), @@ -440,25 +436,25 @@ bytecodes: [ B(JumpIfUndefinedOrNull), U8(15), B(Star), R(11), B(CallProperty0), R(11), R(10), U8(6), - B(JumpIfJSReceiver), U8(22), + B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(GetIterator), R(10), U8(8), + B(LdaNamedProperty), R(10), U8(9), U8(8), B(Star), R(11), B(CallProperty0), R(11), R(10), U8(10), B(Star), R(11), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(11), U8(1), B(Star), R(7), - B(LdaNamedProperty), R(7), U8(9), U8(12), + B(LdaNamedProperty), R(7), U8(10), U8(12), B(Star), R(9), B(LdaUndefined), B(Star), R(8), B(LdaZero), B(Star), R(6), B(Ldar), R(6), - B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(1), + B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(1), B(CallProperty1), R(9), R(7), R(8), U8(14), B(Jump), U8(140), - B(LdaNamedProperty), R(7), U8(12), U8(16), + B(LdaNamedProperty), R(7), U8(13), U8(16), B(JumpIfUndefinedOrNull), U8(11), B(Star), R(10), B(CallProperty1), R(10), R(7), R(8), U8(18), @@ -480,12 +476,12 @@ bytecodes: [ B(Star), R(1), B(Mov), R(10), R(2), B(Jump), U8(241), - B(LdaNamedProperty), R(7), U8(13), U8(20), + B(LdaNamedProperty), R(7), U8(14), U8(20), B(JumpIfUndefinedOrNull), U8(11), B(Star), R(12), B(CallProperty1), R(12), R(7), R(8), U8(22), B(Jump), U8(66), - B(LdaNamedProperty), R(7), U8(12), U8(24), + B(LdaNamedProperty), R(7), U8(13), U8(24), B(JumpIfUndefinedOrNull), U8(55), B(Star), R(12), B(CallProperty0), R(12), R(7), U8(26), @@ -525,9 +521,9 @@ bytecodes: [ B(Mov), R(12), R(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(14), U8(28), + B(LdaNamedProperty), R(5), U8(15), U8(28), B(JumpIfToBooleanTrue), U8(38), - B(LdaNamedProperty), R(5), U8(15), U8(30), + B(LdaNamedProperty), R(5), U8(16), U8(30), B(Star), R(15), B(LdaFalse), B(Star), R(16), @@ -539,7 +535,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(6), B(JumpLoop), U8(236), I8(0), - B(LdaNamedProperty), R(5), U8(15), U8(32), + B(LdaNamedProperty), R(5), U8(16), U8(32), B(Star), R(7), B(LdaSmi), I8(1), B(TestReferenceEqual), R(6), @@ -551,7 +547,7 @@ bytecodes: [ B(Ldar), R(7), B(Jump), U8(36), B(Star), R(5), - B(CreateCatchContext), R(5), U8(16), + B(CreateCatchContext), R(5), U8(17), B(Star), R(4), B(LdaTheHole), B(SetPendingMessage), @@ -580,7 +576,7 @@ bytecodes: [ B(Ldar), R(3), B(SetPendingMessage), B(Ldar), R(1), - B(SwitchOnSmiNoFeedback), U8(18), U8(3), I8(0), + B(SwitchOnSmiNoFeedback), U8(19), U8(3), I8(0), B(Jump), U8(22), B(Ldar), R(2), B(ReThrow), @@ -597,14 +593,15 @@ bytecodes: [ ] constant pool: [ Smi [30], - Smi [157], - Smi [229], - Smi [279], - Smi [338], + Smi [158], + Smi [230], + Smi [280], + Smi [339], Smi [16], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], SYMBOL_TYPE, + SYMBOL_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], Smi [11], Smi [70], @@ -613,13 +610,13 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], SCOPE_INFO_TYPE, - Smi [371], + Smi [372], Smi [6], Smi [9], Smi [23], ] handlers: [ - [20, 412, 420], - [23, 374, 378], + [20, 413, 421], + [23, 375, 379], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden new file mode 100644 index 0000000000..7cbe661b94 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncModules.golden @@ -0,0 +1,349 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: no +module: yes +top level: yes +top level await: yes + +--- +snippet: " + await 42; +" +frame size: 8 +parameter count: 2 +bytecode array length: 142 +bytecodes: [ + 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(Star), R(0), + /* 0 E> */ B(StackCheck), + /* 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(3), + /* 0 E> */ B(Throw), + B(Ldar), R(3), + /* 10 S> */ B(Return), + B(Mov), R(3), R(1), + B(Ldar), R(1), + B(Mov), R(context), R(3), + /* 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(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestReferenceEqual), R(5), + B(JumpIfTrue), U8(5), + B(Ldar), R(4), + B(ReThrow), + B(LdaUndefined), + B(Star), R(5), + B(LdaTrue), + B(Star), R(6), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), + /* 10 S> */ B(Return), + B(Star), R(4), + B(CreateCatchContext), R(4), U8(5), + B(Star), R(3), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(3), + B(PushContext), R(4), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(6), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(0), R(5), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3), + /* 10 S> */ B(Return), +] +constant pool: [ + Smi [36], + Smi [80], + SCOPE_INFO_TYPE, + Smi [10], + Smi [7], + SCOPE_INFO_TYPE, +] +handlers: [ + [64, 114, 114], +] + +--- +snippet: " + await import(\"foo\"); +" +frame size: 8 +parameter count: 2 +bytecode array length: 152 +bytecodes: [ + 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(Star), R(0), + /* 0 E> */ B(StackCheck), + /* 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(3), + /* 0 E> */ B(Throw), + B(Ldar), R(3), + /* 21 S> */ B(Return), + B(Mov), R(3), 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(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestReferenceEqual), R(5), + B(JumpIfTrue), U8(5), + B(Ldar), R(4), + B(ReThrow), + B(LdaUndefined), + B(Star), R(5), + B(LdaTrue), + B(Star), R(6), + B(Mov), R(0), R(4), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3), + /* 21 S> */ B(Return), + B(Star), R(4), + B(CreateCatchContext), R(4), U8(6), + B(Star), R(3), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(3), + B(PushContext), R(4), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(6), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(0), R(5), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3), + /* 21 S> */ B(Return), +] +constant pool: [ + Smi [36], + Smi [90], + SCOPE_INFO_TYPE, + Smi [10], + Smi [7], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], + SCOPE_INFO_TYPE, +] +handlers: [ + [64, 124, 124], +] + +--- +snippet: " + await 42; + async function foo() { + await 42; + } + foo(); +" +frame size: 9 +parameter count: 2 +bytecode array length: 153 +bytecodes: [ + 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(Star), R(0), + B(CreateClosure), U8(3), U8(0), U8(0), + B(Star), R(1), + /* 0 E> */ B(StackCheck), + 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), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(Ldar), R(4), + /* 54 S> */ B(Return), + B(Mov), R(4), R(2), + B(Ldar), R(2), + B(Mov), R(context), R(4), + /* 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(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(Star), R(6), + B(LdaZero), + B(TestReferenceEqual), R(6), + B(JumpIfTrue), U8(5), + B(Ldar), R(5), + B(ReThrow), + /* 47 S> */ B(CallUndefinedReceiver0), R(1), U8(0), + B(LdaUndefined), + B(Star), R(6), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(0), R(5), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), + /* 54 S> */ B(Return), + B(Star), R(5), + B(CreateCatchContext), R(5), U8(6), + B(Star), R(4), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(4), + B(PushContext), R(5), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(7), + B(LdaTrue), + B(Star), R(8), + B(Mov), R(0), R(6), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3), + /* 54 S> */ B(Return), +] +constant pool: [ + Smi [44], + Smi [88], + SCOPE_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + Smi [10], + Smi [7], + SCOPE_INFO_TYPE, +] +handlers: [ + [72, 125, 125], +] + +--- +snippet: " + import * as foo from \"bar\"; + await import(\"goo\"); +" +frame size: 9 +parameter count: 2 +bytecode array length: 164 +bytecodes: [ + 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(Star), R(0), + B(LdaZero), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(4), U8(1), + B(Star), R(1), + /* 0 E> */ B(StackCheck), + 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), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(Ldar), R(4), + /* 49 S> */ B(Return), + B(Mov), R(4), 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(Star), R(5), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(Star), R(6), + B(LdaZero), + B(TestReferenceEqual), R(6), + B(JumpIfTrue), U8(5), + B(Ldar), R(5), + B(ReThrow), + B(LdaUndefined), + B(Star), R(6), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(0), R(5), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), + /* 49 S> */ B(Return), + B(Star), R(5), + B(CreateCatchContext), R(5), U8(6), + B(Star), R(4), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(4), + B(PushContext), R(5), + B(LdaImmutableCurrentContextSlot), U8(4), + B(Star), R(7), + B(LdaTrue), + B(Star), R(8), + B(Mov), R(0), R(6), + B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3), + /* 49 S> */ B(Return), +] +constant pool: [ + Smi [48], + Smi [102], + SCOPE_INFO_TYPE, + Smi [10], + Smi [7], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"], + SCOPE_INFO_TYPE, +] +handlers: [ + [76, 136, 136], +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden index 963cbee018..b86d4e61b1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden @@ -65,9 +65,9 @@ handlers: [ snippet: " Math.max(0, ...[1, 2, 3], 4); " -frame size: 9 +frame size: 8 parameter count: 1 -bytecode array length: 106 +bytecode array length: 94 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaGlobal), U8(0), U8(0), @@ -80,14 +80,10 @@ bytecodes: [ B(Star), R(3), /* 49 S> */ B(CreateArrayLiteral), U8(4), U8(5), U8(37), B(Star), R(7), - B(GetIterator), R(7), U8(6), - B(Star), R(8), - B(CallProperty0), R(8), R(7), U8(8), - B(Mov), R(0), R(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(7), U8(6), U8(8), B(Star), R(6), B(LdaNamedProperty), R(6), U8(5), U8(10), + B(Mov), R(0), R(2), B(Star), R(5), B(CallProperty0), R(5), R(6), U8(19), B(Star), R(7), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index be635a2ed0..cd439d5d14 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -12,27 +12,26 @@ snippet: " speak() { console.log(this.name + ' is speaking.'); } } " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 44 +bytecode array length: 41 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), + B(Star), R(3), B(CreateClosure), U8(3), U8(1), U8(2), - B(Star), R(7), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), - B(Star), R(4), - B(Mov), R(5), R(1), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(Star), R(6), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), + B(Star), R(3), + B(PopContext), R(1), + B(Mov), R(4), R(0), B(LdaUndefined), /* 149 S> */ B(Return), ] @@ -52,27 +51,26 @@ snippet: " speak() { console.log(this.name + ' is speaking.'); } } " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 44 +bytecode array length: 41 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), + B(Star), R(3), B(CreateClosure), U8(3), U8(1), U8(2), - B(Star), R(7), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), - B(Star), R(4), - B(Mov), R(5), R(1), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(Star), R(6), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), + B(Star), R(3), + B(PopContext), R(1), + B(Mov), R(4), R(0), B(LdaUndefined), /* 149 S> */ B(Return), ] @@ -94,43 +92,42 @@ snippet: " static [n1]() { return n1; } } " -frame size: 12 +frame size: 11 parameter count: 1 -bytecode array length: 87 +bytecode array length: 84 bytecodes: [ B(CreateFunctionContext), U8(0), U8(2), - B(PushContext), R(2), + B(PushContext), R(1), /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaConstant), U8(1), /* 43 E> */ B(StaCurrentContextSlot), U8(4), /* 57 S> */ B(LdaConstant), U8(2), /* 57 E> */ B(StaCurrentContextSlot), U8(5), B(CreateBlockContext), U8(3), - B(PushContext), R(3), + B(PushContext), R(2), B(LdaTheHole), - B(Star), R(7), + B(Star), R(6), B(CreateClosure), U8(5), U8(0), U8(2), - B(Star), R(4), + B(Star), R(3), B(LdaConstant), U8(4), - B(Star), R(5), - /* 75 S> */ B(LdaImmutableContextSlot), R(3), U8(4), U8(0), - B(ToName), R(8), + B(Star), R(4), + /* 75 S> */ B(LdaImmutableContextSlot), R(2), U8(4), U8(0), + B(ToName), R(7), B(CreateClosure), U8(6), U8(1), U8(2), - B(Star), R(9), - /* 106 S> */ B(LdaImmutableContextSlot), R(3), U8(5), U8(0), - B(ToName), R(10), + B(Star), R(8), + /* 106 S> */ B(LdaImmutableContextSlot), R(2), U8(5), U8(0), + B(ToName), R(9), B(LdaConstant), U8(7), - B(TestEqualStrict), R(10), U8(0), - B(Mov), R(4), R(6), + B(TestEqualStrict), R(9), U8(0), + B(Mov), R(3), R(5), B(JumpIfFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), B(CreateClosure), U8(8), U8(2), U8(2), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(7), - B(Star), R(5), - B(Mov), R(4), R(1), - B(PopContext), R(3), - B(Mov), R(1), R(0), + B(Star), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(7), + B(Star), R(4), + B(PopContext), R(2), + B(Mov), R(3), R(0), B(LdaUndefined), /* 129 S> */ B(Return), ] @@ -154,29 +151,28 @@ snippet: " class C { constructor() { count++; }} return new C(); " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 52 +bytecode array length: 49 bytecodes: [ B(CreateFunctionContext), U8(0), U8(1), - B(PushContext), R(2), + B(PushContext), R(1), /* 30 E> */ B(StackCheck), /* 46 S> */ B(LdaZero), /* 46 E> */ B(StaCurrentContextSlot), U8(4), B(CreateBlockContext), U8(1), - B(PushContext), R(3), + B(PushContext), R(2), B(LdaTheHole), - B(Star), R(7), + B(Star), R(6), B(CreateClosure), U8(3), U8(0), U8(2), - B(Star), R(4), + B(Star), R(3), B(LdaConstant), U8(2), - B(Star), R(5), - B(Mov), R(4), R(6), - B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), - B(Star), R(5), - B(Mov), R(6), R(1), - B(PopContext), R(3), - B(Mov), R(1), R(0), + B(Star), R(4), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), + B(Star), R(4), + B(PopContext), R(2), + B(Mov), R(5), R(0), /* 87 S> */ B(Ldar), R(0), /* 94 E> */ B(Construct), R(0), R(0), U8(0), U8(0), /* 102 S> */ B(Return), @@ -195,39 +191,38 @@ snippet: " (class {}) class E { static name () {}} " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 73 +bytecode array length: 70 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), - B(Star), R(4), - B(PopContext), R(2), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(PopContext), R(1), B(CreateBlockContext), U8(3), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(5), U8(1), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(4), - B(Star), R(4), + B(Star), R(3), B(CreateClosure), U8(6), U8(2), U8(2), - B(Star), R(7), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), - B(Star), R(4), - B(Mov), R(5), R(1), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(Star), R(6), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), + B(Star), R(3), + B(PopContext), R(1), + B(Mov), R(4), R(0), B(LdaUndefined), /* 74 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden index e26b79a9fb..b4c9a75ef1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden @@ -12,21 +12,17 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 172 +bytecode array length: 160 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), - B(Star), R(6), - B(CallProperty0), R(6), R(1), U8(3), - B(Mov), R(1), R(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 60 S> */ B(GetIterator), R(1), U8(1), U8(3), B(Star), R(4), B(LdaNamedProperty), R(4), U8(1), U8(5), B(Star), R(3), B(LdaFalse), + B(Mov), R(1), R(2), B(Star), R(5), B(Mov), R(context), R(8), /* 57 S> */ B(Ldar), R(5), @@ -101,8 +97,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [40, 82, 90], - [114, 147, 149], + [28, 70, 78], + [102, 135, 137], ] --- @@ -112,21 +108,17 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 258 +bytecode array length: 246 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), - B(Star), R(7), - B(CallProperty0), R(7), R(2), U8(3), - B(Mov), R(2), R(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 69 S> */ B(GetIterator), R(2), U8(1), U8(3), B(Star), R(5), B(LdaNamedProperty), R(5), U8(1), U8(5), B(Star), R(4), B(LdaFalse), + B(Mov), R(2), R(3), B(Star), R(6), B(Mov), R(context), R(9), B(Ldar), R(6), @@ -235,8 +227,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [40, 168, 176], - [200, 233, 235], + [28, 156, 164], + [188, 221, 223], ] --- @@ -246,23 +238,19 @@ snippet: " " frame size: 16 parameter count: 1 -bytecode array length: 223 +bytecode array length: 211 bytecodes: [ /* 30 E> */ B(StackCheck), /* 40 S> */ B(CreateEmptyObjectLiteral), B(Star), R(0), /* 51 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(2), - /* 68 S> */ B(GetIterator), R(2), U8(1), - B(Star), R(7), - B(CallProperty0), R(7), R(2), U8(3), - B(Mov), R(2), R(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 68 S> */ B(GetIterator), R(2), U8(1), U8(3), B(Star), R(5), B(LdaNamedProperty), R(5), U8(1), U8(5), B(Star), R(4), B(LdaFalse), + B(Mov), R(2), R(3), B(Star), R(6), B(Mov), R(context), R(9), /* 59 S> */ B(Ldar), R(6), @@ -357,8 +345,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [43, 133, 141], - [165, 198, 200], + [31, 121, 129], + [153, 186, 188], ] --- diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden index f60e591040..43b6c0ed22 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden @@ -16,7 +16,7 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 320 +bytecode array length: 321 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), @@ -31,15 +31,15 @@ bytecodes: [ B(JumpIfUndefinedOrNull), U8(15), B(Star), R(8), B(CallProperty0), R(8), R(7), U8(3), - B(JumpIfJSReceiver), U8(22), + B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(GetIterator), R(7), U8(5), + B(LdaNamedProperty), R(7), U8(4), U8(5), B(Star), R(8), B(CallProperty0), R(8), R(7), U8(7), B(Star), R(8), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(8), U8(1), B(Star), R(6), - B(LdaNamedProperty), R(6), U8(4), U8(9), + B(LdaNamedProperty), R(6), U8(5), U8(9), B(Star), R(5), B(LdaFalse), B(Star), R(7), @@ -64,9 +64,9 @@ bytecodes: [ B(Mov), R(12), R(11), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), - B(LdaNamedProperty), R(11), U8(5), U8(13), + B(LdaNamedProperty), R(11), U8(6), U8(13), B(JumpIfToBooleanTrue), U8(23), - B(LdaNamedProperty), R(11), U8(6), U8(15), + B(LdaNamedProperty), R(11), U8(7), U8(15), B(Star), R(11), B(LdaFalse), B(Star), R(7), @@ -87,7 +87,7 @@ bytecodes: [ B(Star), R(10), B(Ldar), R(7), B(JumpIfToBooleanTrue), U8(94), - B(LdaNamedProperty), R(6), U8(7), U8(17), + B(LdaNamedProperty), R(6), U8(8), U8(17), B(Star), R(14), B(JumpIfUndefinedOrNull), U8(86), B(Mov), R(context), R(15), @@ -95,7 +95,7 @@ bytecodes: [ B(JumpIfTrue), U8(18), B(Wide), B(LdaSmi), I16(159), B(Star), R(16), - B(LdaConstant), U8(8), + B(LdaConstant), U8(9), B(Star), R(17), B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), B(Throw), @@ -139,7 +139,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), /* 57 S> */ B(Return), B(Star), R(5), - B(CreateCatchContext), R(5), U8(9), + B(CreateCatchContext), R(5), U8(10), B(Star), R(4), B(LdaTheHole), B(SetPendingMessage), @@ -154,10 +154,11 @@ bytecodes: [ /* 57 S> */ B(Return), ] constant pool: [ - Smi [95], - Smi [224], + Smi [96], + Smi [225], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, SYMBOL_TYPE, + SYMBOL_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -166,9 +167,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 292, 292], - [74, 154, 162], - [186, 255, 257], + [20, 293, 293], + [75, 155, 163], + [187, 256, 258], ] --- @@ -180,7 +181,7 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 341 +bytecode array length: 342 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), @@ -195,15 +196,15 @@ bytecodes: [ B(JumpIfUndefinedOrNull), U8(15), B(Star), R(8), B(CallProperty0), R(8), R(7), U8(3), - B(JumpIfJSReceiver), U8(22), + B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(GetIterator), R(7), U8(5), + B(LdaNamedProperty), R(7), U8(4), U8(5), B(Star), R(8), B(CallProperty0), R(8), R(7), U8(7), B(Star), R(8), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(8), U8(1), B(Star), R(6), - B(LdaNamedProperty), R(6), U8(4), U8(9), + B(LdaNamedProperty), R(6), U8(5), U8(9), B(Star), R(5), B(LdaFalse), B(Star), R(7), @@ -228,9 +229,9 @@ bytecodes: [ B(Mov), R(12), R(11), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), - B(LdaNamedProperty), R(11), U8(5), U8(13), + B(LdaNamedProperty), R(11), U8(6), U8(13), B(JumpIfToBooleanTrue), U8(27), - B(LdaNamedProperty), R(11), U8(6), U8(15), + B(LdaNamedProperty), R(11), U8(7), U8(15), B(Star), R(11), B(LdaFalse), B(Star), R(7), @@ -253,7 +254,7 @@ bytecodes: [ B(Star), R(10), B(Ldar), R(7), B(JumpIfToBooleanTrue), U8(94), - B(LdaNamedProperty), R(6), U8(7), U8(17), + B(LdaNamedProperty), R(6), U8(8), U8(17), B(Star), R(14), B(JumpIfUndefinedOrNull), U8(86), B(Mov), R(context), R(15), @@ -261,7 +262,7 @@ bytecodes: [ B(JumpIfTrue), U8(18), B(Wide), B(LdaSmi), I16(159), B(Star), R(16), - B(LdaConstant), U8(8), + B(LdaConstant), U8(9), B(Star), R(17), B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), B(Throw), @@ -293,7 +294,7 @@ bytecodes: [ B(Ldar), R(10), B(SetPendingMessage), B(Ldar), R(8), - B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), + B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0), B(Jump), U8(19), B(Ldar), R(9), B(ReThrow), @@ -311,7 +312,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), /* 68 S> */ B(Return), B(Star), R(5), - B(CreateCatchContext), R(5), U8(11), + B(CreateCatchContext), R(5), U8(12), B(Star), R(4), B(LdaTheHole), B(SetPendingMessage), @@ -326,10 +327,11 @@ bytecodes: [ /* 68 S> */ B(Return), ] constant pool: [ - Smi [95], - Smi [228], + Smi [96], + Smi [229], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, SYMBOL_TYPE, + SYMBOL_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -340,9 +342,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 313, 313], - [74, 158, 166], - [190, 259, 261], + [20, 314, 314], + [75, 159, 167], + [191, 260, 262], ] --- @@ -357,7 +359,7 @@ snippet: " " frame size: 19 parameter count: 1 -bytecode array length: 336 +bytecode array length: 337 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), @@ -372,15 +374,15 @@ bytecodes: [ B(JumpIfUndefinedOrNull), U8(15), B(Star), R(8), B(CallProperty0), R(8), R(7), U8(3), - B(JumpIfJSReceiver), U8(22), + B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(GetIterator), R(7), U8(5), + B(LdaNamedProperty), R(7), U8(4), U8(5), B(Star), R(8), B(CallProperty0), R(8), R(7), U8(7), B(Star), R(8), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(8), U8(1), B(Star), R(6), - B(LdaNamedProperty), R(6), U8(4), U8(9), + B(LdaNamedProperty), R(6), U8(5), U8(9), B(Star), R(5), B(LdaFalse), B(Star), R(7), @@ -405,9 +407,9 @@ bytecodes: [ B(Mov), R(12), R(11), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), - B(LdaNamedProperty), R(11), U8(5), U8(13), + B(LdaNamedProperty), R(11), U8(6), U8(13), B(JumpIfToBooleanTrue), U8(39), - B(LdaNamedProperty), R(11), U8(6), U8(15), + B(LdaNamedProperty), R(11), U8(7), U8(15), B(Star), R(11), B(LdaFalse), B(Star), R(7), @@ -435,7 +437,7 @@ bytecodes: [ B(Star), R(10), B(Ldar), R(7), B(JumpIfToBooleanTrue), U8(94), - B(LdaNamedProperty), R(6), U8(7), U8(19), + B(LdaNamedProperty), R(6), U8(8), U8(19), B(Star), R(14), B(JumpIfUndefinedOrNull), U8(86), B(Mov), R(context), R(15), @@ -443,7 +445,7 @@ bytecodes: [ B(JumpIfTrue), U8(18), B(Wide), B(LdaSmi), I16(159), B(Star), R(16), - B(LdaConstant), U8(8), + B(LdaConstant), U8(9), B(Star), R(17), B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), B(Throw), @@ -487,7 +489,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3), /* 114 S> */ B(Return), B(Star), R(5), - B(CreateCatchContext), R(5), U8(9), + B(CreateCatchContext), R(5), U8(10), B(Star), R(4), B(LdaTheHole), B(SetPendingMessage), @@ -502,10 +504,11 @@ bytecodes: [ /* 114 S> */ B(Return), ] constant pool: [ - Smi [95], - Smi [240], + Smi [96], + Smi [241], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, SYMBOL_TYPE, + SYMBOL_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -514,9 +517,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 308, 308], - [74, 170, 178], - [202, 271, 273], + [20, 309, 309], + [75, 171, 179], + [203, 272, 274], ] --- @@ -529,7 +532,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 258 +bytecode array length: 246 bytecodes: [ B(Mov), R(closure), R(2), B(Mov), R(this), R(3), @@ -541,11 +544,7 @@ bytecodes: [ B(Star), R(1), /* 68 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), B(Star), R(5), - B(GetIterator), R(5), U8(2), - B(Star), R(6), - B(CallProperty0), R(6), R(5), U8(4), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(5), U8(2), U8(4), B(Star), R(4), B(LdaNamedProperty), R(4), U8(2), U8(6), B(Star), R(3), @@ -657,8 +656,8 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [16, 230, 230], - [58, 111, 119], - [143, 176, 178], + [16, 218, 218], + [46, 99, 107], + [131, 164, 166], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index 1557e8d2a8..6c599df00c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -11,16 +11,12 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 170 +bytecode array length: 158 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), - B(Star), R(5), - B(CallProperty0), R(5), R(4), U8(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(4), U8(1), U8(3), B(Star), R(3), B(LdaNamedProperty), R(3), U8(1), U8(5), B(Star), R(2), @@ -98,8 +94,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [37, 80, 88], - [112, 145, 147], + [25, 68, 76], + [100, 133, 135], ] --- @@ -109,16 +105,12 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 178 +bytecode array length: 166 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), - /* 68 S> */ B(GetIterator), R(0), U8(0), - B(Star), R(6), - B(CallProperty0), R(6), R(0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 68 S> */ B(GetIterator), R(0), U8(0), U8(2), B(Star), R(4), B(LdaNamedProperty), R(4), U8(1), U8(4), B(Star), R(3), @@ -202,8 +194,8 @@ constant pool: [ Smi [9], ] handlers: [ - [35, 82, 90], - [114, 147, 149], + [23, 70, 78], + [102, 135, 137], ] --- @@ -215,16 +207,12 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 186 +bytecode array length: 174 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), - B(Star), R(5), - B(CallProperty0), R(5), R(4), U8(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(4), U8(1), U8(3), B(Star), R(3), B(LdaNamedProperty), R(3), U8(1), U8(5), B(Star), R(2), @@ -309,8 +297,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [37, 96, 104], - [128, 161, 163], + [25, 84, 92], + [116, 149, 151], ] --- @@ -320,18 +308,14 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 192 +bytecode array length: 180 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), B(Star), R(3), - B(GetIterator), R(3), U8(2), - B(Star), R(4), - B(CallProperty0), R(4), R(3), U8(4), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(3), U8(2), U8(4), B(Star), R(2), B(LdaNamedProperty), R(2), U8(2), U8(6), B(Star), R(1), @@ -419,7 +403,7 @@ constant pool: [ Smi [9], ] handlers: [ - [43, 96, 104], - [128, 161, 163], + [31, 84, 92], + [116, 149, 151], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden index f50891172e..c643232d4b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden @@ -15,14 +15,10 @@ snippet: " " frame size: 15 parameter count: 2 -bytecode array length: 167 +bytecode array length: 155 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 34 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(7), - B(CallProperty0), R(7), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 34 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(5), B(LdaNamedProperty), R(5), U8(0), U8(4), B(Star), R(4), @@ -100,8 +96,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [31, 77, 85], - [109, 142, 144], + [19, 65, 73], + [97, 130, 132], ] --- @@ -113,7 +109,7 @@ snippet: " " frame size: 20 parameter count: 2 -bytecode array length: 251 +bytecode array length: 239 bytecodes: [ B(CreateFunctionContext), U8(0), U8(4), B(PushContext), R(2), @@ -132,11 +128,7 @@ bytecodes: [ B(StaCurrentContextSlot), U8(4), /* 34 S> */ B(LdaContextSlot), R(3), U8(4), U8(0), B(Star), R(6), - B(GetIterator), R(6), U8(0), - B(Star), R(7), - B(CallProperty0), R(7), R(6), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(6), U8(0), U8(2), B(Star), R(5), B(LdaNamedProperty), R(5), U8(2), U8(4), B(Star), R(4), @@ -241,8 +233,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [64, 159, 167], - [191, 224, 226], + [52, 147, 155], + [179, 212, 214], ] --- @@ -254,14 +246,10 @@ snippet: " " frame size: 14 parameter count: 2 -bytecode array length: 184 +bytecode array length: 172 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 34 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(5), - B(CallProperty0), R(5), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 34 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(3), B(LdaNamedProperty), R(3), U8(0), U8(4), B(Star), R(2), @@ -349,8 +337,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [31, 94, 102], - [126, 159, 161], + [19, 82, 90], + [114, 147, 149], ] --- @@ -362,14 +350,10 @@ snippet: " " frame size: 17 parameter count: 2 -bytecode array length: 178 +bytecode array length: 166 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 41 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(9), - B(CallProperty0), R(9), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 41 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(7), B(LdaNamedProperty), R(7), U8(0), U8(4), B(Star), R(6), @@ -453,8 +437,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [31, 88, 96], - [120, 153, 155], + [19, 76, 84], + [108, 141, 143], ] --- @@ -466,7 +450,7 @@ snippet: " " frame size: 16 parameter count: 2 -bytecode array length: 208 +bytecode array length: 196 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(5), @@ -483,11 +467,7 @@ bytecodes: [ /* 11 E> */ B(Throw), B(Ldar), R(5), /* 55 S> */ B(Return), - /* 35 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(8), - B(CallProperty0), R(8), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 35 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(6), B(LdaNamedProperty), R(6), U8(3), U8(4), B(Star), R(5), @@ -568,8 +548,8 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ - [72, 118, 126], - [150, 183, 185], + [60, 106, 114], + [138, 171, 173], ] --- @@ -581,7 +561,7 @@ snippet: " " frame size: 15 parameter count: 2 -bytecode array length: 252 +bytecode array length: 240 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), @@ -598,11 +578,7 @@ bytecodes: [ /* 11 E> */ B(Throw), B(Ldar), R(4), /* 49 S> */ B(Return), - /* 35 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(7), - B(CallProperty0), R(7), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 35 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(5), B(LdaNamedProperty), R(5), U8(4), U8(4), B(Star), R(4), @@ -690,7 +666,7 @@ bytecodes: [ ] constant pool: [ Smi [22], - Smi [125], + Smi [113], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], @@ -704,8 +680,8 @@ constant pool: [ Smi [9], ] handlers: [ - [72, 156, 164], - [188, 221, 223], + [60, 144, 152], + [176, 209, 211], ] --- @@ -717,7 +693,7 @@ snippet: " " frame size: 17 parameter count: 2 -bytecode array length: 222 +bytecode array length: 210 bytecodes: [ B(Mov), R(closure), R(5), B(Mov), R(this), R(6), @@ -725,11 +701,7 @@ bytecodes: [ B(Star), R(0), /* 16 E> */ B(StackCheck), B(Mov), R(context), R(5), - /* 40 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(9), - B(CallProperty0), R(9), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 40 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(7), B(LdaNamedProperty), R(7), U8(0), U8(4), B(Star), R(6), @@ -827,9 +799,9 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [16, 194, 194], - [46, 92, 100], - [124, 157, 159], + [16, 182, 182], + [34, 80, 88], + [112, 145, 147], ] --- @@ -841,7 +813,7 @@ snippet: " " frame size: 16 parameter count: 2 -bytecode array length: 258 +bytecode array length: 246 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(1), B(Mov), R(closure), R(4), @@ -850,11 +822,7 @@ bytecodes: [ B(Star), R(0), /* 16 E> */ B(StackCheck), B(Mov), R(context), R(4), - /* 40 S> */ B(GetIterator), R(arg0), U8(0), - B(Star), R(8), - B(CallProperty0), R(8), R(arg0), U8(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + /* 40 S> */ B(GetIterator), R(arg0), U8(0), U8(2), B(Star), R(6), B(LdaNamedProperty), R(6), U8(1), U8(4), B(Star), R(5), @@ -956,7 +924,7 @@ bytecodes: [ /* 54 S> */ B(Return), ] constant pool: [ - Smi [103], + Smi [91], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], @@ -965,8 +933,8 @@ constant pool: [ SCOPE_INFO_TYPE, ] handlers: [ - [20, 230, 230], - [50, 128, 136], - [160, 193, 195], + [20, 218, 218], + [38, 116, 124], + [148, 181, 183], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index 157b58d81d..ca3ef0bef3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -100,7 +100,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 258 +bytecode array length: 246 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(4), @@ -119,11 +119,7 @@ bytecodes: [ /* 44 S> */ B(Return), /* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37), B(Star), R(6), - B(GetIterator), R(6), U8(1), - B(Star), R(7), - B(CallProperty0), R(7), R(6), U8(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(6), U8(1), U8(3), B(Star), R(5), B(LdaNamedProperty), R(5), U8(5), U8(5), B(Star), R(4), @@ -211,7 +207,7 @@ bytecodes: [ ] constant pool: [ Smi [22], - Smi [131], + Smi [119], Smi [10], Smi [7], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, @@ -226,8 +222,8 @@ constant pool: [ Smi [9], ] handlers: [ - [78, 162, 170], - [194, 227, 229], + [66, 150, 158], + [182, 215, 217], ] --- @@ -236,9 +232,9 @@ snippet: " function* f() { yield* g() } f(); " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 210 +bytecode array length: 198 bytecodes: [ B(SwitchOnGeneratorState), R(0), U8(0), U8(2), B(Mov), R(closure), R(1), @@ -259,11 +255,7 @@ bytecodes: [ B(Star), R(5), /* 50 E> */ B(CallUndefinedReceiver0), R(5), U8(2), B(Star), R(6), - B(GetIterator), R(6), U8(4), - B(Star), R(7), - B(CallProperty0), R(7), R(6), U8(6), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(6), U8(4), U8(6), B(Star), R(3), B(LdaNamedProperty), R(3), U8(5), U8(8), B(Star), R(5), @@ -320,7 +312,7 @@ bytecodes: [ ] constant pool: [ Smi [22], - Smi [178], + Smi [166], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden index dce8d7ac8c..c29b74c0e2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden @@ -10,29 +10,28 @@ snippet: " class A { constructor(...args) { this.args = args; } } new A(...[1, 2, 3]); " -frame size: 7 +frame size: 6 parameter count: 1 -bytecode array length: 51 +bytecode array length: 48 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), - B(Star), R(4), - B(Mov), R(5), R(1), - B(PopContext), R(2), - B(Mov), R(1), R(0), - /* 89 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(PopContext), R(1), + B(Mov), R(4), R(0), + /* 89 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), + B(Star), R(2), B(Ldar), R(0), - /* 89 E> */ B(ConstructWithSpread), R(0), R(3), U8(1), U8(1), + /* 89 E> */ B(ConstructWithSpread), R(0), R(2), U8(1), U8(1), B(LdaUndefined), /* 110 S> */ B(Return), ] @@ -50,31 +49,30 @@ snippet: " class A { constructor(...args) { this.args = args; } } new A(0, ...[1, 2, 3]); " -frame size: 7 +frame size: 6 parameter count: 1 -bytecode array length: 54 +bytecode array length: 51 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), - B(Star), R(4), - B(Mov), R(5), R(1), - B(PopContext), R(2), - B(Mov), R(1), R(0), - /* 89 S> */ B(LdaZero), B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(PopContext), R(1), + B(Mov), R(4), R(0), + /* 89 S> */ B(LdaZero), + B(Star), R(2), B(CreateArrayLiteral), U8(3), U8(0), U8(37), - B(Star), R(4), + B(Star), R(3), B(Ldar), R(0), - /* 89 E> */ B(ConstructWithSpread), R(0), R(3), U8(2), U8(1), + /* 89 E> */ B(ConstructWithSpread), R(0), R(2), U8(2), U8(1), B(LdaUndefined), /* 113 S> */ B(Return), ] @@ -92,56 +90,51 @@ snippet: " class A { constructor(...args) { this.args = args; } } new A(0, ...[1, 2, 3], 4); " -frame size: 9 +frame size: 7 parameter count: 1 -bytecode array length: 130 +bytecode array length: 115 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), - B(Star), R(4), - B(Mov), R(5), R(1), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(PopContext), R(1), + B(Mov), R(4), R(0), /* 89 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), - B(Star), R(4), - B(LdaConstant), U8(4), B(Star), R(3), + B(LdaConstant), U8(4), + B(Star), R(2), /* 101 S> */ B(CreateArrayLiteral), U8(5), U8(1), U8(37), - B(Star), R(7), - B(GetIterator), R(7), U8(2), - B(Star), R(8), - B(CallProperty0), R(8), R(7), U8(4), - B(Mov), R(5), R(2), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(6), - B(LdaNamedProperty), R(6), U8(6), U8(6), + B(GetIterator), R(6), U8(2), U8(4), B(Star), R(5), - B(CallProperty0), R(5), R(6), U8(15), - B(Star), R(7), + B(LdaNamedProperty), R(5), U8(6), U8(6), + B(Star), R(4), + B(Mov), R(0), R(1), + B(CallProperty0), R(4), R(5), U8(15), + B(Star), R(6), B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(LdaNamedProperty), R(7), U8(7), U8(17), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(7), U8(17), B(JumpIfToBooleanTrue), U8(19), - B(LdaNamedProperty), R(7), U8(8), U8(8), - B(StaInArrayLiteral), R(4), R(3), U8(13), - B(Ldar), R(3), + B(LdaNamedProperty), R(6), U8(8), U8(8), + B(StaInArrayLiteral), R(3), R(2), U8(13), + B(Ldar), R(2), B(Inc), U8(12), - B(Star), R(3), + B(Star), R(2), B(JumpLoop), U8(33), I8(0), B(LdaSmi), I8(4), - B(StaInArrayLiteral), R(4), R(3), U8(13), - B(Mov), R(4), R(3), - B(CallJSRuntime), U8(%reflect_construct), R(2), U8(2), + B(StaInArrayLiteral), R(3), R(2), U8(13), + B(Mov), R(3), R(2), + B(CallJSRuntime), U8(%reflect_construct), R(1), U8(2), B(LdaUndefined), /* 116 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden index aceee552b5..2c0af93787 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateAccessorDeclaration.golden @@ -15,45 +15,44 @@ snippet: " } } " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 68 +bytecode array length: 65 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), + B(LdaConstant), U8(2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(3), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), B(Star), R(6), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(4), - B(Mov), R(3), R(5), + B(Mov), R(2), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), B(Star), R(4), - B(Mov), R(5), R(1), - B(LdaConstant), U8(3), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), - B(StaCurrentContextSlot), U8(5), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(5), U8(2), U8(2), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), + B(Star), R(6), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(5), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(PopContext), R(1), + B(Mov), R(2), R(0), B(LdaUndefined), /* 101 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["A"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -66,44 +65,43 @@ snippet: " } } " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 65 +bytecode array length: 62 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), + B(LdaConstant), U8(2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(3), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), B(Star), R(6), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(4), - B(Mov), R(3), R(5), + B(Mov), R(2), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), B(Star), R(4), - B(Mov), R(5), R(1), - B(LdaConstant), U8(3), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), - B(StaCurrentContextSlot), U8(5), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(6), + B(Star), R(5), B(LdaNull), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), + B(Star), R(6), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(5), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(PopContext), R(1), + B(Mov), R(2), R(0), B(LdaUndefined), /* 81 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["B"], SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -116,44 +114,43 @@ snippet: " } } " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 65 +bytecode array length: 62 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), + B(LdaConstant), U8(2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(3), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), B(Star), R(6), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(4), - B(Mov), R(3), R(5), + B(Mov), R(2), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), B(Star), R(4), - B(Mov), R(5), R(1), - B(LdaConstant), U8(3), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), - B(StaCurrentContextSlot), U8(5), B(LdaNull), - B(Star), R(6), + B(Star), R(5), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), + B(Star), R(6), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(5), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(PopContext), R(1), + B(Mov), R(2), R(0), B(LdaUndefined), /* 74 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["C"], SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -172,74 +169,72 @@ snippet: " } } " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 133 +bytecode array length: 127 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(8), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), - B(LdaConstant), U8(1), - B(Star), R(6), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(3), - B(LdaConstant), U8(3), B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), - B(StaCurrentContextSlot), U8(5), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(3), + B(LdaConstant), U8(1), + B(Star), R(5), + B(Mov), R(3), R(6), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(5), U8(2), U8(2), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(8), U8(2), + B(Star), R(7), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(4), + B(PopContext), R(2), B(Mov), R(3), R(0), /* 38 E> */ B(CreateBlockContext), U8(6), - B(PushContext), R(4), - /* 118 E> */ B(CreateClosure), U8(8), U8(3), U8(2), - B(Star), R(5), - B(LdaConstant), U8(7), - B(Star), R(6), - B(Mov), R(5), R(7), - B(Mov), R(3), R(8), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(2), - B(LdaConstant), U8(9), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), + B(PushContext), R(2), + B(LdaConstant), U8(8), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), B(StaCurrentContextSlot), U8(5), + /* 118 E> */ B(CreateClosure), U8(9), U8(3), U8(2), + B(Star), R(3), + B(LdaConstant), U8(7), + B(Star), R(5), + B(Mov), R(3), R(6), + B(Mov), R(0), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), B(CreateClosure), U8(10), U8(4), U8(2), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(11), U8(5), U8(2), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(8), U8(2), + B(Star), R(7), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(4), - B(Mov), R(2), R(1), + B(PopContext), R(2), + B(Mov), R(3), R(1), B(LdaUndefined), /* 175 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["D"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["E"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -254,52 +249,50 @@ snippet: " new C(); } " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 119 +bytecode array length: 113 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(6), + B(Star), R(4), B(CreateClosure), U8(3), U8(1), U8(2), - B(Star), R(9), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), - B(Star), R(6), - B(Mov), R(7), R(3), - B(PopContext), R(4), - B(Mov), R(3), R(0), - /* 38 E> */ B(CreateBlockContext), U8(4), - B(PushContext), R(4), - /* 77 E> */ B(CreateClosure), U8(6), U8(2), U8(2), - B(Star), R(5), - B(LdaConstant), U8(5), - B(Star), R(6), - B(Mov), R(5), R(7), - B(Mov), R(3), R(8), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(2), - B(LdaConstant), U8(7), B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(PopContext), R(2), + B(Mov), R(5), R(0), + /* 38 E> */ B(CreateBlockContext), U8(4), + B(PushContext), R(2), + B(LdaConstant), U8(6), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), B(StaCurrentContextSlot), U8(5), + /* 77 E> */ B(CreateClosure), U8(7), U8(2), U8(2), + B(Star), R(3), + B(LdaConstant), U8(5), + B(Star), R(5), + B(Mov), R(3), R(6), + B(Mov), R(0), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), B(CreateClosure), U8(8), U8(3), U8(2), - B(Star), R(8), - B(Ldar), R(6), - B(StaNamedProperty), R(8), U8(9), U8(0), + B(Star), R(6), + B(Ldar), R(5), + B(StaNamedProperty), R(6), U8(9), U8(0), B(LdaNull), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(8), U8(2), + B(Star), R(7), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(4), - B(Mov), R(2), R(1), + B(PopContext), R(2), + B(Mov), R(3), R(1), /* 122 S> */ B(Ldar), R(1), /* 122 E> */ B(Construct), R(1), R(0), U8(0), U8(2), B(LdaUndefined), @@ -312,9 +305,9 @@ constant pool: [ SHARED_FUNCTION_INFO_TYPE, SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["C"], SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, SYMBOL_TYPE, ] handlers: [ @@ -330,52 +323,50 @@ snippet: " new C(); } " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 119 +bytecode array length: 113 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(6), + B(Star), R(4), B(CreateClosure), U8(3), U8(1), U8(2), - B(Star), R(9), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), - B(Star), R(6), - B(Mov), R(7), R(3), - B(PopContext), R(4), - B(Mov), R(3), R(0), - /* 38 E> */ B(CreateBlockContext), U8(4), - B(PushContext), R(4), - /* 80 E> */ B(CreateClosure), U8(6), U8(2), U8(2), - B(Star), R(5), - B(LdaConstant), U8(5), - B(Star), R(6), - B(Mov), R(5), R(7), - B(Mov), R(3), R(8), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(2), - B(LdaConstant), U8(7), B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(PopContext), R(2), + B(Mov), R(5), R(0), + /* 38 E> */ B(CreateBlockContext), U8(4), + B(PushContext), R(2), + B(LdaConstant), U8(6), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), B(StaCurrentContextSlot), U8(5), + /* 80 E> */ B(CreateClosure), U8(7), U8(2), U8(2), + B(Star), R(3), + B(LdaConstant), U8(5), + B(Star), R(5), + B(Mov), R(3), R(6), + B(Mov), R(0), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), B(LdaNull), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(8), U8(3), U8(2), - B(Star), R(9), - B(Ldar), R(6), - B(StaNamedProperty), R(9), U8(9), U8(0), - B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(8), U8(2), + B(Star), R(7), + B(Ldar), R(5), + B(StaNamedProperty), R(7), U8(9), U8(0), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(6), U8(2), B(StaCurrentContextSlot), U8(4), - B(PopContext), R(4), - B(Mov), R(2), R(1), + B(PopContext), R(2), + B(Mov), R(3), R(1), /* 126 S> */ B(Ldar), R(1), /* 126 E> */ B(Construct), R(1), R(0), U8(0), U8(2), B(LdaUndefined), @@ -388,9 +379,9 @@ constant pool: [ SHARED_FUNCTION_INFO_TYPE, SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["C"], SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, SYMBOL_TYPE, ] handlers: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden index dbe688f814..62603a93f8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden @@ -22,70 +22,68 @@ snippet: " new B; } " -frame size: 10 +frame size: 7 parameter count: 1 -bytecode array length: 137 +bytecode array length: 131 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), - B(LdaTheHole), - B(Star), R(8), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), - B(LdaConstant), U8(1), - B(Star), R(6), - B(LdaConstant), U8(3), - B(Star), R(9), - B(LdaConstant), U8(3), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(9), U8(1), + B(PushContext), R(2), + B(LdaConstant), U8(2), + B(Star), R(4), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), B(StaCurrentContextSlot), U8(4), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), + B(LdaTheHole), B(Star), R(6), - B(Mov), R(7), R(3), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(3), + B(LdaConstant), U8(1), + B(Star), R(4), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), + B(Star), R(4), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(7), - B(StaNamedProperty), R(5), U8(5), U8(0), - B(PopContext), R(4), + B(Star), R(5), + B(StaNamedProperty), R(3), U8(5), U8(0), + B(PopContext), R(2), B(Mov), R(3), R(0), /* 38 E> */ B(CreateBlockContext), U8(6), - B(PushContext), R(4), + B(PushContext), R(2), + B(LdaConstant), U8(2), + B(Star), R(4), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), + B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(8), U8(2), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(7), - B(Star), R(6), - B(LdaConstant), U8(3), - B(Star), R(9), - B(LdaConstant), U8(3), - B(Star), R(9), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(9), U8(1), - B(StaCurrentContextSlot), U8(4), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(2), + B(Star), R(4), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), + B(Star), R(4), B(CreateClosure), U8(9), U8(3), U8(2), - B(Star), R(7), - B(StaNamedProperty), R(5), U8(5), U8(2), - B(PopContext), R(4), - B(Mov), R(2), R(1), - /* 136 S> */ B(Ldar), R(3), - /* 136 E> */ B(Construct), R(3), R(0), U8(0), U8(4), - /* 145 S> */ B(Ldar), R(2), - /* 145 E> */ B(Construct), R(2), R(0), U8(0), U8(6), + B(Star), R(5), + B(StaNamedProperty), R(3), U8(5), U8(2), + B(PopContext), R(2), + B(Mov), R(3), R(1), + /* 136 S> */ B(Ldar), R(0), + /* 136 E> */ B(Construct), R(0), R(0), U8(0), U8(4), + /* 145 S> */ B(Ldar), R(1), + /* 145 E> */ B(Construct), R(1), R(0), U8(0), U8(6), B(LdaUndefined), /* 154 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, - SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["#a"], SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, SYMBOL_TYPE, SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, @@ -130,129 +128,126 @@ snippet: " new C; }; " -frame size: 15 +frame size: 12 parameter count: 1 -bytecode array length: 277 +bytecode array length: 268 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(6), - B(LdaTheHole), - B(Star), R(14), - B(CreateClosure), U8(3), U8(0), U8(2), - B(Star), R(11), + B(PushContext), R(3), B(LdaConstant), U8(2), - B(Star), R(12), - B(Mov), R(11), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), - B(Star), R(12), - B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(7), - B(LdaConstant), U8(1), - B(Star), R(8), - B(LdaConstant), U8(5), - B(Star), R(11), - B(LdaConstant), U8(5), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(11), U8(1), + B(Star), R(5), + B(LdaConstant), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), B(StaCurrentContextSlot), U8(4), - B(Mov), R(7), R(9), - B(Mov), R(13), R(10), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(3), + B(LdaTheHole), + B(Star), R(11), + B(CreateClosure), U8(4), U8(0), U8(2), B(Star), R(8), - B(Mov), R(9), R(5), - B(CreateClosure), U8(6), U8(2), U8(2), + B(LdaConstant), U8(3), + B(Star), R(9), + B(Mov), R(8), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(9), U8(3), B(Star), R(9), - B(StaNamedProperty), R(7), U8(7), U8(0), - B(PopContext), R(6), - B(Mov), R(5), R(0), + B(CreateClosure), U8(5), U8(1), U8(2), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(5), + B(Mov), R(4), R(6), + B(Mov), R(10), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), + B(CreateClosure), U8(6), U8(2), U8(2), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(7), U8(0), + B(PopContext), R(3), + B(Mov), R(4), R(0), /* 38 E> */ B(CreateBlockContext), U8(8), - B(PushContext), R(6), + B(PushContext), R(3), + B(LdaConstant), U8(2), + B(Star), R(5), + B(LdaConstant), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), + B(StaCurrentContextSlot), U8(4), + B(LdaConstant), U8(10), + B(Star), R(5), + B(LdaConstant), U8(10), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(14), - B(CreateClosure), U8(11), U8(3), U8(2), B(Star), R(11), - B(LdaConstant), U8(10), - B(Star), R(12), - B(Mov), R(11), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), - B(Star), R(12), - B(CreateClosure), U8(12), U8(4), U8(2), - B(Star), R(7), - B(LdaConstant), U8(9), + B(CreateClosure), U8(12), U8(3), U8(2), B(Star), R(8), - B(LdaConstant), U8(5), - B(Star), R(11), - B(LdaConstant), U8(5), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(11), U8(1), - B(StaCurrentContextSlot), U8(4), - B(LdaConstant), U8(13), - B(Star), R(11), - B(LdaConstant), U8(13), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(11), U8(1), - B(StaCurrentContextSlot), U8(5), + B(LdaConstant), U8(11), + B(Star), R(9), + B(Mov), R(8), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(9), U8(3), + B(Star), R(9), + B(CreateClosure), U8(13), U8(4), U8(2), + B(Star), R(4), + B(LdaConstant), U8(9), + B(Star), R(5), B(CreateClosure), U8(14), U8(5), U8(2), - B(Star), R(11), - B(CreateClosure), U8(15), U8(6), U8(2), - B(Star), R(12), - B(Mov), R(7), R(9), - B(Mov), R(13), R(10), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), B(Star), R(8), - B(Mov), R(9), R(4), - B(CreateClosure), U8(16), U8(7), U8(2), + B(CreateClosure), U8(15), U8(6), U8(2), B(Star), R(9), - B(StaNamedProperty), R(7), U8(7), U8(2), - B(PopContext), R(6), + B(Mov), R(4), R(6), + B(Mov), R(10), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(5), + B(Star), R(5), + B(CreateClosure), U8(16), U8(7), U8(2), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(7), U8(2), + B(PopContext), R(3), B(Mov), R(4), R(1), /* 140 E> */ B(CreateBlockContext), U8(17), - B(PushContext), R(6), + B(PushContext), R(3), + B(LdaConstant), U8(2), + B(Star), R(5), + B(LdaConstant), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), + B(StaCurrentContextSlot), U8(4), /* 356 E> */ B(CreateClosure), U8(19), U8(8), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(18), - B(Star), R(8), - B(LdaConstant), U8(5), - B(Star), R(11), - B(LdaConstant), U8(5), - B(Star), R(11), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(11), U8(1), - B(StaCurrentContextSlot), U8(4), - B(Mov), R(7), R(9), - B(Mov), R(4), R(10), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(3), - B(Star), R(8), - B(Mov), R(9), R(3), + B(Star), R(5), + B(Mov), R(4), R(6), + B(Mov), R(1), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), B(CreateClosure), U8(20), U8(9), U8(2), - B(Star), R(9), - B(StaNamedProperty), R(7), U8(7), U8(4), - B(PopContext), R(6), - B(Mov), R(3), R(2), - /* 430 S> */ B(Ldar), R(5), - /* 430 E> */ B(Construct), R(5), R(0), U8(0), U8(6), - /* 439 S> */ B(Ldar), R(4), - /* 439 E> */ B(Construct), R(4), R(0), U8(0), U8(8), - /* 448 S> */ B(Ldar), R(3), - /* 448 E> */ B(Construct), R(3), R(0), U8(0), U8(10), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(7), U8(4), + B(PopContext), R(3), + B(Mov), R(4), R(2), + /* 430 S> */ B(Ldar), R(0), + /* 430 E> */ B(Construct), R(0), R(0), U8(0), U8(6), + /* 439 S> */ B(Ldar), R(1), + /* 439 E> */ B(Construct), R(1), R(0), U8(0), U8(8), + /* 448 S> */ B(Ldar), R(2), + /* 448 E> */ B(Construct), R(2), R(0), U8(0), U8(10), B(LdaUndefined), /* 458 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#a"], FIXED_ARRAY_TYPE, SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["#a"], SHARED_FUNCTION_INFO_TYPE, SYMBOL_TYPE, SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#b"], FIXED_ARRAY_TYPE, SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["#b"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden index d1aab34fda..6456245741 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateMethodDeclaration.golden @@ -16,38 +16,37 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 55 +bytecode array length: 52 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(2), + B(PushContext), R(1), + B(LdaConstant), U8(2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(3), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), B(Star), R(6), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(3), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(4), - B(CreateClosure), U8(3), U8(1), U8(2), - B(StaCurrentContextSlot), U8(4), - B(Mov), R(3), R(5), + B(Mov), R(2), R(5), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), B(Star), R(4), - B(Mov), R(5), R(1), - B(LdaConstant), U8(4), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(5), U8(1), - B(StaCurrentContextSlot), U8(5), - B(PopContext), R(2), - B(Mov), R(1), R(0), + B(CreateClosure), U8(4), U8(1), U8(2), + B(StaCurrentContextSlot), U8(4), + B(PopContext), R(1), + B(Mov), R(5), R(0), B(LdaUndefined), /* 77 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["A"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["A"], ] handlers: [ ] @@ -63,64 +62,62 @@ snippet: " } } " -frame size: 9 +frame size: 8 parameter count: 1 -bytecode array length: 107 +bytecode array length: 101 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), + B(LdaConstant), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), + B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(8), - B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), + B(Star), R(7), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(6), - B(CreateClosure), U8(3), U8(1), U8(2), + B(Star), R(5), + B(Mov), R(3), R(6), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), + B(CreateClosure), U8(4), U8(1), U8(2), B(StaCurrentContextSlot), U8(4), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(3), - B(LdaConstant), U8(4), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), - B(StaCurrentContextSlot), U8(5), - B(PopContext), R(4), - B(Mov), R(3), R(0), + B(PopContext), R(2), + B(Mov), R(6), R(0), /* 38 E> */ B(CreateBlockContext), U8(5), - B(PushContext), R(4), - /* 93 E> */ B(CreateClosure), U8(7), U8(2), U8(2), - B(Star), R(5), + B(PushContext), R(2), + B(LdaConstant), U8(7), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), + B(StaCurrentContextSlot), U8(5), + /* 93 E> */ B(CreateClosure), U8(8), U8(2), U8(2), + B(Star), R(3), B(LdaConstant), U8(6), - B(Star), R(6), - B(CreateClosure), U8(8), U8(3), U8(2), + B(Star), R(5), + B(Mov), R(3), R(6), + B(Mov), R(0), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), + B(CreateClosure), U8(9), U8(3), U8(2), B(StaCurrentContextSlot), U8(4), - B(Mov), R(5), R(7), - B(Mov), R(3), R(8), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), - B(Star), R(6), - B(Mov), R(7), R(2), - B(LdaConstant), U8(9), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), - B(StaCurrentContextSlot), U8(5), - B(PopContext), R(4), - B(Mov), R(2), R(1), + B(PopContext), R(2), + B(Mov), R(6), R(1), B(LdaUndefined), /* 126 S> */ B(Return), ] constant pool: [ SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["D"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["D"], SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["E"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["E"], ] handlers: [ ] @@ -134,50 +131,47 @@ snippet: " } } " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 106 +bytecode array length: 98 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(6), + B(Star), R(4), B(CreateClosure), U8(3), U8(1), U8(2), - B(Star), R(9), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), - B(Star), R(6), - B(Mov), R(7), R(3), - B(PopContext), R(4), - B(Mov), R(3), R(0), + B(Star), R(7), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(PopContext), R(2), + B(Mov), R(5), R(0), /* 38 E> */ B(CreateBlockContext), U8(4), - B(PushContext), R(4), - /* 77 E> */ B(CreateClosure), U8(6), U8(2), U8(2), - B(Star), R(5), + B(PushContext), R(2), + B(LdaConstant), U8(6), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(4), U8(1), + B(StaCurrentContextSlot), U8(5), + /* 77 E> */ B(CreateClosure), U8(7), U8(2), U8(2), + B(Star), R(3), B(LdaConstant), U8(5), - B(Star), R(6), - B(CreateClosure), U8(7), U8(3), U8(2), + B(Star), R(5), + B(Mov), R(3), R(6), + B(Mov), R(0), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), + B(CreateClosure), U8(8), U8(3), U8(2), B(StaCurrentContextSlot), U8(4), - B(Mov), R(5), R(7), - B(Mov), R(3), R(8), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3), B(Star), R(6), - B(Mov), R(7), R(2), - B(LdaConstant), U8(8), - B(Star), R(7), - B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(7), U8(1), - B(StaCurrentContextSlot), U8(5), - B(LdaCurrentContextSlot), U8(4), - B(Star), R(8), - B(Ldar), R(6), - B(StaNamedProperty), R(8), U8(9), U8(0), - B(PopContext), R(4), - B(Mov), R(2), R(1), + B(Ldar), R(5), + B(StaNamedProperty), R(6), U8(9), U8(0), + B(PopContext), R(2), + B(Mov), R(3), R(1), B(LdaUndefined), /* 118 S> */ B(Return), ] @@ -188,9 +182,9 @@ constant pool: [ SHARED_FUNCTION_INFO_TYPE, SCOPE_INFO_TYPE, FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["C"], SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["C"], SYMBOL_TYPE, ] handlers: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden index c91e7b06aa..4b893861bf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden @@ -21,59 +21,57 @@ snippet: " new B; } " -frame size: 10 +frame size: 8 parameter count: 1 -bytecode array length: 125 +bytecode array length: 119 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(6), + B(Star), R(4), /* 60 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), - B(Star), R(9), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), - B(Star), R(6), - B(Mov), R(7), R(3), - B(CreateClosure), U8(4), U8(1), U8(2), B(Star), R(7), - B(StaNamedProperty), R(5), U8(5), U8(0), - B(PopContext), R(4), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(CreateClosure), U8(4), U8(1), U8(2), + B(Star), R(5), + B(StaNamedProperty), R(3), U8(5), U8(0), + B(PopContext), R(2), B(Mov), R(3), R(0), /* 38 E> */ B(CreateBlockContext), U8(6), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(8), U8(2), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(7), - B(Star), R(6), + B(Star), R(4), /* 99 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), - B(Star), R(9), - B(Mov), R(5), R(7), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), - B(Star), R(6), - B(Mov), R(7), R(2), - B(CreateClosure), U8(9), U8(3), U8(2), B(Star), R(7), - B(StaNamedProperty), R(5), U8(5), U8(2), - B(PopContext), R(4), - B(Mov), R(2), R(1), - /* 120 S> */ B(Ldar), R(3), - /* 120 E> */ B(Construct), R(3), R(0), U8(0), U8(4), - /* 129 S> */ B(Ldar), R(2), - /* 129 E> */ B(Construct), R(2), R(0), U8(0), U8(6), + B(Mov), R(3), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), + B(Star), R(4), + B(CreateClosure), U8(9), U8(3), U8(2), + B(Star), R(5), + B(StaNamedProperty), R(3), U8(5), U8(2), + B(PopContext), R(2), + B(Mov), R(3), R(1), + /* 120 S> */ B(Ldar), R(0), + /* 120 E> */ B(Construct), R(0), R(0), U8(0), U8(4), + /* 129 S> */ B(Ldar), R(1), + /* 129 E> */ B(Construct), R(1), R(0), U8(0), U8(6), B(LdaUndefined), /* 138 S> */ B(Return), ] @@ -122,100 +120,97 @@ snippet: " new C; } " -frame size: 15 +frame size: 12 parameter count: 1 -bytecode array length: 238 +bytecode array length: 229 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(6), + B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(14), - B(CreateClosure), U8(3), U8(0), U8(2), B(Star), R(11), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(8), B(LdaConstant), U8(2), - B(Star), R(12), - B(Mov), R(11), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), - B(Star), R(12), + B(Star), R(9), + B(Mov), R(8), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(9), U8(3), + B(Star), R(9), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(1), - B(Star), R(8), + B(Star), R(5), /* 77 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), - B(Star), R(11), - B(Mov), R(7), R(9), - B(Mov), R(13), R(10), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4), B(Star), R(8), - B(Mov), R(9), R(5), + B(Mov), R(4), R(6), + B(Mov), R(10), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(4), + B(Star), R(5), B(CreateClosure), U8(6), U8(2), U8(2), - B(Star), R(9), - B(StaNamedProperty), R(7), U8(7), U8(0), - B(PopContext), R(6), - B(Mov), R(5), R(0), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(7), U8(0), + B(PopContext), R(3), + B(Mov), R(4), R(0), /* 38 E> */ B(CreateBlockContext), U8(8), - B(PushContext), R(6), + B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(14), - B(CreateClosure), U8(11), U8(3), U8(2), B(Star), R(11), + B(CreateClosure), U8(11), U8(3), U8(2), + B(Star), R(8), B(LdaConstant), U8(10), - B(Star), R(12), - B(Mov), R(11), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), - B(Star), R(12), + B(Star), R(9), + B(Mov), R(8), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(9), U8(3), + B(Star), R(9), B(CreateClosure), U8(12), U8(4), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(9), - B(Star), R(8), + B(Star), R(5), /* 133 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), - B(Star), R(11), - B(CreateClosure), U8(13), U8(5), U8(2), - B(Star), R(12), - B(Mov), R(7), R(9), - B(Mov), R(13), R(10), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), B(Star), R(8), - B(Mov), R(9), R(4), - B(CreateClosure), U8(14), U8(6), U8(2), + B(CreateClosure), U8(13), U8(5), U8(2), B(Star), R(9), - B(StaNamedProperty), R(7), U8(7), U8(2), - B(PopContext), R(6), + B(Mov), R(4), R(6), + B(Mov), R(10), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(5), + B(Star), R(5), + B(CreateClosure), U8(14), U8(6), U8(2), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(7), U8(2), + B(PopContext), R(3), B(Mov), R(4), R(1), /* 90 E> */ B(CreateBlockContext), U8(15), - B(PushContext), R(6), + B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), /* 236 E> */ B(CreateClosure), U8(17), U8(7), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(16), - B(Star), R(8), + B(Star), R(5), /* 256 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), - B(Star), R(11), - B(Mov), R(7), R(9), - B(Mov), R(4), R(10), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4), B(Star), R(8), - B(Mov), R(9), R(3), + B(Mov), R(4), R(6), + B(Mov), R(1), R(7), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(4), + B(Star), R(5), B(CreateClosure), U8(18), U8(8), U8(2), - B(Star), R(9), - B(StaNamedProperty), R(7), U8(7), U8(4), - B(PopContext), R(6), - B(Mov), R(3), R(2), - /* 329 S> */ B(Ldar), R(5), - /* 329 E> */ B(Construct), R(5), R(0), U8(0), U8(6), - /* 338 S> */ B(Ldar), R(4), - /* 338 E> */ B(Construct), R(4), R(0), U8(0), U8(8), - /* 347 S> */ B(Ldar), R(3), - /* 347 E> */ B(Construct), R(3), R(0), U8(0), U8(10), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(7), U8(4), + B(PopContext), R(3), + B(Mov), R(4), R(2), + /* 329 S> */ B(Ldar), R(0), + /* 329 E> */ B(Construct), R(0), R(0), U8(0), U8(6), + /* 338 S> */ B(Ldar), R(1), + /* 338 E> */ B(Construct), R(1), R(0), U8(0), U8(8), + /* 347 S> */ B(Ldar), R(2), + /* 347 E> */ B(Construct), R(2), R(0), U8(0), U8(10), B(LdaUndefined), /* 356 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden index f03337e4aa..f47a701358 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden @@ -25,85 +25,83 @@ snippet: " new B; } " -frame size: 11 +frame size: 9 parameter count: 1 -bytecode array length: 191 +bytecode array length: 185 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(2), U8(0), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(6), + B(Star), R(4), /* 60 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), - B(Star), R(9), + B(Star), R(7), /* 92 S> */ B(LdaConstant), U8(4), - B(Star), R(10), + B(Star), R(8), B(LdaConstant), U8(5), - B(TestEqualStrict), R(10), U8(0), - B(Mov), R(5), R(7), + B(TestEqualStrict), R(8), U8(0), + B(Mov), R(3), R(5), B(JumpIfFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(10), + B(Ldar), R(8), B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5), - B(Star), R(6), - B(Mov), R(5), R(3), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(5), + B(Star), R(4), B(CreateClosure), U8(6), U8(1), U8(2), - B(Star), R(7), - B(StaNamedProperty), R(5), U8(7), U8(1), + B(Star), R(5), + B(StaNamedProperty), R(3), U8(7), U8(1), B(CreateClosure), U8(8), U8(2), U8(2), - B(Star), R(9), - B(CallProperty0), R(9), R(3), U8(3), - B(PopContext), R(4), + B(Star), R(7), + B(CallProperty0), R(7), R(3), U8(3), + B(PopContext), R(2), B(Mov), R(3), R(0), /* 38 E> */ B(CreateBlockContext), U8(9), - B(PushContext), R(4), + B(PushContext), R(2), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(8), + B(Star), R(6), B(CreateClosure), U8(11), U8(3), U8(2), - B(Star), R(5), + B(Star), R(3), B(LdaConstant), U8(10), - B(Star), R(6), + B(Star), R(4), /* 131 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), - B(Star), R(9), + B(Star), R(7), /* 176 S> */ B(LdaConstant), U8(4), - B(Star), R(10), + B(Star), R(8), B(LdaConstant), U8(5), - B(TestEqualStrict), R(10), U8(0), - B(Mov), R(5), R(7), + B(TestEqualStrict), R(8), U8(0), + B(Mov), R(3), R(5), B(JumpIfFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(10), + B(Ldar), R(8), B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5), - B(Star), R(6), - B(Mov), R(5), R(2), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(5), + B(Star), R(4), B(CreateClosure), U8(12), U8(4), U8(2), - B(Star), R(7), - B(StaNamedProperty), R(5), U8(7), U8(5), + B(Star), R(5), + B(StaNamedProperty), R(3), U8(7), U8(5), B(CreateClosure), U8(13), U8(5), U8(2), - B(Star), R(9), - B(CallProperty0), R(9), R(2), U8(7), - B(PopContext), R(4), - B(Mov), R(2), R(1), + B(Star), R(7), + B(CallProperty0), R(7), R(3), U8(7), + B(PopContext), R(2), + B(Mov), R(3), R(1), /* 197 S> */ B(Ldar), R(0), /* 197 E> */ B(Construct), R(0), R(0), U8(0), U8(9), - /* 206 S> */ B(Ldar), R(2), - /* 206 E> */ B(Construct), R(2), R(0), U8(0), U8(11), + /* 206 S> */ B(Ldar), R(1), + /* 206 E> */ B(Construct), R(1), R(0), U8(0), U8(11), B(LdaUndefined), /* 215 S> */ B(Return), ] @@ -162,141 +160,138 @@ snippet: " new C; } " -frame size: 15 +frame size: 12 parameter count: 1 -bytecode array length: 343 +bytecode array length: 334 bytecodes: [ /* 30 E> */ B(StackCheck), B(CreateBlockContext), U8(0), - B(PushContext), R(6), + B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(14), - B(CreateClosure), U8(3), U8(0), U8(2), B(Star), R(11), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(8), B(LdaConstant), U8(2), - B(Star), R(12), - B(Mov), R(11), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), - B(Star), R(12), + B(Star), R(9), + B(Mov), R(8), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(9), U8(3), + B(Star), R(9), B(CreateClosure), U8(4), U8(1), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(1), - B(Star), R(8), + B(Star), R(5), /* 77 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), - B(Star), R(11), + B(Star), R(8), /* 109 S> */ B(LdaConstant), U8(6), - B(Star), R(12), + B(Star), R(9), B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), U8(0), - B(Mov), R(13), R(10), - B(Mov), R(7), R(9), + B(TestEqualStrict), R(9), U8(0), + B(Mov), R(10), R(7), + B(Mov), R(4), R(6), B(JumpIfFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(12), + B(Ldar), R(9), B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), - B(Star), R(8), - B(Mov), R(7), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(5), + B(Star), R(5), B(CreateClosure), U8(8), U8(2), U8(2), - B(Star), R(9), - B(StaNamedProperty), R(7), U8(9), U8(1), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(9), U8(1), B(CreateClosure), U8(10), U8(3), U8(2), - B(Star), R(11), - B(CallProperty0), R(11), R(5), U8(3), - B(PopContext), R(6), - B(Mov), R(5), R(0), + B(Star), R(8), + B(CallProperty0), R(8), R(4), U8(3), + B(PopContext), R(3), + B(Mov), R(4), R(0), /* 38 E> */ B(CreateBlockContext), U8(11), - B(PushContext), R(6), + B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(5), B(LdaTheHole), - B(Star), R(14), - B(CreateClosure), U8(14), U8(4), U8(2), B(Star), R(11), + B(CreateClosure), U8(14), U8(4), U8(2), + B(Star), R(8), B(LdaConstant), U8(13), - B(Star), R(12), - B(Mov), R(11), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), - B(Star), R(12), + B(Star), R(9), + B(Mov), R(8), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(9), U8(3), + B(Star), R(9), B(CreateClosure), U8(15), U8(5), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(12), - B(Star), R(8), + B(Star), R(5), /* 165 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), - B(Star), R(11), + B(Star), R(8), /* 210 S> */ B(LdaConstant), U8(6), - B(Star), R(12), + B(Star), R(9), B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), U8(0), - B(Mov), R(7), R(9), - B(Mov), R(13), R(10), + B(TestEqualStrict), R(9), U8(0), + B(Mov), R(4), R(6), + B(Mov), R(10), R(7), B(JumpIfFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(12), + B(Ldar), R(9), B(StaCurrentContextSlot), U8(5), B(CreateClosure), U8(16), U8(6), U8(2), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(6), - B(Star), R(8), - B(Mov), R(7), R(4), + B(Star), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(6), + B(Star), R(5), B(CreateClosure), U8(17), U8(7), U8(2), - B(Star), R(9), - B(StaNamedProperty), R(7), U8(9), U8(5), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(9), U8(5), B(CreateClosure), U8(18), U8(8), U8(2), - B(Star), R(11), - B(CallProperty0), R(11), R(4), U8(7), - B(PopContext), R(6), + B(Star), R(8), + B(CallProperty0), R(8), R(4), U8(7), + B(PopContext), R(3), B(Mov), R(4), R(1), /* 122 E> */ B(CreateBlockContext), U8(19), - B(PushContext), R(6), + B(PushContext), R(3), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(5), /* 313 E> */ B(CreateClosure), U8(21), U8(9), U8(2), - B(Star), R(7), + B(Star), R(4), B(LdaConstant), U8(20), - B(Star), R(8), + B(Star), R(5), /* 333 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), - B(Star), R(11), + B(Star), R(8), /* 378 S> */ B(LdaConstant), U8(6), - B(Star), R(12), + B(Star), R(9), B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), U8(0), - B(Mov), R(4), R(10), - B(Mov), R(7), R(9), + B(TestEqualStrict), R(9), U8(0), + B(Mov), R(4), R(6), + B(Mov), R(1), R(7), B(JumpIfFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(12), + B(Ldar), R(9), B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), - B(Star), R(8), - B(Mov), R(7), R(3), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(5), + B(Star), R(5), B(CreateClosure), U8(22), U8(10), U8(2), - B(Star), R(9), - B(StaNamedProperty), R(7), U8(9), U8(9), + B(Star), R(6), + B(StaNamedProperty), R(4), U8(9), U8(9), B(CreateClosure), U8(23), U8(11), U8(2), - B(Star), R(11), - B(Ldar), R(3), - B(StaNamedProperty), R(11), U8(24), U8(11), - B(CallProperty0), R(11), R(3), U8(13), - B(PopContext), R(6), - B(Mov), R(3), R(2), + B(Star), R(8), + B(Ldar), R(4), + B(StaNamedProperty), R(8), U8(24), U8(11), + B(CallProperty0), R(8), R(4), U8(13), + B(PopContext), R(3), + B(Mov), R(4), R(2), /* 456 S> */ B(Ldar), R(0), /* 456 E> */ B(Construct), R(0), R(0), U8(0), U8(15), /* 465 S> */ B(Ldar), R(1), /* 465 E> */ B(Construct), R(1), R(0), U8(0), U8(17), - /* 474 S> */ B(Ldar), R(3), - /* 474 E> */ B(Construct), R(3), R(0), U8(0), U8(19), + /* 474 S> */ B(Ldar), R(2), + /* 474 E> */ B(Construct), R(2), R(0), U8(0), U8(19), B(LdaUndefined), /* 483 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden new file mode 100644 index 0000000000..888fca1cf8 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden @@ -0,0 +1,290 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: no +test function name: test +private methods: yes + +--- +snippet: " + class A { + static #a() { return 1; } + static test() { return this.#a(); } + } + + var test = A.test; + test(); +" +frame size: 4 +parameter count: 1 +bytecode array length: 36 +bytecodes: [ + /* 51 E> */ B(StackCheck), + /* 56 S> */ B(LdaCurrentContextSlot), U8(5), + B(TestReferenceEqual), R(this), + B(Mov), R(this), R(1), + B(JumpIfTrue), U8(18), + B(Wide), B(LdaSmi), I16(259), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kNewTypeError), R(2), U8(2), + B(Throw), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(0), + /* 70 E> */ B(CallAnyReceiver), R(0), R(1), U8(1), U8(0), + /* 73 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#a"], +] +handlers: [ +] + +--- +snippet: " + class B { + static #b() { return 1; } + static test() { this.#b = 1; } + } + + var test = B.test; + test(); +" +frame size: 2 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 51 E> */ B(StackCheck), + /* 56 S> */ B(Wide), B(LdaSmi), I16(261), + B(Star), R(0), + B(LdaConstant), U8(0), + B(Star), R(1), + /* 64 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(0), U8(2), + B(Throw), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#b"], +] +handlers: [ +] + +--- +snippet: " + class C { + static #c() { return 1; } + static test() { this.#c++; } + } + + var test = C.test; + test(); +" +frame size: 2 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 51 E> */ B(StackCheck), + /* 56 S> */ B(Wide), B(LdaSmi), I16(261), + B(Star), R(0), + B(LdaConstant), U8(0), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kNewTypeError), R(0), U8(2), + B(Throw), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#c"], +] +handlers: [ +] + +--- +snippet: " + class D { + static get #d() { return 1; } + static set #d(val) { } + + static test() { + this.#d++; + this.#d = 1; + return this.#d; + } + } + + var test = D.test; + test(); +" +frame size: 5 +parameter count: 1 +bytecode array length: 143 +bytecodes: [ + /* 81 E> */ B(StackCheck), + /* 90 S> */ B(LdaCurrentContextSlot), U8(4), + B(Star), R(1), + B(LdaCurrentContextSlot), U8(5), + /* 94 E> */ B(TestReferenceEqual), R(this), + B(Mov), R(this), R(0), + B(JumpIfTrue), U8(18), + B(Wide), B(LdaSmi), I16(259), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kNewTypeError), R(2), U8(2), + B(Throw), + B(CallRuntime), U16(Runtime::kLoadPrivateGetter), R(1), U8(1), + B(Star), R(2), + B(CallProperty0), R(2), R(0), U8(0), + B(Inc), U8(2), + B(Star), R(2), + /* 97 E> */ B(CallRuntime), U16(Runtime::kLoadPrivateSetter), R(1), U8(1), + B(Star), R(3), + B(CallProperty1), R(3), R(0), R(2), U8(3), + /* 105 S> */ B(LdaSmi), I8(1), + B(Star), R(0), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(2), + B(LdaCurrentContextSlot), U8(5), + /* 109 E> */ B(TestReferenceEqual), R(this), + B(Mov), R(this), R(1), + B(JumpIfTrue), U8(18), + B(Wide), B(LdaSmi), I16(260), + B(Star), R(3), + B(LdaConstant), U8(0), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kNewTypeError), R(3), U8(2), + B(Throw), + B(CallRuntime), U16(Runtime::kLoadPrivateSetter), R(2), U8(1), + B(Star), R(3), + B(CallProperty1), R(3), R(1), R(0), U8(5), + /* 122 S> */ B(LdaCurrentContextSlot), U8(4), + B(Star), R(1), + B(LdaCurrentContextSlot), U8(5), + /* 133 E> */ B(TestReferenceEqual), R(this), + B(Mov), R(this), R(0), + B(JumpIfTrue), U8(18), + B(Wide), B(LdaSmi), I16(259), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kNewTypeError), R(2), U8(2), + B(Throw), + B(CallRuntime), U16(Runtime::kLoadPrivateGetter), R(1), U8(1), + B(Star), R(2), + B(CallProperty0), R(2), R(0), U8(7), + /* 137 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#d"], +] +handlers: [ +] + +--- +snippet: " + class E { + static get #e() { return 1; } + static test() { this.#e++; } + } + var test = E.test; + test(); +" +frame size: 2 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 55 E> */ B(StackCheck), + /* 60 S> */ B(Wide), B(LdaSmi), I16(263), + B(Star), R(0), + B(LdaConstant), U8(0), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kNewTypeError), R(0), U8(2), + B(Throw), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#e"], +] +handlers: [ +] + +--- +snippet: " + class F { + static set #f(val) { } + static test() { this.#f++; } + } + var test = F.test; + test(); +" +frame size: 2 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 48 E> */ B(StackCheck), + /* 53 S> */ B(Wide), B(LdaSmi), I16(262), + B(Star), R(0), + B(LdaConstant), U8(0), + B(Star), R(1), + B(CallRuntime), U16(Runtime::kNewTypeError), R(0), U8(2), + B(Throw), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#f"], +] +handlers: [ +] + +--- +snippet: " + class G { + static get #d() { return 1; } + static test() { this.#d = 1; } + } + var test = G.test; + test(); +" +frame size: 2 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 55 E> */ B(StackCheck), + /* 60 S> */ B(Wide), B(LdaSmi), I16(263), + B(Star), R(0), + B(LdaConstant), U8(0), + B(Star), R(1), + /* 68 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(0), U8(2), + B(Throw), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#d"], +] +handlers: [ +] + +--- +snippet: " + class H { + set #h(val) { } + static test() { this.#h; } + } + var test = H.test; + test(); +" +frame size: 3 +parameter count: 1 +bytecode array length: 17 +bytecodes: [ + /* 41 E> */ B(StackCheck), + /* 46 S> */ B(Wide), B(LdaSmi), I16(262), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2), + B(Throw), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["#h"], +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden new file mode 100644 index 0000000000..fda73f08d2 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticPrivateMethodDeclaration.golden @@ -0,0 +1,231 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: yes +private methods: yes + +--- +snippet: " + { + class A { + static #a() { return 1; } + } + } +" +frame size: 6 +parameter count: 1 +bytecode array length: 41 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(Star), R(5), + B(CreateClosure), U8(2), U8(0), U8(2), + B(Star), R(2), + B(LdaConstant), U8(1), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(CreateClosure), U8(3), U8(1), U8(2), + B(StaCurrentContextSlot), U8(4), + B(PopContext), R(1), + B(Mov), R(4), R(0), + B(LdaUndefined), + /* 84 S> */ B(Return), +] +constant pool: [ + SCOPE_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + +--- +snippet: " + { + class A { + static get #a() { return 1; } + } + } +" +frame size: 6 +parameter count: 1 +bytecode array length: 51 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(Star), R(5), + B(CreateClosure), U8(2), U8(0), U8(2), + B(Star), R(2), + B(LdaConstant), U8(1), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(CreateClosure), U8(3), U8(1), U8(2), + B(Star), R(4), + B(LdaNull), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(4), U8(2), + B(StaCurrentContextSlot), U8(4), + B(PopContext), R(1), + B(Mov), R(2), R(0), + B(LdaUndefined), + /* 88 S> */ B(Return), +] +constant pool: [ + SCOPE_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + +--- +snippet: " + { + class A { + static set #a(val) { } + } + } +" +frame size: 6 +parameter count: 1 +bytecode array length: 51 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(Star), R(5), + B(CreateClosure), U8(2), U8(0), U8(2), + B(Star), R(2), + B(LdaConstant), U8(1), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(LdaNull), + B(Star), R(4), + B(CreateClosure), U8(3), U8(1), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(4), U8(2), + B(StaCurrentContextSlot), U8(4), + B(PopContext), R(1), + B(Mov), R(2), R(0), + B(LdaUndefined), + /* 81 S> */ B(Return), +] +constant pool: [ + SCOPE_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + +--- +snippet: " + { + class A { + static get #a() { return 1; } + static set #a(val) { } + } + } +" +frame size: 6 +parameter count: 1 +bytecode array length: 54 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaTheHole), + B(Star), R(5), + B(CreateClosure), U8(2), U8(0), U8(2), + B(Star), R(2), + B(LdaConstant), U8(1), + B(Star), R(3), + B(Mov), R(2), R(4), + B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3), + B(Star), R(3), + B(CreateClosure), U8(3), U8(1), U8(2), + B(Star), R(4), + B(CreateClosure), U8(4), U8(2), U8(2), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kCreatePrivateAccessors), R(4), U8(2), + B(StaCurrentContextSlot), U8(4), + B(PopContext), R(1), + B(Mov), R(2), R(0), + B(LdaUndefined), + /* 115 S> */ B(Return), +] +constant pool: [ + SCOPE_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + +--- +snippet: " + { + class A { + static #a() { } + #b() { } + } + } +" +frame size: 7 +parameter count: 1 +bytecode array length: 58 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(CreateBlockContext), U8(0), + B(PushContext), R(1), + B(LdaConstant), U8(2), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(3), U8(1), + B(StaCurrentContextSlot), U8(6), + B(LdaTheHole), + B(Star), R(6), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(2), + B(LdaConstant), U8(1), + B(Star), R(4), + B(Mov), R(2), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), + B(Star), R(4), + B(CreateClosure), U8(4), U8(1), U8(2), + B(StaCurrentContextSlot), U8(4), + B(CreateClosure), U8(5), U8(2), U8(2), + B(StaCurrentContextSlot), U8(5), + B(PopContext), R(1), + B(Mov), R(5), R(0), + B(LdaUndefined), + /* 87 S> */ B(Return), +] +constant pool: [ + SCOPE_INFO_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["A"], + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden index e3eed68138..2ec0a8baa5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden @@ -91,9 +91,9 @@ snippet: " test = new B(1, 2, 3).constructor; })(); " -frame size: 12 +frame size: 11 parameter count: 1 -bytecode array length: 124 +bytecode array length: 112 bytecodes: [ B(CreateRestParameter), B(Star), R(3), @@ -111,15 +111,11 @@ bytecodes: [ B(Ldar), R(6), B(Inc), U8(3), /* 152 S> */ B(Star), R(6), - B(GetIterator), R(3), U8(4), - B(Star), R(11), - B(CallProperty0), R(11), R(3), U8(6), - B(Mov), R(1), R(4), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), + B(GetIterator), R(3), U8(4), U8(6), B(Star), R(9), B(LdaNamedProperty), R(9), U8(0), U8(8), B(Star), R(8), + B(Mov), R(1), R(4), B(CallProperty0), R(8), R(9), U8(14), B(Star), R(10), B(JumpIfJSReceiver), U8(7), diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc index 746c554087..2fe3658813 100644 --- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc +++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc @@ -47,11 +47,12 @@ class ProgramOptions final { oneshot_opt_(false), async_iteration_(false), private_methods_(false), + top_level_await_(false), verbose_(false) {} bool Validate() const; - void UpdateFromHeader(std::istream& stream); // NOLINT - void PrintHeader(std::ostream& stream) const; // NOLINT + void UpdateFromHeader(std::istream* stream); + void PrintHeader(std::ostream* stream) const; bool parsing_failed() const { return parsing_failed_; } bool print_help() const { return print_help_; } @@ -70,6 +71,7 @@ class ProgramOptions final { bool oneshot_opt() const { return oneshot_opt_; } bool async_iteration() const { return async_iteration_; } bool private_methods() const { return private_methods_; } + bool top_level_await() const { return top_level_await_; } bool verbose() const { return verbose_; } bool suppress_runtime_errors() const { return baseline() && !verbose_; } std::vector<std::string> input_filenames() const { return input_filenames_; } @@ -90,6 +92,7 @@ class ProgramOptions final { bool oneshot_opt_; bool async_iteration_; bool private_methods_; + bool top_level_await_; bool verbose_; std::vector<std::string> input_filenames_; std::string output_filename_; @@ -196,6 +199,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) { options.async_iteration_ = true; } else if (strcmp(argv[i], "--private-methods") == 0) { options.private_methods_ = true; + } else if (strcmp(argv[i], "--harmony-top-level-await") == 0) { + options.top_level_await_ = true; } else if (strcmp(argv[i], "--verbose") == 0) { options.verbose_ = true; } else if (strncmp(argv[i], "--output=", 9) == 0) { @@ -291,17 +296,17 @@ bool ProgramOptions::Validate() const { return true; } -void ProgramOptions::UpdateFromHeader(std::istream& stream) { +void ProgramOptions::UpdateFromHeader(std::istream* stream) { std::string line; const char* kPrintCallee = "print callee: "; const char* kOneshotOpt = "oneshot opt: "; // Skip to the beginning of the options header - while (std::getline(stream, line)) { + while (std::getline(*stream, line)) { if (line == "---") break; } - while (std::getline(stream, line)) { + while (std::getline(*stream, line)) { if (line.compare(0, 8, "module: ") == 0) { module_ = ParseBoolean(line.c_str() + 8); } else if (line.compare(0, 6, "wrap: ") == 0) { @@ -318,6 +323,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { async_iteration_ = ParseBoolean(line.c_str() + 17); } else if (line.compare(0, 17, "private methods: ") == 0) { private_methods_ = ParseBoolean(line.c_str() + 17); + } else if (line.compare(0, 17, "top level await: ") == 0) { + top_level_await_ = ParseBoolean(line.c_str() + 17); } else if (line == "---") { break; } else if (line.empty()) { @@ -328,22 +335,23 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { } } -void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT - stream << "---" - << "\nwrap: " << BooleanToString(wrap_); +void ProgramOptions::PrintHeader(std::ostream* stream) const { + *stream << "---" + << "\nwrap: " << BooleanToString(wrap_); if (!test_function_name_.empty()) { - stream << "\ntest function name: " << test_function_name_; + *stream << "\ntest function name: " << test_function_name_; } - if (module_) stream << "\nmodule: yes"; - if (top_level_) stream << "\ntop level: yes"; - if (print_callee_) stream << "\nprint callee: yes"; - if (oneshot_opt_) stream << "\noneshot opt: yes"; - if (async_iteration_) stream << "\nasync iteration: yes"; - if (private_methods_) stream << "\nprivate methods: yes"; + if (module_) *stream << "\nmodule: yes"; + if (top_level_) *stream << "\ntop level: yes"; + if (print_callee_) *stream << "\nprint callee: yes"; + if (oneshot_opt_) *stream << "\noneshot opt: yes"; + if (async_iteration_) *stream << "\nasync iteration: yes"; + if (private_methods_) *stream << "\nprivate methods: yes"; + if (top_level_await_) *stream << "\ntop level await: yes"; - stream << "\n\n"; + *stream << "\n\n"; } V8InitializationScope::V8InitializationScope(const char* exec_path) @@ -370,17 +378,17 @@ V8InitializationScope::~V8InitializationScope() { v8::V8::ShutdownPlatform(); } -std::string ReadRawJSSnippet(std::istream& stream) { // NOLINT +std::string ReadRawJSSnippet(std::istream* stream) { std::stringstream body_buffer; - CHECK(body_buffer << stream.rdbuf()); + CHECK(body_buffer << stream->rdbuf()); return body_buffer.str(); } -bool ReadNextSnippet(std::istream& stream, std::string* string_out) { // NOLINT +bool ReadNextSnippet(std::istream* stream, std::string* string_out) { std::string line; bool found_begin_snippet = false; string_out->clear(); - while (std::getline(stream, line)) { + while (std::getline(*stream, line)) { if (line == "snippet: \"") { found_begin_snippet = true; continue; @@ -420,8 +428,7 @@ std::string UnescapeString(const std::string& escaped_string) { } void ExtractSnippets(std::vector<std::string>* snippet_list, - std::istream& body_stream, // NOLINT - bool read_raw_js_snippet) { + std::istream* body_stream, bool read_raw_js_snippet) { if (read_raw_js_snippet) { snippet_list->push_back(ReadRawJSSnippet(body_stream)); } else { @@ -432,7 +439,7 @@ void ExtractSnippets(std::vector<std::string>* snippet_list, } } -void GenerateExpectationsFile(std::ostream& stream, // NOLINT +void GenerateExpectationsFile(std::ostream* stream, const std::vector<std::string>& snippet_list, const V8InitializationScope& platform, const ProgramOptions& options) { @@ -452,14 +459,16 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT } if (options.private_methods()) i::FLAG_harmony_private_methods = true; + if (options.top_level_await()) i::FLAG_harmony_top_level_await = true; - stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n"; + *stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n"; options.PrintHeader(stream); for (const std::string& snippet : snippet_list) { printer.PrintExpectation(stream, snippet); } i::FLAG_harmony_private_methods = false; + i::FLAG_harmony_top_level_await = false; } bool WriteExpectationsFile(const std::vector<std::string>& snippet_list, @@ -477,7 +486,7 @@ bool WriteExpectationsFile(const std::vector<std::string>& snippet_list, std::ostream& output_stream = options.write_to_stdout() ? std::cout : output_file_handle; - GenerateExpectationsFile(output_stream, snippet_list, platform, options); + GenerateExpectationsFile(&output_stream, snippet_list, platform, options); return true; } @@ -487,7 +496,7 @@ std::string WriteExpectationsToString( const V8InitializationScope& platform, const ProgramOptions& options) { std::stringstream output_string; - GenerateExpectationsFile(output_string, snippet_list, platform, options); + GenerateExpectationsFile(&output_string, snippet_list, platform, options); return output_string.str(); } @@ -520,6 +529,7 @@ void PrintUsage(const char* exec_path) { "Specify the name of the test function.\n" " --top-level Process top level code, not the top-level function.\n" " --private-methods Enable harmony_private_methods flag.\n" + " --top-level-await Enable await at the module level.\n" " --output=file.name\n" " Specify the output file. If not specified, output goes to " "stdout.\n" @@ -612,7 +622,7 @@ int main(int argc, char** argv) { // Rebaseline will never get here, so we will always take the // GenerateExpectationsFile at the end of this function. DCHECK(!options.rebaseline() && !options.check_baseline()); - ExtractSnippets(&snippet_list, std::cin, options.read_raw_js_snippet()); + ExtractSnippets(&snippet_list, &std::cin, options.read_raw_js_snippet()); } else { bool check_failed = false; for (const std::string& input_filename : options.input_filenames()) { @@ -628,11 +638,11 @@ int main(int argc, char** argv) { ProgramOptions updated_options = options; if (options.baseline()) { - updated_options.UpdateFromHeader(input_stream); + updated_options.UpdateFromHeader(&input_stream); CHECK(updated_options.Validate()); } - ExtractSnippets(&snippet_list, input_stream, + ExtractSnippets(&snippet_list, &input_stream, options.read_raw_js_snippet()); input_stream.close(); diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index fda02933aa..be0b129418 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -95,10 +95,10 @@ class InitializedIgnitionHandleScope : public InitializedHandleScope { } }; -void SkipGoldenFileHeader(std::istream& stream) { // NOLINT +void SkipGoldenFileHeader(std::istream* stream) { std::string line; int separators_seen = 0; - while (std::getline(stream, line)) { + while (std::getline(*stream, line)) { if (line == "---") separators_seen += 1; if (separators_seen == 2) return; } @@ -107,7 +107,7 @@ void SkipGoldenFileHeader(std::istream& stream) { // NOLINT std::string LoadGolden(const std::string& golden_filename) { std::ifstream expected_file((kGoldenFileDirectory + golden_filename).c_str()); CHECK(expected_file.is_open()); - SkipGoldenFileHeader(expected_file); + SkipGoldenFileHeader(&expected_file); std::ostringstream expected_stream; // Restore the first separator, which was consumed by SkipGoldenFileHeader expected_stream << "---\n" << expected_file.rdbuf(); @@ -125,31 +125,30 @@ std::string BuildActual(const BytecodeExpectationsPrinter& printer, if (prologue) source_code += prologue; source_code += snippet; if (epilogue) source_code += epilogue; - printer.PrintExpectation(actual_stream, source_code); + printer.PrintExpectation(&actual_stream, source_code); } return actual_stream.str(); } // inplace left trim -static inline void ltrim(std::string& str) { // NOLINT(runtime/references) - str.erase(str.begin(), - std::find_if(str.begin(), str.end(), - [](unsigned char ch) { return !std::isspace(ch); })); +static inline void ltrim(std::string* str) { + str->erase(str->begin(), + std::find_if(str->begin(), str->end(), + [](unsigned char ch) { return !std::isspace(ch); })); } // inplace right trim -static inline void rtrim(std::string& str) { // NOLINT(runtime/references) - str.erase(std::find_if(str.rbegin(), str.rend(), - [](unsigned char ch) { return !std::isspace(ch); }) - .base(), - str.end()); +static inline void rtrim(std::string* str) { + str->erase(std::find_if(str->rbegin(), str->rend(), + [](unsigned char ch) { return !std::isspace(ch); }) + .base(), + str->end()); } -static inline std::string trim( - std::string& str) { // NOLINT(runtime/references) +static inline std::string trim(std::string* str) { ltrim(str); rtrim(str); - return str; + return *str; } bool CompareTexts(const std::string& generated, const std::string& expected) { @@ -181,7 +180,7 @@ bool CompareTexts(const std::string& generated, const std::string& expected) { return false; } - if (trim(generated_line) != trim(expected_line)) { + if (trim(&generated_line) != trim(&expected_line)) { std::cerr << "Inputs differ at line " << line_number << "\n"; std::cerr << " Generated: '" << generated_line << "'\n"; std::cerr << " Expected: '" << expected_line << "'\n"; @@ -2885,6 +2884,130 @@ TEST(PrivateAccessorAccess) { i::FLAG_harmony_private_methods = old_methods_flag; } +TEST(StaticPrivateMethodDeclaration) { + bool old_methods_flag = i::FLAG_harmony_private_methods; + i::FLAG_harmony_private_methods = true; + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + + const char* snippets[] = { + "{\n" + " class A {\n" + " static #a() { return 1; }\n" + " }\n" + "}\n", + + "{\n" + " class A {\n" + " static get #a() { return 1; }\n" + " }\n" + "}\n", + + "{\n" + " class A {\n" + " static set #a(val) { }\n" + " }\n" + "}\n", + + "{\n" + " class A {\n" + " static get #a() { return 1; }\n" + " static set #a(val) { }\n" + " }\n" + "}\n", + + "{\n" + " class A {\n" + " static #a() { }\n" + " #b() { }\n" + " }\n" + "}\n"}; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("StaticPrivateMethodDeclaration.golden"))); + i::FLAG_harmony_private_methods = old_methods_flag; +} + +TEST(StaticPrivateMethodAccess) { + bool old_methods_flag = i::FLAG_harmony_private_methods; + i::FLAG_harmony_private_methods = true; + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + printer.set_wrap(false); + printer.set_test_function_name("test"); + + const char* snippets[] = { + "class A {\n" + " static #a() { return 1; }\n" + " static test() { return this.#a(); }\n" + "}\n" + "\n" + "var test = A.test;\n" + "test();\n", + + "class B {\n" + " static #b() { return 1; }\n" + " static test() { this.#b = 1; }\n" + "}\n" + "\n" + "var test = B.test;\n" + "test();\n", + + "class C {\n" + " static #c() { return 1; }\n" + " static test() { this.#c++; }\n" + "}\n" + "\n" + "var test = C.test;\n" + "test();\n", + + "class D {\n" + " static get #d() { return 1; }\n" + " static set #d(val) { }\n" + "\n" + " static test() {\n" + " this.#d++;\n" + " this.#d = 1;\n" + " return this.#d;\n" + " }\n" + "}\n" + "\n" + "var test = D.test;\n" + "test();\n", + + "class E {\n" + " static get #e() { return 1; }\n" + " static test() { this.#e++; }\n" + "}\n" + "var test = E.test;\n" + "test();\n", + + "class F {\n" + " static set #f(val) { }\n" + " static test() { this.#f++; }\n" + "}\n" + "var test = F.test;\n" + "test();\n", + + "class G {\n" + " static get #d() { return 1; }\n" + " static test() { this.#d = 1; }\n" + "}\n" + "var test = G.test;\n" + "test();\n", + + "class H {\n" + " set #h(val) { }\n" + " static test() { this.#h; }\n" + "}\n" + "var test = H.test;\n" + "test();\n"}; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("StaticPrivateMethodAccess.golden"))); + i::FLAG_harmony_private_methods = old_methods_flag; +} + TEST(PrivateAccessorDeclaration) { bool old_methods_flag = i::FLAG_harmony_private_methods; i::FLAG_harmony_private_methods = true; @@ -3099,6 +3222,35 @@ TEST(Modules) { LoadGolden("Modules.golden"))); } +TEST(AsyncModules) { + bool previous_top_level_await_flag = i::FLAG_harmony_top_level_await; + i::FLAG_harmony_top_level_await = true; + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + printer.set_wrap(false); + printer.set_module(true); + printer.set_top_level(true); + + const char* snippets[] = { + "await 42;\n", + + "await import(\"foo\");\n", + + "await 42;\n" + "async function foo() {\n" + " await 42;\n" + "}\n" + "foo();\n", + + "import * as foo from \"bar\";\n" + "await import(\"goo\");\n", + }; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("AsyncModules.golden"))); + i::FLAG_harmony_top_level_await = previous_top_level_await_flag; +} + TEST(SuperCallAndSpread) { InitializedIgnitionHandleScope scope; BytecodeExpectationsPrinter printer(CcTest::isolate()); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index 466e768d7d..0ddc8fe608 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -1485,19 +1485,20 @@ TEST(InterpreterCall) { } } -static BytecodeArrayBuilder& SetRegister( - BytecodeArrayBuilder& builder, // NOLINT(runtime/references) - Register reg, int value, Register scratch) { - return builder.StoreAccumulatorInRegister(scratch) +static BytecodeArrayBuilder& SetRegister(BytecodeArrayBuilder* builder, + Register reg, int value, + Register scratch) { + return builder->StoreAccumulatorInRegister(scratch) .LoadLiteral(Smi::FromInt(value)) .StoreAccumulatorInRegister(reg) .LoadAccumulatorWithRegister(scratch); } -static BytecodeArrayBuilder& IncrementRegister( - BytecodeArrayBuilder& builder, // NOLINT(runtime/references) - Register reg, int value, Register scratch, int slot_index) { - return builder.StoreAccumulatorInRegister(scratch) +static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder* builder, + Register reg, int value, + Register scratch, + int slot_index) { + return builder->StoreAccumulatorInRegister(scratch) .LoadLiteral(Smi::FromInt(value)) .BinaryOperation(Token::Value::ADD, reg, slot_index) .StoreAccumulatorInRegister(reg) @@ -1525,13 +1526,13 @@ TEST(InterpreterJumps) { builder.LoadLiteral(Smi::zero()) .StoreAccumulatorInRegister(reg) .Jump(&label[0]); - SetRegister(builder, reg, 1024, scratch).Bind(&loop_header); - 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)) + SetRegister(&builder, reg, 1024, scratch).Bind(&loop_header); + 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); - SetRegister(builder, reg, 4096, scratch).Bind(&label[1]); - IncrementRegister(builder, reg, 4, scratch, GetIndex(slot2)) + SetRegister(&builder, reg, 4096, scratch).Bind(&label[1]); + IncrementRegister(&builder, reg, 4, scratch, GetIndex(slot2)) .LoadAccumulatorWithRegister(reg) .Return(); @@ -1566,19 +1567,19 @@ TEST(InterpreterConditionalJumps) { .StoreAccumulatorInRegister(reg) .LoadFalse() .JumpIfFalse(ToBooleanMode::kAlreadyBoolean, &label[0]); - IncrementRegister(builder, reg, 1024, scratch, GetIndex(slot)) + IncrementRegister(&builder, reg, 1024, scratch, GetIndex(slot)) .Bind(&label[0]) .LoadTrue() .JumpIfFalse(ToBooleanMode::kAlreadyBoolean, &done); - IncrementRegister(builder, reg, 1, scratch, GetIndex(slot1)) + IncrementRegister(&builder, reg, 1, scratch, GetIndex(slot1)) .LoadTrue() .JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &label[1]); - IncrementRegister(builder, reg, 2048, scratch, GetIndex(slot2)) + IncrementRegister(&builder, reg, 2048, scratch, GetIndex(slot2)) .Bind(&label[1]); - IncrementRegister(builder, reg, 2, scratch, GetIndex(slot3)) + IncrementRegister(&builder, reg, 2, scratch, GetIndex(slot3)) .LoadFalse() .JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &done1); - IncrementRegister(builder, reg, 4, scratch, GetIndex(slot4)) + IncrementRegister(&builder, reg, 4, scratch, GetIndex(slot4)) .LoadAccumulatorWithRegister(reg) .Bind(&done) .Bind(&done1) @@ -1616,19 +1617,19 @@ TEST(InterpreterConditionalJumps2) { .StoreAccumulatorInRegister(reg) .LoadFalse() .JumpIfFalse(ToBooleanMode::kAlreadyBoolean, &label[0]); - IncrementRegister(builder, reg, 1024, scratch, GetIndex(slot)) + IncrementRegister(&builder, reg, 1024, scratch, GetIndex(slot)) .Bind(&label[0]) .LoadTrue() .JumpIfFalse(ToBooleanMode::kAlreadyBoolean, &done); - IncrementRegister(builder, reg, 1, scratch, GetIndex(slot1)) + IncrementRegister(&builder, reg, 1, scratch, GetIndex(slot1)) .LoadTrue() .JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &label[1]); - IncrementRegister(builder, reg, 2048, scratch, GetIndex(slot2)) + IncrementRegister(&builder, reg, 2048, scratch, GetIndex(slot2)) .Bind(&label[1]); - IncrementRegister(builder, reg, 2, scratch, GetIndex(slot3)) + IncrementRegister(&builder, reg, 2, scratch, GetIndex(slot3)) .LoadFalse() .JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &done1); - IncrementRegister(builder, reg, 4, scratch, GetIndex(slot4)) + IncrementRegister(&builder, reg, 4, scratch, GetIndex(slot4)) .LoadAccumulatorWithRegister(reg) .Bind(&done) .Bind(&done1) diff --git a/deps/v8/test/cctest/libplatform/DEPS b/deps/v8/test/cctest/libplatform/DEPS index b2bee408ab..54415e157b 100644 --- a/deps/v8/test/cctest/libplatform/DEPS +++ b/deps/v8/test/cctest/libplatform/DEPS @@ -1,3 +1,3 @@ include_rules = [ - "+perfetto", + "+protos/perfetto", ] diff --git a/deps/v8/test/cctest/libplatform/test-tracing.cc b/deps/v8/test/cctest/libplatform/test-tracing.cc index a98445be97..1f1cb55f9b 100644 --- a/deps/v8/test/cctest/libplatform/test-tracing.cc +++ b/deps/v8/test/cctest/libplatform/test-tracing.cc @@ -10,11 +10,11 @@ #include "test/cctest/cctest.h" #ifdef V8_USE_PERFETTO -#include "perfetto/trace/chrome/chrome_trace_event.pb.h" -#include "perfetto/trace/chrome/chrome_trace_event.pbzero.h" -#include "perfetto/trace/chrome/chrome_trace_packet.pb.h" -#include "perfetto/trace/trace.pb.h" #include "perfetto/tracing.h" +#include "protos/perfetto/trace/chrome/chrome_trace_event.pb.h" +#include "protos/perfetto/trace/chrome/chrome_trace_event.pbzero.h" +#include "protos/perfetto/trace/chrome/chrome_trace_packet.pb.h" +#include "protos/perfetto/trace/trace.pb.h" #include "src/libplatform/tracing/json-trace-event-listener.h" #include "src/libplatform/tracing/trace-event-listener.h" #endif // V8_USE_PERFETTO @@ -157,7 +157,7 @@ void PopulateJSONWriter(TraceWriter* writer) { std::unique_ptr<v8::Platform> default_platform( v8::platform::NewDefaultPlatform()); i::V8::SetPlatformForTesting(default_platform.get()); - auto tracing = base::make_unique<v8::platform::tracing::TracingController>(); + auto tracing = std::make_unique<v8::platform::tracing::TracingController>(); v8::platform::tracing::TracingController* tracing_controller = tracing.get(); static_cast<v8::platform::DefaultPlatform*>(default_platform.get()) ->SetTracingController(std::move(tracing)); @@ -242,7 +242,7 @@ TEST(TestTracingController) { v8::platform::NewDefaultPlatform()); i::V8::SetPlatformForTesting(default_platform.get()); - auto tracing = base::make_unique<v8::platform::tracing::TracingController>(); + auto tracing = std::make_unique<v8::platform::tracing::TracingController>(); v8::platform::tracing::TracingController* tracing_controller = tracing.get(); static_cast<v8::platform::DefaultPlatform*>(default_platform.get()) ->SetTracingController(std::move(tracing)); @@ -301,8 +301,7 @@ TEST(TestTracingControllerMultipleArgsAndCopy) { v8::platform::NewDefaultPlatform()); i::V8::SetPlatformForTesting(default_platform.get()); - auto tracing = - base::make_unique<v8::platform::tracing::TracingController>(); + auto tracing = std::make_unique<v8::platform::tracing::TracingController>(); v8::platform::tracing::TracingController* tracing_controller = tracing.get(); static_cast<v8::platform::DefaultPlatform*>(default_platform.get()) @@ -424,7 +423,7 @@ TEST(TracingObservers) { v8::platform::NewDefaultPlatform()); i::V8::SetPlatformForTesting(default_platform.get()); - auto tracing = base::make_unique<v8::platform::tracing::TracingController>(); + auto tracing = std::make_unique<v8::platform::tracing::TracingController>(); v8::platform::tracing::TracingController* tracing_controller = tracing.get(); static_cast<v8::platform::DefaultPlatform*>(default_platform.get()) ->SetTracingController(std::move(tracing)); @@ -517,7 +516,7 @@ TEST(AddTraceEventMultiThreaded) { v8::platform::NewDefaultPlatform()); i::V8::SetPlatformForTesting(default_platform.get()); - auto tracing = base::make_unique<v8::platform::tracing::TracingController>(); + auto tracing = std::make_unique<v8::platform::tracing::TracingController>(); v8::platform::tracing::TracingController* tracing_controller = tracing.get(); static_cast<v8::platform::DefaultPlatform*>(default_platform.get()) ->SetTracingController(std::move(tracing)); @@ -576,8 +575,7 @@ class TracingTestHarness { default_platform_ = v8::platform::NewDefaultPlatform(); i::V8::SetPlatformForTesting(default_platform_.get()); - auto tracing = - base::make_unique<v8::platform::tracing::TracingController>(); + auto tracing = std::make_unique<v8::platform::tracing::TracingController>(); tracing_controller_ = tracing.get(); static_cast<v8::platform::DefaultPlatform*>(default_platform_.get()) ->SetTracingController(std::move(tracing)); diff --git a/deps/v8/test/cctest/manually-externalized-buffer.h b/deps/v8/test/cctest/manually-externalized-buffer.h new file mode 100644 index 0000000000..b5eeed7382 --- /dev/null +++ b/deps/v8/test/cctest/manually-externalized-buffer.h @@ -0,0 +1,34 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_CCTEST_MANUALLY_EXTERNALIZED_BUFFER_H_ +#define V8_CCTEST_MANUALLY_EXTERNALIZED_BUFFER_H_ + +#include "src/api/api-inl.h" + +namespace v8 { +namespace internal { +namespace testing { + +// Utility to free the allocated memory for a buffer that is manually +// externalized in a test. +struct ManuallyExternalizedBuffer { + Handle<JSArrayBuffer> buffer_; + v8::ArrayBuffer::Contents contents_; + + explicit ManuallyExternalizedBuffer(Handle<JSArrayBuffer> buffer) + : buffer_(buffer), + contents_(v8::Utils::ToLocal(buffer_)->Externalize()) {} + ~ManuallyExternalizedBuffer() { + contents_.Deleter()(contents_.Data(), contents_.ByteLength(), + contents_.DeleterData()); + } + void* backing_store() { return contents_.Data(); } +}; + +} // namespace testing +} // namespace internal +} // namespace v8 + +#endif // V8_CCTEST_MANUALLY_EXTERNALIZED_BUFFER_H_ diff --git a/deps/v8/test/cctest/test-accessor-assembler.cc b/deps/v8/test/cctest/test-accessor-assembler.cc index c88c85b586..6183ef970c 100644 --- a/deps/v8/test/cctest/test-accessor-assembler.cc +++ b/deps/v8/test/cctest/test-accessor-assembler.cc @@ -18,7 +18,6 @@ namespace internal { using compiler::CodeAssemblerTester; using compiler::FunctionTester; using compiler::Node; -using compiler::TNode; namespace { diff --git a/deps/v8/test/cctest/test-api-accessors.cc b/deps/v8/test/cctest/test-api-accessors.cc index 8c2f92d665..5f82d78711 100644 --- a/deps/v8/test/cctest/test-api-accessors.cc +++ b/deps/v8/test/cctest/test-api-accessors.cc @@ -287,21 +287,30 @@ TEST(AccessorSetHasNoSideEffect) { v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); obj->SetAccessor(context, v8_str("foo"), Getter).ToChecked(); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); obj->SetAccessor(context, v8_str("foo"), Getter, nullptr, v8::MaybeLocal<v8::Value>(), v8::AccessControl::DEFAULT, v8::PropertyAttribute::None, v8::SideEffectType::kHasNoSideEffect) .ToChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that setter is not whitelisted. v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), false) + CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDefault) .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); @@ -323,12 +332,16 @@ TEST(SetAccessorSetSideEffectReceiverCheck1) { v8::SideEffectType::kHasNoSideEffect, v8::SideEffectType::kHasSideEffectToReceiver) .ToChecked(); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .ToLocalChecked() ->Equals(env.local(), v8_str("return value")) .FromJust()); v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); CHECK_EQ(0, set_accessor_call_count); @@ -357,11 +370,15 @@ TEST(SetAccessorSetSideEffectReceiverCheck2) { ->Set(env.local(), v8_str("f"), templ->GetFunction(env.local()).ToLocalChecked()) .FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("new f().bar"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("new f().bar"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .ToLocalChecked() ->Equals(env.local(), v8_str("return value")) .FromJust()); - v8::debug::EvaluateGlobal(isolate, v8_str("new f().bar = 1"), true) + v8::debug::EvaluateGlobal( + isolate, v8_str("new f().bar = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .ToLocalChecked(); CHECK_EQ(1, set_accessor_call_count); } @@ -377,20 +394,29 @@ TEST(AccessorSetNativeDataPropertyHasNoSideEffect) { v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); obj->SetNativeDataProperty(context, v8_str("foo"), Getter).ToChecked(); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); obj->SetNativeDataProperty( context, v8_str("foo"), Getter, nullptr, v8::Local<v8::Value>(), v8::PropertyAttribute::None, v8::SideEffectType::kHasNoSideEffect) .ToChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that setter is not whitelisted. v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), false) + CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDefault) .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); @@ -407,20 +433,29 @@ TEST(AccessorSetLazyDataPropertyHasNoSideEffect) { v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); obj->SetLazyDataProperty(context, v8_str("foo"), Getter).ToChecked(); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); obj->SetLazyDataProperty(context, v8_str("foo"), Getter, v8::Local<v8::Value>(), v8::PropertyAttribute::None, v8::SideEffectType::kHasNoSideEffect) .ToChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that setter is not whitelisted. v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), false) + CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDefault) .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); @@ -440,15 +475,24 @@ TEST(ObjectTemplateSetAccessorHasNoSideEffect) { v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); - v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), true).ToLocalChecked(); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo2"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that setter is not whitelisted. v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2 = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo2 = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), false) + CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), + v8::debug::EvaluateGlobalMode::kDefault) .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); @@ -468,15 +512,24 @@ TEST(ObjectTemplateSetNativePropertyHasNoSideEffect) { v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); - v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), true).ToLocalChecked(); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo2"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that setter is not whitelisted. v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2 = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo2 = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), false) + CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), + v8::debug::EvaluateGlobalMode::kDefault) .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); @@ -495,15 +548,24 @@ TEST(ObjectTemplateSetLazyPropertyHasNoSideEffect) { v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); - v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), true).ToLocalChecked(); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo2"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that setter is not whitelisted. v8::TryCatch try_catch(isolate); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2 = 1"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.foo2 = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); CHECK(try_catch.HasCaught()); - CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), false) + CHECK_NE(1, v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo2"), + v8::debug::EvaluateGlobalMode::kDefault) .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); diff --git a/deps/v8/test/cctest/test-api-array-buffer.cc b/deps/v8/test/cctest/test-api-array-buffer.cc index 5b8433a6a2..508604aa41 100644 --- a/deps/v8/test/cctest/test-api-array-buffer.cc +++ b/deps/v8/test/cctest/test-api-array-buffer.cc @@ -13,43 +13,6 @@ using ::v8::Value; namespace { -class ScopedArrayBufferContents { - public: - explicit ScopedArrayBufferContents(const v8::ArrayBuffer::Contents& contents) - : contents_(contents) {} - ~ScopedArrayBufferContents() { free(contents_.AllocationBase()); } - void* Data() const { return contents_.Data(); } - size_t ByteLength() const { return contents_.ByteLength(); } - - void* AllocationBase() const { return contents_.AllocationBase(); } - size_t AllocationLength() const { return contents_.AllocationLength(); } - v8::ArrayBuffer::Allocator::AllocationMode AllocationMode() const { - return contents_.AllocationMode(); - } - - private: - const v8::ArrayBuffer::Contents contents_; -}; - -class ScopedSharedArrayBufferContents { - public: - explicit ScopedSharedArrayBufferContents( - const v8::SharedArrayBuffer::Contents& contents) - : contents_(contents) {} - ~ScopedSharedArrayBufferContents() { free(contents_.AllocationBase()); } - void* Data() const { return contents_.Data(); } - size_t ByteLength() const { return contents_.ByteLength(); } - - void* AllocationBase() const { return contents_.AllocationBase(); } - size_t AllocationLength() const { return contents_.AllocationLength(); } - v8::ArrayBuffer::Allocator::AllocationMode AllocationMode() const { - return contents_.AllocationMode(); - } - - private: - const v8::SharedArrayBuffer::Contents contents_; -}; - void CheckDataViewIsDetached(v8::Local<v8::DataView> dv) { CHECK_EQ(0, static_cast<int>(dv->ByteLength())); CHECK_EQ(0, static_cast<int>(dv->ByteOffset())); @@ -83,6 +46,20 @@ Local<TypedArray> CreateAndCheck(Local<v8::ArrayBuffer> ab, int byteOffset, return ta; } +std::shared_ptr<v8::BackingStore> Externalize(Local<v8::ArrayBuffer> ab) { + std::shared_ptr<v8::BackingStore> backing_store = ab->GetBackingStore(); + ab->Externalize(backing_store); + CHECK(ab->IsExternal()); + return backing_store; +} + +std::shared_ptr<v8::BackingStore> Externalize(Local<v8::SharedArrayBuffer> ab) { + std::shared_ptr<v8::BackingStore> backing_store = ab->GetBackingStore(); + ab->Externalize(backing_store); + CHECK(ab->IsExternal()); + return backing_store; +} + } // namespace THREADED_TEST(ArrayBuffer_ApiInternalToExternal) { @@ -92,15 +69,14 @@ THREADED_TEST(ArrayBuffer_ApiInternalToExternal) { Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 1024); CheckInternalFieldsAreZero(ab); - CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); + CHECK_EQ(1024, ab->ByteLength()); CHECK(!ab->IsExternal()); CcTest::CollectAllGarbage(); - ScopedArrayBufferContents ab_contents(ab->Externalize()); - CHECK(ab->IsExternal()); + std::shared_ptr<v8::BackingStore> backing_store = Externalize(ab); + CHECK_EQ(1024, backing_store->ByteLength()); - CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); - uint8_t* data = static_cast<uint8_t*>(ab_contents.Data()); + uint8_t* data = static_cast<uint8_t*>(backing_store->Data()); CHECK_NOT_NULL(data); CHECK(env->Global()->Set(env.local(), v8_str("ab"), ab).FromJust()); @@ -133,10 +109,9 @@ THREADED_TEST(ArrayBuffer_JSInternalToExternal) { "u8_a[1] = 0xFF; u8_a.buffer"); Local<v8::ArrayBuffer> ab1 = Local<v8::ArrayBuffer>::Cast(result); CheckInternalFieldsAreZero(ab1); - CHECK_EQ(2, static_cast<int>(ab1->ByteLength())); + CHECK_EQ(2, ab1->ByteLength()); CHECK(!ab1->IsExternal()); - ScopedArrayBufferContents ab1_contents(ab1->Externalize()); - CHECK(ab1->IsExternal()); + std::shared_ptr<v8::BackingStore> backing_store = Externalize(ab1); result = CompileRun("ab1.byteLength"); CHECK_EQ(2, result->Int32Value(env.local()).FromJust()); @@ -152,8 +127,8 @@ THREADED_TEST(ArrayBuffer_JSInternalToExternal) { result = CompileRun("u8_b[1]"); CHECK_EQ(0xFF, result->Int32Value(env.local()).FromJust()); - CHECK_EQ(2, static_cast<int>(ab1_contents.ByteLength())); - uint8_t* ab1_data = static_cast<uint8_t*>(ab1_contents.Data()); + CHECK_EQ(2, backing_store->ByteLength()); + uint8_t* ab1_data = static_cast<uint8_t*>(backing_store->Data()); CHECK_EQ(0xBB, ab1_data[0]); CHECK_EQ(0xFF, ab1_data[1]); ab1_data[0] = 0xCC; @@ -172,7 +147,7 @@ THREADED_TEST(ArrayBuffer_External) { Local<v8::ArrayBuffer> ab3 = v8::ArrayBuffer::New(isolate, my_data.begin(), 100); CheckInternalFieldsAreZero(ab3); - CHECK_EQ(100, static_cast<int>(ab3->ByteLength())); + CHECK_EQ(100, ab3->ByteLength()); CHECK(ab3->IsExternal()); CHECK(env->Global()->Set(env.local(), v8_str("ab3"), ab3).FromJust()); @@ -242,12 +217,12 @@ THREADED_TEST(ArrayBuffer_DetachingApi) { v8::Local<v8::DataView> dv = v8::DataView::New(buffer, 1, 1023); CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv); - CHECK_EQ(1, static_cast<int>(dv->ByteOffset())); - CHECK_EQ(1023, static_cast<int>(dv->ByteLength())); + CHECK_EQ(1, dv->ByteOffset()); + CHECK_EQ(1023, dv->ByteLength()); - ScopedArrayBufferContents contents(buffer->Externalize()); + Externalize(buffer); buffer->Detach(); - CHECK_EQ(0, static_cast<int>(buffer->ByteLength())); + CHECK_EQ(0, buffer->ByteLength()); CheckIsDetached(u8a); CheckIsDetached(u8c); CheckIsDetached(i8a); @@ -283,9 +258,9 @@ THREADED_TEST(ArrayBuffer_DetachingScript) { v8::Local<v8::DataView> dv = v8::Local<v8::DataView>::Cast(CompileRun("dv")); - ScopedArrayBufferContents contents(ab->Externalize()); + Externalize(ab); ab->Detach(); - CHECK_EQ(0, static_cast<int>(ab->ByteLength())); + CHECK_EQ(0, ab->ByteLength()); CHECK_EQ(0, v8_run_int32value(v8_compile("ab.byteLength"))); CheckIsTypedArrayVarDetached("u8a"); @@ -302,6 +277,7 @@ THREADED_TEST(ArrayBuffer_DetachingScript) { CheckDataViewIsDetached(dv); } +// TODO(v8:9380) the Contents data structure should be deprecated. THREADED_TEST(ArrayBuffer_AllocationInformation) { LocalContext env; v8::Isolate* isolate = env->GetIsolate(); @@ -309,7 +285,7 @@ THREADED_TEST(ArrayBuffer_AllocationInformation) { const size_t ab_size = 1024; Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, ab_size); - ScopedArrayBufferContents contents(ab->Externalize()); + v8::ArrayBuffer::Contents contents(ab->GetContents()); // Array buffers should have normal allocation mode. CHECK_EQ(contents.AllocationMode(), @@ -329,13 +305,13 @@ THREADED_TEST(ArrayBuffer_ExternalizeEmpty) { v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope handle_scope(isolate); - Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 0); + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 2); CheckInternalFieldsAreZero(ab); - CHECK_EQ(0, static_cast<int>(ab->ByteLength())); + CHECK_EQ(2, ab->ByteLength()); CHECK(!ab->IsExternal()); // Externalize the buffer (taking ownership of the backing store memory). - ScopedArrayBufferContents ab_contents(ab->Externalize()); + std::shared_ptr<v8::BackingStore> backing_store = Externalize(ab); Local<v8::Uint8Array> u8a = v8::Uint8Array::New(ab, 0, 0); // Calling Buffer() will materialize the ArrayBuffer (transitioning it from @@ -344,6 +320,7 @@ THREADED_TEST(ArrayBuffer_ExternalizeEmpty) { USE(u8a->Buffer()); CHECK(ab->IsExternal()); + CHECK_EQ(2, backing_store->ByteLength()); } THREADED_TEST(SharedArrayBuffer_ApiInternalToExternal) { @@ -354,15 +331,14 @@ THREADED_TEST(SharedArrayBuffer_ApiInternalToExternal) { Local<v8::SharedArrayBuffer> ab = v8::SharedArrayBuffer::New(isolate, 1024); CheckInternalFieldsAreZero(ab); - CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); + CHECK_EQ(1024, ab->ByteLength()); CHECK(!ab->IsExternal()); CcTest::CollectAllGarbage(); - ScopedSharedArrayBufferContents ab_contents(ab->Externalize()); - CHECK(ab->IsExternal()); + std::shared_ptr<v8::BackingStore> backing_store = Externalize(ab); - CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); - uint8_t* data = static_cast<uint8_t*>(ab_contents.Data()); + CHECK_EQ(1024, backing_store->ByteLength()); + uint8_t* data = static_cast<uint8_t*>(backing_store->Data()); CHECK_NOT_NULL(data); CHECK(env->Global()->Set(env.local(), v8_str("ab"), ab).FromJust()); @@ -383,6 +359,35 @@ THREADED_TEST(SharedArrayBuffer_ApiInternalToExternal) { CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust()); } +THREADED_TEST(ArrayBuffer_ExternalReused) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + i::ScopedVector<uint8_t> data(100); + Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, data.begin(), 100); + std::shared_ptr<v8::BackingStore> bs1 = ab1->GetBackingStore(); + ab1->Detach(); + Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, data.begin(), 100); + std::shared_ptr<v8::BackingStore> bs2 = ab2->GetBackingStore(); + CHECK_EQ(bs1->Data(), bs2->Data()); +} + +THREADED_TEST(SharedArrayBuffer_ExternalReused) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + i::ScopedVector<uint8_t> data(100); + Local<v8::SharedArrayBuffer> ab1 = + v8::SharedArrayBuffer::New(isolate, data.begin(), 100); + std::shared_ptr<v8::BackingStore> bs1 = ab1->GetBackingStore(); + Local<v8::SharedArrayBuffer> ab2 = + v8::SharedArrayBuffer::New(isolate, data.begin(), 100); + std::shared_ptr<v8::BackingStore> bs2 = ab2->GetBackingStore(); + CHECK_EQ(bs1->Data(), bs2->Data()); +} + THREADED_TEST(SharedArrayBuffer_JSInternalToExternal) { i::FLAG_harmony_sharedarraybuffer = true; LocalContext env; @@ -396,10 +401,9 @@ THREADED_TEST(SharedArrayBuffer_JSInternalToExternal) { "u8_a[1] = 0xFF; u8_a.buffer"); Local<v8::SharedArrayBuffer> ab1 = Local<v8::SharedArrayBuffer>::Cast(result); CheckInternalFieldsAreZero(ab1); - CHECK_EQ(2, static_cast<int>(ab1->ByteLength())); + CHECK_EQ(2, ab1->ByteLength()); CHECK(!ab1->IsExternal()); - ScopedSharedArrayBufferContents ab1_contents(ab1->Externalize()); - CHECK(ab1->IsExternal()); + std::shared_ptr<v8::BackingStore> backing_store = Externalize(ab1); result = CompileRun("ab1.byteLength"); CHECK_EQ(2, result->Int32Value(env.local()).FromJust()); @@ -415,8 +419,8 @@ THREADED_TEST(SharedArrayBuffer_JSInternalToExternal) { result = CompileRun("u8_b[1]"); CHECK_EQ(0xFF, result->Int32Value(env.local()).FromJust()); - CHECK_EQ(2, static_cast<int>(ab1_contents.ByteLength())); - uint8_t* ab1_data = static_cast<uint8_t*>(ab1_contents.Data()); + CHECK_EQ(2, backing_store->ByteLength()); + uint8_t* ab1_data = static_cast<uint8_t*>(backing_store->Data()); CHECK_EQ(0xBB, ab1_data[0]); CHECK_EQ(0xFF, ab1_data[1]); ab1_data[0] = 0xCC; @@ -458,6 +462,7 @@ THREADED_TEST(SharedArrayBuffer_External) { CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust()); } +// TODO(v8:9380) the Contents data structure should be deprecated. THREADED_TEST(SharedArrayBuffer_AllocationInformation) { i::FLAG_harmony_sharedarraybuffer = true; LocalContext env; @@ -467,7 +472,7 @@ THREADED_TEST(SharedArrayBuffer_AllocationInformation) { const size_t ab_size = 1024; Local<v8::SharedArrayBuffer> ab = v8::SharedArrayBuffer::New(isolate, ab_size); - ScopedSharedArrayBufferContents contents(ab->Externalize()); + v8::SharedArrayBuffer::Contents contents(ab->GetContents()); // Array buffers should have normal allocation mode. CHECK_EQ(contents.AllocationMode(), @@ -500,7 +505,7 @@ THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) { CcTest::CollectAllGarbage(); // Should not move the pointer - CHECK_EQ(ab->GetContents().Data(), store_ptr); + CHECK_EQ(ab->GetBackingStore()->Data(), store_ptr); } THREADED_TEST(SkipArrayBufferDuringScavenge) { @@ -525,5 +530,16 @@ THREADED_TEST(SkipArrayBufferDuringScavenge) { CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now // Use `ab` to silence compiler warning - CHECK_EQ(ab->GetContents().Data(), store_ptr); + CHECK_EQ(ab->GetBackingStore()->Data(), store_ptr); +} + +THREADED_TEST(Regress1006600) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + Local<v8::Value> ab = CompileRunChecked(isolate, "new ArrayBuffer()"); + for (int i = 0; i < v8::ArrayBuffer::kEmbedderFieldCount; i++) { + CHECK_NULL(ab.As<v8::Object>()->GetAlignedPointerFromInternalField(i)); + } } diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc index e331d1a26a..cbf9f75be5 100644 --- a/deps/v8/test/cctest/test-api-interceptors.cc +++ b/deps/v8/test/cctest/test-api-interceptors.cc @@ -2712,16 +2712,26 @@ THREADED_TEST(NoSideEffectPropertyHandler) { templ->NewInstance(context.local()).ToLocalChecked(); context->Global()->Set(context.local(), v8_str("obj"), object).FromJust(); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.x"), true).IsEmpty()); - CHECK( - v8::debug::EvaluateGlobal(isolate, v8_str("obj.x = 1"), true).IsEmpty()); - CHECK( - v8::debug::EvaluateGlobal(isolate, v8_str("'x' in obj"), true).IsEmpty()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("delete obj.x"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.x"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj.x = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("'x' in obj"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("delete obj.x"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); // Wrap the variable declaration since declaring globals is a side effect. CHECK(v8::debug::EvaluateGlobal( - isolate, v8_str("(function() { for (var p in obj) ; })()"), true) + isolate, v8_str("(function() { for (var p in obj) ; })()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); // Side-effect-free version. @@ -2734,15 +2744,25 @@ THREADED_TEST(NoSideEffectPropertyHandler) { templ2->NewInstance(context.local()).ToLocalChecked(); context->Global()->Set(context.local(), v8_str("obj2"), object2).FromJust(); - v8::debug::EvaluateGlobal(isolate, v8_str("obj2.x"), true).ToLocalChecked(); - CHECK( - v8::debug::EvaluateGlobal(isolate, v8_str("obj2.x = 1"), true).IsEmpty()); - v8::debug::EvaluateGlobal(isolate, v8_str("'x' in obj2"), true) + v8::debug::EvaluateGlobal( + isolate, v8_str("obj2.x"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj2.x = 1"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + v8::debug::EvaluateGlobal( + isolate, v8_str("'x' in obj2"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .ToLocalChecked(); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("delete obj2.x"), true) + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("delete obj2.x"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .IsEmpty()); v8::debug::EvaluateGlobal( - isolate, v8_str("(function() { for (var p in obj2) ; })()"), true) + isolate, v8_str("(function() { for (var p in obj2) ; })()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) .ToLocalChecked(); } diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 345ee0bfc9..1daa19402e 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -46,6 +46,7 @@ #include "src/execution/arguments.h" #include "src/execution/execution.h" #include "src/execution/futex-emulation.h" +#include "src/execution/protectors-inl.h" #include "src/execution/vm-state.h" #include "src/handles/global-handles.h" #include "src/heap/heap-inl.h" @@ -2955,11 +2956,8 @@ THREADED_TEST(SetAlignedPointerInInternalFields) { obj->SetAlignedPointerInInternalFields(2, indices, values); CcTest::CollectAllGarbage(); - { - v8::SealHandleScope no_handle_leak(isolate); - CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0)); - CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1)); - } + CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0)); + CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1)); indices[0] = 1; indices[1] = 0; @@ -3012,7 +3010,6 @@ THREADED_TEST(EmbedderDataAlignedPointers) { } CcTest::CollectAllGarbage(); for (int i = 0; i < 100; i++) { - v8::SealHandleScope no_handle_leak(env->GetIsolate()); CHECK_EQ(AlignedTestPointer(i), env->GetAlignedPointerFromEmbedderData(i)); } } @@ -7064,7 +7061,7 @@ static const char* kSimpleExtensionSource = TEST(SimpleExtensions) { v8::HandleScope handle_scope(CcTest::isolate()); v8::RegisterExtension( - v8::base::make_unique<Extension>("simpletest", kSimpleExtensionSource)); + std::make_unique<Extension>("simpletest", kSimpleExtensionSource)); const char* extension_names[] = {"simpletest"}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7086,7 +7083,7 @@ static const char* kStackTraceFromExtensionSource = TEST(StackTraceInExtension) { v8::HandleScope handle_scope(CcTest::isolate()); - v8::RegisterExtension(v8::base::make_unique<Extension>( + v8::RegisterExtension(std::make_unique<Extension>( "stacktracetest", kStackTraceFromExtensionSource)); const char* extension_names[] = {"stacktracetest"}; v8::ExtensionConfiguration extensions(1, extension_names); @@ -7104,7 +7101,7 @@ TEST(StackTraceInExtension) { TEST(NullExtensions) { v8::HandleScope handle_scope(CcTest::isolate()); - v8::RegisterExtension(v8::base::make_unique<Extension>("nulltest", nullptr)); + v8::RegisterExtension(std::make_unique<Extension>("nulltest", nullptr)); const char* extension_names[] = {"nulltest"}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7122,8 +7119,8 @@ static const int kEmbeddedExtensionSourceValidLen = 34; TEST(ExtensionMissingSourceLength) { v8::HandleScope handle_scope(CcTest::isolate()); - v8::RegisterExtension(v8::base::make_unique<Extension>( - "srclentest_fail", kEmbeddedExtensionSource)); + v8::RegisterExtension( + std::make_unique<Extension>("srclentest_fail", kEmbeddedExtensionSource)); const char* extension_names[] = {"srclentest_fail"}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7137,9 +7134,9 @@ TEST(ExtensionWithSourceLength) { v8::HandleScope handle_scope(CcTest::isolate()); i::ScopedVector<char> extension_name(32); i::SNPrintF(extension_name, "ext #%d", source_len); - v8::RegisterExtension(v8::base::make_unique<Extension>( - extension_name.begin(), kEmbeddedExtensionSource, 0, nullptr, - source_len)); + v8::RegisterExtension(std::make_unique<Extension>(extension_name.begin(), + kEmbeddedExtensionSource, + 0, nullptr, source_len)); const char* extension_names[1] = {extension_name.begin()}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7177,9 +7174,9 @@ static const char* kEvalExtensionSource2 = TEST(UseEvalFromExtension) { v8::HandleScope handle_scope(CcTest::isolate()); v8::RegisterExtension( - v8::base::make_unique<Extension>("evaltest1", kEvalExtensionSource1)); + std::make_unique<Extension>("evaltest1", kEvalExtensionSource1)); v8::RegisterExtension( - v8::base::make_unique<Extension>("evaltest2", kEvalExtensionSource2)); + std::make_unique<Extension>("evaltest2", kEvalExtensionSource2)); const char* extension_names[] = {"evaltest1", "evaltest2"}; v8::ExtensionConfiguration extensions(2, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7213,9 +7210,9 @@ static const char* kWithExtensionSource2 = TEST(UseWithFromExtension) { v8::HandleScope handle_scope(CcTest::isolate()); v8::RegisterExtension( - v8::base::make_unique<Extension>("withtest1", kWithExtensionSource1)); + std::make_unique<Extension>("withtest1", kWithExtensionSource1)); v8::RegisterExtension( - v8::base::make_unique<Extension>("withtest2", kWithExtensionSource2)); + std::make_unique<Extension>("withtest2", kWithExtensionSource2)); const char* extension_names[] = {"withtest1", "withtest2"}; v8::ExtensionConfiguration extensions(2, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7232,7 +7229,7 @@ TEST(UseWithFromExtension) { TEST(AutoExtensions) { v8::HandleScope handle_scope(CcTest::isolate()); auto extension = - v8::base::make_unique<Extension>("autotest", kSimpleExtensionSource); + std::make_unique<Extension>("autotest", kSimpleExtensionSource); extension->set_auto_enable(true); v8::RegisterExtension(std::move(extension)); v8::Local<Context> context = Context::New(CcTest::isolate()); @@ -7250,7 +7247,7 @@ static const char* kSyntaxErrorInExtensionSource = "["; // error but results in an empty context. TEST(SyntaxErrorExtensions) { v8::HandleScope handle_scope(CcTest::isolate()); - v8::RegisterExtension(v8::base::make_unique<Extension>( + v8::RegisterExtension(std::make_unique<Extension>( "syntaxerror", kSyntaxErrorInExtensionSource)); const char* extension_names[] = {"syntaxerror"}; v8::ExtensionConfiguration extensions(1, extension_names); @@ -7266,8 +7263,8 @@ static const char* kExceptionInExtensionSource = "throw 42"; // a fatal error but results in an empty context. TEST(ExceptionExtensions) { v8::HandleScope handle_scope(CcTest::isolate()); - v8::RegisterExtension(v8::base::make_unique<Extension>( - "exception", kExceptionInExtensionSource)); + v8::RegisterExtension( + std::make_unique<Extension>("exception", kExceptionInExtensionSource)); const char* extension_names[] = {"exception"}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7285,8 +7282,8 @@ static const char* kNativeCallTest = // Test that a native runtime calls are supported in extensions. TEST(NativeCallInExtensions) { v8::HandleScope handle_scope(CcTest::isolate()); - v8::RegisterExtension(v8::base::make_unique<Extension>( - "nativecall", kNativeCallInExtensionSource)); + v8::RegisterExtension( + std::make_unique<Extension>("nativecall", kNativeCallInExtensionSource)); const char* extension_names[] = {"nativecall"}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7320,7 +7317,7 @@ class NativeFunctionExtension : public Extension { TEST(NativeFunctionDeclaration) { v8::HandleScope handle_scope(CcTest::isolate()); const char* name = "nativedecl"; - v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>( + v8::RegisterExtension(std::make_unique<NativeFunctionExtension>( name, "native function foo();")); const char* extension_names[] = {name}; v8::ExtensionConfiguration extensions(1, extension_names); @@ -7336,7 +7333,7 @@ TEST(NativeFunctionDeclarationError) { v8::HandleScope handle_scope(CcTest::isolate()); const char* name = "nativedeclerr"; // Syntax error in extension code. - v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>( + v8::RegisterExtension(std::make_unique<NativeFunctionExtension>( name, "native\nfunction foo();")); const char* extension_names[] = {name}; v8::ExtensionConfiguration extensions(1, extension_names); @@ -7350,7 +7347,7 @@ TEST(NativeFunctionDeclarationErrorEscape) { const char* name = "nativedeclerresc"; // Syntax error in extension code - escape code in "native" means that // it's not treated as a keyword. - v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>( + v8::RegisterExtension(std::make_unique<NativeFunctionExtension>( name, "nativ\\u0065 function foo();")); const char* extension_names[] = {name}; v8::ExtensionConfiguration extensions(1, extension_names); @@ -7382,17 +7379,17 @@ static void CheckDependencies(const char* name, const char* expected) { THREADED_TEST(ExtensionDependency) { static const char* kEDeps[] = {"D"}; v8::RegisterExtension( - v8::base::make_unique<Extension>("E", "this.loaded += 'E';", 1, kEDeps)); + std::make_unique<Extension>("E", "this.loaded += 'E';", 1, kEDeps)); static const char* kDDeps[] = {"B", "C"}; v8::RegisterExtension( - v8::base::make_unique<Extension>("D", "this.loaded += 'D';", 2, kDDeps)); + std::make_unique<Extension>("D", "this.loaded += 'D';", 2, kDDeps)); static const char* kBCDeps[] = {"A"}; v8::RegisterExtension( - v8::base::make_unique<Extension>("B", "this.loaded += 'B';", 1, kBCDeps)); + std::make_unique<Extension>("B", "this.loaded += 'B';", 1, kBCDeps)); v8::RegisterExtension( - v8::base::make_unique<Extension>("C", "this.loaded += 'C';", 1, kBCDeps)); + std::make_unique<Extension>("C", "this.loaded += 'C';", 1, kBCDeps)); v8::RegisterExtension( - v8::base::make_unique<Extension>("A", "this.loaded += 'A';")); + std::make_unique<Extension>("A", "this.loaded += 'A';")); CheckDependencies("A", "undefinedA"); CheckDependencies("B", "undefinedAB"); CheckDependencies("C", "undefinedAC"); @@ -7464,7 +7461,7 @@ v8::Local<v8::FunctionTemplate> FunctionExtension::GetNativeFunctionTemplate( THREADED_TEST(FunctionLookup) { - v8::RegisterExtension(v8::base::make_unique<FunctionExtension>()); + v8::RegisterExtension(std::make_unique<FunctionExtension>()); v8::HandleScope handle_scope(CcTest::isolate()); static const char* exts[1] = {"functiontest"}; v8::ExtensionConfiguration config(1, exts); @@ -7483,7 +7480,7 @@ THREADED_TEST(FunctionLookup) { THREADED_TEST(NativeFunctionConstructCall) { - v8::RegisterExtension(v8::base::make_unique<FunctionExtension>()); + v8::RegisterExtension(std::make_unique<FunctionExtension>()); v8::HandleScope handle_scope(CcTest::isolate()); static const char* exts[1] = {"functiontest"}; v8::ExtensionConfiguration config(1, exts); @@ -7520,9 +7517,9 @@ void StoringErrorCallback(const char* location, const char* message) { TEST(ErrorReporting) { CcTest::isolate()->SetFatalErrorHandler(StoringErrorCallback); static const char* aDeps[] = {"B"}; - v8::RegisterExtension(v8::base::make_unique<Extension>("A", "", 1, aDeps)); + v8::RegisterExtension(std::make_unique<Extension>("A", "", 1, aDeps)); static const char* bDeps[] = {"A"}; - v8::RegisterExtension(v8::base::make_unique<Extension>("B", "", 1, bDeps)); + v8::RegisterExtension(std::make_unique<Extension>("B", "", 1, bDeps)); last_location = nullptr; v8::ExtensionConfiguration config(1, bDeps); v8::Local<Context> context = Context::New(CcTest::isolate(), &config); @@ -10625,7 +10622,6 @@ THREADED_TEST(ShadowObjectAndDataProperty) { i::FeedbackSlot slot = i::FeedbackVector::ToSlot(0); i::FeedbackNexus nexus(foo->feedback_vector(), slot); CHECK_EQ(i::FeedbackSlotKind::kStoreGlobalSloppy, nexus.kind()); - CHECK_EQ(i::PREMONOMORPHIC, nexus.ic_state()); CompileRun("foo(1)"); CHECK_EQ(i::MONOMORPHIC, nexus.ic_state()); // We go a bit further, checking that the form of monomorphism is @@ -10676,7 +10672,6 @@ THREADED_TEST(ShadowObjectAndDataPropertyTurbo) { i::FeedbackSlot slot = i::FeedbackVector::ToSlot(0); i::FeedbackNexus nexus(foo->feedback_vector(), slot); CHECK_EQ(i::FeedbackSlotKind::kStoreGlobalSloppy, nexus.kind()); - CHECK_EQ(i::PREMONOMORPHIC, nexus.ic_state()); CompileRun("%OptimizeFunctionOnNextCall(foo); foo(1)"); CHECK_EQ(i::MONOMORPHIC, nexus.ic_state()); i::HeapObject heap_object; @@ -12310,8 +12305,14 @@ TEST(CallHandlerHasNoSideEffect) { ->Set(context.local(), v8_str("f"), templ->GetFunction(context.local()).ToLocalChecked()) .FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f()"), true).IsEmpty()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("new f()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("new f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // Side-effect-free version. Local<v8::FunctionTemplate> templ2 = v8::FunctionTemplate::New(isolate); @@ -12321,8 +12322,14 @@ TEST(CallHandlerHasNoSideEffect) { ->Set(context.local(), v8_str("f2"), templ2->GetFunction(context.local()).ToLocalChecked()) .FromJust()); - v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), true).ToLocalChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("new f2()"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("new f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); } TEST(FunctionTemplateNewHasNoSideEffect) { @@ -12337,8 +12344,14 @@ TEST(FunctionTemplateNewHasNoSideEffect) { ->Set(context.local(), v8_str("f"), templ->GetFunction(context.local()).ToLocalChecked()) .FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f()"), true).IsEmpty()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("new f()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("new f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // Side-effect-free version. Local<v8::FunctionTemplate> templ2 = v8::FunctionTemplate::New( @@ -12348,8 +12361,14 @@ TEST(FunctionTemplateNewHasNoSideEffect) { ->Set(context.local(), v8_str("f2"), templ2->GetFunction(context.local()).ToLocalChecked()) .FromJust()); - v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), true).ToLocalChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("new f2()"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("new f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); } TEST(FunctionTemplateNewWithCacheHasNoSideEffect) { @@ -12366,8 +12385,14 @@ TEST(FunctionTemplateNewWithCacheHasNoSideEffect) { ->Set(context.local(), v8_str("f"), templ->GetFunction(context.local()).ToLocalChecked()) .FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f()"), true).IsEmpty()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("new f()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("new f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // Side-effect-free version. Local<v8::FunctionTemplate> templ2 = v8::FunctionTemplate::NewWithCache( @@ -12377,8 +12402,14 @@ TEST(FunctionTemplateNewWithCacheHasNoSideEffect) { ->Set(context.local(), v8_str("f2"), templ2->GetFunction(context.local()).ToLocalChecked()) .FromJust()); - v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), true).ToLocalChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("new f2()"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("new f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); } TEST(FunctionNewHasNoSideEffect) { @@ -12390,8 +12421,14 @@ TEST(FunctionNewHasNoSideEffect) { Local<Function> func = Function::New(context.local(), EmptyHandler).ToLocalChecked(); CHECK(context->Global()->Set(context.local(), v8_str("f"), func).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f()"), true).IsEmpty()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("new f()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("new f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // Side-effect-free version. Local<Function> func2 = @@ -12401,8 +12438,14 @@ TEST(FunctionNewHasNoSideEffect) { .ToLocalChecked(); CHECK( context->Global()->Set(context.local(), v8_str("f2"), func2).FromJust()); - v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), true).ToLocalChecked(); - v8::debug::EvaluateGlobal(isolate, v8_str("new f2()"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("new f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); } // These handlers instantiate a function the embedder considers safe in some @@ -12461,7 +12504,10 @@ TEST(FunctionNewInstanceHasNoSideEffect) { v8::SideEffectType::kHasNoSideEffect) .ToLocalChecked(); CHECK(context->Global()->Set(context.local(), v8_str("f"), func0).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // A whitelisted function that creates a new object. Should throw. Local<Function> func = @@ -12470,7 +12516,10 @@ TEST(FunctionNewInstanceHasNoSideEffect) { v8::SideEffectType::kHasNoSideEffect) .ToLocalChecked(); CHECK(context->Global()->Set(context.local(), v8_str("f"), func).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // A whitelisted function that creates a new object with explicit intent to // have no side-effects (e.g. building an "object wrapper"). Should not throw. @@ -12481,18 +12530,26 @@ TEST(FunctionNewInstanceHasNoSideEffect) { .ToLocalChecked(); CHECK( context->Global()->Set(context.local(), v8_str("f2"), func2).FromJust()); - v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), true).ToLocalChecked(); + v8::debug::EvaluateGlobal( + isolate, v8_str("f2()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .ToLocalChecked(); // Check that side effect skipping did not leak outside to future evaluations. Local<Function> func3 = Function::New(context.local(), EmptyHandler).ToLocalChecked(); CHECK( context->Global()->Set(context.local(), v8_str("f3"), func3).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("f3()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("f3()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // Check that using side effect free NewInstance works in normal evaluation // (without throwOnSideEffect). - v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), false).ToLocalChecked(); + v8::debug::EvaluateGlobal(isolate, v8_str("f2()"), + v8::debug::EvaluateGlobalMode::kDefault) + .ToLocalChecked(); } TEST(CallHandlerAsFunctionHasNoSideEffectNotSupported) { @@ -12505,7 +12562,10 @@ TEST(CallHandlerAsFunctionHasNoSideEffectNotSupported) { templ->SetCallAsFunctionHandler(EmptyHandler); Local<v8::Object> obj = templ->NewInstance(context.local()).ToLocalChecked(); CHECK(context->Global()->Set(context.local(), v8_str("obj"), obj).FromJust()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); // Side-effect-free version is not supported. i::FunctionTemplateInfo cons = i::FunctionTemplateInfo::cast( @@ -12516,7 +12576,10 @@ TEST(CallHandlerAsFunctionHasNoSideEffectNotSupported) { CHECK(!handler_info.IsSideEffectFreeCallHandlerInfo()); handler_info.set_map( i::ReadOnlyRoots(heap).side_effect_free_call_handler_info_map()); - CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj()"), true).IsEmpty()); + CHECK(v8::debug::EvaluateGlobal( + isolate, v8_str("obj()"), + v8::debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) + .IsEmpty()); } static void IsConstructHandler( @@ -18192,10 +18255,10 @@ static void BreakArrayGuarantees(const char* script) { v8::Context::Scope context_scope(context); v8::internal::Isolate* i_isolate = reinterpret_cast<v8::internal::Isolate*>(isolate1); - CHECK(i_isolate->IsNoElementsProtectorIntact()); + CHECK(v8::internal::Protectors::IsNoElementsIntact(i_isolate)); // Run something in new isolate. CompileRun(script); - CHECK(!i_isolate->IsNoElementsProtectorIntact()); + CHECK(!v8::internal::Protectors::IsNoElementsIntact(i_isolate)); } isolate1->Exit(); isolate1->Dispose(); @@ -23170,7 +23233,7 @@ void RunStreamingTest(const char** chunks, v8::TryCatch try_catch(isolate); v8::ScriptCompiler::StreamedSource source( - v8::base::make_unique<TestSourceStream>(chunks), encoding); + std::make_unique<TestSourceStream>(chunks), encoding); v8::ScriptCompiler::ScriptStreamingTask* task = v8::ScriptCompiler::StartStreamingScript(isolate, &source); @@ -23441,7 +23504,7 @@ TEST(StreamingWithDebuggingEnabledLate) { v8::TryCatch try_catch(isolate); v8::ScriptCompiler::StreamedSource source( - v8::base::make_unique<TestSourceStream>(chunks), + std::make_unique<TestSourceStream>(chunks), v8::ScriptCompiler::StreamedSource::ONE_BYTE); v8::ScriptCompiler::ScriptStreamingTask* task = v8::ScriptCompiler::StartStreamingScript(isolate, &source); @@ -23549,7 +23612,7 @@ TEST(StreamingWithHarmonyScopes) { v8::TryCatch try_catch(isolate); v8::ScriptCompiler::StreamedSource source( - v8::base::make_unique<TestSourceStream>(chunks), + std::make_unique<TestSourceStream>(chunks), v8::ScriptCompiler::StreamedSource::ONE_BYTE); v8::ScriptCompiler::ScriptStreamingTask* task = v8::ScriptCompiler::StartStreamingScript(isolate, &source); @@ -23658,9 +23721,7 @@ v8::MaybeLocal<Value> SyntheticModuleEvaluationStepsCallbackFail( v8::MaybeLocal<Value> SyntheticModuleEvaluationStepsCallbackSetExport( Local<Context> context, Local<Module> module) { - Maybe<bool> set_export_result = module->SetSyntheticModuleExport( - context->GetIsolate(), v8_str("test_export"), v8_num(42)); - CHECK(set_export_result.FromJust()); + module->SetSyntheticModuleExport(v8_str("test_export"), v8_num(42)); return v8::Undefined(reinterpret_cast<v8::Isolate*>(context->GetIsolate())); } @@ -23771,7 +23832,13 @@ TEST(ModuleCodeCache) { // Evaluate for possible lazy compilation. Local<Value> completion_value = module->Evaluate(context).ToLocalChecked(); - CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(completion_value)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + } // Now create the cache. Note that it is freed, obscurely, when // ScriptCompiler::Source goes out of scope below. @@ -23802,7 +23869,13 @@ TEST(ModuleCodeCache) { Local<Value> completion_value = module->Evaluate(context).ToLocalChecked(); - CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(completion_value)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + } } isolate->Dispose(); } @@ -23867,9 +23940,7 @@ TEST(SyntheticModuleSetExports) { // undefined. CHECK(foo_cell->value().IsUndefined()); - Maybe<bool> set_export_result = - module->SetSyntheticModuleExport(isolate, foo_string, bar_string); - CHECK(set_export_result.FromJust()); + module->SetSyntheticModuleExport(foo_string, bar_string); // After setting the export the Cell should still have the same idenitity. CHECK_EQ(exports->Lookup(v8::Utils::OpenHandle(*foo_string)), *foo_cell); @@ -23880,34 +23951,6 @@ TEST(SyntheticModuleSetExports) { ->Equals(*v8::Utils::OpenHandle(*bar_string))); } -TEST(SyntheticModuleSetMissingExport) { - LocalContext env; - v8::Isolate* isolate = env->GetIsolate(); - auto i_isolate = reinterpret_cast<i::Isolate*>(isolate); - v8::Isolate::Scope iscope(isolate); - v8::HandleScope scope(isolate); - v8::Local<v8::Context> context = v8::Context::New(isolate); - v8::Context::Scope cscope(context); - - Local<String> foo_string = v8_str("foo"); - Local<String> bar_string = v8_str("bar"); - - Local<Module> module = CreateAndInstantiateSyntheticModule( - isolate, v8_str("SyntheticModuleSetExports-TestSyntheticModule"), context, - std::vector<v8::Local<v8::String>>(), - UnexpectedSyntheticModuleEvaluationStepsCallback); - - i::Handle<i::SyntheticModule> i_module = - i::Handle<i::SyntheticModule>::cast(v8::Utils::OpenHandle(*module)); - i::Handle<i::ObjectHashTable> exports(i_module->exports(), i_isolate); - - TryCatch try_catch(isolate); - Maybe<bool> set_export_result = - module->SetSyntheticModuleExport(isolate, foo_string, bar_string); - CHECK(set_export_result.IsNothing()); - CHECK(try_catch.HasCaught()); -} - TEST(SyntheticModuleEvaluationStepsNoThrow) { synthetic_module_callback_count = 0; LocalContext env; @@ -24011,7 +24054,13 @@ TEST(ImportFromSyntheticModule) { .ToChecked(); Local<Value> completion_value = module->Evaluate(context).ToLocalChecked(); - CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(completion_value)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + } } TEST(ImportFromSyntheticModuleThrow) { @@ -24041,7 +24090,15 @@ TEST(ImportFromSyntheticModuleThrow) { CHECK_EQ(module->GetStatus(), Module::kInstantiated); TryCatch try_catch(isolate); v8::MaybeLocal<Value> completion_value = module->Evaluate(context); - CHECK(completion_value.IsEmpty()); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise( + Local<v8::Promise>::Cast(completion_value.ToLocalChecked())); + CHECK_EQ(promise->State(), v8::Promise::kRejected); + CHECK_EQ(promise->Result(), try_catch.Exception()); + } else { + CHECK(completion_value.IsEmpty()); + } + CHECK_EQ(module->GetStatus(), Module::kErrored); CHECK(try_catch.HasCaught()); } @@ -24074,7 +24131,13 @@ TEST(CodeCacheModuleScriptMismatch) { // Evaluate for possible lazy compilation. Local<Value> completion_value = module->Evaluate(context).ToLocalChecked(); - CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(completion_value)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + } // Now create the cache. Note that it is freed, obscurely, when // ScriptCompiler::Source goes out of scope below. @@ -24170,7 +24233,13 @@ TEST(CodeCacheScriptModuleMismatch) { Local<Value> completion_value = module->Evaluate(context).ToLocalChecked(); - CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(completion_value)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + } } isolate->Dispose(); } @@ -24206,10 +24275,14 @@ TEST(InvalidCodeCacheDataInCompileModule) { .ToChecked(); CHECK(cached_data->rejected); - CHECK_EQ(42, module->Evaluate(context) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); + Local<Value> completion_value = module->Evaluate(context).ToLocalChecked(); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(completion_value)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK_EQ(42, completion_value->Int32Value(context).FromJust()); + } } void TestInvalidCacheData(v8::ScriptCompiler::CompileOptions option) { @@ -24403,280 +24476,6 @@ TEST(SealHandleScopeNested) { } } - -static void ExtrasBindingTestRuntimeFunction( - const v8::FunctionCallbackInfo<v8::Value>& args) { - CHECK_EQ( - 3, - args[0]->Int32Value(args.GetIsolate()->GetCurrentContext()).FromJust()); - args.GetReturnValue().Set(v8_num(7)); -} - -TEST(ExtrasFunctionSource) { - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope handle_scope(isolate); - LocalContext env; - - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - // Functions defined in extras do not expose source code. - auto func = binding->Get(env.local(), v8_str("testFunctionToString")) - .ToLocalChecked() - .As<v8::Function>(); - auto undefined = v8::Undefined(isolate); - auto result = func->Call(env.local(), undefined, 0, {}) - .ToLocalChecked() - .As<v8::String>(); - CHECK(result->StrictEquals(v8_str("function foo() { [native code] }"))); - - // Functions defined in extras do not show up in the stack trace. - auto wrapper = binding->Get(env.local(), v8_str("testStackTrace")) - .ToLocalChecked() - .As<v8::Function>(); - CHECK(env->Global()->Set(env.local(), v8_str("wrapper"), wrapper).FromJust()); - ExpectString( - "function f(x) { return wrapper(x) }" - "function g() { return new Error().stack; }" - "f(g)", - "Error\n" - " at g (<anonymous>:1:58)\n" - " at f (<anonymous>:1:24)\n" - " at <anonymous>:1:78"); -} - -TEST(ExtrasBindingObject) { - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope handle_scope(isolate); - LocalContext env; - - // standalone.gypi ensures we include the test-extra.js file, which should - // export the tested functions. - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - auto func = binding->Get(env.local(), v8_str("testExtraShouldReturnFive")) - .ToLocalChecked() - .As<v8::Function>(); - auto undefined = v8::Undefined(isolate); - auto result = func->Call(env.local(), undefined, 0, {}) - .ToLocalChecked() - .As<v8::Number>(); - CHECK_EQ(5, result->Int32Value(env.local()).FromJust()); - - v8::Local<v8::FunctionTemplate> runtimeFunction = - v8::FunctionTemplate::New(isolate, ExtrasBindingTestRuntimeFunction); - binding->Set(env.local(), v8_str("runtime"), - runtimeFunction->GetFunction(env.local()).ToLocalChecked()) - .FromJust(); - func = binding->Get(env.local(), v8_str("testExtraShouldCallToRuntime")) - .ToLocalChecked() - .As<v8::Function>(); - result = func->Call(env.local(), undefined, 0, {}) - .ToLocalChecked() - .As<v8::Number>(); - CHECK_EQ(7, result->Int32Value(env.local()).FromJust()); -} - - -TEST(ExtrasCreatePromise) { - i::FLAG_allow_natives_syntax = true; - LocalContext context; - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - - LocalContext env; - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - auto func = binding->Get(env.local(), v8_str("testCreatePromise")) - .ToLocalChecked() - .As<v8::Function>(); - CHECK(env->Global()->Set(env.local(), v8_str("func"), func).FromJust()); - - auto promise = CompileRun( - "%PrepareFunctionForOptimization(func);\n" - "func();\n" - "func();\n" - "%OptimizeFunctionOnNextCall(func);\n" - "func()\n") - .As<v8::Promise>(); - CHECK_EQ(v8::Promise::kPending, promise->State()); -} - -TEST(ExtrasCreatePromiseWithParent) { - i::FLAG_allow_natives_syntax = true; - LocalContext context; - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - - LocalContext env; - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - auto func = binding->Get(env.local(), v8_str("testCreatePromiseWithParent")) - .ToLocalChecked() - .As<v8::Function>(); - CHECK(env->Global()->Set(env.local(), v8_str("func"), func).FromJust()); - - auto promise = CompileRun( - "var parent = new Promise((a, b) => {});\n" - "%PrepareFunctionForOptimization(func);\n" - "func(parent);\n" - "func(parent);\n" - "%OptimizeFunctionOnNextCall(func);\n" - "func(parent)\n") - .As<v8::Promise>(); - CHECK_EQ(v8::Promise::kPending, promise->State()); -} - -TEST(ExtrasRejectPromise) { - i::FLAG_allow_natives_syntax = true; - LocalContext context; - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - - LocalContext env; - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - auto func = binding->Get(env.local(), v8_str("testRejectPromise")) - .ToLocalChecked() - .As<v8::Function>(); - CHECK(env->Global()->Set(env.local(), v8_str("func"), func).FromJust()); - - auto rejected_promise = CompileRun( - "function newPromise() {\n" - " return new Promise((a, b) => {});\n" - "}\n" - "%PrepareFunctionForOptimization(func);\n" - "func(newPromise(), 1);\n" - "func(newPromise(), 1);\n" - "%OptimizeFunctionOnNextCall(func);\n" - "var promise = newPromise();\n" - "func(promise, 1);\n" - "promise;\n") - .As<v8::Promise>(); - CHECK_EQ(v8::Promise::kRejected, rejected_promise->State()); - CHECK_EQ(1, rejected_promise->Result()->Int32Value(env.local()).FromJust()); -} - -TEST(ExtrasResolvePromise) { - i::FLAG_allow_natives_syntax = true; - LocalContext context; - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - - LocalContext env; - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - auto func = binding->Get(env.local(), v8_str("testResolvePromise")) - .ToLocalChecked() - .As<v8::Function>(); - CHECK(env->Global()->Set(env.local(), v8_str("func"), func).FromJust()); - - auto pending_promise = CompileRun( - "function newPromise() {\n" - " return new Promise((a, b) => {});\n" - "}\n" - "%PrepareFunctionForOptimization(func);\n" - "func(newPromise(), newPromise());\n" - "func(newPromise(), newPromise());\n" - "%OptimizeFunctionOnNextCall(func);\n" - "var promise = newPromise();\n" - "func(promise, newPromise());\n" - "promise;\n") - .As<v8::Promise>(); - CHECK_EQ(v8::Promise::kPending, pending_promise->State()); - - auto fulfilled_promise = CompileRun( - "function newPromise() {\n" - " return new Promise((a, b) => {});\n" - "}\n" - "%PrepareFunctionForOptimization(func);\n" - "func(newPromise(), 1);\n" - "func(newPromise(), 1);\n" - "%OptimizeFunctionOnNextCall(func);\n" - "var promise = newPromise();\n" - "func(promise, 1);\n" - "promise;\n") - .As<v8::Promise>(); - CHECK_EQ(v8::Promise::kFulfilled, fulfilled_promise->State()); - CHECK_EQ(1, fulfilled_promise->Result()->Int32Value(env.local()).FromJust()); -} - -TEST(ExtrasUtilsObject) { - LocalContext context; - v8::Isolate* isolate = context->GetIsolate(); - v8::HandleScope handle_scope(isolate); - - LocalContext env; - v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); - - auto func = binding->Get(env.local(), v8_str("testExtraCanUseUtils")) - .ToLocalChecked() - .As<v8::Function>(); - auto undefined = v8::Undefined(isolate); - auto result = func->Call(env.local(), undefined, 0, {}) - .ToLocalChecked() - .As<v8::Object>(); - - auto private_symbol = result->Get(env.local(), v8_str("privateSymbol")) - .ToLocalChecked() - .As<v8::Symbol>(); - i::Handle<i::Symbol> ips = v8::Utils::OpenHandle(*private_symbol); - CHECK(ips->IsPrivate()); - - CompileRun("var result = 0; function store(x) { result = x; }"); - auto store = CompileRun("store").As<v8::Function>(); - - auto fulfilled_promise = result->Get(env.local(), v8_str("fulfilledPromise")) - .ToLocalChecked() - .As<v8::Promise>(); - fulfilled_promise->Then(env.local(), store).ToLocalChecked(); - isolate->RunMicrotasks(); - CHECK_EQ(1, CompileRun("result")->Int32Value(env.local()).FromJust()); - - auto fulfilled_promise_2 = - result->Get(env.local(), v8_str("fulfilledPromise2")) - .ToLocalChecked() - .As<v8::Promise>(); - fulfilled_promise_2->Then(env.local(), store).ToLocalChecked(); - isolate->RunMicrotasks(); - CHECK_EQ(2, CompileRun("result")->Int32Value(env.local()).FromJust()); - - auto rejected_promise = result->Get(env.local(), v8_str("rejectedPromise")) - .ToLocalChecked() - .As<v8::Promise>(); - rejected_promise->Catch(env.local(), store).ToLocalChecked(); - isolate->RunMicrotasks(); - CHECK_EQ(3, CompileRun("result")->Int32Value(env.local()).FromJust()); - - auto rejected_but_handled_promise = - result->Get(env.local(), v8_str("rejectedButHandledPromise")) - .ToLocalChecked() - .As<v8::Promise>(); - CHECK(rejected_but_handled_promise->HasHandler()); - - auto promise_states = result->Get(env.local(), v8_str("promiseStates")) - .ToLocalChecked() - .As<v8::String>(); - String::Utf8Value promise_states_string(isolate, promise_states); - CHECK_EQ(0, strcmp(*promise_states_string, "pending fulfilled rejected")); - - auto promise_is_promise = result->Get(env.local(), v8_str("promiseIsPromise")) - .ToLocalChecked() - .As<v8::Boolean>(); - CHECK_EQ(true, promise_is_promise->Value()); - - auto thenable_is_promise = - result->Get(env.local(), v8_str("thenableIsPromise")) - .ToLocalChecked() - .As<v8::Boolean>(); - CHECK_EQ(false, thenable_is_promise->Value()); - - auto uncurry_this = result->Get(env.local(), v8_str("uncurryThis")) - .ToLocalChecked() - .As<v8::Boolean>(); - CHECK_EQ(true, uncurry_this->Value()); -} - - TEST(Map) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope handle_scope(isolate); @@ -25854,7 +25653,14 @@ TEST(ImportMeta) { module->InstantiateModule(context.local(), UnexpectedModuleResolveCallback) .ToChecked(); Local<Value> result = module->Evaluate(context.local()).ToLocalChecked(); - CHECK(result->StrictEquals(Local<v8::Value>::Cast(v8::Utils::ToLocal(meta)))); + if (i::FLAG_harmony_top_level_await) { + Local<v8::Promise> promise(Local<v8::Promise>::Cast(result)); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK( + result->StrictEquals(Local<v8::Value>::Cast(v8::Utils::ToLocal(meta)))); + } } TEST(GetModuleNamespace) { @@ -26180,7 +25986,7 @@ void AtomicsWaitCallbackForTesting( wake_handle->Wake(); break; case AtomicsWaitCallbackAction::StopFromThreadAndThrow: - info->stop_thread = v8::base::make_unique<StopAtomicsWaitThread>(info); + info->stop_thread = std::make_unique<StopAtomicsWaitThread>(info); CHECK(info->stop_thread->Start()); break; case AtomicsWaitCallbackAction::KeepWaiting: diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index c96a0199bb..bae39ba2ad 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -3391,7 +3391,9 @@ TEST(ARMv8_vminmax_f32) { template <typename T, typename Inputs, typename Results> static GeneratedCode<F_ppiii> GenerateMacroFloatMinMax( - MacroAssembler& assm) { // NOLINT(runtime/references) + MacroAssembler* assm_ptr) { + MacroAssembler& assm = *assm_ptr; + T a = T::from_code(0); // d0/s0 T b = T::from_code(1); // d1/s1 T c = T::from_code(2); // d2/s2 @@ -3509,7 +3511,7 @@ TEST(macro_float_minmax_f64) { double max_aba_; }; - auto f = GenerateMacroFloatMinMax<DwVfpRegister, Inputs, Results>(assm); + auto f = GenerateMacroFloatMinMax<DwVfpRegister, Inputs, Results>(&assm); #define CHECK_MINMAX(left, right, min, max) \ do { \ @@ -3574,7 +3576,7 @@ TEST(macro_float_minmax_f32) { float max_aba_; }; - auto f = GenerateMacroFloatMinMax<SwVfpRegister, Inputs, Results>(assm); + auto f = GenerateMacroFloatMinMax<SwVfpRegister, Inputs, Results>(&assm); #define CHECK_MINMAX(left, right, min, max) \ do { \ diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc index 4fdf30ef64..44ee286587 100644 --- a/deps/v8/test/cctest/test-assembler-arm64.cc +++ b/deps/v8/test/cctest/test-assembler-arm64.cc @@ -2019,17 +2019,19 @@ TEST(far_branch_backward) { START(); Label done, fail; - Label near, far, in_range, out_of_range; + // Avoid using near and far as variable name because both are defined as + // macro in minwindef.h from Windows SDK. + Label near_label, far_label, in_range, out_of_range; __ Mov(x0, 0); __ Mov(x1, 1); __ Mov(x10, 0); - __ B(&near); + __ B(&near_label); __ Bind(&in_range); __ Orr(x0, x0, 1 << 0); - __ B(&far); + __ B(&far_label); __ Bind(&out_of_range); __ Orr(x0, x0, 1 << 1); @@ -2053,19 +2055,19 @@ TEST(far_branch_backward) { // close to the limit. GenerateLandingNops(&masm, budget - kSlack, &fail); - __ Bind(&near); + __ Bind(&near_label); switch (type) { case TestBranchType: __ Tbz(x10, 3, &in_range); // This should be: // TBZ <in_range> - CHECK_EQ(1 * kInstrSize, __ SizeOfCodeGeneratedSince(&near)); + CHECK_EQ(1 * kInstrSize, __ SizeOfCodeGeneratedSince(&near_label)); break; case CompareBranchType: __ Cbz(x10, &in_range); // This should be: // CBZ <in_range> - CHECK_EQ(1 * kInstrSize, __ SizeOfCodeGeneratedSince(&near)); + CHECK_EQ(1 * kInstrSize, __ SizeOfCodeGeneratedSince(&near_label)); break; case CondBranchType: __ Cmp(x10, 0); @@ -2073,7 +2075,7 @@ TEST(far_branch_backward) { // This should be: // CMP // B.EQ <in_range> - CHECK_EQ(2 * kInstrSize, __ SizeOfCodeGeneratedSince(&near)); + CHECK_EQ(2 * kInstrSize, __ SizeOfCodeGeneratedSince(&near_label)); break; default: UNREACHABLE(); @@ -2083,7 +2085,7 @@ TEST(far_branch_backward) { // Now go past the limit so that branches are now out of range. GenerateLandingNops(&masm, kSlack * 2, &fail); - __ Bind(&far); + __ Bind(&far_label); switch (type) { case TestBranchType: __ Tbz(x10, 5, &out_of_range); @@ -2091,7 +2093,7 @@ TEST(far_branch_backward) { // TBNZ <skip> // B <out_of_range> // skip: - CHECK_EQ(2 * kInstrSize, __ SizeOfCodeGeneratedSince(&far)); + CHECK_EQ(2 * kInstrSize, __ SizeOfCodeGeneratedSince(&far_label)); break; case CompareBranchType: __ Cbz(x10, &out_of_range); @@ -2099,7 +2101,7 @@ TEST(far_branch_backward) { // CBNZ <skip> // B <out_of_range> // skip: - CHECK_EQ(2 * kInstrSize, __ SizeOfCodeGeneratedSince(&far)); + CHECK_EQ(2 * kInstrSize, __ SizeOfCodeGeneratedSince(&far_label)); break; case CondBranchType: __ Cmp(x10, 0); @@ -2109,7 +2111,7 @@ TEST(far_branch_backward) { // B.NE <skip> // B <out_of_range> // skip: - CHECK_EQ(3 * kInstrSize, __ SizeOfCodeGeneratedSince(&far)); + CHECK_EQ(3 * kInstrSize, __ SizeOfCodeGeneratedSince(&far_label)); break; default: UNREACHABLE(); diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc index 1cc1aa3213..dd0c056369 100644 --- a/deps/v8/test/cctest/test-assembler-mips.cc +++ b/deps/v8/test/cctest/test-assembler-mips.cc @@ -3206,7 +3206,7 @@ TEST(jump_tables3) { Handle<Object> values[kNumCases]; for (int i = 0; i < kNumCases; ++i) { double value = isolate->random_number_generator()->NextDouble(); - values[i] = isolate->factory()->NewHeapNumber(value, AllocationType::kOld); + values[i] = isolate->factory()->NewHeapNumber<AllocationType::kOld>(value); } Label labels[kNumCases]; Object obj; @@ -4825,9 +4825,10 @@ TEST(r6_beqzc) { } } -void load_elements_of_vector( - MacroAssembler& assm, // NOLINT(runtime/references) - const uint64_t elements[], MSARegister w, Register t0, Register t1) { +void load_elements_of_vector(MacroAssembler* assm_ptr, + const uint64_t elements[], MSARegister w, + Register t0, Register t1) { + MacroAssembler& assm = *assm_ptr; __ li(t0, static_cast<uint32_t>(elements[0] & 0xFFFFFFFF)); __ li(t1, static_cast<uint32_t>((elements[0] >> 32) & 0xFFFFFFFF)); __ insert_w(w, 0, t0); @@ -4838,9 +4839,9 @@ void load_elements_of_vector( __ insert_w(w, 3, t1); } -inline void store_elements_of_vector( - MacroAssembler& assm, // NOLINT(runtime/references) - MSARegister w, Register a) { +inline void store_elements_of_vector(MacroAssembler* assm_ptr, MSARegister w, + Register a) { + MacroAssembler& assm = *assm_ptr; __ st_d(w, MemOperand(a, 0)); } @@ -4876,15 +4877,15 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch, msa_reg_t res; Label do_not_move_w0_to_w2; - load_elements_of_vector(assm, &t.ws_lo, w0, t0, t1); - load_elements_of_vector(assm, &t.wd_lo, w2, t0, t1); - load_elements_of_vector(assm, &input->wt_lo, w1, t0, t1); + load_elements_of_vector(&assm, &t.ws_lo, w0, t0, t1); + load_elements_of_vector(&assm, &t.wd_lo, w2, t0, t1); + load_elements_of_vector(&assm, &input->wt_lo, w1, t0, t1); GenerateBranch(assm, do_not_move_w0_to_w2); __ nop(); __ move_v(w2, w0); __ bind(&do_not_move_w0_to_w2); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -5841,7 +5842,7 @@ void run_msa_insert(int32_t rs_value, int n, msa_reg_t* w) { UNREACHABLE(); } - store_elements_of_vector(assm, w0, a0); + store_elements_of_vector(&assm, w0, a0); __ jr(ra); __ nop(); @@ -5937,10 +5938,10 @@ TEST(MSA_move_v) { MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes); CpuFeatureScope fscope(&assm, MIPS_SIMD); - load_elements_of_vector(assm, &t[i].ws_lo, w0, t0, t1); - load_elements_of_vector(assm, &t[i].wd_lo, w2, t0, t1); + load_elements_of_vector(&assm, &t[i].ws_lo, w0, t0, t1); + load_elements_of_vector(&assm, &t[i].wd_lo, w2, t0, t1); __ move_v(w2, w0); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -5981,10 +5982,10 @@ void run_msa_sldi(OperFunc GenerateOperation, for (unsigned i = 0; i < arraysize(t); ++i) { MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes); CpuFeatureScope fscope(&assm, MIPS_SIMD); - load_elements_of_vector(assm, &t[i].ws_lo, w0, t0, t1); - load_elements_of_vector(assm, &t[i].wd_lo, w2, t0, t1); + load_elements_of_vector(&assm, &t[i].ws_lo, w0, t0, t1); + load_elements_of_vector(&assm, &t[i].wd_lo, w2, t0, t1); GenerateOperation(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -6175,7 +6176,7 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, UNREACHABLE(); } - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -6460,11 +6461,11 @@ void run_msa_i5(struct TestCaseMsaI5* input, bool i5_sign_ext, int32_t i5 = i5_sign_ext ? static_cast<int32_t>(input->i5 << 27) >> 27 : input->i5; - load_elements_of_vector(assm, &(input->ws_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w0, t0, t1); GenerateI5InstructionFunc(assm, i5); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -6880,10 +6881,10 @@ void run_msa_2r(const struct TestCaseMsa2R* input, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, reinterpret_cast<const uint64_t*>(input), w0, + load_elements_of_vector(&assm, reinterpret_cast<const uint64_t*>(input), w0, t0, t1); Generate2RInstructionFunc(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -7926,13 +7927,13 @@ void run_msa_vector(struct TestCaseMsaVector* input, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, &(input->ws_lo), w0, t0, t1); - load_elements_of_vector(assm, &(input->wt_lo), w2, t0, t1); - load_elements_of_vector(assm, &(input->wd_lo), w4, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->wt_lo), w2, t0, t1); + load_elements_of_vector(&assm, &(input->wd_lo), w4, t0, t1); GenerateVectorInstructionFunc(assm); - store_elements_of_vector(assm, w4, a0); + store_elements_of_vector(&assm, w4, a0); __ jr(ra); __ nop(); @@ -8014,12 +8015,12 @@ void run_msa_bit(struct TestCaseMsaBit* input, InstFunc GenerateInstructionFunc, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, &(input->ws_lo), w0, t0, t1); - load_elements_of_vector(assm, &(input->wd_lo), w2, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->wd_lo), w2, t0, t1); GenerateInstructionFunc(assm, input->m); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -8491,7 +8492,7 @@ void run_msa_i10(int32_t input, InstFunc GenerateVectorInstructionFunc, GenerateVectorInstructionFunc(assm, input); - store_elements_of_vector(assm, w0, a0); + store_elements_of_vector(&assm, w0, a0); __ jr(ra); __ nop(); @@ -8640,13 +8641,13 @@ void run_msa_3r(struct TestCaseMsa3R* input, InstFunc GenerateI5InstructionFunc, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, &(input->wt_lo), w0, t0, t1); - load_elements_of_vector(assm, &(input->ws_lo), w1, t0, t1); - load_elements_of_vector(assm, &(input->wd_lo), w2, t0, t1); + load_elements_of_vector(&assm, &(input->wt_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w1, t0, t1); + load_elements_of_vector(&assm, &(input->wd_lo), w2, t0, t1); GenerateI5InstructionFunc(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -9645,13 +9646,13 @@ void run_msa_3rf(const struct TestCaseMsa3RF* input, msa_reg_t res; load_elements_of_vector( - assm, reinterpret_cast<const uint64_t*>(&input->ws_lo), w0, t0, t1); + &assm, reinterpret_cast<const uint64_t*>(&input->ws_lo), w0, t0, t1); load_elements_of_vector( - assm, reinterpret_cast<const uint64_t*>(&input->wt_lo), w1, t0, t1); + &assm, reinterpret_cast<const uint64_t*>(&input->wt_lo), w1, t0, t1); load_elements_of_vector( - assm, reinterpret_cast<const uint64_t*>(&input->wd_lo), w2, t0, t1); + &assm, reinterpret_cast<const uint64_t*>(&input->wd_lo), w2, t0, t1); Generate2RInstructionFunc(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc index f337fdfcac..35e81cb46f 100644 --- a/deps/v8/test/cctest/test-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-assembler-mips64.cc @@ -3330,7 +3330,7 @@ TEST(jump_tables3) { Handle<Object> values[kNumCases]; for (int i = 0; i < kNumCases; ++i) { double value = isolate->random_number_generator()->NextDouble(); - values[i] = isolate->factory()->NewHeapNumber(value, AllocationType::kOld); + values[i] = isolate->factory()->NewHeapNumber<AllocationType::kOld>(value); } Label labels[kNumCases]; Object obj; @@ -5430,9 +5430,10 @@ TEST(r6_beqzc) { } } -void load_elements_of_vector( - MacroAssembler& assm, // NOLINT(runtime/references) - const uint64_t elements[], MSARegister w, Register t0, Register t1) { +void load_elements_of_vector(MacroAssembler* assm_ptr, + const uint64_t elements[], MSARegister w, + Register t0, Register t1) { + MacroAssembler& assm = *assm_ptr; __ li(t0, static_cast<uint32_t>(elements[0] & 0xFFFFFFFF)); __ li(t1, static_cast<uint32_t>((elements[0] >> 32) & 0xFFFFFFFF)); __ insert_w(w, 0, t0); @@ -5443,9 +5444,9 @@ void load_elements_of_vector( __ insert_w(w, 3, t1); } -inline void store_elements_of_vector( - MacroAssembler& assm, // NOLINT(runtime/references) - MSARegister w, Register a) { +inline void store_elements_of_vector(MacroAssembler* assm_ptr, MSARegister w, + Register a) { + MacroAssembler& assm = *assm_ptr; __ st_d(w, MemOperand(a, 0)); } @@ -5481,15 +5482,15 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch, msa_reg_t res; Label do_not_move_w0_to_w2; - load_elements_of_vector(assm, &t.ws_lo, w0, t0, t1); - load_elements_of_vector(assm, &t.wd_lo, w2, t0, t1); - load_elements_of_vector(assm, &input->wt_lo, w1, t0, t1); + load_elements_of_vector(&assm, &t.ws_lo, w0, t0, t1); + load_elements_of_vector(&assm, &t.wd_lo, w2, t0, t1); + load_elements_of_vector(&assm, &input->wt_lo, w1, t0, t1); GenerateBranch(assm, do_not_move_w0_to_w2); __ nop(); __ move_v(w2, w0); __ bind(&do_not_move_w0_to_w2); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -6799,7 +6800,7 @@ void run_msa_insert(int64_t rs_value, int n, msa_reg_t* w) { UNREACHABLE(); } - store_elements_of_vector(assm, w0, a0); + store_elements_of_vector(&assm, w0, a0); __ jr(ra); __ nop(); @@ -6953,10 +6954,10 @@ TEST(MSA_move_v) { MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes); CpuFeatureScope fscope(&assm, MIPS_SIMD); - load_elements_of_vector(assm, &t[i].ws_lo, w0, t0, t1); - load_elements_of_vector(assm, &t[i].wd_lo, w2, t0, t1); + load_elements_of_vector(&assm, &t[i].ws_lo, w0, t0, t1); + load_elements_of_vector(&assm, &t[i].wd_lo, w2, t0, t1); __ move_v(w2, w0); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -6997,10 +6998,10 @@ void run_msa_sldi(OperFunc GenerateOperation, for (unsigned i = 0; i < arraysize(t); ++i) { MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes); CpuFeatureScope fscope(&assm, MIPS_SIMD); - load_elements_of_vector(assm, &t[i].ws_lo, w0, t0, t1); - load_elements_of_vector(assm, &t[i].wd_lo, w2, t0, t1); + load_elements_of_vector(&assm, &t[i].ws_lo, w0, t0, t1); + load_elements_of_vector(&assm, &t[i].wd_lo, w2, t0, t1); GenerateOperation(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -7157,7 +7158,7 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, UNREACHABLE(); } - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -7358,11 +7359,11 @@ void run_msa_i5(struct TestCaseMsaI5* input, bool i5_sign_ext, int32_t i5 = i5_sign_ext ? static_cast<int32_t>(input->i5 << 27) >> 27 : input->i5; - load_elements_of_vector(assm, &(input->ws_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w0, t0, t1); GenerateI5InstructionFunc(assm, i5); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -7784,10 +7785,10 @@ void run_msa_2r(const struct TestCaseMsa2R* input, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, reinterpret_cast<const uint64_t*>(input), w0, + load_elements_of_vector(&assm, reinterpret_cast<const uint64_t*>(input), w0, t0, t1); Generate2RInstructionFunc(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -8830,13 +8831,13 @@ void run_msa_vector(struct TestCaseMsaVector* input, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, &(input->ws_lo), w0, t0, t1); - load_elements_of_vector(assm, &(input->wt_lo), w2, t0, t1); - load_elements_of_vector(assm, &(input->wd_lo), w4, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->wt_lo), w2, t0, t1); + load_elements_of_vector(&assm, &(input->wd_lo), w4, t0, t1); GenerateVectorInstructionFunc(assm); - store_elements_of_vector(assm, w4, a0); + store_elements_of_vector(&assm, w4, a0); __ jr(ra); __ nop(); @@ -8918,12 +8919,12 @@ void run_msa_bit(struct TestCaseMsaBit* input, InstFunc GenerateInstructionFunc, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, &(input->ws_lo), w0, t0, t1); - load_elements_of_vector(assm, &(input->wd_lo), w2, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->wd_lo), w2, t0, t1); GenerateInstructionFunc(assm, input->m); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -9395,7 +9396,7 @@ void run_msa_i10(int32_t input, InstFunc GenerateVectorInstructionFunc, GenerateVectorInstructionFunc(assm, input); - store_elements_of_vector(assm, w0, a0); + store_elements_of_vector(&assm, w0, a0); __ jr(ra); __ nop(); @@ -9544,13 +9545,13 @@ void run_msa_3r(struct TestCaseMsa3R* input, InstFunc GenerateI5InstructionFunc, CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - load_elements_of_vector(assm, &(input->wt_lo), w0, t0, t1); - load_elements_of_vector(assm, &(input->ws_lo), w1, t0, t1); - load_elements_of_vector(assm, &(input->wd_lo), w2, t0, t1); + load_elements_of_vector(&assm, &(input->wt_lo), w0, t0, t1); + load_elements_of_vector(&assm, &(input->ws_lo), w1, t0, t1); + load_elements_of_vector(&assm, &(input->wd_lo), w2, t0, t1); GenerateI5InstructionFunc(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); @@ -10548,13 +10549,13 @@ void run_msa_3rf(const struct TestCaseMsa3RF* input, msa_reg_t res; load_elements_of_vector( - assm, reinterpret_cast<const uint64_t*>(&input->ws_lo), w0, t0, t1); + &assm, reinterpret_cast<const uint64_t*>(&input->ws_lo), w0, t0, t1); load_elements_of_vector( - assm, reinterpret_cast<const uint64_t*>(&input->wt_lo), w1, t0, t1); + &assm, reinterpret_cast<const uint64_t*>(&input->wt_lo), w1, t0, t1); load_elements_of_vector( - assm, reinterpret_cast<const uint64_t*>(&input->wd_lo), w2, t0, t1); + &assm, reinterpret_cast<const uint64_t*>(&input->wd_lo), w2, t0, t1); Generate2RInstructionFunc(assm); - store_elements_of_vector(assm, w2, a0); + store_elements_of_vector(&assm, w2, a0); __ jr(ra); __ nop(); diff --git a/deps/v8/test/cctest/test-backing-store.cc b/deps/v8/test/cctest/test-backing-store.cc new file mode 100644 index 0000000000..f8010d3031 --- /dev/null +++ b/deps/v8/test/cctest/test-backing-store.cc @@ -0,0 +1,85 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/api/api-inl.h" +#include "src/objects/backing-store.h" +#include "src/wasm/wasm-objects.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/manually-externalized-buffer.h" + +namespace v8 { +namespace internal { + +using testing::ManuallyExternalizedBuffer; + +TEST(Run_WasmModule_Buffer_Externalized_Detach) { + { + // Regression test for + // https://bugs.chromium.org/p/chromium/issues/detail?id=731046 + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + MaybeHandle<JSArrayBuffer> result = + isolate->factory()->NewJSArrayBufferAndBackingStore( + wasm::kWasmPageSize, InitializedFlag::kZeroInitialized); + Handle<JSArrayBuffer> buffer = result.ToHandleChecked(); + + // Embedder requests contents. + ManuallyExternalizedBuffer external(buffer); + + buffer->Detach(); + CHECK(buffer->was_detached()); + + // Make sure we can write to the buffer without crashing + uint32_t* int_buffer = + reinterpret_cast<uint32_t*>(external.backing_store()); + int_buffer[0] = 0; + // Embedder frees contents. + } + CcTest::CollectAllAvailableGarbage(); +} + +TEST(Run_WasmModule_Buffer_Externalized_Regression_UseAfterFree) { + { + // Regression test for https://crbug.com/813876 + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + MaybeHandle<WasmMemoryObject> result = + WasmMemoryObject::New(isolate, 1, 1, SharedFlag::kNotShared); + Handle<WasmMemoryObject> memory_object = result.ToHandleChecked(); + Handle<JSArrayBuffer> buffer(memory_object->array_buffer(), isolate); + + { + // Embedder requests contents. + ManuallyExternalizedBuffer external(buffer); + + // Growing (even by 0) detaches the old buffer. + WasmMemoryObject::Grow(isolate, memory_object, 0); + CHECK(buffer->was_detached()); + + // Embedder frees contents. + } + + // Make sure the memory object has a new buffer that can be written to. + uint32_t* int_buffer = reinterpret_cast<uint32_t*>( + memory_object->array_buffer().backing_store()); + int_buffer[0] = 0; + } + CcTest::CollectAllAvailableGarbage(); +} + +#if V8_TARGET_ARCH_64_BIT +TEST(BackingStore_Reclaim) { + // Make sure we can allocate memories without running out of address space. + Isolate* isolate = CcTest::InitIsolateOnce(); + for (int i = 0; i < 256; ++i) { + auto backing_store = + BackingStore::AllocateWasmMemory(isolate, 1, 1, SharedFlag::kNotShared); + CHECK(backing_store); + } +} +#endif + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 3a4f11e126..45512eaf56 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -123,6 +123,62 @@ TEST(CallCFunctionWithCallerSavedRegisters) { CHECK_EQ(3, Handle<Smi>::cast(result)->value()); } +TEST(NumberToString) { + Isolate* isolate(CcTest::InitIsolateOnce()); + Factory* factory = isolate->factory(); + + const int kNumParams = 1; + CodeAssemblerTester asm_tester(isolate, kNumParams); + CodeStubAssembler m(asm_tester.state()); + + { + TNode<Number> input = m.CAST(m.Parameter(0)); + + Label bailout(&m); + m.Return(m.NumberToString(input, &bailout)); + + m.BIND(&bailout); + m.Return(m.UndefinedConstant()); + } + + FunctionTester ft(asm_tester.GenerateCode(), kNumParams); + + // clang-format off + double inputs[] = { + 1, 2, 42, 153, -1, -100, 0, 51095154, -1241950, + std::nan("-1"), std::nan("1"), std::nan("2"), + -std::numeric_limits<double>::infinity(), + std::numeric_limits<double>::infinity(), + -0.0, -0.001, -0.5, -0.999, -1.0, + 0.0, 0.001, 0.5, 0.999, 1.0, + -2147483647.9, -2147483648.0, -2147483648.5, -2147483648.9, // SmiMin. + 2147483646.9, 2147483647.0, 2147483647.5, 2147483647.9, // SmiMax. + -4294967295.9, -4294967296.0, -4294967296.5, -4294967297.0, // - 2^32. + 4294967295.9, 4294967296.0, 4294967296.5, 4294967297.0, // 2^32. + }; + // clang-format on + + const int kFullCacheSize = isolate->heap()->MaxNumberToStringCacheSize(); + const int test_count = arraysize(inputs); + for (int i = 0; i < test_count; i++) { + int cache_length_before_addition = factory->number_string_cache()->length(); + Handle<Object> input = factory->NewNumber(inputs[i]); + Handle<String> expected = factory->NumberToString(input); + + Handle<Object> result = ft.Call(input).ToHandleChecked(); + if (result->IsUndefined(isolate)) { + // Query may fail if cache was resized, in which case the entry is not + // added to the cache. + CHECK_LT(cache_length_before_addition, kFullCacheSize); + CHECK_EQ(factory->number_string_cache()->length(), kFullCacheSize); + expected = factory->NumberToString(input); + result = ft.Call(input).ToHandleChecked(); + } + CHECK(!result->IsUndefined(isolate)); + CHECK_EQ(*expected, *result); + } +} + namespace { void CheckToUint32Result(uint32_t expected, Handle<Object> result) { @@ -439,7 +495,7 @@ TEST(TryToName) { Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m); { TYPED_VARIABLE_DEF(IntPtrT, var_index, &m); - TYPED_VARIABLE_DEF(Object, var_unique, &m); + TYPED_VARIABLE_DEF(Name, var_unique, &m); m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &var_unique, &if_bailout); @@ -1568,8 +1624,8 @@ TEST(TryLookupElement) { v8::ArrayBuffer::Contents contents = buffer->Externalize(); buffer->Detach(); - isolate->array_buffer_allocator()->Free(contents.Data(), - contents.ByteLength()); + contents.Deleter()(contents.Data(), contents.ByteLength(), + contents.DeleterData()); CHECK_ABSENT(object, 0); CHECK_ABSENT(object, 1); @@ -1809,7 +1865,7 @@ TEST(OneToTwoByteStringCopy) { const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); - CodeStubAssembler m(asm_tester.state()); + StringBuiltinsAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(0), m.IntPtrConstant(5), @@ -1841,7 +1897,7 @@ TEST(OneToOneByteStringCopy) { const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); - CodeStubAssembler m(asm_tester.state()); + StringBuiltinsAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(0), m.IntPtrConstant(5), @@ -1873,7 +1929,7 @@ TEST(OneToOneByteStringCopyNonZeroStart) { const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); - CodeStubAssembler m(asm_tester.state()); + StringBuiltinsAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(3), m.IntPtrConstant(2), @@ -1902,7 +1958,7 @@ TEST(TwoToTwoByteStringCopy) { const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); - CodeStubAssembler m(asm_tester.state()); + StringBuiltinsAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(0), m.IntPtrConstant(5), @@ -1941,12 +1997,9 @@ TEST(Arguments) { CodeStubArguments arguments(&m, m.IntPtrConstant(3)); - CSA_ASSERT( - &m, m.TaggedEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12)))); - CSA_ASSERT( - &m, m.TaggedEqual(arguments.AtIndex(1), m.SmiConstant(Smi::FromInt(13)))); - CSA_ASSERT( - &m, m.TaggedEqual(arguments.AtIndex(2), m.SmiConstant(Smi::FromInt(14)))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(0), m.SmiConstant(12))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(1), m.SmiConstant(13))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(2), m.SmiConstant(14))); arguments.PopAndReturn(arguments.GetReceiver()); @@ -1966,21 +2019,14 @@ TEST(ArgumentsWithSmiConstantIndices) { CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); - CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, - CodeStubAssembler::SMI_PARAMETERS); - - CSA_ASSERT(&m, - m.TaggedEqual(arguments.AtIndex(m.SmiConstant(0), - CodeStubAssembler::SMI_PARAMETERS), - m.SmiConstant(Smi::FromInt(12)))); - CSA_ASSERT(&m, - m.TaggedEqual(arguments.AtIndex(m.SmiConstant(1), - CodeStubAssembler::SMI_PARAMETERS), - m.SmiConstant(Smi::FromInt(13)))); - CSA_ASSERT(&m, - m.TaggedEqual(arguments.AtIndex(m.SmiConstant(2), - CodeStubAssembler::SMI_PARAMETERS), - m.SmiConstant(Smi::FromInt(14)))); + CodeStubArguments arguments(&m, m.SmiConstant(3)); + + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(0)), + m.SmiConstant(12))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(1)), + m.SmiConstant(13))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(2)), + m.SmiConstant(14))); arguments.PopAndReturn(arguments.GetReceiver()); @@ -2019,21 +2065,14 @@ TEST(ArgumentsWithSmiIndices) { CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); - CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, - CodeStubAssembler::SMI_PARAMETERS); - - CSA_ASSERT(&m, - m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 0), - CodeStubAssembler::SMI_PARAMETERS), - m.SmiConstant(Smi::FromInt(12)))); - CSA_ASSERT(&m, - m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 1), - CodeStubAssembler::SMI_PARAMETERS), - m.SmiConstant(Smi::FromInt(13)))); - CSA_ASSERT(&m, - m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 2), - CodeStubAssembler::SMI_PARAMETERS), - m.SmiConstant(Smi::FromInt(14)))); + CodeStubArguments arguments(&m, m.SmiConstant(3)); + + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 0)), + m.SmiConstant(12))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 1)), + m.SmiConstant(13))); + CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 2)), + m.SmiConstant(14))); arguments.PopAndReturn(arguments.GetReceiver()); @@ -2060,7 +2099,7 @@ TEST(ArgumentsForEach) { sum = m.SmiConstant(0); - arguments.ForEach(list, [&m, &sum](Node* arg) { + arguments.ForEach(list, [&](TNode<Object> arg) { sum = m.SmiAdd(sum.value(), m.CAST(arg)); }); @@ -2130,8 +2169,8 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler { TVariable<IntPtrT> arg_index(this); Label bailout(this); arg_index = IntPtrConstant(0); - Node* length = BuildAppendJSArray(kind_, HeapConstant(array), &args, - &arg_index, &bailout); + TNode<Smi> length = BuildAppendJSArray(kind_, HeapConstant(array), &args, + &arg_index, &bailout); Return(length); BIND(&bailout); @@ -2281,7 +2320,7 @@ TEST(AllocateAndInitJSPromise) { PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); - Node* const promise = m.AllocateAndInitJSPromise(context); + TNode<JSPromise> const promise = m.AllocateAndInitJSPromise(m.CAST(context)); m.Return(promise); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -2298,8 +2337,8 @@ TEST(AllocateAndSetJSPromise) { PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); - Node* const promise = m.AllocateAndSetJSPromise( - context, v8::Promise::kRejected, m.SmiConstant(1)); + TNode<JSPromise> const promise = m.AllocateAndSetJSPromise( + m.CAST(context), v8::Promise::kRejected, m.SmiConstant(1)); m.Return(promise); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -2361,8 +2400,8 @@ TEST(PromiseHasHandler) { PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); - Node* const promise = - m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); + TNode<JSPromise> const promise = + m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant()); m.Return(m.SelectBooleanConstant(m.PromiseHasHandler(promise))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -2380,10 +2419,11 @@ TEST(CreatePromiseResolvingFunctionsContext) { Node* const context = m.Parameter(kNumParams + 2); TNode<NativeContext> const native_context = m.LoadNativeContext(context); - Node* const promise = - m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); - Node* const promise_context = m.CreatePromiseResolvingFunctionsContext( - promise, m.BooleanConstant(false), native_context); + const TNode<JSPromise> promise = + m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant()); + TNode<Context> const promise_context = + m.CreatePromiseResolvingFunctionsContext( + promise, m.BooleanConstant(false), native_context); m.Return(promise_context); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -2408,8 +2448,8 @@ TEST(CreatePromiseResolvingFunctions) { Node* const context = m.Parameter(kNumParams + 2); TNode<NativeContext> const native_context = m.LoadNativeContext(context); - Node* const promise = - m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); + const TNode<JSPromise> promise = + m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant()); Node *resolve, *reject; std::tie(resolve, reject) = m.CreatePromiseResolvingFunctions( promise, m.BooleanConstant(false), native_context); @@ -2498,17 +2538,17 @@ TEST(AllocateFunctionWithMapAndContext) { Node* const context = m.Parameter(kNumParams + 2); TNode<NativeContext> const native_context = m.LoadNativeContext(context); - Node* const promise = - m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); - Node* promise_context = m.CreatePromiseResolvingFunctionsContext( + const TNode<JSPromise> promise = + m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant()); + TNode<Context> promise_context = m.CreatePromiseResolvingFunctionsContext( promise, m.BooleanConstant(false), native_context); TNode<Object> resolve_info = m.LoadContextElement( native_context, Context::PROMISE_CAPABILITY_DEFAULT_RESOLVE_SHARED_FUN_INDEX); TNode<Object> const map = m.LoadContextElement( native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX); - Node* const resolve = - m.AllocateFunctionWithMapAndContext(map, resolve_info, promise_context); + TNode<JSFunction> const resolve = m.AllocateFunctionWithMapAndContext( + m.CAST(map), m.CAST(resolve_info), promise_context); m.Return(resolve); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3122,7 +3162,7 @@ TEST(CloneEmptyFixedArray) { CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); - m.Return(m.CloneFixedArray(m.Parameter(0))); + m.Return(m.CloneFixedArray(m.CAST(m.Parameter(0)))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3139,7 +3179,7 @@ TEST(CloneFixedArray) { CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); - m.Return(m.CloneFixedArray(m.Parameter(0))); + m.Return(m.CloneFixedArray(m.CAST(m.Parameter(0)))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3161,7 +3201,7 @@ TEST(CloneFixedArrayCOW) { CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); - m.Return(m.CloneFixedArray(m.Parameter(0))); + m.Return(m.CloneFixedArray(m.CAST(m.Parameter(0)))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); @@ -3542,37 +3582,6 @@ TEST(TestCallBuiltinIndirectLoad) { Handle<String>::cast(result.ToHandleChecked()))); } -TEST(TestGotoIfDebugExecutionModeChecksSideEffects) { - Isolate* isolate(CcTest::InitIsolateOnce()); - CodeAssemblerTester asm_tester(isolate, 0); - { - CodeStubAssembler m(asm_tester.state()); - Label is_true(&m), is_false(&m); - m.GotoIfDebugExecutionModeChecksSideEffects(&is_true); - m.Goto(&is_false); - m.BIND(&is_false); - m.Return(m.BooleanConstant(false)); - - m.BIND(&is_true); - m.Return(m.BooleanConstant(true)); - } - - FunctionTester ft(asm_tester.GenerateCode(), 0); - - CHECK(isolate->debug_execution_mode() != DebugInfo::kSideEffects); - - Handle<Object> result = ft.Call().ToHandleChecked(); - CHECK(result->IsBoolean()); - CHECK_EQ(false, result->BooleanValue(isolate)); - - isolate->debug()->StartSideEffectCheckMode(); - CHECK(isolate->debug_execution_mode() == DebugInfo::kSideEffects); - - result = ft.Call().ToHandleChecked(); - CHECK(result->IsBoolean()); - CHECK_EQ(true, result->BooleanValue(isolate)); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index b961da9437..bd2766518b 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -907,7 +907,7 @@ TEST(DeepEagerCompilationPeakMemory) { " }" "}"); v8::ScriptCompiler::Source script_source(source); - CcTest::i_isolate()->compilation_cache()->Disable(); + CcTest::i_isolate()->compilation_cache()->DisableScriptAndEval(); v8::HeapStatistics heap_statistics; CcTest::isolate()->GetHeapStatistics(&heap_statistics); diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 6d0ee0e512..c0d43b21a1 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -54,8 +54,8 @@ #include "src/tracing/trace-event.h" #ifdef V8_USE_PERFETTO -#include "perfetto/trace/chrome/chrome_trace_event.pb.h" -#include "perfetto/trace/trace.pb.h" +#include "protos/perfetto/trace/chrome/chrome_trace_event.pb.h" +#include "protos/perfetto/trace/trace.pb.h" #endif namespace v8 { diff --git a/deps/v8/test/cctest/test-debug-helper.cc b/deps/v8/test/cctest/test-debug-helper.cc index 67236e5a31..560db1b0d2 100644 --- a/deps/v8/test/cctest/test-debug-helper.cc +++ b/deps/v8/test/cctest/test-debug-helper.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "src/api/api-inl.h" +#include "src/flags/flags.h" #include "src/heap/spaces.h" #include "test/cctest/cctest.h" #include "tools/debug_helper/debug-helper.h" @@ -61,6 +62,10 @@ void CheckProp(const d::ObjectProperty& property, const char* expected_type, CHECK(*reinterpret_cast<TValue*>(property.address) == expected_value); } +bool StartsWith(std::string full_string, std::string prefix) { + return full_string.substr(0, prefix.size()) == prefix; +} + } // namespace TEST(GetObjectProperties) { @@ -68,12 +73,13 @@ TEST(GetObjectProperties) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); LocalContext context; - d::Roots roots{0, 0, 0, 0}; // We don't know the heap roots. + // Claim we don't know anything about the heap layout. + d::HeapAddresses heap_addresses{0, 0, 0, 0}; v8::Local<v8::Value> v = CompileRun("42"); Handle<Object> o = v8::Utils::OpenHandle(*v); d::ObjectPropertiesResultPtr props = - d::GetObjectProperties(o->ptr(), &ReadMemory, roots); + d::GetObjectProperties(o->ptr(), &ReadMemory, heap_addresses); CHECK(props->type_check_result == d::TypeCheckResult::kSmi); CHECK(props->brief == std::string("42 (0x2a)")); CHECK(props->type == std::string("v8::internal::Smi")); @@ -81,7 +87,7 @@ TEST(GetObjectProperties) { v = CompileRun("[\"a\", \"bc\"]"); o = v8::Utils::OpenHandle(*v); - props = d::GetObjectProperties(o->ptr(), &ReadMemory, roots); + props = d::GetObjectProperties(o->ptr(), &ReadMemory, heap_addresses); CHECK(props->type_check_result == d::TypeCheckResult::kUsedMap); CHECK(props->type == std::string("v8::internal::JSArray")); CHECK_EQ(props->num_properties, 4); @@ -92,9 +98,9 @@ TEST(GetObjectProperties) { CheckProp(*props->properties[3], "v8::internal::Object", "length", static_cast<i::Tagged_t>(IntToSmi(2))); - // We need to supply a root address for decompression before reading the + // We need to supply some valid address for decompression before reading the // elements from the JSArray. - roots.any_heap_pointer = o->ptr(); + heap_addresses.any_heap_pointer = o->ptr(); i::Tagged_t properties_or_hash = *reinterpret_cast<i::Tagged_t*>(props->properties[1]->address); @@ -106,32 +112,39 @@ TEST(GetObjectProperties) { // any ability to read memory. { MemoryFailureRegion failure(0, UINTPTR_MAX); - props = d::GetObjectProperties(properties_or_hash, &ReadMemory, roots); + props = + d::GetObjectProperties(properties_or_hash, &ReadMemory, heap_addresses); CHECK(props->type_check_result == d::TypeCheckResult::kObjectPointerValidButInaccessible); CHECK(props->type == std::string("v8::internal::HeapObject")); CHECK_EQ(props->num_properties, 1); CheckProp(*props->properties[0], "v8::internal::Map", "map"); - CHECK(std::string(props->brief).substr(0, 21) == - std::string("maybe EmptyFixedArray")); + // "maybe" prefix indicates that GetObjectProperties recognized the offset + // within the page as matching a known object, but didn't know whether the + // object is on the right page. This response can only happen in builds + // without pointer compression, because otherwise heap addresses would be at + // deterministic locations within the heap reservation. + CHECK(COMPRESS_POINTERS_BOOL + ? StartsWith(props->brief, "EmptyFixedArray") + : StartsWith(props->brief, "maybe EmptyFixedArray")); - // Provide a heap root so the API can be more sure. - roots.read_only_space = + // 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()); - props = d::GetObjectProperties(properties_or_hash, &ReadMemory, roots); + props = + d::GetObjectProperties(properties_or_hash, &ReadMemory, heap_addresses); CHECK(props->type_check_result == d::TypeCheckResult::kObjectPointerValidButInaccessible); CHECK(props->type == std::string("v8::internal::HeapObject")); CHECK_EQ(props->num_properties, 1); CheckProp(*props->properties[0], "v8::internal::Map", "map"); - CHECK(std::string(props->brief).substr(0, 15) == - std::string("EmptyFixedArray")); + CHECK(StartsWith(props->brief, "EmptyFixedArray")); } - props = d::GetObjectProperties(elements, &ReadMemory, roots); + props = d::GetObjectProperties(elements, &ReadMemory, heap_addresses); CHECK(props->type_check_result == d::TypeCheckResult::kUsedMap); CHECK(props->type == std::string("v8::internal::FixedArray")); CHECK_EQ(props->num_properties, 3); @@ -142,9 +155,10 @@ TEST(GetObjectProperties) { d::PropertyKind::kArrayOfKnownSize, 2); // Get the second string value from the FixedArray. - i::Tagged_t second_string_address = *reinterpret_cast<i::Tagged_t*>( - props->properties[2]->address + sizeof(i::Tagged_t)); - props = d::GetObjectProperties(second_string_address, &ReadMemory, roots); + i::Tagged_t second_string_address = + reinterpret_cast<i::Tagged_t*>(props->properties[2]->address)[1]; + props = d::GetObjectProperties(second_string_address, &ReadMemory, + heap_addresses); CHECK(props->type_check_result == d::TypeCheckResult::kUsedMap); CHECK(props->type == std::string("v8::internal::SeqOneByteString")); CHECK_EQ(props->num_properties, 4); @@ -162,18 +176,38 @@ TEST(GetObjectProperties) { // its properties should match what we read last time. d::ObjectPropertiesResultPtr props2; { + heap_addresses.read_only_space_first_page = 0; uintptr_t map_address = d::GetObjectProperties( *reinterpret_cast<i::Tagged_t*>(props->properties[0]->address), - &ReadMemory, roots) + &ReadMemory, heap_addresses) ->properties[0] ->address; MemoryFailureRegion failure(map_address, map_address + i::Map::kSize); - props2 = d::GetObjectProperties(second_string_address, &ReadMemory, roots, - "v8::internal::String"); - CHECK(props2->type_check_result == d::TypeCheckResult::kUsedTypeHint); - CHECK(props2->type == std::string("v8::internal::String")); - CHECK_EQ(props2->num_properties, 3); + props2 = d::GetObjectProperties(second_string_address, &ReadMemory, + heap_addresses, "v8::internal::String"); + if (COMPRESS_POINTERS_BOOL) { + // The first page of each heap space can be automatically detected when + // pointer compression is active, so we expect to use known maps instead + // of the type hint. + CHECK_EQ(props2->type_check_result, d::TypeCheckResult::kKnownMapPointer); + CHECK(props2->type == std::string("v8::internal::SeqOneByteString")); + CHECK_EQ(props2->num_properties, 4); + CheckProp(*props2->properties[3], "char", "chars", + d::PropertyKind::kArrayOfKnownSize, 2); + CHECK_EQ(props2->num_guessed_types, 0); + } else { + CHECK_EQ(props2->type_check_result, d::TypeCheckResult::kUsedTypeHint); + CHECK(props2->type == std::string("v8::internal::String")); + CHECK_EQ(props2->num_properties, 3); + + // The type hint we provided was the abstract class String, but + // GetObjectProperties should have recognized that the Map pointer looked + // like the right value for a SeqOneByteString. + CHECK_EQ(props2->num_guessed_types, 1); + CHECK(std::string(props2->guessed_types[0]) == + std::string("v8::internal::SeqOneByteString")); + } CheckProp(*props2->properties[0], "v8::internal::Map", "map", *reinterpret_cast<i::Tagged_t*>(props->properties[0]->address)); CheckProp(*props2->properties[1], "uint32_t", "hash_field", @@ -183,7 +217,7 @@ TEST(GetObjectProperties) { // Try a weak reference. props2 = d::GetObjectProperties(second_string_address | kWeakHeapObjectMask, - &ReadMemory, roots); + &ReadMemory, heap_addresses); std::string weak_ref_prefix = "weak ref to "; CHECK(weak_ref_prefix + props->brief == props2->brief); CHECK(props2->type_check_result == d::TypeCheckResult::kUsedMap); @@ -201,9 +235,8 @@ TEST(GetObjectProperties) { const alphabet = "abcdefghijklmnopqrstuvwxyz"; alphabet.substr(3,20) + alphabet.toUpperCase().substr(5,15) + "7")"); o = v8::Utils::OpenHandle(*v); - props = d::GetObjectProperties(o->ptr(), &ReadMemory, roots); - CHECK(std::string(props->brief).substr(0, 38) == - std::string("\"defghijklmnopqrstuvwFGHIJKLMNOPQRST7\"")); + props = d::GetObjectProperties(o->ptr(), &ReadMemory, heap_addresses); + CHECK(StartsWith(props->brief, "\"defghijklmnopqrstuvwFGHIJKLMNOPQRST7\"")); // Cause a failure when reading the "second" pointer within the top-level // ConsString. @@ -211,15 +244,15 @@ TEST(GetObjectProperties) { CheckProp(*props->properties[4], "v8::internal::String", "second"); uintptr_t second_address = props->properties[4]->address; MemoryFailureRegion failure(second_address, second_address + 4); - props = d::GetObjectProperties(o->ptr(), &ReadMemory, roots); - CHECK(std::string(props->brief).substr(0, 40) == - std::string("\"defghijklmnopqrstuvwFGHIJKLMNOPQRST...\"")); + props = d::GetObjectProperties(o->ptr(), &ReadMemory, heap_addresses); + CHECK( + StartsWith(props->brief, "\"defghijklmnopqrstuvwFGHIJKLMNOPQRST...\"")); } // Build a very long string. v = CompileRun("'a'.repeat(1000)"); o = v8::Utils::OpenHandle(*v); - props = d::GetObjectProperties(o->ptr(), &ReadMemory, roots); + props = d::GetObjectProperties(o->ptr(), &ReadMemory, heap_addresses); CHECK(std::string(props->brief).substr(79, 7) == std::string("aa...\" ")); } diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 4ad55ef6b5..c76f922d86 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -893,7 +893,6 @@ TEST(BreakPointInlineBoundBuiltin) { TEST(BreakPointInlinedConstructorBuiltin) { i::FLAG_allow_natives_syntax = true; - i::FLAG_experimental_inline_promise_constructor = true; LocalContext env; v8::HandleScope scope(env->GetIsolate()); @@ -1032,8 +1031,6 @@ TEST(BreakPointBuiltinNewContext) { i::Handle<i::BreakPoint> bp; // === Test builtin from a new context === -// This does not work with no-snapshot build. -#ifdef V8_USE_SNAPSHOT break_point_hit_count = 0; builtin = CompileRun("String.prototype.repeat").As<v8::Function>(); CompileRun("'a'.repeat(10)"); @@ -1059,7 +1056,6 @@ TEST(BreakPointBuiltinNewContext) { CompileRun("'b'.repeat(10)"); CHECK_EQ(2, break_point_hit_count); } -#endif v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(); @@ -3135,8 +3131,8 @@ TEST(NoBreakWhenBootstrapping) { { // Create a context with an extension to make sure that some JavaScript // code is executed during bootstrapping. - v8::RegisterExtension(v8::base::make_unique<v8::Extension>( - "simpletest", kSimpleExtensionSource)); + v8::RegisterExtension( + std::make_unique<v8::Extension>("simpletest", kSimpleExtensionSource)); const char* extension_names[] = { "simpletest" }; v8::ExtensionConfiguration extensions(1, extension_names); v8::HandleScope handle_scope(isolate); @@ -4510,7 +4506,7 @@ UNINITIALIZED_TEST(LoadedAtStartupScripts) { } } CHECK_EQ(count_by_type[i::Script::TYPE_NATIVE], 0); - CHECK_EQ(count_by_type[i::Script::TYPE_EXTENSION], 2); + CHECK_EQ(count_by_type[i::Script::TYPE_EXTENSION], 1); CHECK_EQ(count_by_type[i::Script::TYPE_NORMAL], 1); CHECK_EQ(count_by_type[i::Script::TYPE_WASM], 0); CHECK_EQ(count_by_type[i::Script::TYPE_INSPECTOR], 0); diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc index 76e06df47e..16dee03f50 100644 --- a/deps/v8/test/cctest/test-disasm-arm.cc +++ b/deps/v8/test/cctest/test-disasm-arm.cc @@ -1166,6 +1166,12 @@ TEST(Neon) { "f2dae550 vshl.i16 q15, q0, #10"); COMPARE(vshl(NeonS32, q15, q0, 17), "f2f1e550 vshl.i32 q15, q0, #17"); + COMPARE(vshl(NeonS8, q15, q0, q1), + "f242e440 vshl.s8 q15, q0, q1"); + COMPARE(vshl(NeonU16, q15, q2, q3), + "f356e444 vshl.u16 q15, q2, q3"); + COMPARE(vshl(NeonS32, q15, q4, q5), + "f26ae448 vshl.s32 q15, q4, q5"); COMPARE(vshr(NeonS8, q15, q0, 6), "f2cae050 vshr.s8 q15, q0, #6"); COMPARE(vshr(NeonU16, q15, q0, 10), diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc index ba4d92d3a2..2b46d7ed11 100644 --- a/deps/v8/test/cctest/test-disasm-arm64.cc +++ b/deps/v8/test/cctest/test-disasm-arm64.cc @@ -1888,6 +1888,8 @@ TEST(system_pauth) { COMPARE(paciasp(), "paciasp"); COMPARE(autia1716(), "autia1716"); COMPARE(autiasp(), "autiasp"); + + CLEANUP(); } TEST_(debug) { diff --git a/deps/v8/test/cctest/test-disasm-ia32.cc b/deps/v8/test/cctest/test-disasm-ia32.cc index 4078bd429c..563d3a87cf 100644 --- a/deps/v8/test/cctest/test-disasm-ia32.cc +++ b/deps/v8/test/cctest/test-disasm-ia32.cc @@ -435,6 +435,8 @@ TEST(DisasmIa320) { __ maxps(xmm1, Operand(ebx, ecx, times_4, 10000)); __ rcpps(xmm1, xmm0); __ rcpps(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ sqrtps(xmm1, xmm0); + __ sqrtps(xmm1, Operand(ebx, ecx, times_4, 10000)); __ rsqrtps(xmm1, xmm0); __ rsqrtps(xmm1, Operand(ebx, ecx, times_4, 10000)); @@ -444,6 +446,8 @@ TEST(DisasmIa320) { __ cmpltps(xmm5, Operand(ebx, ecx, times_4, 10000)); __ cmpleps(xmm5, xmm1); __ cmpleps(xmm5, Operand(ebx, ecx, times_4, 10000)); + __ cmpunordps(xmm5, xmm1); + __ cmpunordps(xmm5, Operand(ebx, ecx, times_4, 10000)); __ cmpneqps(xmm5, xmm1); __ cmpneqps(xmm5, Operand(ebx, ecx, times_4, 10000)); @@ -467,6 +471,9 @@ TEST(DisasmIa320) { __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); + __ movapd(xmm0, xmm1); + __ movapd(xmm0, Operand(edx, 4)); + __ movd(xmm0, edi); __ movd(xmm0, Operand(ebx, ecx, times_4, 10000)); __ movd(eax, xmm1); @@ -490,6 +497,36 @@ TEST(DisasmIa320) { __ cmpltsd(xmm0, xmm1); __ andpd(xmm0, xmm1); + __ andpd(xmm0, Operand(ebx, ecx, times_4, 10000)); + __ andnpd(xmm0, xmm1); + __ andnpd(xmm0, Operand(ebx, ecx, times_4, 10000)); + __ orpd(xmm0, xmm1); + __ orpd(xmm0, Operand(ebx, ecx, times_4, 10000)); + __ xorpd(xmm0, xmm1); + __ xorpd(xmm0, Operand(ebx, ecx, times_4, 10000)); + __ addpd(xmm1, xmm0); + __ addpd(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ subpd(xmm1, xmm0); + __ subpd(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ mulpd(xmm1, xmm0); + __ mulpd(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ divpd(xmm1, xmm0); + __ divpd(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ minpd(xmm1, xmm0); + __ minpd(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ maxpd(xmm1, xmm0); + __ maxpd(xmm1, Operand(ebx, ecx, times_4, 10000)); + + __ cmpeqpd(xmm5, xmm1); + __ cmpeqpd(xmm5, Operand(ebx, ecx, times_4, 10000)); + __ cmpltpd(xmm5, xmm1); + __ cmpltpd(xmm5, Operand(ebx, ecx, times_4, 10000)); + __ cmplepd(xmm5, xmm1); + __ cmplepd(xmm5, Operand(ebx, ecx, times_4, 10000)); + __ cmpunordpd(xmm5, xmm1); + __ cmpunordpd(xmm5, Operand(ebx, ecx, times_4, 10000)); + __ cmpneqpd(xmm5, xmm1); + __ cmpneqpd(xmm5, Operand(ebx, ecx, times_4, 10000)); __ psllw(xmm0, 17); __ pslld(xmm0, 17); @@ -623,6 +660,8 @@ TEST(DisasmIa320) { __ vandps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); __ vandnps(xmm0, xmm1, xmm2); __ vandnps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vorps(xmm0, xmm1, xmm2); + __ vorps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); __ vxorps(xmm0, xmm1, xmm2); __ vxorps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); __ vaddps(xmm0, xmm1, xmm2); @@ -639,9 +678,13 @@ TEST(DisasmIa320) { __ vmaxps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); __ vrcpps(xmm1, xmm0); __ vrcpps(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vsqrtps(xmm1, xmm0); + __ vsqrtps(xmm1, Operand(ebx, ecx, times_4, 10000)); __ vrsqrtps(xmm1, xmm0); __ vrsqrtps(xmm1, Operand(ebx, ecx, times_4, 10000)); __ vmovaps(xmm0, xmm1); + __ vmovapd(xmm0, xmm1); + __ vmovapd(xmm0, Operand(ebx, ecx, times_4, 10000)); __ vshufps(xmm0, xmm1, xmm2, 3); __ vshufps(xmm0, xmm1, Operand(edx, 4), 3); __ vhaddps(xmm0, xmm1, xmm2); @@ -653,11 +696,17 @@ TEST(DisasmIa320) { __ vcmpltps(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); __ vcmpleps(xmm5, xmm4, xmm1); __ vcmpleps(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); + __ vcmpunordps(xmm5, xmm4, xmm1); + __ vcmpunordps(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); __ vcmpneqps(xmm5, xmm4, xmm1); __ vcmpneqps(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); __ vandpd(xmm0, xmm1, xmm2); __ vandpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vandnpd(xmm0, xmm1, xmm2); + __ vandnpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vorpd(xmm0, xmm1, xmm2); + __ vorpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); __ vxorpd(xmm0, xmm1, xmm2); __ vxorpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); __ vaddpd(xmm0, xmm1, xmm2); @@ -673,10 +722,22 @@ TEST(DisasmIa320) { __ vmaxpd(xmm0, xmm1, xmm2); __ vmaxpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vcmpeqpd(xmm5, xmm4, xmm1); + __ vcmpeqpd(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); + __ vcmpltpd(xmm5, xmm4, xmm1); + __ vcmpltpd(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); + __ vcmplepd(xmm5, xmm4, xmm1); + __ vcmplepd(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); + __ vcmpunordpd(xmm5, xmm4, xmm1); + __ vcmpunordpd(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); + __ vcmpneqpd(xmm5, xmm4, xmm1); + __ vcmpneqpd(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); + __ vpsllw(xmm0, xmm7, 21); __ vpslld(xmm0, xmm7, 21); __ vpsrlw(xmm0, xmm7, 21); __ vpsrld(xmm0, xmm7, 21); + __ vpsrlq(xmm0, xmm7, 21); __ vpsraw(xmm0, xmm7, 21); __ vpsrad(xmm0, xmm7, 21); diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc index 08793fba4a..86d98d8daf 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -182,6 +182,8 @@ TEST(DisasmX64) { __ decq(rdx); __ cdq(); + __ repstosq(); + __ nop(); __ idivq(rdx); __ mull(rdx); diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index 512bf2a9c6..9eb9071d77 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -249,21 +249,22 @@ class Expectations { } } - bool Check(DescriptorArray descriptors, int descriptor) const { + bool Check(DescriptorArray descriptors, InternalIndex descriptor) const { PropertyDetails details = descriptors.GetDetails(descriptor); - if (details.kind() != kinds_[descriptor]) return false; - if (details.location() != locations_[descriptor]) return false; - if (details.constness() != constnesses_[descriptor]) return false; + if (details.kind() != kinds_[descriptor.as_int()]) return false; + if (details.location() != locations_[descriptor.as_int()]) return false; + if (details.constness() != constnesses_[descriptor.as_int()]) return false; - PropertyAttributes expected_attributes = attributes_[descriptor]; + PropertyAttributes expected_attributes = attributes_[descriptor.as_int()]; if (details.attributes() != expected_attributes) return false; - Representation expected_representation = representations_[descriptor]; + Representation expected_representation = + representations_[descriptor.as_int()]; if (!details.representation().Equals(expected_representation)) return false; - Object expected_value = *values_[descriptor]; + Object expected_value = *values_[descriptor.as_int()]; if (details.location() == kField) { if (details.kind() == kData) { FieldType type = descriptors.GetFieldType(descriptor); @@ -278,7 +279,7 @@ class Expectations { if (value == expected_value) return true; if (!value.IsAccessorPair()) return false; AccessorPair pair = AccessorPair::cast(value); - return pair.Equals(expected_value, *setter_values_[descriptor]); + return pair.Equals(expected_value, *setter_values_[descriptor.as_int()]); } UNREACHABLE(); } @@ -291,13 +292,12 @@ class Expectations { DescriptorArray descriptors = map.instance_descriptors(); CHECK(expected_nof <= number_of_properties_); - for (int i = 0; i < expected_nof; i++) { + for (InternalIndex i : InternalIndex::Range(expected_nof)) { if (!Check(descriptors, i)) { Print(); #ifdef OBJECT_PRINT descriptors.Print(); #endif - Check(descriptors, i); return false; } } @@ -459,7 +459,7 @@ class Expectations { Handle<Object> getter(pair->getter(), isolate); Handle<Object> setter(pair->setter(), isolate); - int descriptor = + InternalIndex descriptor = map->instance_descriptors().SearchWithCache(isolate, *name, *map); map = Map::TransitionToAccessorProperty(isolate, map, name, descriptor, getter, setter, attributes); @@ -495,8 +495,9 @@ TEST(ReconfigureAccessorToNonExistingDataField) { CHECK(map->is_stable()); CHECK(expectations.Check(*map)); + InternalIndex first(0); Handle<Map> new_map = Map::ReconfigureProperty( - isolate, map, 0, kData, NONE, Representation::None(), none_type); + isolate, map, first, kData, NONE, Representation::None(), none_type); // |map| did not change except marked unstable. CHECK(!map->is_deprecated()); CHECK(!map->is_stable()); @@ -511,12 +512,12 @@ TEST(ReconfigureAccessorToNonExistingDataField) { CHECK(expectations.Check(*new_map)); Handle<Map> new_map2 = Map::ReconfigureProperty( - isolate, map, 0, kData, NONE, Representation::None(), none_type); + isolate, map, first, kData, NONE, Representation::None(), none_type); CHECK_EQ(*new_map, *new_map2); Handle<Object> value(Smi::kZero, isolate); Handle<Map> prepared_map = Map::PrepareForDataProperty( - isolate, new_map, 0, PropertyConstness::kConst, value); + isolate, new_map, first, PropertyConstness::kConst, value); // None to Smi generalization is trivial, map does not change. CHECK_EQ(*new_map, *prepared_map); @@ -530,7 +531,7 @@ TEST(ReconfigureAccessorToNonExistingDataField) { Factory* factory = isolate->factory(); Handle<JSObject> obj = factory->NewJSObjectFromMap(map); JSObject::MigrateToMap(isolate, obj, prepared_map); - FieldIndex index = FieldIndex::ForDescriptor(*prepared_map, 0); + FieldIndex index = FieldIndex::ForDescriptor(*prepared_map, first); CHECK(obj->RawFastPropertyAt(index).IsUninitialized(isolate)); #ifdef VERIFY_HEAP obj->ObjectVerify(isolate); @@ -565,14 +566,16 @@ TEST(ReconfigureAccessorToNonExistingDataFieldHeavy) { Handle<JSObject> obj = Handle<JSObject>::cast(obj_value); CHECK_EQ(1, obj->map().NumberOfOwnDescriptors()); - CHECK(obj->map().instance_descriptors().GetStrongValue(0).IsAccessorPair()); + InternalIndex first(0); + CHECK( + obj->map().instance_descriptors().GetStrongValue(first).IsAccessorPair()); Handle<Object> value(Smi::FromInt(42), isolate); JSObject::SetOwnPropertyIgnoreAttributes(obj, foo_str, value, NONE).Check(); // Check that the property contains |value|. CHECK_EQ(1, obj->map().NumberOfOwnDescriptors()); - FieldIndex index = FieldIndex::ForDescriptor(obj->map(), 0); + FieldIndex index = FieldIndex::ForDescriptor(obj->map(), first); Object the_value = obj->RawFastPropertyAt(index); CHECK(the_value.IsSmi()); CHECK_EQ(42, Smi::ToInt(the_value)); @@ -641,7 +644,7 @@ void TestGeneralizeField(int detach_property_at_index, int property_index, from.representation, from.type); } else { map = expectations.AddDataField(map, NONE, PropertyConstness::kConst, - Representation::Double(), any_type); + Representation::Smi(), any_type); if (i == detach_property_at_index) { detach_point_map = map; } @@ -653,11 +656,11 @@ void TestGeneralizeField(int detach_property_at_index, int property_index, if (is_detached_map) { detach_point_map = Map::ReconfigureProperty( - isolate, detach_point_map, detach_property_at_index, kData, NONE, - Representation::Tagged(), any_type); + isolate, detach_point_map, InternalIndex(detach_property_at_index), + kData, NONE, Representation::Double(), any_type); expectations.SetDataField(detach_property_at_index, PropertyConstness::kConst, - Representation::Tagged(), any_type); + Representation::Double(), any_type); CHECK(map->is_deprecated()); CHECK(expectations.Check(*detach_point_map, detach_point_map->NumberOfOwnDescriptors())); @@ -666,16 +669,17 @@ void TestGeneralizeField(int detach_property_at_index, int property_index, // Create dummy optimized code object to test correct dependencies // on the field owner. Handle<Code> code = CreateDummyOptimizedCode(isolate); - Handle<Map> field_owner(map->FindFieldOwner(isolate, property_index), - isolate); + Handle<Map> field_owner( + map->FindFieldOwner(isolate, InternalIndex(property_index)), isolate); DependentCode::InstallDependency(isolate, MaybeObjectHandle::Weak(code), field_owner, DependentCode::kFieldOwnerGroup); CHECK(!code->marked_for_deoptimization()); // Create new maps by generalizing representation of propX field. - Handle<Map> new_map = Map::ReconfigureProperty( - isolate, map, property_index, kData, NONE, to.representation, to.type); + Handle<Map> new_map = + Map::ReconfigureProperty(isolate, map, InternalIndex(property_index), + kData, NONE, to.representation, to.type); expectations.SetDataField(property_index, expected.constness, expected.representation, expected.type); @@ -814,7 +818,9 @@ TEST(GeneralizeDoubleFieldToTagged) { TestGeneralizeField( {PropertyConstness::kMutable, Representation::Double(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, - {PropertyConstness::kMutable, Representation::Tagged(), any_type}); + {PropertyConstness::kMutable, Representation::Tagged(), any_type}, + FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace, + !FLAG_unbox_double_fields && FLAG_modify_field_representation_inplace); } TEST(GeneralizeHeapObjectFieldToTagged) { @@ -965,8 +971,9 @@ TEST(GeneralizeFieldWithAccessorProperties) { maps[i] = maps[i - 1]; continue; } - Handle<Map> new_map = Map::ReconfigureProperty( - isolate, map, i, kData, NONE, Representation::Double(), any_type); + Handle<Map> new_map = + Map::ReconfigureProperty(isolate, map, InternalIndex(i), kData, NONE, + Representation::Double(), any_type); maps[i] = new_map; expectations.SetDataField(i, PropertyConstness::kMutable, @@ -1053,7 +1060,8 @@ void TestReconfigureDataFieldAttribute_GeneralizeField( // Create dummy optimized code object to test correct dependencies // on the field owner. Handle<Code> code = CreateDummyOptimizedCode(isolate); - Handle<Map> field_owner(map->FindFieldOwner(isolate, kSplitProp), isolate); + Handle<Map> field_owner( + map->FindFieldOwner(isolate, InternalIndex(kSplitProp)), isolate); DependentCode::InstallDependency(isolate, MaybeObjectHandle::Weak(code), field_owner, DependentCode::kFieldOwnerGroup); @@ -1061,8 +1069,9 @@ void TestReconfigureDataFieldAttribute_GeneralizeField( // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. - Handle<Map> new_map = Map::ReconfigureExistingProperty( - isolate, map2, kSplitProp, kData, NONE, PropertyConstness::kConst); + Handle<Map> new_map = + Map::ReconfigureExistingProperty(isolate, map2, InternalIndex(kSplitProp), + kData, NONE, PropertyConstness::kConst); // |map2| should be left unchanged but marked unstable. CHECK(!map2->is_stable()); @@ -1141,7 +1150,8 @@ void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( // Create dummy optimized code object to test correct dependencies // on the field owner. Handle<Code> code = CreateDummyOptimizedCode(isolate); - Handle<Map> field_owner(map->FindFieldOwner(isolate, kSplitProp), isolate); + Handle<Map> field_owner( + map->FindFieldOwner(isolate, InternalIndex(kSplitProp)), isolate); DependentCode::InstallDependency(isolate, MaybeObjectHandle::Weak(code), field_owner, DependentCode::kFieldOwnerGroup); @@ -1149,8 +1159,9 @@ void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. - Handle<Map> new_map = Map::ReconfigureExistingProperty( - isolate, map2, kSplitProp, kData, NONE, PropertyConstness::kConst); + Handle<Map> new_map = + Map::ReconfigureExistingProperty(isolate, map2, InternalIndex(kSplitProp), + kData, NONE, PropertyConstness::kConst); // |map2| should be left unchanged but marked unstable. CHECK(!map2->is_stable()); @@ -1436,8 +1447,7 @@ struct CheckNormalize { // template <typename TestConfig, typename Checker> static void TestReconfigureProperty_CustomPropertyAfterTargetMap( - TestConfig& config, // NOLINT(runtime/references) - Checker& checker) { // NOLINT(runtime/references) + TestConfig* config, Checker* checker) { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); @@ -1469,7 +1479,7 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( map1 = expectations1.AddDataField(map1, NONE, constness, representation, any_type); } - map1 = config.AddPropertyAtBranch(1, expectations1, map1); + map1 = config->AddPropertyAtBranch(1, &expectations1, map1); for (int i = kCustomPropIndex + 1; i < kPropCount; i++) { map1 = expectations1.AddDataField(map1, NONE, constness, representation, any_type); @@ -1489,7 +1499,7 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( map2 = expectations2.AddDataField(map2, NONE, constness, representation, any_type); } - map2 = config.AddPropertyAtBranch(2, expectations2, map2); + map2 = config->AddPropertyAtBranch(2, &expectations2, map2); for (int i = kCustomPropIndex + 1; i < kPropCount; i++) { map2 = expectations2.AddDataField(map2, NONE, constness, representation, any_type); @@ -1501,8 +1511,9 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. - Handle<Map> new_map = Map::ReconfigureExistingProperty( - isolate, map2, kSplitProp, kData, NONE, PropertyConstness::kConst); + Handle<Map> new_map = + Map::ReconfigureExistingProperty(isolate, map2, InternalIndex(kSplitProp), + kData, NONE, PropertyConstness::kConst); // |map2| should be left unchanged but marked unstable. CHECK(!map2->is_stable()); @@ -1510,8 +1521,8 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap( CHECK_NE(*map2, *new_map); CHECK(expectations2.Check(*map2)); - config.UpdateExpectations(kCustomPropIndex, expectations1); - checker.Check(isolate, map1, new_map, expectations1); + config->UpdateExpectations(kCustomPropIndex, &expectations1); + checker->Check(isolate, map1, new_map, expectations1); } TEST(ReconfigureDataFieldAttribute_SameDataConstantAfterTargetMap) { @@ -1526,18 +1537,14 @@ TEST(ReconfigureDataFieldAttribute_SameDataConstantAfterTargetMap) { js_func_ = factory->NewFunctionForTest(factory->empty_string()); } - Handle<Map> AddPropertyAtBranch( - int branch_id, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { + Handle<Map> AddPropertyAtBranch(int branch_id, Expectations* expectations, + Handle<Map> map) { CHECK(branch_id == 1 || branch_id == 2); // Add the same data constant property at both transition tree branches. - return expectations.AddDataConstant(map, NONE, js_func_); + return expectations->AddDataConstant(map, NONE, js_func_); } - void UpdateExpectations( - int property_index, - Expectations& expectations) { // NOLINT(runtime/references) + void UpdateExpectations(int property_index, Expectations* expectations) { // Expectations stay the same. } }; @@ -1545,7 +1552,7 @@ TEST(ReconfigureDataFieldAttribute_SameDataConstantAfterTargetMap) { TestConfig config; // Two branches are "compatible" so the |map1| should NOT be deprecated. CheckSameMap checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } @@ -1575,26 +1582,22 @@ TEST(ReconfigureDataFieldAttribute_DataConstantToDataFieldAfterTargetMap) { factory->NewFunction(sloppy_map, info, isolate->native_context()); } - Handle<Map> AddPropertyAtBranch( - int branch_id, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { + Handle<Map> AddPropertyAtBranch(int branch_id, Expectations* expectations, + Handle<Map> map) { CHECK(branch_id == 1 || branch_id == 2); Handle<JSFunction> js_func = branch_id == 1 ? js_func1_ : js_func2_; - return expectations.AddDataConstant(map, NONE, js_func); + return expectations->AddDataConstant(map, NONE, js_func); } - void UpdateExpectations( - int property_index, - Expectations& expectations) { // NOLINT(runtime/references) - expectations.SetDataField(property_index, PropertyConstness::kConst, - Representation::HeapObject(), function_type_); + void UpdateExpectations(int property_index, Expectations* expectations) { + expectations->SetDataField(property_index, PropertyConstness::kConst, + Representation::HeapObject(), function_type_); } }; TestConfig config; CheckSameMap checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } @@ -1612,28 +1615,23 @@ TEST(ReconfigureDataFieldAttribute_DataConstantToAccConstantAfterTargetMap) { pair_ = CreateAccessorPair(true, true); } - Handle<Map> AddPropertyAtBranch( - int branch_id, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { + Handle<Map> AddPropertyAtBranch(int branch_id, Expectations* expectations, + Handle<Map> map) { CHECK(branch_id == 1 || branch_id == 2); if (branch_id == 1) { - return expectations.AddDataConstant(map, NONE, js_func_); + return expectations->AddDataConstant(map, NONE, js_func_); } else { - return expectations.AddAccessorConstant(map, NONE, pair_); + return expectations->AddAccessorConstant(map, NONE, pair_); } } - void UpdateExpectations( - int property_index, - Expectations& expectations // NOLINT(runtime/references) - ) {} + void UpdateExpectations(int property_index, Expectations* expectations) {} }; TestConfig config; // These are completely separate branches in transition tree. CheckUnrelated checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } @@ -1645,26 +1643,22 @@ TEST(ReconfigureDataFieldAttribute_SameAccessorConstantAfterTargetMap) { Handle<AccessorPair> pair_; TestConfig() { pair_ = CreateAccessorPair(true, true); } - Handle<Map> AddPropertyAtBranch( - int branch_id, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { + Handle<Map> AddPropertyAtBranch(int branch_id, Expectations* expectations, + Handle<Map> map) { CHECK(branch_id == 1 || branch_id == 2); // Add the same accessor constant property at both transition tree // branches. - return expectations.AddAccessorConstant(map, NONE, pair_); + return expectations->AddAccessorConstant(map, NONE, pair_); } - void UpdateExpectations( - int property_index, - Expectations& expectations) { // NOLINT(runtime/references) + void UpdateExpectations(int property_index, Expectations* expectations) { // Two branches are "compatible" so the |map1| should NOT be deprecated. } }; TestConfig config; CheckSameMap checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } @@ -1680,24 +1674,20 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToAccFieldAfterTargetMap) { pair2_ = CreateAccessorPair(true, true); } - Handle<Map> AddPropertyAtBranch( - int branch_id, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { + Handle<Map> AddPropertyAtBranch(int branch_id, Expectations* expectations, + Handle<Map> map) { CHECK(branch_id == 1 || branch_id == 2); Handle<AccessorPair> pair = branch_id == 1 ? pair1_ : pair2_; - return expectations.AddAccessorConstant(map, NONE, pair); + return expectations->AddAccessorConstant(map, NONE, pair); } - void UpdateExpectations( - int property_index, - Expectations& expectations) { // NOLINT(runtime/references) + void UpdateExpectations(int property_index, Expectations* expectations) { if (IS_ACCESSOR_FIELD_SUPPORTED) { - expectations.SetAccessorField(property_index); + expectations->SetAccessorField(property_index); } else { // Currently we have a normalize case and ACCESSOR property becomes // ACCESSOR_CONSTANT. - expectations.SetAccessorConstant(property_index, pair2_); + expectations->SetAccessorConstant(property_index, pair2_); } } }; @@ -1705,11 +1695,11 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToAccFieldAfterTargetMap) { TestConfig config; if (IS_ACCESSOR_FIELD_SUPPORTED) { CheckSameMap checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } else { // Currently we have a normalize case. CheckNormalize checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } } @@ -1722,31 +1712,26 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) { Handle<AccessorPair> pair_; TestConfig() { pair_ = CreateAccessorPair(true, true); } - Handle<Map> AddPropertyAtBranch( - int branch_id, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { + Handle<Map> AddPropertyAtBranch(int branch_id, Expectations* expectations, + Handle<Map> map) { CHECK(branch_id == 1 || branch_id == 2); if (branch_id == 1) { - return expectations.AddAccessorConstant(map, NONE, pair_); + return expectations->AddAccessorConstant(map, NONE, pair_); } else { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); - return expectations.AddDataField(map, NONE, PropertyConstness::kConst, - Representation::Smi(), any_type); + return expectations->AddDataField(map, NONE, PropertyConstness::kConst, + Representation::Smi(), any_type); } } - void UpdateExpectations( - int property_index, - Expectations& expectations // NOLINT(runtime/references) - ) {} + void UpdateExpectations(int property_index, Expectations* expectations) {} }; TestConfig config; // These are completely separate branches in transition tree. CheckUnrelated checker; - TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); + TestReconfigureProperty_CustomPropertyAfterTargetMap(&config, &checker); } @@ -1811,7 +1796,8 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial( // Create dummy optimized code object to test correct dependencies // on the field owner. Handle<Code> code = CreateDummyOptimizedCode(isolate); - Handle<Map> field_owner(map->FindFieldOwner(isolate, kDiffProp), isolate); + Handle<Map> field_owner( + map->FindFieldOwner(isolate, InternalIndex(kDiffProp)), isolate); DependentCode::InstallDependency(isolate, MaybeObjectHandle::Weak(code), field_owner, DependentCode::kFieldOwnerGroup); @@ -2084,8 +2070,9 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { map2 = handle(target, isolate); } - map2 = Map::ReconfigureProperty(isolate, map2, kSplitProp, kData, NONE, - Representation::Double(), any_type); + map2 = Map::ReconfigureProperty(isolate, map2, InternalIndex(kSplitProp), + kData, NONE, Representation::Double(), + any_type); expectations.SetDataField(kSplitProp, PropertyConstness::kMutable, Representation::Double(), any_type); @@ -2141,9 +2128,8 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) { // fixed. template <typename TestConfig> static void TestGeneralizeFieldWithSpecialTransition( - TestConfig& config, // NOLINT(runtime/references) - const CRFTData& from, const CRFTData& to, const CRFTData& expected, - bool expected_deprecation) { + TestConfig* config, const CRFTData& from, const CRFTData& to, + const CRFTData& expected, bool expected_deprecation) { Isolate* isolate = CcTest::i_isolate(); Expectations expectations(isolate); @@ -2163,13 +2149,13 @@ static void TestGeneralizeFieldWithSpecialTransition( // Apply some special transition to |map|. CHECK(map->owns_descriptors()); - Handle<Map> map2 = config.Transition(map, expectations2); + Handle<Map> map2 = config->Transition(map, &expectations2); // |map| should still match expectations. CHECK(!map->is_deprecated()); CHECK(expectations.Check(*map)); - if (config.generalizes_representations()) { + if (config->generalizes_representations()) { for (int i = 0; i < kPropCount; i++) { expectations2.GeneralizeField(i); } @@ -2182,8 +2168,9 @@ static void TestGeneralizeFieldWithSpecialTransition( // Create new maps by generalizing representation of propX field. Handle<Map> maps[kPropCount]; for (int i = 0; i < kPropCount; i++) { - Handle<Map> new_map = Map::ReconfigureProperty(isolate, map, i, kData, NONE, - to.representation, to.type); + Handle<Map> new_map = + Map::ReconfigureProperty(isolate, map, InternalIndex(i), kData, NONE, + to.representation, to.type); maps[i] = new_map; expectations.SetDataField(i, expected.constness, expected.representation, @@ -2206,10 +2193,10 @@ static void TestGeneralizeFieldWithSpecialTransition( CHECK_EQ(*new_map2, *tmp_map); } else { // Equivalent transitions should always find the updated map. - CHECK(config.is_non_equivalent_transition()); + CHECK(config->is_non_equivalent_transition()); } - if (config.is_non_equivalent_transition()) { + if (config->is_non_equivalent_transition()) { // In case of non-equivalent transition currently we generalize all // representations. for (int i = 0; i < kPropCount; i++) { @@ -2260,9 +2247,9 @@ TEST(ElementsKindTransitionFromMapOwningDescriptor) { ElementsKind kind) : attributes(attributes), symbol(symbol), elements_kind(kind) {} - Handle<Map> Transition(Handle<Map> map, Expectations& expectations) { - expectations.SetElementsKind(elements_kind); - expectations.ChangeAttributesForAllProperties(attributes); + Handle<Map> Transition(Handle<Map> map, Expectations* expectations) { + expectations->SetElementsKind(elements_kind); + expectations->ChangeAttributesForAllProperties(attributes); return Map::CopyForPreventExtensions(CcTest::i_isolate(), map, attributes, symbol, "CopyForPreventExtensions"); } @@ -2287,17 +2274,17 @@ TEST(ElementsKindTransitionFromMapOwningDescriptor) { : DICTIONARY_ELEMENTS}}; for (size_t i = 0; i < arraysize(configs); i++) { TestGeneralizeFieldWithSpecialTransition( - configs[i], + &configs[i], {PropertyConstness::kMutable, Representation::Smi(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, {PropertyConstness::kMutable, Representation::Tagged(), any_type}, !FLAG_modify_field_representation_inplace); TestGeneralizeFieldWithSpecialTransition( - configs[i], + &configs[i], {PropertyConstness::kMutable, Representation::Double(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, {PropertyConstness::kMutable, Representation::Tagged(), any_type}, - true); + FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace); } } @@ -2316,7 +2303,7 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) { ElementsKind kind) : attributes(attributes), symbol(symbol), elements_kind(kind) {} - Handle<Map> Transition(Handle<Map> map, Expectations& expectations) { + Handle<Map> Transition(Handle<Map> map, Expectations* expectations) { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); @@ -2329,8 +2316,8 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) { .ToHandleChecked(); CHECK(!map->owns_descriptors()); - expectations.SetElementsKind(elements_kind); - expectations.ChangeAttributesForAllProperties(attributes); + expectations->SetElementsKind(elements_kind); + expectations->ChangeAttributesForAllProperties(attributes); return Map::CopyForPreventExtensions(isolate, map, attributes, symbol, "CopyForPreventExtensions"); } @@ -2355,17 +2342,17 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) { : DICTIONARY_ELEMENTS}}; for (size_t i = 0; i < arraysize(configs); i++) { TestGeneralizeFieldWithSpecialTransition( - configs[i], + &configs[i], {PropertyConstness::kMutable, Representation::Smi(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, {PropertyConstness::kMutable, Representation::Tagged(), any_type}, !FLAG_modify_field_representation_inplace); TestGeneralizeFieldWithSpecialTransition( - configs[i], + &configs[i], {PropertyConstness::kMutable, Representation::Double(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, {PropertyConstness::kMutable, Representation::Tagged(), any_type}, - true); + FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace); } } @@ -2388,9 +2375,7 @@ TEST(PrototypeTransitionFromMapOwningDescriptor) { prototype_ = factory->NewJSObjectFromMap(Map::Create(isolate, 0)); } - Handle<Map> Transition( - Handle<Map> map, - Expectations& expectations) { // NOLINT(runtime/references) + Handle<Map> Transition(Handle<Map> map, Expectations* expectations) { return Map::TransitionToPrototype(CcTest::i_isolate(), map, prototype_); } // TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed. @@ -2401,14 +2386,16 @@ TEST(PrototypeTransitionFromMapOwningDescriptor) { }; TestConfig config; TestGeneralizeFieldWithSpecialTransition( - config, {PropertyConstness::kMutable, Representation::Smi(), any_type}, + &config, {PropertyConstness::kMutable, Representation::Smi(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, {PropertyConstness::kMutable, Representation::Tagged(), any_type}, !FLAG_modify_field_representation_inplace); TestGeneralizeFieldWithSpecialTransition( - config, {PropertyConstness::kMutable, Representation::Double(), any_type}, + &config, + {PropertyConstness::kMutable, Representation::Double(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, - {PropertyConstness::kMutable, Representation::Tagged(), any_type}, true); + {PropertyConstness::kMutable, Representation::Tagged(), any_type}, + FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace); } TEST(PrototypeTransitionFromMapNotOwningDescriptor) { @@ -2429,9 +2416,7 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) { prototype_ = factory->NewJSObjectFromMap(Map::Create(isolate, 0)); } - Handle<Map> Transition( - Handle<Map> map, - Expectations& expectations) { // NOLINT(runtime/references) + Handle<Map> Transition(Handle<Map> map, Expectations* expectations) { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); @@ -2454,14 +2439,16 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) { }; TestConfig config; TestGeneralizeFieldWithSpecialTransition( - config, {PropertyConstness::kMutable, Representation::Smi(), any_type}, + &config, {PropertyConstness::kMutable, Representation::Smi(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, {PropertyConstness::kMutable, Representation::Tagged(), any_type}, !FLAG_modify_field_representation_inplace); TestGeneralizeFieldWithSpecialTransition( - config, {PropertyConstness::kMutable, Representation::Double(), any_type}, + &config, + {PropertyConstness::kMutable, Representation::Double(), any_type}, {PropertyConstness::kMutable, Representation::HeapObject(), value_type}, - {PropertyConstness::kMutable, Representation::Tagged(), any_type}, true); + {PropertyConstness::kMutable, Representation::Tagged(), any_type}, + FLAG_unbox_double_fields || !FLAG_modify_field_representation_inplace); } //////////////////////////////////////////////////////////////////////////////// @@ -2486,10 +2473,8 @@ struct TransitionToDataFieldOperator { heap_type_(heap_type), value_(value) {} - Handle<Map> DoTransition( - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { - return expectations.TransitionToDataField( + Handle<Map> DoTransition(Expectations* expectations, Handle<Map> map) { + return expectations->TransitionToDataField( map, attributes_, constness_, representation_, heap_type_, value_); } }; @@ -2503,8 +2488,8 @@ struct TransitionToDataConstantOperator { PropertyAttributes attributes = NONE) : attributes_(attributes), value_(value) {} - Handle<Map> DoTransition(Expectations& expectations, Handle<Map> map) { - return expectations.TransitionToDataConstant(map, attributes_, value_); + Handle<Map> DoTransition(Expectations* expectations, Handle<Map> map) { + return expectations->TransitionToDataConstant(map, attributes_, value_); } }; @@ -2517,14 +2502,14 @@ struct TransitionToAccessorConstantOperator { PropertyAttributes attributes = NONE) : attributes_(attributes), pair_(pair) {} - Handle<Map> DoTransition(Expectations& expectations, Handle<Map> map) { - return expectations.TransitionToAccessorConstant(map, attributes_, pair_); + Handle<Map> DoTransition(Expectations* expectations, Handle<Map> map) { + return expectations->TransitionToAccessorConstant(map, attributes_, pair_); } }; struct ReconfigureAsDataPropertyOperator { - int descriptor_; + InternalIndex descriptor_; Representation representation_; PropertyAttributes attributes_; Handle<FieldType> heap_type_; @@ -2538,12 +2523,11 @@ struct ReconfigureAsDataPropertyOperator { attributes_(attributes), heap_type_(heap_type) {} - Handle<Map> DoTransition( - Isolate* isolate, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map) { - expectations.SetDataField(descriptor_, PropertyConstness::kMutable, - representation_, heap_type_); + Handle<Map> DoTransition(Isolate* isolate, Expectations* expectations, + Handle<Map> map) { + expectations->SetDataField(descriptor_.as_int(), + PropertyConstness::kMutable, representation_, + heap_type_); return Map::ReconfigureExistingProperty(isolate, map, descriptor_, kData, attributes_, PropertyConstness::kConst); @@ -2552,16 +2536,16 @@ struct ReconfigureAsDataPropertyOperator { struct ReconfigureAsAccessorPropertyOperator { - int descriptor_; + InternalIndex descriptor_; PropertyAttributes attributes_; ReconfigureAsAccessorPropertyOperator(int descriptor, PropertyAttributes attributes = NONE) : descriptor_(descriptor), attributes_(attributes) {} - Handle<Map> DoTransition(Isolate* isolate, Expectations& expectations, + Handle<Map> DoTransition(Isolate* isolate, Expectations* expectations, Handle<Map> map) { - expectations.SetAccessorField(descriptor_); + expectations->SetAccessorField(descriptor_.as_int()); return Map::ReconfigureExistingProperty(isolate, map, descriptor_, kAccessor, attributes_, PropertyConstness::kConst); @@ -2586,9 +2570,8 @@ struct FieldGeneralizationChecker { attributes_(attributes), heap_type_(heap_type) {} - void Check(Isolate* isolate, - Expectations& expectations2, // NOLINT(runtime/references) - Handle<Map> map1, Handle<Map> map2) { + void Check(Isolate* isolate, Expectations* expectations, Handle<Map> map1, + Handle<Map> map2) { CHECK(!map2->is_deprecated()); CHECK(map1->is_deprecated()); @@ -2597,21 +2580,20 @@ struct FieldGeneralizationChecker { CHECK_EQ(*map2, *updated_map); CheckMigrationTarget(isolate, *map1, *updated_map); - expectations2.SetDataField(descriptor_, attributes_, constness_, + expectations->SetDataField(descriptor_, attributes_, constness_, representation_, heap_type_); - CHECK(expectations2.Check(*map2)); + CHECK(expectations->Check(*map2)); } }; // Checks that existing transition was taken as is. struct SameMapChecker { - void Check(Isolate* isolate, - Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map1, Handle<Map> map2) { + void Check(Isolate* isolate, Expectations* expectations, Handle<Map> map1, + Handle<Map> map2) { CHECK(!map2->is_deprecated()); CHECK_EQ(*map1, *map2); - CHECK(expectations.Check(*map2)); + CHECK(expectations->Check(*map2)); } }; @@ -2619,12 +2601,11 @@ struct SameMapChecker { // Checks that both |map1| and |map2| should stays non-deprecated, this is // the case when property kind is change. struct PropertyKindReconfigurationChecker { - void Check(Expectations& expectations, // NOLINT(runtime/references) - Handle<Map> map1, Handle<Map> map2) { + void Check(Expectations* expectations, Handle<Map> map1, Handle<Map> map2) { CHECK(!map1->is_deprecated()); CHECK(!map2->is_deprecated()); CHECK_NE(*map1, *map2); - CHECK(expectations.Check(*map2)); + CHECK(expectations->Check(*map2)); } }; @@ -2645,10 +2626,8 @@ struct PropertyKindReconfigurationChecker { // where "p4A" and "p4B" differ only in the attributes. // template <typename TransitionOp1, typename TransitionOp2, typename Checker> -static void TestTransitionTo( - TransitionOp1& transition_op1, // NOLINT(runtime/references) - TransitionOp2& transition_op2, // NOLINT(runtime/references) - Checker& checker) { // NOLINT(runtime/references) +static void TestTransitionTo(TransitionOp1* transition_op1, + TransitionOp2* transition_op2, Checker* checker) { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); @@ -2664,14 +2643,14 @@ static void TestTransitionTo( CHECK(expectations.Check(*map)); Expectations expectations1 = expectations; - Handle<Map> map1 = transition_op1.DoTransition(expectations1, map); + Handle<Map> map1 = transition_op1->DoTransition(&expectations1, map); CHECK(expectations1.Check(*map1)); Expectations expectations2 = expectations; - Handle<Map> map2 = transition_op2.DoTransition(expectations2, map); + Handle<Map> map2 = transition_op2->DoTransition(&expectations2, map); // Let the test customization do the check. - checker.Check(isolate, expectations2, map1, map2); + checker->Check(isolate, &expectations2, map1, map2); } TEST(TransitionDataFieldToDataField) { @@ -2692,7 +2671,7 @@ TEST(TransitionDataFieldToDataField) { FieldGeneralizationChecker checker(kPropCount - 1, PropertyConstness::kMutable, Representation::Double(), any_type); - TestTransitionTo(transition_op1, transition_op2, checker); + TestTransitionTo(&transition_op1, &transition_op2, &checker); } TEST(TransitionDataConstantToSameDataConstant) { @@ -2706,7 +2685,7 @@ TEST(TransitionDataConstantToSameDataConstant) { TransitionToDataConstantOperator transition_op(js_func); SameMapChecker checker; - TestTransitionTo(transition_op, transition_op, checker); + TestTransitionTo(&transition_op, &transition_op, &checker); } @@ -2732,7 +2711,7 @@ TEST(TransitionDataConstantToAnotherDataConstant) { TransitionToDataConstantOperator transition_op2(js_func2); SameMapChecker checker; - TestTransitionTo(transition_op1, transition_op2, checker); + TestTransitionTo(&transition_op1, &transition_op2, &checker); } @@ -2754,12 +2733,12 @@ TEST(TransitionDataConstantToDataField) { if (FLAG_modify_field_representation_inplace) { SameMapChecker checker; - TestTransitionTo(transition_op1, transition_op2, checker); + TestTransitionTo(&transition_op1, &transition_op2, &checker); } else { FieldGeneralizationChecker checker(kPropCount - 1, PropertyConstness::kMutable, Representation::Tagged(), any_type); - TestTransitionTo(transition_op1, transition_op2, checker); + TestTransitionTo(&transition_op1, &transition_op2, &checker); } } @@ -2772,7 +2751,7 @@ TEST(TransitionAccessorConstantToSameAccessorConstant) { TransitionToAccessorConstantOperator transition_op(pair); SameMapChecker checker; - TestTransitionTo(transition_op, transition_op, checker); + TestTransitionTo(&transition_op, &transition_op, &checker); } // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. @@ -2840,11 +2819,11 @@ void TestStoreToConstantField(const char* store_func_source, CHECK(!map->is_dictionary_map()); CHECK(!map->is_deprecated()); CHECK_EQ(1, map->NumberOfOwnDescriptors()); - - CHECK(map->instance_descriptors().GetDetails(0).representation().Equals( + InternalIndex first(0); + CHECK(map->instance_descriptors().GetDetails(first).representation().Equals( expected_rep)); CHECK_EQ(PropertyConstness::kConst, - map->instance_descriptors().GetDetails(0).constness()); + map->instance_descriptors().GetDetails(first).constness()); // Store value2 to obj2 and check that it got same map and property details // did not change. @@ -2856,10 +2835,10 @@ void TestStoreToConstantField(const char* store_func_source, CHECK(!map->is_deprecated()); CHECK_EQ(1, map->NumberOfOwnDescriptors()); - CHECK(map->instance_descriptors().GetDetails(0).representation().Equals( + CHECK(map->instance_descriptors().GetDetails(first).representation().Equals( expected_rep)); CHECK_EQ(PropertyConstness::kConst, - map->instance_descriptors().GetDetails(0).constness()); + map->instance_descriptors().GetDetails(first).constness()); // Store value2 to obj1 and check that property became mutable. Call(isolate, store_func, obj1, value2).Check(); @@ -2869,10 +2848,10 @@ void TestStoreToConstantField(const char* store_func_source, CHECK(!map->is_deprecated()); CHECK_EQ(1, map->NumberOfOwnDescriptors()); - CHECK(map->instance_descriptors().GetDetails(0).representation().Equals( + CHECK(map->instance_descriptors().GetDetails(first).representation().Equals( expected_rep)); CHECK_EQ(expected_constness, - map->instance_descriptors().GetDetails(0).constness()); + map->instance_descriptors().GetDetails(first).constness()); } void TestStoreToConstantField_PlusMinusZero(const char* store_func_source, diff --git a/deps/v8/test/cctest/test-flags.cc b/deps/v8/test/cctest/test-flags.cc index 4e5fcffa62..93c7048f81 100644 --- a/deps/v8/test/cctest/test-flags.cc +++ b/deps/v8/test/cctest/test-flags.cc @@ -209,11 +209,5 @@ TEST(FlagsJitlessImplications) { } } -TEST(FlagsRegexpInterpretAllImplications) { - if (FLAG_regexp_interpret_all) { - CHECK(!FLAG_regexp_tier_up); - } -} - } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc index 417679432b..98a66bf535 100644 --- a/deps/v8/test/cctest/test-global-handles.cc +++ b/deps/v8/test/cctest/test-global-handles.cc @@ -49,7 +49,7 @@ class NonRootingEmbedderHeapTracer final : public v8::EmbedderHeapTracer { const std::vector<std::pair<void*, void*>>& embedder_fields) final {} bool AdvanceTracing(double deadline_in_ms) final { return true; } bool IsTracingDone() final { return true; } - void TracePrologue() final {} + void TracePrologue(TraceFlags) final {} void TraceEpilogue() final {} void EnterFinalPause(EmbedderStackState) final {} diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 3aec4ae003..7784a7f855 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -3062,7 +3062,8 @@ TEST(ArrayBufferSharedBackingStore) { CHECK(ab2_data); CHECK_EQ(ab1_data, ab2_data); CHECK_EQ(2, GetRetainersCount(snapshot, ab1_data)); - free(data); + ab_contents.Deleter()(ab_contents.Data(), ab_contents.ByteLength(), + ab_contents.DeleterData()); } @@ -3577,10 +3578,9 @@ TEST(AddressToTraceMap) { } static const v8::AllocationProfile::Node* FindAllocationProfileNode( - v8::Isolate* isolate, - v8::AllocationProfile& profile, // NOLINT(runtime/references) + v8::Isolate* isolate, v8::AllocationProfile* profile, const Vector<const char*>& names) { - v8::AllocationProfile::Node* node = profile.GetRootNode(); + v8::AllocationProfile::Node* node = profile->GetRootNode(); for (int i = 0; node != nullptr && i < names.length(); ++i) { const char* name = names[i]; auto children = node->children; @@ -3650,7 +3650,7 @@ TEST(SamplingHeapProfiler) { CHECK(profile); const char* names[] = {"", "foo", "bar"}; - auto node_bar = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node_bar = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(names)); CHECK(node_bar); @@ -3674,12 +3674,12 @@ TEST(SamplingHeapProfiler) { CHECK(profile); const char* names1[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"}; - auto node1 = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node1 = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(names1)); CHECK(node1); const char* names2[] = {"", "generateFunctions"}; - auto node2 = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node2 = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(names2)); CHECK(node2); @@ -3737,11 +3737,11 @@ TEST(SamplingHeapProfilerRateAgnosticEstimates) { CHECK(profile); const char* path_to_foo[] = {"", "foo"}; - auto node_foo = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node_foo = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(path_to_foo)); CHECK(node_foo); const char* path_to_bar[] = {"", "foo", "bar"}; - auto node_bar = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node_bar = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(path_to_bar)); CHECK(node_bar); @@ -3761,11 +3761,11 @@ TEST(SamplingHeapProfilerRateAgnosticEstimates) { CHECK(profile); const char* path_to_foo[] = {"", "foo"}; - auto node_foo = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node_foo = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(path_to_foo)); CHECK(node_foo); const char* path_to_bar[] = {"", "foo", "bar"}; - auto node_bar = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node_bar = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(path_to_bar)); CHECK(node_bar); @@ -3804,7 +3804,7 @@ TEST(SamplingHeapProfilerApiAllocation) { heap_profiler->GetAllocationProfile()); CHECK(profile); const char* names[] = {"(V8 API)"}; - auto node = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(names)); CHECK(node); @@ -3944,7 +3944,7 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) { heap_profiler->StopSamplingHeapProfiler(); const char* names[] = {"f"}; - auto node_f = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node_f = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(names)); CHECK(node_f); @@ -3974,7 +3974,7 @@ TEST(SamplingHeapProfilerLargeInterval) { heap_profiler->GetAllocationProfile()); CHECK(profile); const char* names[] = {"(EXTERNAL)"}; - auto node = FindAllocationProfileNode(env->GetIsolate(), *profile, + auto node = FindAllocationProfileNode(env->GetIsolate(), profile.get(), ArrayVector(names)); CHECK(node); diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc index 6a25536dd5..e2de4df4fb 100644 --- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc +++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc @@ -1112,7 +1112,7 @@ TEST(SubclassRegExpBuiltin) { v8::HandleScope scope(CcTest::isolate()); const int first_field = 1; - TestSubclassBuiltin("A1", JS_REGEXP_TYPE, "RegExp", "'o(..)h', 'g'", + TestSubclassBuiltin("A1", JS_REG_EXP_TYPE, "RegExp", "'o(..)h', 'g'", first_field); } diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc index 092c107841..4ed00e0a11 100644 --- a/deps/v8/test/cctest/test-lockers.cc +++ b/deps/v8/test/cctest/test-lockers.cc @@ -944,7 +944,7 @@ TEST(ExtensionsRegistration) { "test4", "test5", "test6", "test7"}; for (const char* name : extension_names) { v8::RegisterExtension( - v8::base::make_unique<v8::Extension>(name, kSimpleExtensionSource)); + std::make_unique<v8::Extension>(name, kSimpleExtensionSource)); } std::vector<JoinableThread*> threads; threads.reserve(kNThreads); diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc index 1344c0e9d1..e238c8c021 100644 --- a/deps/v8/test/cctest/test-macro-assembler-x64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc @@ -242,37 +242,37 @@ TEST(SmiTag) { __ movq(rax, Immediate(1)); // Test number. __ movq(rcx, Immediate(0)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); __ Set(rdx, Smi::kZero.ptr()); - __ cmpq(rcx, rdx); + __ cmp_tagged(rcx, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(2)); // Test number. __ movq(rcx, Immediate(1024)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); __ Set(rdx, Smi::FromInt(1024).ptr()); - __ cmpq(rcx, rdx); + __ cmp_tagged(rcx, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(3)); // Test number. __ movq(rcx, Immediate(-1)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); __ Set(rdx, Smi::FromInt(-1).ptr()); - __ cmpq(rcx, rdx); + __ cmp_tagged(rcx, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(4)); // Test number. __ movq(rcx, Immediate(Smi::kMaxValue)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); __ Set(rdx, Smi::FromInt(Smi::kMaxValue).ptr()); - __ cmpq(rcx, rdx); + __ cmp_tagged(rcx, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(5)); // Test number. __ movq(rcx, Immediate(Smi::kMinValue)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); __ Set(rdx, Smi::FromInt(Smi::kMinValue).ptr()); - __ cmpq(rcx, rdx); + __ cmp_tagged(rcx, rdx); __ j(not_equal, &exit); // Different target register. @@ -281,35 +281,35 @@ TEST(SmiTag) { __ movq(rcx, Immediate(0)); __ SmiTag(r8, rcx); __ Set(rdx, Smi::zero().ptr()); - __ cmpq(r8, rdx); + __ cmp_tagged(r8, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(7)); // Test number. __ movq(rcx, Immediate(1024)); __ SmiTag(r8, rcx); __ Set(rdx, Smi::FromInt(1024).ptr()); - __ cmpq(r8, rdx); + __ cmp_tagged(r8, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(8)); // Test number. __ movq(rcx, Immediate(-1)); __ SmiTag(r8, rcx); __ Set(rdx, Smi::FromInt(-1).ptr()); - __ cmpq(r8, rdx); + __ cmp_tagged(r8, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(9)); // Test number. __ movq(rcx, Immediate(Smi::kMaxValue)); __ SmiTag(r8, rcx); __ Set(rdx, Smi::FromInt(Smi::kMaxValue).ptr()); - __ cmpq(r8, rdx); + __ cmp_tagged(r8, rdx); __ j(not_equal, &exit); __ movq(rax, Immediate(10)); // Test number. __ movq(rcx, Immediate(Smi::kMinValue)); __ SmiTag(r8, rcx); __ Set(rdx, Smi::FromInt(Smi::kMinValue).ptr()); - __ cmpq(r8, rdx); + __ cmp_tagged(r8, rdx); __ j(not_equal, &exit); @@ -344,7 +344,7 @@ TEST(SmiCheck) { // CheckSmi __ movl(rcx, Immediate(0)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); cond = masm->CheckSmi(rcx); __ j(NegateCondition(cond), &exit); @@ -355,7 +355,7 @@ TEST(SmiCheck) { __ incq(rax); __ movl(rcx, Immediate(-1)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); cond = masm->CheckSmi(rcx); __ j(NegateCondition(cond), &exit); @@ -366,7 +366,7 @@ TEST(SmiCheck) { __ incq(rax); __ movl(rcx, Immediate(Smi::kMaxValue)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); cond = masm->CheckSmi(rcx); __ j(NegateCondition(cond), &exit); @@ -377,7 +377,7 @@ TEST(SmiCheck) { __ incq(rax); __ movl(rcx, Immediate(Smi::kMinValue)); - __ SmiTag(rcx, rcx); + __ SmiTag(rcx); cond = masm->CheckSmi(rcx); __ j(NegateCondition(cond), &exit); diff --git a/deps/v8/test/cctest/test-modules.cc b/deps/v8/test/cctest/test-modules.cc index 0f2bfd2a5f..d7cb6e610e 100644 --- a/deps/v8/test/cctest/test-modules.cc +++ b/deps/v8/test/cctest/test-modules.cc @@ -14,6 +14,7 @@ using v8::Isolate; using v8::Local; using v8::MaybeLocal; using v8::Module; +using v8::Promise; using v8::ScriptCompiler; using v8::ScriptOrigin; using v8::String; @@ -196,99 +197,480 @@ static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( } TEST(ModuleEvaluation) { - 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; - Local<String> source_text = v8_str( - "import 'Object.expando = 5';" - "import 'Object.expando *= 2';"); - ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - Local<Module> module = - ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - CHECK(module - ->InstantiateModule(env.local(), - CompileSpecifierAsModuleResolveCallback) - .FromJust()); - CHECK_EQ(Module::kInstantiated, module->GetStatus()); - CHECK(!module->Evaluate(env.local()).IsEmpty()); - CHECK_EQ(Module::kEvaluated, module->GetStatus()); - ExpectInt32("Object.expando", 10); + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + v8::TryCatch try_catch(isolate); - CHECK(!try_catch.HasCaught()); + Local<String> source_text = v8_str( + "import 'Object.expando = 5';" + "import 'Object.expando *= 2';"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) + .FromJust()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + + MaybeLocal<Value> result = module->Evaluate(env.local()); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + if (i::FLAG_harmony_top_level_await) { + Local<Promise> promise = Local<Promise>::Cast(result.ToLocalChecked()); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + } else { + CHECK(!result.IsEmpty()); + ExpectInt32("Object.expando", 10); + } + CHECK(!try_catch.HasCaught()); + } + i::FLAG_harmony_top_level_await = prev_top_level_await; } -TEST(ModuleEvaluationError) { - Isolate* isolate = CcTest::isolate(); - HandleScope scope(isolate); - LocalContext env; - v8::TryCatch try_catch(isolate); +TEST(ModuleEvaluationError1) { + 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; - Local<String> source_text = - v8_str("Object.x = (Object.x || 0) + 1; throw 'boom';"); - ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - Local<Module> module = - ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - CHECK(module - ->InstantiateModule(env.local(), - CompileSpecifierAsModuleResolveCallback) - .FromJust()); - CHECK_EQ(Module::kInstantiated, module->GetStatus()); + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + v8::TryCatch try_catch(isolate); - { - v8::TryCatch inner_try_catch(isolate); - CHECK(module->Evaluate(env.local()).IsEmpty()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kErrored, module->GetStatus()); - Local<Value> exception = module->GetException(); - CHECK(exception->StrictEquals(v8_str("boom"))); - ExpectInt32("Object.x", 1); + Local<String> source_text = + v8_str("Object.x = (Object.x || 0) + 1; throw 'boom';"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) + .FromJust()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + + MaybeLocal<Value> result_1; + { + v8::TryCatch inner_try_catch(isolate); + result_1 = module->Evaluate(env.local()); + CHECK_EQ(Module::kErrored, module->GetStatus()); + Local<Value> exception = module->GetException(); + CHECK(exception->StrictEquals(v8_str("boom"))); + ExpectInt32("Object.x", 1); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + } + + MaybeLocal<Value> result_2; + { + v8::TryCatch inner_try_catch(isolate); + result_2 = module->Evaluate(env.local()); + CHECK_EQ(Module::kErrored, module->GetStatus()); + Local<Value> exception = module->GetException(); + CHECK(exception->StrictEquals(v8_str("boom"))); + ExpectInt32("Object.x", 1); + + if (i::FLAG_harmony_top_level_await) { + // With top level await we do not rethrow the exception. + CHECK(!inner_try_catch.HasCaught()); + } else { + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + } + } + if (i::FLAG_harmony_top_level_await) { + // With top level await, errored evaluation returns a rejected promise + // with the exception. + Local<Promise> promise_1 = + Local<Promise>::Cast(result_1.ToLocalChecked()); + Local<Promise> promise_2 = + Local<Promise>::Cast(result_2.ToLocalChecked()); + CHECK_EQ(promise_1->State(), v8::Promise::kRejected); + CHECK_EQ(promise_2->State(), v8::Promise::kRejected); + CHECK_EQ(promise_1->Result(), module->GetException()); + CHECK_EQ(promise_2->Result(), module->GetException()); + } else { + CHECK(result_1.IsEmpty() && result_2.IsEmpty()); + } + + CHECK(!try_catch.HasCaught()); } + i::FLAG_harmony_top_level_await = prev_top_level_await; +} - { - v8::TryCatch inner_try_catch(isolate); - CHECK(module->Evaluate(env.local()).IsEmpty()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kErrored, module->GetStatus()); - Local<Value> exception = module->GetException(); - CHECK(exception->StrictEquals(v8_str("boom"))); - ExpectInt32("Object.x", 1); +static Local<Module> failure_module; +static Local<Module> dependent_module; +MaybeLocal<Module> ResolveCallbackForModuleEvaluationError2( + Local<Context> context, Local<String> specifier, Local<Module> referrer) { + if (specifier->StrictEquals(v8_str("./failure.js"))) { + return failure_module; + } else { + CHECK(specifier->StrictEquals(v8_str("./dependent.js"))); + return dependent_module; } +} - CHECK(!try_catch.HasCaught()); +TEST(ModuleEvaluationError2) { + 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<String> failure_text = v8_str("throw 'boom';"); + ScriptOrigin failure_origin = + ModuleOrigin(v8_str("failure.js"), CcTest::isolate()); + ScriptCompiler::Source failure_source(failure_text, failure_origin); + failure_module = ScriptCompiler::CompileModule(isolate, &failure_source) + .ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, failure_module->GetStatus()); + CHECK(failure_module + ->InstantiateModule(env.local(), + ResolveCallbackForModuleEvaluationError2) + .FromJust()); + CHECK_EQ(Module::kInstantiated, failure_module->GetStatus()); + + MaybeLocal<Value> result_1; + { + v8::TryCatch inner_try_catch(isolate); + result_1 = failure_module->Evaluate(env.local()); + CHECK_EQ(Module::kErrored, failure_module->GetStatus()); + Local<Value> exception = failure_module->GetException(); + CHECK(exception->StrictEquals(v8_str("boom"))); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + } + + Local<String> dependent_text = + v8_str("import './failure.js'; export const c = 123;"); + ScriptOrigin dependent_origin = + ModuleOrigin(v8_str("dependent.js"), CcTest::isolate()); + ScriptCompiler::Source dependent_source(dependent_text, dependent_origin); + dependent_module = ScriptCompiler::CompileModule(isolate, &dependent_source) + .ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, dependent_module->GetStatus()); + CHECK(dependent_module + ->InstantiateModule(env.local(), + ResolveCallbackForModuleEvaluationError2) + .FromJust()); + CHECK_EQ(Module::kInstantiated, dependent_module->GetStatus()); + + MaybeLocal<Value> result_2; + { + v8::TryCatch inner_try_catch(isolate); + result_2 = dependent_module->Evaluate(env.local()); + CHECK_EQ(Module::kErrored, dependent_module->GetStatus()); + Local<Value> exception = dependent_module->GetException(); + CHECK(exception->StrictEquals(v8_str("boom"))); + CHECK_EQ(exception, failure_module->GetException()); + + if (i::FLAG_harmony_top_level_await) { + // With top level await we do not rethrow the exception. + CHECK(!inner_try_catch.HasCaught()); + } else { + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + } + } + + if (i::FLAG_harmony_top_level_await) { + // With top level await, errored evaluation returns a rejected promise + // with the exception. + Local<Promise> promise_1 = + Local<Promise>::Cast(result_1.ToLocalChecked()); + Local<Promise> promise_2 = + Local<Promise>::Cast(result_2.ToLocalChecked()); + CHECK_EQ(promise_1->State(), v8::Promise::kRejected); + CHECK_EQ(promise_2->State(), v8::Promise::kRejected); + CHECK_EQ(promise_1->Result(), failure_module->GetException()); + CHECK_EQ(promise_2->Result(), failure_module->GetException()); + } else { + CHECK(result_1.IsEmpty() && result_2.IsEmpty()); + } + + CHECK(!try_catch.HasCaught()); + } + i::FLAG_harmony_top_level_await = prev_top_level_await; } TEST(ModuleEvaluationCompletion1) { + 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); + + const char* sources[] = { + "", + "var a = 1", + "import '42'", + "export * from '42'", + "export {} from '42'", + "export {}", + "var a = 1; export {a}", + "export function foo() {}", + "export class C extends null {}", + "export let a = 1", + "export default 1", + "export default function foo() {}", + "export default function () {}", + "export default (function () {})", + "export default class C extends null {}", + "export default (class C extends null {})", + "for (var i = 0; i < 5; ++i) {}", + }; + + for (auto src : sources) { + Local<String> source_text = v8_str(src); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) + .FromJust()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + + // Evaluate twice. + Local<Value> result_1 = module->Evaluate(env.local()).ToLocalChecked(); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + Local<Value> result_2 = module->Evaluate(env.local()).ToLocalChecked(); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + + if (i::FLAG_harmony_top_level_await) { + Local<Promise> promise = Local<Promise>::Cast(result_1); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + + // Second evaluation should return the same promise. + Local<Promise> promise_too = Local<Promise>::Cast(result_2); + CHECK_EQ(promise, promise_too); + CHECK_EQ(promise_too->State(), v8::Promise::kFulfilled); + CHECK(promise_too->Result()->IsUndefined()); + } else { + CHECK(result_1->IsUndefined()); + CHECK(result_2->IsUndefined()); + } + } + CHECK(!try_catch.HasCaught()); + } + i::FLAG_harmony_top_level_await = prev_top_level_await; +} + +TEST(ModuleEvaluationCompletion2) { + 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); + + const char* sources[] = { + "'gaga'; ", + "'gaga'; var a = 1", + "'gaga'; import '42'", + "'gaga'; export * from '42'", + "'gaga'; export {} from '42'", + "'gaga'; export {}", + "'gaga'; var a = 1; export {a}", + "'gaga'; export function foo() {}", + "'gaga'; export class C extends null {}", + "'gaga'; export let a = 1", + "'gaga'; export default 1", + "'gaga'; export default function foo() {}", + "'gaga'; export default function () {}", + "'gaga'; export default (function () {})", + "'gaga'; export default class C extends null {}", + "'gaga'; export default (class C extends null {})", + }; + + for (auto src : sources) { + Local<String> source_text = v8_str(src); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) + .FromJust()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + + Local<Value> result_1 = module->Evaluate(env.local()).ToLocalChecked(); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + + Local<Value> result_2 = module->Evaluate(env.local()).ToLocalChecked(); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + if (i::FLAG_harmony_top_level_await) { + Local<Promise> promise = Local<Promise>::Cast(result_1); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + + // Second Evaluation should return the same promise. + Local<Promise> promise_too = Local<Promise>::Cast(result_2); + CHECK_EQ(promise, promise_too); + CHECK_EQ(promise_too->State(), v8::Promise::kFulfilled); + CHECK(promise_too->Result()->IsUndefined()); + } else { + CHECK(result_1->StrictEquals(v8_str("gaga"))); + CHECK(result_2->IsUndefined()); + } + } + CHECK(!try_catch.HasCaught()); + } + i::FLAG_harmony_top_level_await = prev_top_level_await; +} + +TEST(ModuleNamespace) { + 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<v8::Object> ReferenceError = + CompileRun("ReferenceError")->ToObject(env.local()).ToLocalChecked(); + + Local<String> source_text = v8_str( + "import {a, b} from 'export var a = 1; export let b = 2';" + "export function geta() {return a};" + "export function getb() {return b};" + "export let radio = 3;" + "export var gaga = 4;"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) + .FromJust()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + Local<Value> ns = module->GetModuleNamespace(); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + Local<v8::Object> nsobj = ns->ToObject(env.local()).ToLocalChecked(); + CHECK_EQ(nsobj->CreationContext(), env.local()); + + // a, b + CHECK(nsobj->Get(env.local(), v8_str("a")).ToLocalChecked()->IsUndefined()); + CHECK(nsobj->Get(env.local(), v8_str("b")).ToLocalChecked()->IsUndefined()); + + // geta + { + auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked(); + auto a = geta.As<v8::Function>() + ->Call(env.local(), geta, 0, nullptr) + .ToLocalChecked(); + CHECK(a->IsUndefined()); + } + + // getb + { + v8::TryCatch inner_try_catch(isolate); + auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked(); + CHECK(getb.As<v8::Function>() + ->Call(env.local(), getb, 0, nullptr) + .IsEmpty()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception() + ->InstanceOf(env.local(), ReferenceError) + .FromJust()); + } + + // radio + { + v8::TryCatch inner_try_catch(isolate); + // https://bugs.chromium.org/p/v8/issues/detail?id=7235 + // CHECK(nsobj->Get(env.local(), v8_str("radio")).IsEmpty()); + CHECK(nsobj->Get(env.local(), v8_str("radio")) + .ToLocalChecked() + ->IsUndefined()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception() + ->InstanceOf(env.local(), ReferenceError) + .FromJust()); + } + + // gaga + { + auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked(); + CHECK(gaga->IsUndefined()); + } + + CHECK(!try_catch.HasCaught()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); + module->Evaluate(env.local()).ToLocalChecked(); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + + // geta + { + auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked(); + auto a = geta.As<v8::Function>() + ->Call(env.local(), geta, 0, nullptr) + .ToLocalChecked(); + CHECK_EQ(1, a->Int32Value(env.local()).FromJust()); + } + + // getb + { + auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked(); + auto b = getb.As<v8::Function>() + ->Call(env.local(), getb, 0, nullptr) + .ToLocalChecked(); + CHECK_EQ(2, b->Int32Value(env.local()).FromJust()); + } + + // radio + { + auto radio = nsobj->Get(env.local(), v8_str("radio")).ToLocalChecked(); + CHECK_EQ(3, radio->Int32Value(env.local()).FromJust()); + } + + // gaga + { + auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked(); + CHECK_EQ(4, gaga->Int32Value(env.local()).FromJust()); + } + CHECK(!try_catch.HasCaught()); + } + i::FLAG_harmony_top_level_await = prev_top_level_await; +} + +TEST(ModuleEvaluationTopLevelAwait) { + bool previous_top_level_await_flag_value = i::FLAG_harmony_top_level_await; + i::FLAG_harmony_top_level_await = true; Isolate* isolate = CcTest::isolate(); HandleScope scope(isolate); LocalContext env; v8::TryCatch try_catch(isolate); - const char* sources[] = { - "", - "var a = 1", - "import '42'", - "export * from '42'", - "export {} from '42'", - "export {}", - "var a = 1; export {a}", - "export function foo() {}", - "export class C extends null {}", - "export let a = 1", - "export default 1", - "export default function foo() {}", - "export default function () {}", - "export default (function () {})", - "export default class C extends null {}", - "export default (class C extends null {})", - "for (var i = 0; i < 5; ++i) {}", + "await 42", + "import 'await 42';", + "import '42'; import 'await 42';", }; for (auto src : sources) { @@ -303,41 +685,30 @@ TEST(ModuleEvaluationCompletion1) { CompileSpecifierAsModuleResolveCallback) .FromJust()); CHECK_EQ(Module::kInstantiated, module->GetStatus()); - CHECK(module->Evaluate(env.local()).ToLocalChecked()->IsUndefined()); - CHECK_EQ(Module::kEvaluated, module->GetStatus()); - CHECK(module->Evaluate(env.local()).ToLocalChecked()->IsUndefined()); + Local<Promise> promise = + Local<Promise>::Cast(module->Evaluate(env.local()).ToLocalChecked()); CHECK_EQ(Module::kEvaluated, module->GetStatus()); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); + CHECK(promise->Result()->IsUndefined()); + CHECK(!try_catch.HasCaught()); } - - CHECK(!try_catch.HasCaught()); + i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value; } -TEST(ModuleEvaluationCompletion2) { +TEST(ModuleEvaluationTopLevelAwaitError) { + bool previous_top_level_await_flag_value = i::FLAG_harmony_top_level_await; + i::FLAG_harmony_top_level_await = true; Isolate* isolate = CcTest::isolate(); HandleScope scope(isolate); LocalContext env; - v8::TryCatch try_catch(isolate); - const char* sources[] = { - "'gaga'; ", - "'gaga'; var a = 1", - "'gaga'; import '42'", - "'gaga'; export * from '42'", - "'gaga'; export {} from '42'", - "'gaga'; export {}", - "'gaga'; var a = 1; export {a}", - "'gaga'; export function foo() {}", - "'gaga'; export class C extends null {}", - "'gaga'; export let a = 1", - "'gaga'; export default 1", - "'gaga'; export default function foo() {}", - "'gaga'; export default function () {}", - "'gaga'; export default (function () {})", - "'gaga'; export default class C extends null {}", - "'gaga'; export default (class C extends null {})", + "await 42; throw 'boom';", + "import 'await 42; throw \"boom\";';", + "import '42'; import 'await 42; throw \"boom\";';", }; for (auto src : sources) { + v8::TryCatch try_catch(isolate); Local<String> source_text = v8_str(src); ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); ScriptCompiler::Source source(source_text, origin); @@ -349,126 +720,170 @@ TEST(ModuleEvaluationCompletion2) { CompileSpecifierAsModuleResolveCallback) .FromJust()); CHECK_EQ(Module::kInstantiated, module->GetStatus()); - CHECK(module->Evaluate(env.local()) - .ToLocalChecked() - ->StrictEquals(v8_str("gaga"))); - CHECK_EQ(Module::kEvaluated, module->GetStatus()); - CHECK(module->Evaluate(env.local()).ToLocalChecked()->IsUndefined()); - CHECK_EQ(Module::kEvaluated, module->GetStatus()); + Local<Promise> promise = + Local<Promise>::Cast(module->Evaluate(env.local()).ToLocalChecked()); + CHECK_EQ(Module::kErrored, module->GetStatus()); + CHECK_EQ(promise->State(), v8::Promise::kRejected); + 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 + // because it is async. + CHECK(!try_catch.HasCaught()); } + i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value; +} - CHECK(!try_catch.HasCaught()); +namespace { +struct DynamicImportData { + DynamicImportData(Isolate* isolate_, Local<Promise::Resolver> resolver_, + Local<Context> context_, bool should_resolve_) + : isolate(isolate_), should_resolve(should_resolve_) { + resolver.Reset(isolate, resolver_); + context.Reset(isolate, context_); + } + + Isolate* isolate; + v8::Global<Promise::Resolver> resolver; + v8::Global<Context> context; + bool should_resolve; +}; + +void DoHostImportModuleDynamically(void* import_data) { + std::unique_ptr<DynamicImportData> import_data_( + static_cast<DynamicImportData*>(import_data)); + Isolate* isolate(import_data_->isolate); + HandleScope handle_scope(isolate); + + Local<Promise::Resolver> resolver(import_data_->resolver.Get(isolate)); + Local<Context> realm(import_data_->context.Get(isolate)); + Context::Scope context_scope(realm); + + if (import_data_->should_resolve) { + resolver->Resolve(realm, True(isolate)).ToChecked(); + } else { + resolver->Reject(realm, v8_str("boom")).ToChecked(); + } } -TEST(ModuleNamespace) { +v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackResolve( + Local<Context> context, Local<v8::ScriptOrModule> referrer, + Local<String> specifier) { + Isolate* isolate = context->GetIsolate(); + Local<v8::Promise::Resolver> resolver = + v8::Promise::Resolver::New(context).ToLocalChecked(); + + DynamicImportData* data = + new DynamicImportData(isolate, resolver, context, true); + isolate->EnqueueMicrotask(DoHostImportModuleDynamically, data); + return resolver->GetPromise(); +} + +v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackReject( + Local<Context> context, Local<v8::ScriptOrModule> referrer, + Local<String> specifier) { + Isolate* isolate = context->GetIsolate(); + Local<v8::Promise::Resolver> resolver = + v8::Promise::Resolver::New(context).ToLocalChecked(); + + DynamicImportData* data = + new DynamicImportData(isolate, resolver, context, false); + isolate->EnqueueMicrotask(DoHostImportModuleDynamically, data); + return resolver->GetPromise(); +} + +} // namespace + +TEST(ModuleEvaluationTopLevelAwaitDynamicImport) { + bool previous_top_level_await_flag_value = i::FLAG_harmony_top_level_await; + bool previous_dynamic_import_flag_value = i::FLAG_harmony_dynamic_import; + i::FLAG_harmony_top_level_await = true; + i::FLAG_harmony_dynamic_import = true; Isolate* isolate = CcTest::isolate(); HandleScope scope(isolate); + isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit); + isolate->SetHostImportModuleDynamicallyCallback( + HostImportModuleDynamicallyCallbackResolve); LocalContext env; v8::TryCatch try_catch(isolate); + const char* sources[] = { + "await import('foo');", + "import 'await import(\"foo\");';", + "import '42'; import 'await import(\"foo\");';", + }; - Local<v8::Object> ReferenceError = - CompileRun("ReferenceError")->ToObject(env.local()).ToLocalChecked(); - - Local<String> source_text = v8_str( - "import {a, b} from 'export var a = 1; export let b = 2';" - "export function geta() {return a};" - "export function getb() {return b};" - "export let radio = 3;" - "export var gaga = 4;"); - ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - Local<Module> module = - ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - CHECK(module - ->InstantiateModule(env.local(), - CompileSpecifierAsModuleResolveCallback) - .FromJust()); - CHECK_EQ(Module::kInstantiated, module->GetStatus()); - Local<Value> ns = module->GetModuleNamespace(); - CHECK_EQ(Module::kInstantiated, module->GetStatus()); - Local<v8::Object> nsobj = ns->ToObject(env.local()).ToLocalChecked(); - - // a, b - CHECK(nsobj->Get(env.local(), v8_str("a")).ToLocalChecked()->IsUndefined()); - CHECK(nsobj->Get(env.local(), v8_str("b")).ToLocalChecked()->IsUndefined()); - - // geta - { - auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked(); - auto a = geta.As<v8::Function>() - ->Call(env.local(), geta, 0, nullptr) - .ToLocalChecked(); - CHECK(a->IsUndefined()); - } - - // getb - { - v8::TryCatch inner_try_catch(isolate); - auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked(); - CHECK( - getb.As<v8::Function>()->Call(env.local(), getb, 0, nullptr).IsEmpty()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception() - ->InstanceOf(env.local(), ReferenceError) + for (auto src : sources) { + Local<String> source_text = v8_str(src); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) .FromJust()); - } + CHECK_EQ(Module::kInstantiated, module->GetStatus()); - // radio - { - v8::TryCatch inner_try_catch(isolate); - // https://bugs.chromium.org/p/v8/issues/detail?id=7235 - // CHECK(nsobj->Get(env.local(), v8_str("radio")).IsEmpty()); - CHECK(nsobj->Get(env.local(), v8_str("radio")) - .ToLocalChecked() - ->IsUndefined()); - CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception() - ->InstanceOf(env.local(), ReferenceError) - .FromJust()); - } + Local<Promise> promise = + Local<Promise>::Cast(module->Evaluate(env.local()).ToLocalChecked()); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + CHECK_EQ(promise->State(), v8::Promise::kPending); + CHECK(!try_catch.HasCaught()); - // gaga - { - auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked(); - CHECK(gaga->IsUndefined()); + isolate->RunMicrotasks(); + CHECK_EQ(promise->State(), v8::Promise::kFulfilled); } + i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value; + i::FLAG_harmony_dynamic_import = previous_dynamic_import_flag_value; +} - CHECK(!try_catch.HasCaught()); - CHECK_EQ(Module::kInstantiated, module->GetStatus()); - module->Evaluate(env.local()).ToLocalChecked(); - CHECK_EQ(Module::kEvaluated, module->GetStatus()); - - // geta - { - auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked(); - auto a = geta.As<v8::Function>() - ->Call(env.local(), geta, 0, nullptr) - .ToLocalChecked(); - CHECK_EQ(1, a->Int32Value(env.local()).FromJust()); - } +TEST(ModuleEvaluationTopLevelAwaitDynamicImportError) { + bool previous_top_level_await_flag_value = i::FLAG_harmony_top_level_await; + bool previous_dynamic_import_flag_value = i::FLAG_harmony_dynamic_import; + i::FLAG_harmony_top_level_await = true; + i::FLAG_harmony_dynamic_import = true; + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit); + isolate->SetHostImportModuleDynamicallyCallback( + HostImportModuleDynamicallyCallbackReject); + LocalContext env; + v8::TryCatch try_catch(isolate); + const char* sources[] = { + "await import('foo');", + "import 'await import(\"foo\");';", + "import '42'; import 'await import(\"foo\");';", + }; - // getb - { - auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked(); - auto b = getb.As<v8::Function>() - ->Call(env.local(), getb, 0, nullptr) - .ToLocalChecked(); - CHECK_EQ(2, b->Int32Value(env.local()).FromJust()); - } + for (auto src : sources) { + Local<String> source_text = v8_str(src); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK(module + ->InstantiateModule(env.local(), + CompileSpecifierAsModuleResolveCallback) + .FromJust()); + CHECK_EQ(Module::kInstantiated, module->GetStatus()); - // radio - { - auto radio = nsobj->Get(env.local(), v8_str("radio")).ToLocalChecked(); - CHECK_EQ(3, radio->Int32Value(env.local()).FromJust()); - } + Local<Promise> promise = + Local<Promise>::Cast(module->Evaluate(env.local()).ToLocalChecked()); + CHECK_EQ(Module::kEvaluated, module->GetStatus()); + CHECK_EQ(promise->State(), v8::Promise::kPending); + CHECK(!try_catch.HasCaught()); - // gaga - { - auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked(); - CHECK_EQ(4, gaga->Int32Value(env.local()).FromJust()); + isolate->RunMicrotasks(); + CHECK_EQ(Module::kErrored, module->GetStatus()); + CHECK_EQ(promise->State(), v8::Promise::kRejected); + CHECK(promise->Result()->StrictEquals(v8_str("boom"))); + CHECK(module->GetException()->StrictEquals(v8_str("boom"))); + CHECK(!try_catch.HasCaught()); } - - CHECK(!try_catch.HasCaught()); + i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value; + i::FLAG_harmony_dynamic_import = previous_dynamic_import_flag_value; } + } // anonymous namespace diff --git a/deps/v8/test/cctest/test-orderedhashtable.cc b/deps/v8/test/cctest/test-orderedhashtable.cc index 44a845eb74..189f950b2e 100644 --- a/deps/v8/test/cctest/test-orderedhashtable.cc +++ b/deps/v8/test/cctest/test-orderedhashtable.cc @@ -1262,6 +1262,7 @@ TEST(OrderedHashMapHandlerInsertion) { Verify(isolate, map); CHECK(OrderedHashMapHandler::HasKey(isolate, map, key1)); CHECK(SmallOrderedHashMap::Is(map)); + for (int i = 0; i < 1024; i++) { Handle<Smi> key_i(Smi::FromInt(i), isolate); Handle<Smi> value_i(Smi::FromInt(i), isolate); @@ -1276,6 +1277,83 @@ TEST(OrderedHashMapHandlerInsertion) { CHECK(OrderedHashMap::Is(map)); } +TEST(OrderedHashSetHandlerDeletion) { + LocalContext context; + Isolate* isolate = GetIsolateFrom(&context); + HandleScope scope(isolate); + + Handle<HeapObject> set = + OrderedHashSetHandler::Allocate(isolate, 4).ToHandleChecked(); + Verify(isolate, set); + + // Add a new key. + Handle<Smi> key1(Smi::FromInt(1), isolate); + CHECK(!OrderedHashSetHandler::HasKey(isolate, set, key1)); + set = OrderedHashSetHandler::Add(isolate, set, key1).ToHandleChecked(); + Verify(isolate, set); + CHECK(OrderedHashSetHandler::HasKey(isolate, set, key1)); + + // Add existing key. + set = OrderedHashSetHandler::Add(isolate, set, key1).ToHandleChecked(); + Verify(isolate, set); + CHECK(OrderedHashSetHandler::HasKey(isolate, set, key1)); + CHECK(SmallOrderedHashSet::Is(set)); + + // Remove a non-existing key. + Handle<Smi> key2(Smi::FromInt(2), isolate); + OrderedHashSetHandler::Delete(isolate, set, key2); + Verify(isolate, set); + CHECK(OrderedHashSetHandler::HasKey(isolate, set, key1)); + CHECK(!OrderedHashSetHandler::HasKey(isolate, set, key2)); + CHECK(SmallOrderedHashSet::Is(set)); + + // Remove an existing key. + OrderedHashSetHandler::Delete(isolate, set, key1); + Verify(isolate, set); + CHECK(!OrderedHashSetHandler::HasKey(isolate, set, key1)); + CHECK(SmallOrderedHashSet::Is(set)); +} + +TEST(OrderedHashMapHandlerDeletion) { + LocalContext context; + Isolate* isolate = GetIsolateFrom(&context); + HandleScope scope(isolate); + + Handle<HeapObject> map = + OrderedHashMapHandler::Allocate(isolate, 4).ToHandleChecked(); + Verify(isolate, map); + + // Add a new key. + Handle<Smi> key1(Smi::FromInt(1), isolate); + Handle<Smi> value1(Smi::FromInt(1), isolate); + CHECK(!OrderedHashMapHandler::HasKey(isolate, map, key1)); + map = + OrderedHashMapHandler::Add(isolate, map, key1, value1).ToHandleChecked(); + Verify(isolate, map); + CHECK(OrderedHashMapHandler::HasKey(isolate, map, key1)); + + // Add existing key. + map = + OrderedHashMapHandler::Add(isolate, map, key1, value1).ToHandleChecked(); + Verify(isolate, map); + CHECK(OrderedHashMapHandler::HasKey(isolate, map, key1)); + CHECK(SmallOrderedHashMap::Is(map)); + + // Remove a non-existing key. + Handle<Smi> key2(Smi::FromInt(2), isolate); + OrderedHashMapHandler::Delete(isolate, map, key2); + Verify(isolate, map); + CHECK(OrderedHashMapHandler::HasKey(isolate, map, key1)); + CHECK(!OrderedHashMapHandler::HasKey(isolate, map, key2)); + CHECK(SmallOrderedHashMap::Is(map)); + + // Remove an existing key. + OrderedHashMapHandler::Delete(isolate, map, key1); + Verify(isolate, map); + CHECK(!OrderedHashMapHandler::HasKey(isolate, map, key1)); + CHECK(SmallOrderedHashMap::Is(map)); +} + TEST(OrderedNameDictionaryInsertion) { LocalContext context; Isolate* isolate = GetIsolateFrom(&context); @@ -1798,6 +1876,49 @@ TEST(OrderedNameDictionaryHandlerInsertion) { CHECK(table->IsOrderedNameDictionary()); } +TEST(OrderedNameDictionaryHandlerDeletion) { + LocalContext context; + Isolate* isolate = GetIsolateFrom(&context); + HandleScope scope(isolate); + + Handle<HeapObject> table = + OrderedNameDictionaryHandler::Allocate(isolate, 4).ToHandleChecked(); + CHECK(table->IsSmallOrderedNameDictionary()); + Verify(isolate, table); + + // Add a new key. + Handle<String> value = isolate->factory()->InternalizeUtf8String("bar"); + Handle<String> key = isolate->factory()->InternalizeUtf8String("foo"); + Handle<String> key2 = isolate->factory()->InternalizeUtf8String("foo2"); + PropertyDetails details = PropertyDetails::Empty(); + + table = OrderedNameDictionaryHandler::Add(isolate, table, key, value, details) + .ToHandleChecked(); + DCHECK(key->IsUniqueName()); + Verify(isolate, table); + CHECK(table->IsSmallOrderedNameDictionary()); + CHECK_NE(OrderedNameDictionaryHandler::kNotFound, + OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key)); + + // Remove a non-existing key. + OrderedNameDictionaryHandler::Delete(isolate, table, key2); + Verify(isolate, table); + CHECK(table->IsSmallOrderedNameDictionary()); + CHECK_EQ(OrderedNameDictionaryHandler::kNotFound, + OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key2)); + CHECK_NE(OrderedNameDictionaryHandler::kNotFound, + OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key)); + + // Remove an existing key. + OrderedNameDictionaryHandler::Delete(isolate, table, key); + Verify(isolate, table); + CHECK(table->IsSmallOrderedNameDictionary()); + CHECK_EQ(OrderedNameDictionaryHandler::kNotFound, + OrderedNameDictionaryHandler::FindEntry(isolate, *table, *key)); + + CHECK(table->IsSmallOrderedNameDictionary()); +} + TEST(OrderedNameDictionarySetEntry) { LocalContext context; Isolate* isolate = GetIsolateFrom(&context); diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 857bd7a454..18f15af477 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -1506,8 +1506,11 @@ TEST(DiscardFunctionBody) { fun = exp->AsObjectLiteral()->properties()->at(0)->value()-> AsFunctionLiteral(); } else { - fun = exp->AsClassLiteral()->properties()->at(0)->value()-> - AsFunctionLiteral(); + fun = exp->AsClassLiteral() + ->public_members() + ->at(0) + ->value() + ->AsFunctionLiteral(); } } CHECK(!fun->ShouldEagerCompile()); @@ -3608,6 +3611,14 @@ TEST(MaybeAssignedParameters) { "g(arg)}"}, {true, "function f(arg) {g(arg); eval('arguments[0] = 42'); g(arg)}"}, {true, "function f(arg) {g(arg); g(() => arguments[0] = 42); g(arg)}"}, + + // default values + {false, "function f({x:arg = 1}) {}"}, + {true, "function f({x:arg = 1}, {y:b=(arg=2)}) {}"}, + {true, "function f({x:arg = (arg = 2)}) {}"}, + {false, "var f = ({x:arg = 1}) => {}"}, + {true, "var f = ({x:arg = 1}, {y:b=(arg=2)}) => {}"}, + {true, "var f = ({x:arg = (arg = 2)}) => {}"}, }; const char* suffix = "; f"; @@ -5877,6 +5888,70 @@ TEST(PrivateMembersWrongAccessNoEarlyErrors) { private_methods, arraysize(private_methods)); } +TEST(PrivateStaticClassMethodsAndAccessorsNoErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + "static #a() { }", + "static get #a() { }", + "static set #a(val) { }", + "static get #a() { } static set #a(val) { }", + "static *#a() { }", + "static async #a() { }", + "static async *#a() { }", + nullptr + }; + // clang-format on + + RunParserSyncTest(context_data, class_body_data, kError); + + static const ParserFlag private_methods[] = {kAllowHarmonyPrivateMethods}; + RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0, + private_methods, arraysize(private_methods)); +} + +TEST(PrivateStaticClassMethodsAndAccessorsDuplicateErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + "static get #a() {} static get #a() {}", + "static get #a() {} static #a() {}", + "static get #a() {} get #a() {}", + "static get #a() {} set #a(val) {}", + "static get #a() {} #a() {}", + + "static set #a(val) {} static set #a(val) {}", + "static set #a(val) {} static #a() {}", + "static set #a(val) {} get #a() {}", + "static set #a(val) {} set #a(val) {}", + "static set #a(val) {} #a() {}", + + "static #a() {} static #a() {}", + "static #a() {} #a(val) {}", + "static #a() {} set #a(val) {}", + "static #a() {} get #a() {}", + + nullptr + }; + // clang-format on + + RunParserSyncTest(context_data, class_body_data, kError); + + static const ParserFlag private_methods[] = {kAllowHarmonyPrivateMethods}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + private_methods, arraysize(private_methods)); +} + TEST(PrivateClassFieldsNoErrors) { // clang-format off // Tests proposed class fields syntax. @@ -6216,14 +6291,6 @@ TEST(PrivateStaticClassFieldsErrors) { "#a; static #a", "static #a; #a", - // TODO(joyee): support static private methods - "static #a() { }", - "static get #a() { }", - "static set #a() { }", - "static *#a() { }", - "static async #a() { }", - "static async *#a() { }", - // ASI "static #['a'] = 0\n", "static #['a'] = 0\n b", diff --git a/deps/v8/test/cctest/test-poison-disasm-arm.cc b/deps/v8/test/cctest/test-poison-disasm-arm.cc index 3410e5487d..dd54bf28bc 100644 --- a/deps/v8/test/cctest/test-poison-disasm-arm.cc +++ b/deps/v8/test/cctest/test-poison-disasm-arm.cc @@ -24,6 +24,8 @@ const std::string kPReg = // NOLINT(runtime/string) TEST(DisasmPoisonMonomorphicLoad) { #ifdef ENABLE_DISASSEMBLER if (i::FLAG_always_opt || !i::FLAG_opt) return; + // TODO(9684): Re-enable for TurboProp if necessary. + if (i::FLAG_turboprop) return; i::FLAG_allow_natives_syntax = true; i::FLAG_untrusted_code_mitigations = true; @@ -58,6 +60,8 @@ TEST(DisasmPoisonMonomorphicLoad) { TEST(DisasmPoisonPolymorphicLoad) { #ifdef ENABLE_DISASSEMBLER if (i::FLAG_always_opt || !i::FLAG_opt) return; + // TODO(9684): Re-enable for TurboProp if necessary. + if (i::FLAG_turboprop) return; i::FLAG_allow_natives_syntax = true; i::FLAG_untrusted_code_mitigations = true; @@ -101,7 +105,7 @@ TEST(DisasmPoisonPolymorphicLoad) { "csdb", // spec. barrier "ldr <<BSt:r[0-9]+>>, \\[<<Obj>>, #\\+[0-9]+\\]", // load backing store "and <<BSt>>, <<BSt>>, " + kPReg, // apply the poison - "ldr <<Prop:r[0-9]+>>, \\[<<Obj>>, #\\+[0-9]+\\]", // load the property + "ldr <<Prop:r[0-9]+>>, \\[<<BSt>>, #\\+[0-9]+\\]", // load the property "and <<Prop>>, <<Prop>>, " + kPReg, // apply the poison // Ldone: }; @@ -109,5 +113,43 @@ TEST(DisasmPoisonPolymorphicLoad) { #endif // ENABLE_DISASSEMBLER } +TEST(DisasmPoisonMonomorphicLoadFloat64) { +#ifdef ENABLE_DISASSEMBLER + if (i::FLAG_always_opt || !i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + i::FLAG_untrusted_code_mitigations = true; + + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + + CompileRun( + "function mono(o) { return o.x; }" + "%PrepareFunctionForOptimization(mono);" + "mono({ x : 1.1 });" + "mono({ x : 1.1 });" + "%OptimizeFunctionOnNextCall(mono);" + "mono({ x : 1.1 });"); + + // Matches that the property access sequence is instrumented with + // poisoning. + std::vector<std::string> patterns_array = { + "ldr <<Map:r[0-9]+>>, \\[<<Obj:r[0-9]+>>, #-1\\]", // load map + "ldr <<ExpMap:r[0-9]+>>, \\[pc, #", // load expected map + "cmp <<Map>>, <<ExpMap>>", // compare maps + "bne", // deopt if different + "eorne " + kPReg + ", " + kPReg + ", " + kPReg, // update the poison + "csdb", // spec. barrier + "ldr <<Field:r[0-9]+>>, \\[<<Obj>>, #\\+[0-9]+\\]", // load the field + "and <<Field>>, <<Field>>, " + kPReg, // apply the poison + "mov <<Mov:r[0-9]+>>, #[0-9]+", // addr. calculation + "add ip, <<Field>>, <<Mov>>", // addr. calculation + "and ip, ip, " + kPReg, // apply the poison + "vldr d[0-9]+, \\[ip", // load Float64 + }; + CHECK(CheckDisassemblyRegexPatterns("mono", patterns_array)); +#endif // ENABLE_DISASSEMBLER +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-poison-disasm-arm64.cc b/deps/v8/test/cctest/test-poison-disasm-arm64.cc index a428ce7b89..32f4315e3a 100644 --- a/deps/v8/test/cctest/test-poison-disasm-arm64.cc +++ b/deps/v8/test/cctest/test-poison-disasm-arm64.cc @@ -24,6 +24,8 @@ const std::string kPReg = // NOLINT(runtime/string) TEST(DisasmPoisonMonomorphicLoad) { #ifdef ENABLE_DISASSEMBLER if (i::FLAG_always_opt || !i::FLAG_opt) return; + // TODO(9684): Re-enable for TurboProp if necessary. + if (i::FLAG_turboprop) return; i::FLAG_allow_natives_syntax = true; i::FLAG_untrusted_code_mitigations = true; @@ -49,7 +51,7 @@ TEST(DisasmPoisonMonomorphicLoad) { "b.ne", // deopt if different "csel " + kPReg + ", xzr, " + kPReg + ", ne", // update the poison "csdb", // spec. barrier - "ldursw x<<Field:[0-9]+>>, \\[<<Obj>>, #[0-9]+\\]", // load the field + "ldur w<<Field:[0-9]+>>, \\[<<Obj>>, #[0-9]+\\]", // load the field "and x<<Field>>, x<<Field>>, " + kPReg, // apply the poison }; #else @@ -71,6 +73,8 @@ TEST(DisasmPoisonMonomorphicLoad) { TEST(DisasmPoisonPolymorphicLoad) { #ifdef ENABLE_DISASSEMBLER if (i::FLAG_always_opt || !i::FLAG_opt) return; + // TODO(9684): Re-enable for TurboProp if necessary. + if (i::FLAG_turboprop) return; i::FLAG_allow_natives_syntax = true; i::FLAG_untrusted_code_mitigations = true; @@ -113,7 +117,7 @@ TEST(DisasmPoisonPolymorphicLoad) { // Lcase1: "csel " + kPReg + ", xzr, " + kPReg + ", ne", // update the poison "csdb", // spec. barrier - "ldursw x<<BSt:[0-9]+>>, \\[<<Obj>>, #[0-9]+\\]", // load backing store + "ldur w<<BSt:[0-9]+>>, \\[<<Obj>>, #[0-9]+\\]", // load backing store // branchful decompress "add x<<BSt>>, x26, x<<BSt>>", // Add root to ref "and x<<BSt>>, x<<BSt>>, " + kPReg, // apply the poison @@ -135,9 +139,13 @@ TEST(DisasmPoisonPolymorphicLoad) { "b.ne", // deopt if different "csel " + kPReg + ", xzr, " + kPReg + ", ne", // update the poison "csdb", // spec. barrier - "ldur <<Field:x[0-9]+>>, \\[<<Obj>>, #[0-9]+\\]", // load the field - "and <<Field>>, <<Field>>, " + kPReg, // apply the poison - "asr x[0-9]+, <<Field>>, #32", // untag + "ldur x<<Field:[0-9]+>>, \\[<<Obj>>, #[0-9]+\\]", // load the field + "and x<<Field>>, x<<Field>>, " + kPReg, // apply the poison +#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH + "asr w<<Field>>, w<<Field>>, #1", // untag +#else + "asr x[0-9]+, x<<Field>>, #32", // untag +#endif "b", // goto merge point // Lcase1: "csel " + kPReg + ", xzr, " + kPReg + ", ne", // update the poison @@ -153,5 +161,65 @@ TEST(DisasmPoisonPolymorphicLoad) { #endif // ENABLE_DISASSEMBLER } +TEST(DisasmPoisonMonomorphicLoadFloat64) { +#ifdef ENABLE_DISASSEMBLER + if (i::FLAG_always_opt || !i::FLAG_opt) return; + // TODO(9684): Re-enable for TurboProp if necessary. + if (i::FLAG_turboprop) return; + + i::FLAG_allow_natives_syntax = true; + i::FLAG_untrusted_code_mitigations = true; + + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + + CompileRun( + "function mono(o) { return o.x; }" + "%PrepareFunctionForOptimization(mono);" + "mono({ x : 1.1 });" + "mono({ x : 1.1 });" + "%OptimizeFunctionOnNextCall(mono);" + "mono({ x : 1.1 });"); + + // Matches that the property access sequence is instrumented with + // poisoning. +#if defined(V8_COMPRESS_POINTERS) + std::vector<std::string> patterns_array = { + "ldur <<Map:w[0-9]+>>, \\[<<Obj:x[0-9]+>>, #-1\\]", // load map + "ldr <<ExpMap:w[0-9]+>>, pc", // load expected map + "cmp <<Map>>, <<ExpMap>>", // compare maps + "b.ne", // deopt if differ + "csel " + kPReg + ", xzr, " + kPReg + ", ne", // update the poison + "csdb", // spec. barrier + "ldur w<<F1:[0-9]+>>, \\[<<Obj>>, #11\\]", // load heap number + "add x<<F1>>, x26, x<<F1>>", // Decompress ref + "and x<<F1>>, x<<F1>>, " + kPReg, // apply the poison + "add <<Addr:x[0-9]+>>, x<<F1>>, #0x[0-9a-f]+", // addr. calculation + "and <<Addr>>, <<Addr>>, " + kPReg, // apply the poison + "ldr d[0-9]+, \\[<<Addr>>\\]", // load Float64 + }; +#else + std::vector<std::string> patterns_array = { + "ldur <<Map:x[0-9]+>>, \\[<<Obj:x[0-9]+>>, #-1\\]", // load map + "ldr <<ExpMap:x[0-9]+>>, pc", // load expected map + "cmp <<Map>>, <<ExpMap>>", // compare maps + "b.ne", // deopt if differ + "csel " + kPReg + ", xzr, " + kPReg + ", ne", // update the poison + "csdb", // spec. barrier +#if V8_DOUBLE_FIELDS_UNBOXING + "add <<Addr:x[0-9]+>>, <<Obj>>, #0x[0-9a-f]+", // addr. calculation +#else + "ldur <<F1:x[0-9]+>>, \\[<<Obj>>, #23\\]", // load heap number + "and <<F1>>, <<F1>>, " + kPReg, // apply the poison + "add <<Addr:x[0-9]+>>, <<F1>>, #0x7", // addr. calculation +#endif + "and <<Addr>>, <<Addr>>, " + kPReg, // apply the poison + "ldr d[0-9]+, \\[<<Addr>>\\]", // load Float64 + }; +#endif + CHECK(CheckDisassemblyRegexPatterns("mono", patterns_array)); +#endif // ENABLE_DISASSEMBLER +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc index ccebabec30..5cfc4df2a3 100644 --- a/deps/v8/test/cctest/test-profile-generator.cc +++ b/deps/v8/test/cctest/test-profile-generator.cc @@ -674,13 +674,12 @@ static const char* line_number_test_source_profile_time_functions = "bar_at_the_second_line();\n" "function lazy_func_at_6th_line() {}"; -int GetFunctionLineNumber(CpuProfiler& profiler, // NOLINT(runtime/references) - LocalContext& env, // NOLINT(runtime/references) +int GetFunctionLineNumber(CpuProfiler* profiler, LocalContext* env, const char* name) { - CodeMap* code_map = profiler.generator()->code_map(); + CodeMap* code_map = profiler->generator()->code_map(); i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global()->Get(env.local(), v8_str(name)).ToLocalChecked()))); + (*env)->Global()->Get(env->local(), v8_str(name)).ToLocalChecked()))); CodeEntry* func_entry = code_map->FindEntry(func->abstract_code().InstructionStart()); if (!func_entry) FATAL("%s", name); @@ -705,12 +704,12 @@ TEST(LineNumber) { profiler.processor()->StopSynchronously(); bool is_lazy = i::FLAG_lazy; - CHECK_EQ(1, GetFunctionLineNumber(profiler, env, "foo_at_the_first_line")); + CHECK_EQ(1, GetFunctionLineNumber(&profiler, &env, "foo_at_the_first_line")); CHECK_EQ(is_lazy ? 0 : 4, - GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line")); - CHECK_EQ(2, GetFunctionLineNumber(profiler, env, "bar_at_the_second_line")); + GetFunctionLineNumber(&profiler, &env, "lazy_func_at_forth_line")); + CHECK_EQ(2, GetFunctionLineNumber(&profiler, &env, "bar_at_the_second_line")); CHECK_EQ(is_lazy ? 0 : 6, - GetFunctionLineNumber(profiler, env, "lazy_func_at_6th_line")); + GetFunctionLineNumber(&profiler, &env, "lazy_func_at_6th_line")); profiler.StopProfiling("LineNumber"); } diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index 1374673c61..95e752bece 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -38,6 +38,7 @@ #include "src/objects/js-regexp-inl.h" #include "src/objects/objects-inl.h" #include "src/regexp/regexp-bytecode-generator.h" +#include "src/regexp/regexp-bytecodes.h" #include "src/regexp/regexp-compiler.h" #include "src/regexp/regexp-interpreter.h" #include "src/regexp/regexp-macro-assembler-arch.h" @@ -1744,19 +1745,6 @@ TEST(UseCountRegExp) { CHECK_EQ(2, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); CHECK(resultToStringError->IsObject()); - - // Increment a UseCounter when .matchAll() is used with a non-global - // regular expression. - CHECK_EQ(0, use_counts[v8::Isolate::kRegExpMatchAllWithNonGlobalRegExp]); - v8::Local<v8::Value> resultReMatchAllNonGlobal = - CompileRun("'a'.matchAll(/./)"); - CHECK_EQ(1, use_counts[v8::Isolate::kRegExpMatchAllWithNonGlobalRegExp]); - CHECK(resultReMatchAllNonGlobal->IsObject()); - // Don't increment the counter for global regular expressions. - v8::Local<v8::Value> resultReMatchAllGlobal = - CompileRun("'a'.matchAll(/./g)"); - CHECK_EQ(1, use_counts[v8::Isolate::kRegExpMatchAllWithNonGlobalRegExp]); - CHECK(resultReMatchAllGlobal->IsObject()); } class UncachedExternalString @@ -1783,6 +1771,567 @@ TEST(UncachedExternalString) { ExpectString("external.substring(1).match(re)[1]", "z"); } +// Test bytecode peephole optimization + +void CreatePeepholeNoChangeBytecode(RegExpMacroAssembler* m) { + Label fail, backtrack; + m->PushBacktrack(&fail); + m->CheckNotAtStart(0, nullptr); + m->LoadCurrentCharacter(2, nullptr); + m->CheckNotCharacter('o', nullptr); + m->LoadCurrentCharacter(1, nullptr, false); + m->CheckNotCharacter('o', nullptr); + m->LoadCurrentCharacter(0, nullptr, false); + m->CheckNotCharacter('f', nullptr); + m->WriteCurrentPositionToRegister(0, 0); + m->WriteCurrentPositionToRegister(1, 3); + m->AdvanceCurrentPosition(3); + m->PushBacktrack(&backtrack); + m->Succeed(); + m->Bind(&backtrack); + m->Backtrack(); + m->Bind(&fail); + m->Fail(); +} + +TEST(PeepholeNoChange) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeNoChangeBytecode(&orig); + CreatePeepholeNoChangeBytecode(&opt); + + Handle<String> source = factory->NewStringFromStaticChars("^foo"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + byte* byte_array = array->GetDataStartAddress(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + byte* byte_array_optimized = array_optimized->GetDataStartAddress(); + + CHECK_EQ(0, memcmp(byte_array, byte_array_optimized, length)); +} + +void CreatePeepholeSkipUntilCharBytecode(RegExpMacroAssembler* m) { + Label start; + m->Bind(&start); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckCharacter('x', nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&start); +} + +TEST(PeepholeSkipUntilChar) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeSkipUntilCharBytecode(&orig); + CreatePeepholeSkipUntilCharBytecode(&opt); + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + int length_optimized = array_optimized->length(); + + int length_expected = RegExpBytecodeLength(BC_LOAD_CURRENT_CHAR) + + RegExpBytecodeLength(BC_CHECK_CHAR) + + RegExpBytecodeLength(BC_ADVANCE_CP_AND_GOTO) + + RegExpBytecodeLength(BC_POP_BT); + int length_optimized_expected = RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR) + + RegExpBytecodeLength(BC_POP_BT); + + CHECK_EQ(length, length_expected); + CHECK_EQ(length_optimized, length_optimized_expected); + + CHECK_EQ(BC_SKIP_UNTIL_CHAR, array_optimized->get(0)); + CHECK_EQ(BC_POP_BT, + array_optimized->get(RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR))); +} + +void CreatePeepholeSkipUntilBitInTableBytecode(RegExpMacroAssembler* m, + Factory* factory) { + Handle<ByteArray> bit_table = factory->NewByteArray( + RegExpMacroAssembler::kTableSize, AllocationType::kOld); + for (uint32_t i = 0; i < RegExpMacroAssembler::kTableSize; i++) { + bit_table->set(i, 0); + } + + Label start; + m->Bind(&start); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckBitInTable(bit_table, nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&start); +} + +TEST(PeepholeSkipUntilBitInTable) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeSkipUntilBitInTableBytecode(&orig, factory); + CreatePeepholeSkipUntilBitInTableBytecode(&opt, factory); + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + int length_optimized = array_optimized->length(); + + int length_expected = RegExpBytecodeLength(BC_LOAD_CURRENT_CHAR) + + RegExpBytecodeLength(BC_CHECK_BIT_IN_TABLE) + + RegExpBytecodeLength(BC_ADVANCE_CP_AND_GOTO) + + RegExpBytecodeLength(BC_POP_BT); + int length_optimized_expected = + RegExpBytecodeLength(BC_SKIP_UNTIL_BIT_IN_TABLE) + + RegExpBytecodeLength(BC_POP_BT); + + CHECK_EQ(length, length_expected); + CHECK_EQ(length_optimized, length_optimized_expected); + + CHECK_EQ(BC_SKIP_UNTIL_BIT_IN_TABLE, array_optimized->get(0)); + CHECK_EQ(BC_POP_BT, array_optimized->get( + RegExpBytecodeLength(BC_SKIP_UNTIL_BIT_IN_TABLE))); +} + +void CreatePeepholeSkipUntilCharPosCheckedBytecode(RegExpMacroAssembler* m) { + Label start; + m->Bind(&start); + m->LoadCurrentCharacter(0, nullptr, true, 1, 2); + m->CheckCharacter('x', nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&start); +} + +TEST(PeepholeSkipUntilCharPosChecked) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeSkipUntilCharPosCheckedBytecode(&orig); + CreatePeepholeSkipUntilCharPosCheckedBytecode(&opt); + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + int length_optimized = array_optimized->length(); + + int length_expected = RegExpBytecodeLength(BC_CHECK_CURRENT_POSITION) + + RegExpBytecodeLength(BC_LOAD_CURRENT_CHAR_UNCHECKED) + + RegExpBytecodeLength(BC_CHECK_CHAR) + + RegExpBytecodeLength(BC_ADVANCE_CP_AND_GOTO) + + RegExpBytecodeLength(BC_POP_BT); + int length_optimized_expected = + RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR_POS_CHECKED) + + RegExpBytecodeLength(BC_POP_BT); + + CHECK_EQ(length, length_expected); + CHECK_EQ(length_optimized, length_optimized_expected); + + CHECK_EQ(BC_SKIP_UNTIL_CHAR_POS_CHECKED, array_optimized->get(0)); + CHECK_EQ(BC_POP_BT, array_optimized->get(RegExpBytecodeLength( + BC_SKIP_UNTIL_CHAR_POS_CHECKED))); +} + +void CreatePeepholeSkipUntilCharAndBytecode(RegExpMacroAssembler* m) { + Label start; + m->Bind(&start); + m->LoadCurrentCharacter(0, nullptr, true, 1, 2); + m->CheckCharacterAfterAnd('x', 0xFF, nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&start); +} + +TEST(PeepholeSkipUntilCharAnd) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeSkipUntilCharAndBytecode(&orig); + CreatePeepholeSkipUntilCharAndBytecode(&opt); + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + int length_optimized = array_optimized->length(); + + int length_expected = RegExpBytecodeLength(BC_CHECK_CURRENT_POSITION) + + RegExpBytecodeLength(BC_LOAD_CURRENT_CHAR_UNCHECKED) + + RegExpBytecodeLength(BC_AND_CHECK_CHAR) + + RegExpBytecodeLength(BC_ADVANCE_CP_AND_GOTO) + + RegExpBytecodeLength(BC_POP_BT); + int length_optimized_expected = RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR_AND) + + RegExpBytecodeLength(BC_POP_BT); + + CHECK_EQ(length, length_expected); + CHECK_EQ(length_optimized, length_optimized_expected); + + CHECK_EQ(BC_SKIP_UNTIL_CHAR_AND, array_optimized->get(0)); + CHECK_EQ(BC_POP_BT, + array_optimized->get(RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR_AND))); +} + +void CreatePeepholeSkipUntilCharOrCharBytecode(RegExpMacroAssembler* m) { + Label start; + m->Bind(&start); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckCharacter('x', nullptr); + m->CheckCharacter('y', nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&start); +} + +TEST(PeepholeSkipUntilCharOrChar) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeSkipUntilCharOrCharBytecode(&orig); + CreatePeepholeSkipUntilCharOrCharBytecode(&opt); + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + int length_optimized = array_optimized->length(); + + int length_expected = RegExpBytecodeLength(BC_LOAD_CURRENT_CHAR) + + RegExpBytecodeLength(BC_CHECK_CHAR) + + RegExpBytecodeLength(BC_CHECK_CHAR) + + RegExpBytecodeLength(BC_ADVANCE_CP_AND_GOTO) + + RegExpBytecodeLength(BC_POP_BT); + int length_optimized_expected = + RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR_OR_CHAR) + + RegExpBytecodeLength(BC_POP_BT); + + CHECK_EQ(length, length_expected); + CHECK_EQ(length_optimized, length_optimized_expected); + + CHECK_EQ(BC_SKIP_UNTIL_CHAR_OR_CHAR, array_optimized->get(0)); + CHECK_EQ(BC_POP_BT, array_optimized->get( + RegExpBytecodeLength(BC_SKIP_UNTIL_CHAR_OR_CHAR))); +} + +void CreatePeepholeSkipUntilGtOrNotBitInTableBytecode(RegExpMacroAssembler* m, + Factory* factory) { + Handle<ByteArray> bit_table = factory->NewByteArray( + RegExpMacroAssembler::kTableSize, AllocationType::kOld); + for (uint32_t i = 0; i < RegExpMacroAssembler::kTableSize; i++) { + bit_table->set(i, 0); + } + + Label start, end, advance; + m->Bind(&start); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckCharacterGT('x', nullptr); + m->CheckBitInTable(bit_table, &advance); + m->GoTo(&end); + m->Bind(&advance); + m->AdvanceCurrentPosition(1); + m->GoTo(&start); + m->Bind(&end); +} + +TEST(PeepholeSkipUntilGtOrNotBitInTable) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + CreatePeepholeSkipUntilGtOrNotBitInTableBytecode(&orig, factory); + CreatePeepholeSkipUntilGtOrNotBitInTableBytecode(&opt, factory); + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + int length = array->length(); + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + int length_optimized = array_optimized->length(); + + int length_expected = RegExpBytecodeLength(BC_LOAD_CURRENT_CHAR) + + RegExpBytecodeLength(BC_CHECK_GT) + + RegExpBytecodeLength(BC_CHECK_BIT_IN_TABLE) + + RegExpBytecodeLength(BC_GOTO) + + RegExpBytecodeLength(BC_ADVANCE_CP_AND_GOTO) + + RegExpBytecodeLength(BC_POP_BT); + int length_optimized_expected = + RegExpBytecodeLength(BC_SKIP_UNTIL_GT_OR_NOT_BIT_IN_TABLE) + + RegExpBytecodeLength(BC_POP_BT); + + CHECK_EQ(length, length_expected); + CHECK_EQ(length_optimized, length_optimized_expected); + + CHECK_EQ(BC_SKIP_UNTIL_GT_OR_NOT_BIT_IN_TABLE, array_optimized->get(0)); + CHECK_EQ(BC_POP_BT, array_optimized->get(RegExpBytecodeLength( + BC_SKIP_UNTIL_GT_OR_NOT_BIT_IN_TABLE))); +} + +void CreatePeepholeLabelFixupsInsideBytecode(RegExpMacroAssembler* m, + Label* dummy_before, + Label* dummy_after, + Label* dummy_inside) { + Label loop; + m->Bind(dummy_before); + m->LoadCurrentCharacter(0, dummy_before); + m->CheckCharacter('a', dummy_after); + m->CheckCharacter('b', dummy_inside); + m->Bind(&loop); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckCharacter('x', nullptr); + m->Bind(dummy_inside); + m->CheckCharacter('y', nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&loop); + m->Bind(dummy_after); + m->LoadCurrentCharacter(0, dummy_before); + m->CheckCharacter('a', dummy_after); + m->CheckCharacter('b', dummy_inside); +} + +TEST(PeepholeLabelFixupsInside) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + { + Label dummy_before, dummy_after, dummy_inside; + CreatePeepholeLabelFixupsInsideBytecode(&opt, &dummy_before, &dummy_after, + &dummy_inside); + } + Label dummy_before, dummy_after, dummy_inside; + CreatePeepholeLabelFixupsInsideBytecode(&orig, &dummy_before, &dummy_after, + &dummy_inside); + + CHECK_EQ(0x00, dummy_before.pos()); + CHECK_EQ(0x28, dummy_inside.pos()); + CHECK_EQ(0x38, dummy_after.pos()); + + const Label* labels[] = {&dummy_before, &dummy_after, &dummy_inside}; + const int label_positions[4][3] = { + {0x04, 0x3C}, // dummy_before + {0x0C, 0x44}, // dummy after + {0x14, 0x4C} // dummy inside + }; + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + + for (int label_idx = 0; label_idx < 3; label_idx++) { + for (int pos_idx = 0; pos_idx < 2; pos_idx++) { + CHECK_EQ(labels[label_idx]->pos(), + array->get(label_positions[label_idx][pos_idx])); + } + } + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + + const int pos_fixups[] = { + 0, // Position before optimization should be unchanged. + 4, // Position after first replacement should be 4 (optimized size (20) - + // original size (32) + preserve length (16)). + }; + const int target_fixups[] = { + 0, // dummy_before should be unchanged + 4, // dummy_inside should be 4 + 4 // dummy_after should be 4 + }; + + for (int label_idx = 0; label_idx < 3; label_idx++) { + for (int pos_idx = 0; pos_idx < 2; pos_idx++) { + int label_pos = label_positions[label_idx][pos_idx] + pos_fixups[pos_idx]; + int jump_address = *reinterpret_cast<uint32_t*>( + array_optimized->GetDataStartAddress() + label_pos); + int expected_jump_address = + labels[label_idx]->pos() + target_fixups[label_idx]; + CHECK_EQ(expected_jump_address, jump_address); + } + } +} + +void CreatePeepholeLabelFixupsComplexBytecode(RegExpMacroAssembler* m, + Label* dummy_before, + Label* dummy_between, + Label* dummy_after, + Label* dummy_inside) { + Label loop1, loop2; + m->Bind(dummy_before); + m->LoadCurrentCharacter(0, dummy_before); + m->CheckCharacter('a', dummy_between); + m->CheckCharacter('b', dummy_after); + m->CheckCharacter('c', dummy_inside); + m->Bind(&loop1); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckCharacter('x', nullptr); + m->CheckCharacter('y', nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&loop1); + m->Bind(dummy_between); + m->LoadCurrentCharacter(0, dummy_before); + m->CheckCharacter('a', dummy_between); + m->CheckCharacter('b', dummy_after); + m->CheckCharacter('c', dummy_inside); + m->Bind(&loop2); + m->LoadCurrentCharacter(0, nullptr, true); + m->CheckCharacter('x', nullptr); + m->Bind(dummy_inside); + m->CheckCharacter('y', nullptr); + m->AdvanceCurrentPosition(1); + m->GoTo(&loop2); + m->Bind(dummy_after); + m->LoadCurrentCharacter(0, dummy_before); + m->CheckCharacter('a', dummy_between); + m->CheckCharacter('b', dummy_after); + m->CheckCharacter('c', dummy_inside); +} + +TEST(PeepholeLabelFixupsComplex) { + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + Isolate* isolate = CcTest::i_isolate(); + Factory* factory = isolate->factory(); + HandleScope scope(isolate); + + RegExpBytecodeGenerator orig(CcTest::i_isolate(), &zone); + RegExpBytecodeGenerator opt(CcTest::i_isolate(), &zone); + + { + Label dummy_before, dummy_between, dummy_after, dummy_inside; + CreatePeepholeLabelFixupsComplexBytecode( + &opt, &dummy_before, &dummy_between, &dummy_after, &dummy_inside); + } + Label dummy_before, dummy_between, dummy_after, dummy_inside; + CreatePeepholeLabelFixupsComplexBytecode(&orig, &dummy_before, &dummy_between, + &dummy_after, &dummy_inside); + + CHECK_EQ(0x00, dummy_before.pos()); + CHECK_EQ(0x40, dummy_between.pos()); + CHECK_EQ(0x70, dummy_inside.pos()); + CHECK_EQ(0x80, dummy_after.pos()); + + const Label* labels[] = {&dummy_before, &dummy_between, &dummy_after, + &dummy_inside}; + const int label_positions[4][3] = { + {0x04, 0x44, 0x84}, // dummy_before + {0x0C, 0x4C, 0x8C}, // dummy between + {0x14, 0x54, 0x94}, // dummy after + {0x1C, 0x5C, 0x9C} // dummy inside + }; + + Handle<String> source = factory->NewStringFromStaticChars("dummy"); + + i::FLAG_regexp_peephole_optimization = false; + Handle<ByteArray> array = Handle<ByteArray>::cast(orig.GetCode(source)); + + for (int label_idx = 0; label_idx < 4; label_idx++) { + for (int pos_idx = 0; pos_idx < 3; pos_idx++) { + CHECK_EQ(labels[label_idx]->pos(), + array->get(label_positions[label_idx][pos_idx])); + } + } + + i::FLAG_regexp_peephole_optimization = true; + Handle<ByteArray> array_optimized = + Handle<ByteArray>::cast(opt.GetCode(source)); + + const int pos_fixups[] = { + 0, // Position before optimization should be unchanged. + -12, // Position after first replacement should be -12 (optimized size = + // 20 - 32 = original size). + -8 // Position after second replacement should be -8 (-12 from first + // optimization -12 from second optimization + 16 preserved + // bytecodes). + }; + const int target_fixups[] = { + 0, // dummy_before should be unchanged + -12, // dummy_between should be -12 + -8, // dummy_inside should be -8 + -8 // dummy_after should be -8 + }; + + for (int label_idx = 0; label_idx < 4; label_idx++) { + for (int pos_idx = 0; pos_idx < 3; pos_idx++) { + int label_pos = label_positions[label_idx][pos_idx] + pos_fixups[pos_idx]; + int jump_address = *reinterpret_cast<uint32_t*>( + array_optimized->GetDataStartAddress() + label_pos); + int expected_jump_address = + labels[label_idx]->pos() + target_fixups[label_idx]; + CHECK_EQ(expected_jump_address, jump_address); + } + } +} + #undef CHECK_PARSE_ERROR #undef CHECK_SIMPLE #undef CHECK_MIN_MAX diff --git a/deps/v8/test/cctest/test-roots.cc b/deps/v8/test/cctest/test-roots.cc index d041903639..f3d1a56543 100644 --- a/deps/v8/test/cctest/test-roots.cc +++ b/deps/v8/test/cctest/test-roots.cc @@ -46,8 +46,8 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) { V(detached_contexts) \ V(dirty_js_finalization_groups) \ V(feedback_vectors_for_profiling_tools) \ + V(shared_wasm_memories) \ V(materialized_objects) \ - V(noscript_shared_function_infos) \ V(public_symbol_table) \ V(retained_maps) \ V(retaining_path_targets) \ diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index 407437c4b1..e2ab996796 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -98,8 +98,7 @@ class TestSerializer { return v8_isolate; } - static v8::Isolate* NewIsolateFromBlob( - StartupBlobs& blobs) { // NOLINT(runtime/references) + static v8::Isolate* NewIsolateFromBlob(const StartupBlobs& blobs) { SnapshotData startup_snapshot(blobs.startup); SnapshotData read_only_snapshot(blobs.read_only); ReadOnlyDeserializer read_only_deserializer(&read_only_snapshot); @@ -204,8 +203,7 @@ Vector<const uint8_t> ConstructSource(Vector<const uint8_t> head, source_length); } -static v8::Isolate* Deserialize( - StartupBlobs& blobs) { // NOLINT(runtime/references) +static v8::Isolate* Deserialize(const StartupBlobs& blobs) { v8::Isolate* isolate = TestSerializer::NewIsolateFromBlob(blobs); CHECK(isolate); return isolate; @@ -1522,7 +1520,8 @@ TEST(CodeSerializerWithProfiler) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -1563,7 +1562,8 @@ TEST(CodeSerializerWithProfiler) { void TestCodeSerializerOnePlusOneImpl(bool verify_builtins_count = true) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -1676,7 +1676,8 @@ TEST(CodeSerializerPromotedToCompilationCache) { TEST(CodeSerializerInternalizedString) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -1734,7 +1735,8 @@ TEST(CodeSerializerInternalizedString) { TEST(CodeSerializerLargeCodeObject) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -1793,7 +1795,8 @@ TEST(CodeSerializerLargeCodeObjectWithIncrementalMarking) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -1863,7 +1866,8 @@ TEST(CodeSerializerLargeStrings) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); Factory* f = isolate->factory(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -1919,7 +1923,8 @@ TEST(CodeSerializerThreeBigStrings) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); Factory* f = isolate->factory(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -2038,7 +2043,8 @@ class SerializerTwoByteResource : public v8::String::ExternalStringResource { TEST(CodeSerializerExternalString) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); @@ -2104,7 +2110,8 @@ TEST(CodeSerializerExternalString) { TEST(CodeSerializerLargeExternalString) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. Factory* f = isolate->factory(); @@ -2164,7 +2171,8 @@ TEST(CodeSerializerLargeExternalString) { TEST(CodeSerializerExternalScriptName) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. Factory* f = isolate->factory(); @@ -3606,13 +3614,13 @@ UNINITIALIZED_TEST(SnapshotCreatorIncludeGlobalProxy) { // We can introduce new extensions, which could override functions already // in the snapshot. auto extension = - base::make_unique<v8::Extension>("new extension", - "function i() { return 24; }" - "function j() { return 25; }" - "let a = 26;" - "try {" - " if (o.p == 7) o.p++;" - "} catch {}"); + std::make_unique<v8::Extension>("new extension", + "function i() { return 24; }" + "function j() { return 25; }" + "let a = 26;" + "try {" + " if (o.p == 7) o.p++;" + "} catch {}"); extension->set_auto_enable(true); v8::RegisterExtension(std::move(extension)); { @@ -3900,7 +3908,7 @@ UNINITIALIZED_TEST(WeakArraySerializationInSnapshot) { TEST(WeakArraySerializationInCodeCache) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); + isolate->compilation_cache()->DisableScriptAndEval(); v8::HandleScope scope(CcTest::isolate()); @@ -3929,7 +3937,8 @@ TEST(CachedCompileFunctionInContext) { DisableAlwaysOpt(); LocalContext env; Isolate* isolate = CcTest::i_isolate(); - isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. v8::HandleScope scope(CcTest::isolate()); diff --git a/deps/v8/test/cctest/test-smi-lexicographic-compare.cc b/deps/v8/test/cctest/test-smi-lexicographic-compare.cc index 914444c634..7b3e600c14 100644 --- a/deps/v8/test/cctest/test-smi-lexicographic-compare.cc +++ b/deps/v8/test/cctest/test-smi-lexicographic-compare.cc @@ -14,11 +14,11 @@ namespace internal { namespace { -void AddSigned(std::set<Smi>& smis, int64_t x) { // NOLINT(runtime/references) +void AddSigned(std::set<Smi>* smis, int64_t x) { if (!Smi::IsValid(x)) return; - smis.insert(Smi::FromInt(static_cast<int>(x))); - smis.insert(Smi::FromInt(static_cast<int>(-x))); + smis->insert(Smi::FromInt(static_cast<int>(x))); + smis->insert(Smi::FromInt(static_cast<int>(-x))); } // Uses std::lexicographical_compare twice to convert the result to -1, 0 or 1. @@ -58,14 +58,14 @@ TEST(TestSmiLexicographicCompare) { for (int64_t xb = 1; xb <= Smi::kMaxValue; xb *= 10) { for (int64_t xf = 0; xf <= 9; ++xf) { for (int64_t xo = -1; xo <= 1; ++xo) { - AddSigned(smis, xb * xf + xo); + AddSigned(&smis, xb * xf + xo); } } } for (int64_t yb = 1; yb <= Smi::kMaxValue; yb *= 2) { for (int64_t yo = -2; yo <= 2; ++yo) { - AddSigned(smis, yb + yo); + AddSigned(&smis, yb + yo); } } diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index 796f38a73b..f64c044a0c 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -1857,6 +1857,48 @@ GC_INSIDE_NEW_STRING_FROM_UTF8_SUB_STRING( #undef GC_INSIDE_NEW_STRING_FROM_UTF8_SUB_STRING +namespace { + +struct IndexData { + const char* string; + bool is_array_index; + uint32_t array_index; + bool is_integer_index; + size_t integer_index; +}; + +void TestString(i::Isolate* isolate, const IndexData& data) { + Handle<String> s = isolate->factory()->NewStringFromAsciiChecked(data.string); + if (data.is_array_index) { + 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; + CHECK(s->AsIntegerIndex(&index)); + CHECK_EQ(data.integer_index, index); + s->Hash(); + CHECK_EQ(0, s->hash_field() & String::kIsNotIntegerIndexMask); + CHECK(s->HasHashCode()); + } + 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); + } +} + +} // namespace + TEST(HashArrayIndexStrings) { CcTest::InitializeVM(); LocalContext context; @@ -1870,6 +1912,27 @@ TEST(HashArrayIndexStrings) { CHECK_EQ(StringHasher::MakeArrayIndexHash(1 /* value */, 1 /* length */) >> Name::kHashShift, isolate->factory()->one_string()->Hash()); + + IndexData tests[] = { + {"", false, 0, false, 0}, + {"123no", false, 0, false, 0}, + {"12345", true, 12345, true, 12345}, + {"12345678", true, 12345678, true, 12345678}, + {"4294967294", true, 4294967294u, true, 4294967294u}, +#if V8_TARGET_ARCH_32_BIT + {"4294967295", false, 0, false, 0}, // Valid length but not index. + {"4294967296", false, 0, false, 0}, + {"18446744073709551615", false, 0, false, 0}, +#else + {"4294967295", false, 0, true, 4294967295u}, + {"4294967296", false, 0, true, 4294967296ull}, + {"18446744073709551615", false, 0, true, 18446744073709551615ull}, +#endif + {"18446744073709551616", false, 0, false, 0} + }; + for (int i = 0, n = arraysize(tests); i < n; i++) { + TestString(isolate, tests[i]); + } } TEST(StringEquals) { diff --git a/deps/v8/test/cctest/test-threads.cc b/deps/v8/test/cctest/test-threads.cc index 2062724043..5c852d7232 100644 --- a/deps/v8/test/cctest/test-threads.cc +++ b/deps/v8/test/cctest/test-threads.cc @@ -75,7 +75,7 @@ TEST(ThreadIdValidation) { ThreadIdValidationThread* prev = i == kNThreads - 1 ? nullptr : threads[i + 1].get(); threads[i] = - base::make_unique<ThreadIdValidationThread>(prev, refs, i, &semaphore); + std::make_unique<ThreadIdValidationThread>(prev, refs, i, &semaphore); } CHECK(threads[0]->Start()); for (int i = 0; i < kNThreads; i++) { diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc index 7b3c215d69..0f4a699d8a 100644 --- a/deps/v8/test/cctest/test-trace-event.cc +++ b/deps/v8/test/cctest/test-trace-event.cc @@ -6,7 +6,6 @@ #include "src/init/v8.h" -#include "src/base/template-utils.h" #include "test/cctest/cctest.h" #include "src/tracing/trace-event.h" @@ -55,9 +54,8 @@ class MockTracingController : public v8::TracingController { const uint64_t* arg_values, std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables, unsigned int flags, int64_t timestamp) override { - std::unique_ptr<MockTraceObject> to = - v8::base::make_unique<MockTraceObject>( - phase, std::string(name), id, bind_id, num_args, flags, timestamp); + std::unique_ptr<MockTraceObject> to = std::make_unique<MockTraceObject>( + phase, std::string(name), id, bind_id, num_args, flags, timestamp); trace_objects_.push_back(std::move(to)); return 0; } diff --git a/deps/v8/test/cctest/test-typedarrays.cc b/deps/v8/test/cctest/test-typedarrays.cc index fb4740cb92..5e715b75e0 100644 --- a/deps/v8/test/cctest/test-typedarrays.cc +++ b/deps/v8/test/cctest/test-typedarrays.cc @@ -7,6 +7,7 @@ #include "src/init/v8.h" #include "test/cctest/cctest.h" +#include "src/execution/protectors-inl.h" #include "src/heap/heap.h" #include "src/objects/objects-inl.h" #include "src/objects/objects.h" @@ -14,12 +15,11 @@ namespace v8 { namespace internal { -void TestArrayBufferViewContents( - LocalContext& env, // NOLINT(runtime/references) - bool should_use_buffer) { +void TestArrayBufferViewContents(LocalContext* env, bool should_use_buffer) { v8::Local<v8::Object> obj_a = v8::Local<v8::Object>::Cast( - env->Global() - ->Get(env->GetIsolate()->GetCurrentContext(), v8_str("a")) + (*env) + ->Global() + ->Get((*env)->GetIsolate()->GetCurrentContext(), v8_str("a")) .ToLocalChecked()); CHECK(obj_a->IsArrayBufferView()); v8::Local<v8::ArrayBufferView> array_buffer_view = @@ -43,7 +43,7 @@ TEST(CopyContentsTypedArray) { "a[1] = 1;" "a[2] = 2;" "a[3] = 3;"); - TestArrayBufferViewContents(env, false); + TestArrayBufferViewContents(&env, false); } @@ -51,7 +51,7 @@ TEST(CopyContentsArray) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); CompileRun("var a = new Uint8Array([0, 1, 2, 3]);"); - TestArrayBufferViewContents(env, false); + TestArrayBufferViewContents(&env, false); } @@ -68,7 +68,7 @@ TEST(CopyContentsView) { "c[4] = 2;" "c[5] = 3;" "var a = new DataView(b, 2);"); - TestArrayBufferViewContents(env, true); + TestArrayBufferViewContents(&env, true); } @@ -82,7 +82,7 @@ TEST(AllocateNotExternal) { v8::ArrayBuffer::New(env->GetIsolate(), memory, 1024, v8::ArrayBufferCreationMode::kInternalized); CHECK(!buffer->IsExternal()); - CHECK_EQ(memory, buffer->GetContents().Data()); + CHECK_EQ(memory, buffer->GetBackingStore()->Data()); } void TestSpeciesProtector(char* code, @@ -115,12 +115,12 @@ void TestSpeciesProtector(char* code, v8::internal::Isolate* i_isolate = reinterpret_cast<v8::internal::Isolate*>(isolate); - CHECK(i_isolate->IsTypedArraySpeciesLookupChainIntact()); + CHECK(Protectors::IsTypedArraySpeciesLookupChainIntact(i_isolate)); CompileRun(code); if (invalidates_species_protector) { - CHECK(!i_isolate->IsTypedArraySpeciesLookupChainIntact()); + CHECK(!Protectors::IsTypedArraySpeciesLookupChainIntact(i_isolate)); } else { - CHECK(i_isolate->IsTypedArraySpeciesLookupChainIntact()); + CHECK(Protectors::IsTypedArraySpeciesLookupChainIntact(i_isolate)); } v8::Local<v8::Value> my_typed_array = CompileRun("MyTypedArray"); diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc index 9cfc40d37d..ebeb05597e 100644 --- a/deps/v8/test/cctest/test-unboxed-doubles.cc +++ b/deps/v8/test/cctest/test-unboxed-doubles.cc @@ -78,8 +78,9 @@ static double GetDoubleFieldValue(JSObject obj, FieldIndex field_index) { } } -void WriteToField(JSObject object, int descriptor, Object value) { +void WriteToField(JSObject object, int index, Object value) { DescriptorArray descriptors = object.map().instance_descriptors(); + InternalIndex descriptor(index); PropertyDetails details = descriptors.GetDetails(descriptor); object.WriteToField(descriptor, details, value); } @@ -811,7 +812,7 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppendIfFastOrUseFull( Handle<Map> map; // Now check layout descriptors of all intermediate maps. for (int i = 0; i < number_of_descriptors; i++) { - PropertyDetails details = descriptors->GetDetails(i); + PropertyDetails details = descriptors->GetDetails(InternalIndex(i)); map = maps[i]; LayoutDescriptor layout_desc = map->layout_descriptor(); @@ -962,7 +963,7 @@ TEST(Regress436816) { CHECK(fake_object.IsHeapObject()); uint64_t boom_value = bit_cast<uint64_t>(fake_object); - for (int i = 0; i < kPropsCount; i++) { + for (InternalIndex i : InternalIndex::Range(kPropsCount)) { FieldIndex index = FieldIndex::ForDescriptor(*map, i); CHECK(map->IsUnboxedDoubleField(index)); object->RawFastDoublePropertyAsBitsAtPut(index, boom_value); @@ -1100,7 +1101,7 @@ TEST(DoScavenge) { { // Ensure the object is properly set up. - FieldIndex field_index = FieldIndex::ForDescriptor(*map, 0); + FieldIndex field_index = FieldIndex::ForDescriptor(*map, InternalIndex(0)); CHECK(field_index.is_inobject() && field_index.is_double()); CHECK_EQ(FLAG_unbox_double_fields, map->IsUnboxedDoubleField(field_index)); CHECK_EQ(42.5, GetDoubleFieldValue(*obj, field_index)); @@ -1119,7 +1120,8 @@ TEST(DoScavenge) { Address fake_object = temp->ptr() + kSystemPointerSize; double boom_value = bit_cast<double>(fake_object); - FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0); + FieldIndex field_index = + FieldIndex::ForDescriptor(obj->map(), InternalIndex(0)); auto boom_number = factory->NewHeapNumber(boom_value); obj->FastPropertyAtPut(field_index, *boom_number); @@ -1182,12 +1184,12 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { { // Ensure the object is properly set up. - FieldIndex field_index = FieldIndex::ForDescriptor(*map, 0); + FieldIndex field_index = FieldIndex::ForDescriptor(*map, InternalIndex(0)); CHECK(field_index.is_inobject() && field_index.is_double()); CHECK_EQ(FLAG_unbox_double_fields, map->IsUnboxedDoubleField(field_index)); CHECK_EQ(42.5, GetDoubleFieldValue(*obj, field_index)); - field_index = FieldIndex::ForDescriptor(*map, 1); + field_index = FieldIndex::ForDescriptor(*map, InternalIndex(1)); CHECK(field_index.is_inobject() && !field_index.is_double()); CHECK(!map->IsUnboxedDoubleField(field_index)); } @@ -1225,7 +1227,7 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { // |obj_value| must be evacuated. CHECK(!MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); - FieldIndex field_index = FieldIndex::ForDescriptor(*map, 1); + FieldIndex field_index = FieldIndex::ForDescriptor(*map, InternalIndex(1)); CHECK_EQ(*obj_value, obj->RawFastPropertyAt(field_index)); } @@ -1248,7 +1250,7 @@ static void TestLayoutDescriptorHelper(Isolate* isolate, int end_offset = instance_size * 2; int first_non_tagged_field_offset = end_offset; - for (int i = 0; i < number_of_descriptors; i++) { + for (InternalIndex i : InternalIndex::Range(number_of_descriptors)) { PropertyDetails details = descriptors->GetDetails(i); if (details.location() != kField) continue; FieldIndex index = FieldIndex::ForDescriptor(*map, i); @@ -1430,9 +1432,9 @@ TEST(LayoutDescriptorSharing) { CHECK(map2->layout_descriptor().IsConsistentWithMap(*map2, true)); } - static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map, - int tagged_descriptor, int double_descriptor, + InternalIndex tagged_descriptor, + InternalIndex double_descriptor, bool check_tagged_value = true) { FLAG_stress_compaction = true; FLAG_manual_evacuation_candidates_selection = true; @@ -1491,10 +1493,9 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map, CHECK_EQ(boom_value, obj->RawFastDoublePropertyAsBitsAt(double_field_index)); } - static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, - int tagged_descriptor, - int double_descriptor, + InternalIndex tagged_descriptor, + InternalIndex double_descriptor, bool check_tagged_value = true) { if (FLAG_never_compact || !FLAG_incremental_marking) return; ManualGCScope manual_gc_scope; @@ -1607,14 +1608,16 @@ static void TestWriteBarrierObjectShiftFieldsRight( .ToHandleChecked(); // Shift fields right by turning constant property to a field. - Handle<Map> new_map = Map::ReconfigureProperty( - isolate, map, 0, kData, NONE, Representation::Tagged(), any_type); + Handle<Map> new_map = + Map::ReconfigureProperty(isolate, map, InternalIndex(0), kData, NONE, + Representation::Tagged(), any_type); if (write_barrier_kind == OLD_TO_NEW_WRITE_BARRIER) { - TestWriteBarrier(map, new_map, 2, 1); + TestWriteBarrier(map, new_map, InternalIndex(2), InternalIndex(1)); } else { CHECK_EQ(OLD_TO_OLD_WRITE_BARRIER, write_barrier_kind); - TestIncrementalWriteBarrier(map, new_map, 2, 1); + TestIncrementalWriteBarrier(map, new_map, InternalIndex(2), + InternalIndex(1)); } } diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc index 184a867946..5cf70f3374 100644 --- a/deps/v8/test/cctest/torque/test-torque.cc +++ b/deps/v8/test/cctest/torque/test-torque.cc @@ -26,7 +26,6 @@ namespace compiler { namespace { -using Label = CodeAssemblerLabel; using Variable = CodeAssemblerVariable; class TestTorqueAssembler : public CodeStubAssembler { diff --git a/deps/v8/test/cctest/wasm/OWNERS b/deps/v8/test/cctest/wasm/OWNERS index dc68b39733..16b08f3b3b 100644 --- a/deps/v8/test/cctest/wasm/OWNERS +++ b/deps/v8/test/cctest/wasm/OWNERS @@ -1,5 +1,5 @@ ahaas@chromium.org -clemensh@chromium.org +clemensb@chromium.org titzer@chromium.org # COMPONENT: Blink>JavaScript>WebAssembly diff --git a/deps/v8/test/cctest/wasm/test-grow-memory.cc b/deps/v8/test/cctest/wasm/test-grow-memory.cc new file mode 100644 index 0000000000..a188707cae --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-grow-memory.cc @@ -0,0 +1,131 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/wasm/wasm-objects-inl.h" +#include "src/wasm/wasm-opcodes.h" + +#include "src/wasm/wasm-module-builder.h" +#include "test/cctest/cctest.h" +#include "test/cctest/manually-externalized-buffer.h" +#include "test/common/wasm/flag-utils.h" +#include "test/common/wasm/test-signatures.h" +#include "test/common/wasm/wasm-macro-gen.h" +#include "test/common/wasm/wasm-module-runner.h" + +namespace v8 { +namespace internal { +namespace wasm { +namespace test_grow_memory { + +using testing::CompileAndInstantiateForTesting; +using v8::internal::testing::ManuallyExternalizedBuffer; + +namespace { +void ExportAsMain(WasmFunctionBuilder* f) { + f->builder()->AddExport(CStrVector("main"), f); +} +#define EMIT_CODE_WITH_END(f, code) \ + do { \ + f->EmitCode(code, sizeof(code)); \ + f->Emit(kExprEnd); \ + } while (false) + +void Cleanup(Isolate* isolate = CcTest::InitIsolateOnce()) { + // By sending a low memory notifications, we will try hard to collect all + // garbage and will therefore also invoke all weak callbacks of actually + // unreachable persistent handles. + reinterpret_cast<v8::Isolate*>(isolate)->LowMemoryNotification(); +} +} // namespace + +TEST(GrowMemDetaches) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + Handle<WasmMemoryObject> memory_object = + WasmMemoryObject::New(isolate, 16, 100, SharedFlag::kNotShared) + .ToHandleChecked(); + Handle<JSArrayBuffer> buffer(memory_object->array_buffer(), isolate); + int32_t result = WasmMemoryObject::Grow(isolate, memory_object, 0); + CHECK_EQ(16, result); + CHECK_NE(*buffer, memory_object->array_buffer()); + CHECK(buffer->was_detached()); + } + Cleanup(); +} + +TEST(Externalized_GrowMemMemSize) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + Handle<WasmMemoryObject> memory_object = + WasmMemoryObject::New(isolate, 16, 100, SharedFlag::kNotShared) + .ToHandleChecked(); + ManuallyExternalizedBuffer external( + handle(memory_object->array_buffer(), isolate)); + int32_t result = WasmMemoryObject::Grow(isolate, memory_object, 0); + CHECK_EQ(16, result); + CHECK_NE(*external.buffer_, memory_object->array_buffer()); + CHECK(external.buffer_->was_detached()); + } + Cleanup(); +} + +TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = {WASM_GROW_MEMORY(WASM_I32V_1(6)), WASM_DROP, + WASM_MEMORY_SIZE}; + EMIT_CODE_WITH_END(f, code); + + ZoneBuffer buffer(&zone); + builder->WriteTo(&buffer); + testing::SetupIsolateForWasmModule(isolate); + ErrorThrower thrower(isolate, "Test"); + const Handle<WasmInstanceObject> instance = + CompileAndInstantiateForTesting( + isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end())) + .ToHandleChecked(); + Handle<WasmMemoryObject> memory_object(instance->memory_object(), isolate); + + // Fake the Embedder flow by externalizing the array buffer. + ManuallyExternalizedBuffer external1( + handle(memory_object->array_buffer(), isolate)); + + // Grow using the API. + uint32_t result = WasmMemoryObject::Grow(isolate, memory_object, 4); + CHECK_EQ(16, result); + CHECK(external1.buffer_->was_detached()); // growing always detaches + CHECK_EQ(0, external1.buffer_->byte_length()); + + CHECK_NE(*external1.buffer_, memory_object->array_buffer()); + + // Fake the Embedder flow by externalizing the array buffer. + ManuallyExternalizedBuffer external2( + handle(memory_object->array_buffer(), isolate)); + + // 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 + CHECK_EQ(0, external2.buffer_->byte_length()); + CHECK_NE(*external2.buffer_, memory_object->array_buffer()); + } + Cleanup(); +} + +} // namespace test_grow_memory +} // namespace wasm +} // namespace internal +} // namespace v8 + +#undef EMIT_CODE_WITH_END diff --git a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc index 556d74daef..d3aa75a64e 100644 --- a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc +++ b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc @@ -36,7 +36,7 @@ constexpr size_t kThunkBufferSize = AssemblerBase::kMinimalBufferSize; #if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 constexpr uint32_t kAvailableBufferSlots = - (kMaxWasmCodeMemory - kJumpTableSize) / kThunkBufferSize; + (kMaxWasmCodeSpaceSize - kJumpTableSize) / kThunkBufferSize; constexpr uint32_t kBufferSlotStartOffset = RoundUp<kThunkBufferSize>(kJumpTableSize); #else @@ -49,7 +49,7 @@ Address AllocateJumpTableThunk( std::vector<std::unique_ptr<TestingAssemblerBuffer>>* thunk_buffers) { #if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 // To guarantee that the branch range lies within the near-call range, - // generate the thunk in the same (kMaxWasmCodeMemory-sized) buffer as the + // generate the thunk in the same (kMaxWasmCodeSpaceSize-sized) buffer as the // jump_target itself. // // Allocate a slot that we haven't already used. This is necessary because @@ -181,11 +181,13 @@ class JumpTablePatcher : public v8::base::Thread { // Then, repeatedly patch the jump table to jump to one of the two thunks. constexpr int kNumberOfPatchIterations = 64; for (int i = 0; i < kNumberOfPatchIterations; ++i) { - TRACE(" patcher %p patch slot " V8PRIxPTR_FMT " to thunk #%d\n", this, - slot_address, i % 2); + TRACE(" patcher %p patch slot " V8PRIxPTR_FMT + " to thunk #%d (" V8PRIxPTR_FMT ")\n", + this, slot_address, i % 2, thunks_[i % 2]); base::MutexGuard jump_table_guard(jump_table_mutex_); JumpTableAssembler::PatchJumpTableSlot( - slot_start_, slot_index_, thunks_[i % 2], WasmCode::kFlushICache); + slot_start_ + JumpTableAssembler::JumpSlotIndexToOffset(slot_index_), + kNullAddress, thunks_[i % 2]); } TRACE("Patcher %p is stopping ...\n", this); } @@ -219,11 +221,8 @@ TEST(JumpTablePatchingStress) { // is not reliable enough to guarantee that we can always achieve this with // separate allocations, so for Arm64 we generate all code in a single // kMaxMasmCodeMemory-sized chunk. - // - // TODO(wasm): Currently {kMaxWasmCodeMemory} limits code sufficiently, so - // that the jump table only supports {near_call} distances. - STATIC_ASSERT(kMaxWasmCodeMemory >= kJumpTableSize); - auto buffer = AllocateAssemblerBuffer(kMaxWasmCodeMemory); + STATIC_ASSERT(kMaxWasmCodeSpaceSize >= kJumpTableSize); + auto buffer = AllocateAssemblerBuffer(kMaxWasmCodeSpaceSize); byte* thunk_slot_buffer = buffer->start() + kBufferSlotStartOffset; #else auto buffer = AllocateAssemblerBuffer(kJumpTableSize); @@ -242,8 +241,9 @@ TEST(JumpTablePatchingStress) { std::vector<std::unique_ptr<TestingAssemblerBuffer>> thunk_buffers; // Patch the jump table slot to jump to itself. This will later be patched // by the patchers. - JumpTableAssembler::PatchJumpTableSlot( - slot_start, slot, slot_start + slot_offset, WasmCode::kFlushICache); + Address slot_addr = + slot_start + JumpTableAssembler::JumpSlotIndexToOffset(slot); + JumpTableAssembler::PatchJumpTableSlot(slot_addr, kNullAddress, slot_addr); // For each patcher, generate two thunks where this patcher can emit code // which finally jumps back to {slot} in the jump table. std::vector<Address> patcher_thunks; 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 3f96f8720f..09d1eb7fda 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -1502,7 +1502,7 @@ static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) { std::vector<byte> code; for (byte p = 0; p < num_params; p++) { - ADD_CODE(code, kExprGetLocal, p); + ADD_CODE(code, kExprLocalGet, p); } ADD_CODE(code, kExprI32Const, 0); ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO); @@ -1563,7 +1563,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { // Store the result in a local. byte local_index = r.AllocateLocal(ValueTypes::ValueTypeFor(result)); - ADD_CODE(code, kExprSetLocal, local_index); + ADD_CODE(code, kExprLocalSet, local_index); // Store the result in memory. ADD_CODE(code, diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-bulk-memory.cc b/deps/v8/test/cctest/wasm/test-run-wasm-bulk-memory.cc index e794c00ece..d2ac3434df 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-bulk-memory.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-bulk-memory.cc @@ -13,11 +13,10 @@ namespace wasm { namespace test_run_wasm_bulk_memory { namespace { -void CheckMemoryEquals( - TestingModuleBuilder& builder, // NOLINT(runtime/references) - size_t index, const std::vector<byte>& expected) { - const byte* mem_start = builder.raw_mem_start<byte>(); - const byte* mem_end = builder.raw_mem_end<byte>(); +void CheckMemoryEquals(TestingModuleBuilder* builder, size_t index, + const std::vector<byte>& expected) { + const byte* mem_start = builder->raw_mem_start<byte>(); + const byte* mem_end = builder->raw_mem_end<byte>(); size_t mem_size = mem_end - mem_start; CHECK_LE(index, mem_size); CHECK_LE(index + expected.size(), mem_size); @@ -26,11 +25,10 @@ void CheckMemoryEquals( } } -void CheckMemoryEqualsZero( - TestingModuleBuilder& builder, // NOLINT(runtime/references) - size_t index, size_t length) { - const byte* mem_start = builder.raw_mem_start<byte>(); - const byte* mem_end = builder.raw_mem_end<byte>(); +void CheckMemoryEqualsZero(TestingModuleBuilder* builder, size_t index, + size_t length) { + const byte* mem_start = builder->raw_mem_start<byte>(); + const byte* mem_end = builder->raw_mem_end<byte>(); size_t mem_size = mem_end - mem_start; CHECK_LE(index, mem_size); CHECK_LE(index + length, mem_size); @@ -39,12 +37,11 @@ void CheckMemoryEqualsZero( } } -void CheckMemoryEqualsFollowedByZeroes( - TestingModuleBuilder& builder, // NOLINT(runtime/references) - const std::vector<byte>& expected) { +void CheckMemoryEqualsFollowedByZeroes(TestingModuleBuilder* builder, + const std::vector<byte>& expected) { CheckMemoryEquals(builder, 0, expected); CheckMemoryEqualsZero(builder, expected.size(), - builder.mem_size() - expected.size()); + builder->mem_size() - expected.size()); } } // namespace @@ -60,24 +57,24 @@ WASM_EXEC_TEST(MemoryInit) { kExprI32Const, 0); // All zeroes. - CheckMemoryEqualsZero(r.builder(), 0, kWasmPageSize); + CheckMemoryEqualsZero(&r.builder(), 0, kWasmPageSize); // Copy all bytes from data segment 0, to memory at [10, 20). CHECK_EQ(0, r.Call(10, 0, 10)); CheckMemoryEqualsFollowedByZeroes( - r.builder(), + &r.builder(), {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); // Copy bytes in range [5, 10) from data segment 0, to memory at [0, 5). CHECK_EQ(0, r.Call(0, 5, 5)); CheckMemoryEqualsFollowedByZeroes( - r.builder(), + &r.builder(), {5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); // Copy 0 bytes does nothing. CHECK_EQ(0, r.Call(10, 1, 0)); CheckMemoryEqualsFollowedByZeroes( - r.builder(), + &r.builder(), {5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); // Copy 0 at end of memory region or data segment is OK. @@ -100,12 +97,12 @@ WASM_EXEC_TEST(MemoryInitOutOfBoundsData) { // Write all values up to the out-of-bounds write. CHECK_EQ(0xDEADBEEF, r.Call(kWasmPageSize - 5, 0, 6)); - CheckMemoryEquals(r.builder(), last_5_bytes, {0, 1, 2, 3, 4}); + CheckMemoryEquals(&r.builder(), last_5_bytes, {0, 1, 2, 3, 4}); // Write all values up to the out-of-bounds read. r.builder().BlankMemory(); CHECK_EQ(0xDEADBEEF, r.Call(0, 5, 6)); - CheckMemoryEqualsFollowedByZeroes(r.builder(), {5, 6, 7, 8, 9}); + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {5, 6, 7, 8, 9}); } WASM_EXEC_TEST(MemoryInitOutOfBounds) { @@ -155,13 +152,13 @@ WASM_EXEC_TEST(MemoryCopy) { // Copy from [1, 8] to [10, 16]. CHECK_EQ(0, r.Call(10, 1, 8)); CheckMemoryEqualsFollowedByZeroes( - r.builder(), + &r.builder(), {0, 11, 22, 33, 44, 55, 66, 77, 0, 0, 11, 22, 33, 44, 55, 66, 77}); // Copy 0 bytes does nothing. CHECK_EQ(0, r.Call(10, 2, 0)); CheckMemoryEqualsFollowedByZeroes( - r.builder(), + &r.builder(), {0, 11, 22, 33, 44, 55, 66, 77, 0, 0, 11, 22, 33, 44, 55, 66, 77}); // Copy 0 at end of memory region is OK. @@ -184,12 +181,12 @@ WASM_EXEC_TEST(MemoryCopyOverlapping) { // Copy from [0, 3] -> [2, 5]. The copy must not overwrite 30 before copying // it (i.e. cannot copy forward in this case). CHECK_EQ(0, r.Call(2, 0, 3)); - CheckMemoryEqualsFollowedByZeroes(r.builder(), {10, 20, 10, 20, 30}); + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {10, 20, 10, 20, 30}); // Copy from [2, 5] -> [0, 3]. The copy must not write the first 10 (i.e. // cannot copy backward in this case). CHECK_EQ(0, r.Call(0, 2, 3)); - CheckMemoryEqualsFollowedByZeroes(r.builder(), {10, 20, 30, 20, 30}); + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {10, 20, 30, 20, 30}); } WASM_EXEC_TEST(MemoryCopyOutOfBoundsData) { @@ -209,21 +206,21 @@ WASM_EXEC_TEST(MemoryCopyOutOfBoundsData) { // Copy with source < destination. Copy would happen backwards, // but the first byte to copy is out-of-bounds, so no data should be written. CHECK_EQ(0xDEADBEEF, r.Call(last_5_bytes, 0, 6)); - CheckMemoryEquals(r.builder(), last_5_bytes, {0, 0, 0, 0, 0}); + CheckMemoryEquals(&r.builder(), last_5_bytes, {0, 0, 0, 0, 0}); // Copy overlapping with destination < source. Copy will happen forwards, up // to the out-of-bounds access. r.builder().BlankMemory(); memcpy(mem + last_5_bytes, data, 5); CHECK_EQ(0xDEADBEEF, r.Call(0, last_5_bytes, kWasmPageSize)); - CheckMemoryEquals(r.builder(), 0, {11, 22, 33, 44, 55}); + CheckMemoryEquals(&r.builder(), 0, {11, 22, 33, 44, 55}); // Copy overlapping with source < destination. Copy would happen backwards, // but the first byte to copy is out-of-bounds, so no data should be written. r.builder().BlankMemory(); memcpy(mem, data, 5); CHECK_EQ(0xDEADBEEF, r.Call(last_5_bytes, 0, kWasmPageSize)); - CheckMemoryEquals(r.builder(), last_5_bytes, {0, 0, 0, 0, 0}); + CheckMemoryEquals(&r.builder(), last_5_bytes, {0, 0, 0, 0, 0}); } WASM_EXEC_TEST(MemoryCopyOutOfBounds) { @@ -265,15 +262,15 @@ WASM_EXEC_TEST(MemoryFill) { WASM_MEMORY_FILL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), kExprI32Const, 0); CHECK_EQ(0, r.Call(1, 33, 5)); - CheckMemoryEqualsFollowedByZeroes(r.builder(), {0, 33, 33, 33, 33, 33}); + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {0, 33, 33, 33, 33, 33}); CHECK_EQ(0, r.Call(4, 66, 4)); - CheckMemoryEqualsFollowedByZeroes(r.builder(), + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {0, 33, 33, 33, 66, 66, 66, 66}); // Fill 0 bytes does nothing. CHECK_EQ(0, r.Call(4, 66, 0)); - CheckMemoryEqualsFollowedByZeroes(r.builder(), + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {0, 33, 33, 33, 66, 66, 66, 66}); // Fill 0 at end of memory region is OK. @@ -290,7 +287,7 @@ WASM_EXEC_TEST(MemoryFillValueWrapsToByte) { kExprI32Const, 0); CHECK_EQ(0, r.Call(0, 1000, 3)); const byte expected = 1000 & 255; - CheckMemoryEqualsFollowedByZeroes(r.builder(), + CheckMemoryEqualsFollowedByZeroes(&r.builder(), {expected, expected, expected}); } @@ -304,7 +301,7 @@ WASM_EXEC_TEST(MemoryFillOutOfBoundsData) { kExprI32Const, 0); const byte v = 123; CHECK_EQ(0xDEADBEEF, r.Call(kWasmPageSize - 5, v, 999)); - CheckMemoryEquals(r.builder(), kWasmPageSize - 6, {0, v, v, v, v, v}); + CheckMemoryEquals(&r.builder(), kWasmPageSize - 6, {0, v, v, v, v, v}); } WASM_EXEC_TEST(MemoryFillOutOfBounds) { @@ -408,14 +405,13 @@ void CheckTable(Isolate* isolate, Handle<WasmTableObject> table, Args... args) { template <typename WasmRunner, typename... Args> void CheckTableCall(Isolate* isolate, Handle<WasmTableObject> table, - WasmRunner& r, // NOLINT(runtime/references) - uint32_t function_index, Args... args) { + WasmRunner* r, uint32_t function_index, Args... args) { uint32_t args_length = static_cast<uint32_t>(sizeof...(args)); CHECK_EQ(table->current_length(), args_length); double expected[] = {args...}; for (uint32_t i = 0; i < args_length; ++i) { Handle<Object> buffer[] = {isolate->factory()->NewNumber(i)}; - r.CheckCallApplyViaJS(expected[i], function_index, buffer, 1); + r->CheckCallApplyViaJS(expected[i], function_index, buffer, 1); } } } // namespace @@ -462,7 +458,7 @@ void TestTableInitElems(ExecutionTier execution_tier, int table_index) { isolate); const double null = 0xDEADBEEF; - CheckTableCall(isolate, table, r, call_index, null, null, null, null, null); + CheckTableCall(isolate, table, &r, call_index, null, null, null, null, null); // 0 count is ok in bounds, and at end of regions. r.CheckCallViaJS(0, 0, 0, 0); @@ -471,19 +467,19 @@ void TestTableInitElems(ExecutionTier execution_tier, int table_index) { // Test actual writes. r.CheckCallViaJS(0, 0, 0, 1); - CheckTableCall(isolate, table, r, call_index, 0, null, null, null, null); + CheckTableCall(isolate, table, &r, call_index, 0, null, null, null, null); r.CheckCallViaJS(0, 0, 0, 2); - CheckTableCall(isolate, table, r, call_index, 0, 1, null, null, null); + CheckTableCall(isolate, table, &r, call_index, 0, 1, null, null, null); r.CheckCallViaJS(0, 0, 0, 3); - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, null, null); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, null, null); r.CheckCallViaJS(0, 3, 0, 2); - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, 0, 1); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 0, 1); r.CheckCallViaJS(0, 3, 1, 2); - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, 1, 2); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 1, 2); r.CheckCallViaJS(0, 3, 2, 2); - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, 2, 3); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 2, 3); r.CheckCallViaJS(0, 3, 3, 2); - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 3, 4); } WASM_EXEC_TEST(TableInitElems0) { TestTableInitElems(execution_tier, 0); } @@ -534,15 +530,15 @@ void TestTableInitOob(ExecutionTier execution_tier, int table_index) { isolate); const double null = 0xDEADBEEF; - CheckTableCall(isolate, table, r, call_index, null, null, null, null, null); + CheckTableCall(isolate, table, &r, call_index, null, null, null, null, null); // Write all values up to the out-of-bounds write. r.CheckCallViaJS(0xDEADBEEF, 3, 0, 3); - CheckTableCall(isolate, table, r, call_index, null, null, null, 0, 1); + CheckTableCall(isolate, table, &r, call_index, null, null, null, 0, 1); // Write all values up to the out-of-bounds read. r.CheckCallViaJS(0xDEADBEEF, 0, 3, 3); - CheckTableCall(isolate, table, r, call_index, 3, 4, null, 0, 1); + CheckTableCall(isolate, table, &r, call_index, 3, 4, null, 0, 1); // 0-count is never oob. r.CheckCallViaJS(0, kTableSize + 1, 0, 0); @@ -696,21 +692,21 @@ void TestTableCopyCalls(ExecutionTier execution_tier, int table_dst, isolate); if (table_dst == table_src) { - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 3, 4); r.CheckCallViaJS(0, 0, 1, 1); - CheckTableCall(isolate, table, r, call_index, 1, 1, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 1, 1, 2, 3, 4); r.CheckCallViaJS(0, 0, 1, 2); - CheckTableCall(isolate, table, r, call_index, 1, 2, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 3, 4); r.CheckCallViaJS(0, 3, 0, 2); - CheckTableCall(isolate, table, r, call_index, 1, 2, 2, 1, 2); + CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 1, 2); } else { - CheckTableCall(isolate, table, r, call_index, 0, 1, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 3, 4); r.CheckCallViaJS(0, 0, 1, 1); - CheckTableCall(isolate, table, r, call_index, 1, 1, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 1, 1, 2, 3, 4); r.CheckCallViaJS(0, 0, 1, 2); - CheckTableCall(isolate, table, r, call_index, 1, 2, 2, 3, 4); + CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 3, 4); r.CheckCallViaJS(0, 3, 0, 2); - CheckTableCall(isolate, table, r, call_index, 1, 2, 2, 0, 1); + CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 0, 1); } } diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc index 4c1842b537..1b64135cb8 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc @@ -278,7 +278,7 @@ TEST(Breakpoint_I32Add) { static const int kNumBreakpoints = 3; byte code[] = {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; std::unique_ptr<int[]> offsets = - Find(code, sizeof(code), kNumBreakpoints, kExprGetLocal, kExprGetLocal, + Find(code, sizeof(code), kNumBreakpoints, kExprLocalGet, kExprLocalGet, kExprI32Add); WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter); diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc index 51d97650d4..5f70ab6c7b 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -11,7 +11,6 @@ #include "src/utils/version.h" #include "src/wasm/module-decoder.h" #include "src/wasm/wasm-engine.h" -#include "src/wasm/wasm-memory.h" #include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-objects-inl.h" @@ -943,154 +942,6 @@ TEST(MemoryWithOOBEmptyDataSegment) { Cleanup(); } -// Utility to free the allocated memory for a buffer that is manually -// externalized in a test. -struct ManuallyExternalizedBuffer { - Isolate* isolate_; - Handle<JSArrayBuffer> buffer_; - void* allocation_base_; - size_t allocation_length_; - bool const should_free_; - - ManuallyExternalizedBuffer(JSArrayBuffer buffer, Isolate* isolate) - : isolate_(isolate), - buffer_(buffer, isolate), - allocation_base_(buffer.allocation_base()), - allocation_length_(buffer.allocation_length()), - should_free_(!isolate_->wasm_engine()->memory_tracker()->IsWasmMemory( - buffer.backing_store())) { - if (!isolate_->wasm_engine()->memory_tracker()->IsWasmMemory( - buffer.backing_store())) { - v8::Utils::ToLocal(buffer_)->Externalize(); - } - } - ~ManuallyExternalizedBuffer() { - if (should_free_) { - buffer_->FreeBackingStoreFromMainThread(); - } - } -}; - -TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { - { - Isolate* isolate = CcTest::InitIsolateOnce(); - HandleScope scope(isolate); - TestSignatures sigs; - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator, ZONE_NAME); - - WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); - ExportAsMain(f); - byte code[] = {WASM_GROW_MEMORY(WASM_I32V_1(6)), WASM_DROP, - WASM_MEMORY_SIZE}; - EMIT_CODE_WITH_END(f, code); - - ZoneBuffer buffer(&zone); - builder->WriteTo(&buffer); - testing::SetupIsolateForWasmModule(isolate); - ErrorThrower thrower(isolate, "Test"); - const Handle<WasmInstanceObject> instance = - CompileAndInstantiateForTesting( - isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end())) - .ToHandleChecked(); - Handle<WasmMemoryObject> memory_object(instance->memory_object(), isolate); - - // Fake the Embedder flow by externalizing the array buffer. - ManuallyExternalizedBuffer buffer1(memory_object->array_buffer(), isolate); - - // Grow using the API. - uint32_t result = WasmMemoryObject::Grow(isolate, memory_object, 4); - CHECK_EQ(16, result); - CHECK(buffer1.buffer_->was_detached()); // growing always detaches - CHECK_EQ(0, buffer1.buffer_->byte_length()); - - CHECK_NE(*buffer1.buffer_, memory_object->array_buffer()); - - // Fake the Embedder flow by externalizing the array buffer. - ManuallyExternalizedBuffer buffer2(memory_object->array_buffer(), isolate); - - // Grow using an internal WASM bytecode. - result = testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr); - CHECK_EQ(26, result); - CHECK(buffer2.buffer_->was_detached()); // growing always detaches - CHECK_EQ(0, buffer2.buffer_->byte_length()); - CHECK_NE(*buffer2.buffer_, memory_object->array_buffer()); - } - Cleanup(); -} - -TEST(Run_WasmModule_Buffer_Externalized_GrowMemMemSize) { - { - Isolate* isolate = CcTest::InitIsolateOnce(); - HandleScope scope(isolate); - Handle<JSArrayBuffer> buffer; - CHECK(wasm::NewArrayBuffer(isolate, 16 * kWasmPageSize).ToHandle(&buffer)); - Handle<WasmMemoryObject> mem_obj = - WasmMemoryObject::New(isolate, buffer, 100); - auto const contents = v8::Utils::ToLocal(buffer)->Externalize(); - int32_t result = WasmMemoryObject::Grow(isolate, mem_obj, 0); - CHECK_EQ(16, result); - constexpr bool is_wasm_memory = true; - const JSArrayBuffer::Allocation allocation{contents.AllocationBase(), - contents.AllocationLength(), - contents.Data(), is_wasm_memory}; - JSArrayBuffer::FreeBackingStore(isolate, allocation); - } - Cleanup(); -} - -TEST(Run_WasmModule_Buffer_Externalized_Detach) { - { - // Regression test for - // https://bugs.chromium.org/p/chromium/issues/detail?id=731046 - Isolate* isolate = CcTest::InitIsolateOnce(); - HandleScope scope(isolate); - Handle<JSArrayBuffer> buffer; - CHECK(wasm::NewArrayBuffer(isolate, 16 * kWasmPageSize).ToHandle(&buffer)); - auto const contents = v8::Utils::ToLocal(buffer)->Externalize(); - wasm::DetachMemoryBuffer(isolate, buffer, true); - constexpr bool is_wasm_memory = true; - const JSArrayBuffer::Allocation allocation{contents.AllocationBase(), - contents.AllocationLength(), - contents.Data(), is_wasm_memory}; - JSArrayBuffer::FreeBackingStore(isolate, allocation); - } - Cleanup(); -} - -TEST(Run_WasmModule_Buffer_Externalized_Regression_UseAfterFree) { - // Regresion test for https://crbug.com/813876 - Isolate* isolate = CcTest::InitIsolateOnce(); - HandleScope scope(isolate); - Handle<JSArrayBuffer> buffer; - CHECK(wasm::NewArrayBuffer(isolate, 16 * kWasmPageSize).ToHandle(&buffer)); - Handle<WasmMemoryObject> mem = WasmMemoryObject::New(isolate, buffer, 128); - auto contents = v8::Utils::ToLocal(buffer)->Externalize(); - WasmMemoryObject::Grow(isolate, mem, 0); - constexpr bool is_wasm_memory = true; - JSArrayBuffer::FreeBackingStore( - isolate, JSArrayBuffer::Allocation(contents.AllocationBase(), - contents.AllocationLength(), - contents.Data(), is_wasm_memory)); - // Make sure we can write to the buffer without crashing - uint32_t* int_buffer = - reinterpret_cast<uint32_t*>(mem->array_buffer().backing_store()); - int_buffer[0] = 0; -} - -#if V8_TARGET_ARCH_64_BIT -TEST(Run_WasmModule_Reclaim_Memory) { - // Make sure we can allocate memories without running out of address space. - Isolate* isolate = CcTest::InitIsolateOnce(); - Handle<JSArrayBuffer> buffer; - for (int i = 0; i < 256; ++i) { - HandleScope scope(isolate); - CHECK(NewArrayBuffer(isolate, kWasmPageSize).ToHandle(&buffer)); - } -} -#endif - TEST(AtomicOpDisassembly) { { EXPERIMENTAL_FLAG_SCOPE(threads); @@ -1118,12 +969,15 @@ TEST(AtomicOpDisassembly) { ErrorThrower thrower(isolate, "Test"); auto enabled_features = WasmFeaturesFromIsolate(isolate); - MaybeHandle<WasmModuleObject> module_object = - isolate->wasm_engine()->SyncCompile( - isolate, enabled_features, &thrower, - ModuleWireBytes(buffer.begin(), buffer.end())); + Handle<WasmModuleObject> module_object = + isolate->wasm_engine() + ->SyncCompile(isolate, enabled_features, &thrower, + ModuleWireBytes(buffer.begin(), buffer.end())) + .ToHandleChecked(); + NativeModule* native_module = module_object->native_module(); + ModuleWireBytes wire_bytes(native_module->wire_bytes()); - module_object.ToHandleChecked()->DisassembleFunction(0); + DisassembleWasmFunction(native_module->module(), wire_bytes, 0); } Cleanup(); } 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 b48321df40..d76c4c3643 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc @@ -184,13 +184,20 @@ T UnsignedGreaterEqual(T a, T b) { template <typename T> T LogicalShiftLeft(T a, int shift) { using UnsignedT = typename std::make_unsigned<T>::type; - return static_cast<UnsignedT>(a) << shift; + return static_cast<UnsignedT>(a) << (shift % (sizeof(T) * 8)); } template <typename T> T LogicalShiftRight(T a, int shift) { using UnsignedT = typename std::make_unsigned<T>::type; - return static_cast<UnsignedT>(a) >> shift; + return static_cast<UnsignedT>(a) >> (shift % (sizeof(T) * 8)); +} + +// Define our own ArithmeticShiftRight instead of using the one from utils.h +// because the shift amount needs to be taken modulo lane width. +template <typename T> +T ArithmeticShiftRight(T a, int shift) { + return a >> (shift % (sizeof(T) * 8)); } template <typename T> @@ -279,7 +286,7 @@ T Sqrt(T a) { return std::sqrt(a); } -#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32 // only used for F64x2 tests below int64_t Equal(double a, double b) { return a == b ? -1 : 0; } @@ -292,14 +299,106 @@ int64_t GreaterEqual(double a, double b) { return a >= b ? -1 : 0; } 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 +// Only used for qfma and qfms tests below. + +// FMOperation holds the params (a, b, c) for a Multiply-Add or +// Multiply-Subtract operation, and the expected result if the operation was +// fused, rounded only once for the entire operation, or unfused, rounded after +// multiply and again after add/subtract. +template <typename T> +struct FMOperation { + const T a; + const T b; + const T c; + const T fused_result; + const T unfused_result; +}; + +// large_n is large number that overflows T when multiplied by itself, this is a +// useful constant to test fused/unfused behavior. +template <typename T> +constexpr T large_n = T(0); + +template <> +constexpr double large_n<double> = 1e200; + +template <> +constexpr float large_n<float> = 1e20; + +// Fused Multiply-Add performs a + b * c. +template <typename T> +static constexpr FMOperation<T> qfma_array[] = { + {1.0f, 2.0f, 3.0f, 7.0f, 7.0f}, + // fused: a + b * c = -inf + (positive overflow) = -inf + // unfused: a + b * c = -inf + inf = NaN + {-std::numeric_limits<T>::infinity(), large_n<T>, large_n<T>, + -std::numeric_limits<T>::infinity(), std::numeric_limits<T>::quiet_NaN()}, + // fused: a + b * c = inf + (negative overflow) = inf + // unfused: a + b * c = inf + -inf = NaN + {std::numeric_limits<T>::infinity(), -large_n<T>, large_n<T>, + std::numeric_limits<T>::infinity(), std::numeric_limits<T>::quiet_NaN()}, + // NaN + {std::numeric_limits<T>::quiet_NaN(), 2.0f, 3.0f, + std::numeric_limits<T>::quiet_NaN(), std::numeric_limits<T>::quiet_NaN()}, + // -NaN + {-std::numeric_limits<T>::quiet_NaN(), 2.0f, 3.0f, + std::numeric_limits<T>::quiet_NaN(), std::numeric_limits<T>::quiet_NaN()}}; + +template <typename T> +static constexpr Vector<const FMOperation<T>> qfma_vector() { + return ArrayVector(qfma_array<T>); +} + +// Fused Multiply-Subtract performs a - b * c. +template <typename T> +static constexpr FMOperation<T> qfms_array[]{ + {1.0f, 2.0f, 3.0f, -5.0f, -5.0f}, + // fused: a - b * c = inf - (positive overflow) = inf + // unfused: a - b * c = inf - inf = NaN + {std::numeric_limits<T>::infinity(), large_n<T>, large_n<T>, + std::numeric_limits<T>::infinity(), std::numeric_limits<T>::quiet_NaN()}, + // fused: a - b * c = -inf - (negative overflow) = -inf + // unfused: a - b * c = -inf - -inf = NaN + {-std::numeric_limits<T>::infinity(), -large_n<T>, large_n<T>, + -std::numeric_limits<T>::infinity(), std::numeric_limits<T>::quiet_NaN()}, + // NaN + {std::numeric_limits<T>::quiet_NaN(), 2.0f, 3.0f, + std::numeric_limits<T>::quiet_NaN(), std::numeric_limits<T>::quiet_NaN()}, + // -NaN + {-std::numeric_limits<T>::quiet_NaN(), 2.0f, 3.0f, + std::numeric_limits<T>::quiet_NaN(), std::numeric_limits<T>::quiet_NaN()}}; + +template <typename T> +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. +bool ExpectFused(ExecutionTier tier) { +#ifdef V8_TARGET_ARCH_X64 + return CpuFeatures::IsSupported(FMA3) && (tier == ExecutionTier::kTurbofan); +#else + return (tier == ExecutionTier::kTurbofan); +#endif +} #endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32 } // namespace -#define WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lane_value, lane_index) \ - WASM_IF(WASM_##LANE_TYPE##_NE(WASM_GET_LOCAL(lane_value), \ - WASM_SIMD_##TYPE##_EXTRACT_LANE( \ - lane_index, WASM_GET_LOCAL(value))), \ +#define WASM_SIMD_CHECK_LANE_S(TYPE, value, LANE_TYPE, lane_value, lane_index) \ + WASM_IF(WASM_##LANE_TYPE##_NE(WASM_GET_LOCAL(lane_value), \ + WASM_SIMD_##TYPE##_EXTRACT_LANE( \ + lane_index, WASM_GET_LOCAL(value))), \ + WASM_RETURN1(WASM_ZERO)) + +// Unsigned Extracts are only available for I8x16, I16x8 types +#define WASM_SIMD_CHECK_LANE_U(TYPE, value, LANE_TYPE, lane_value, lane_index) \ + WASM_IF(WASM_##LANE_TYPE##_NE(WASM_GET_LOCAL(lane_value), \ + WASM_SIMD_##TYPE##_EXTRACT_LANE_U( \ + lane_index, WASM_GET_LOCAL(value))), \ WASM_RETURN1(WASM_ZERO)) #define TO_BYTE(val) static_cast<byte>(val) @@ -338,13 +437,17 @@ int64_t LessEqual(double a, double b) { return a <= b ? -1 : 0; } #define WASM_SIMD_I16x8_SPLAT(x) WASM_SIMD_SPLAT(I16x8, x) #define WASM_SIMD_I16x8_EXTRACT_LANE(lane, x) \ - x, WASM_SIMD_OP(kExprI16x8ExtractLane), TO_BYTE(lane) + x, WASM_SIMD_OP(kExprI16x8ExtractLaneS), TO_BYTE(lane) +#define WASM_SIMD_I16x8_EXTRACT_LANE_U(lane, x) \ + x, WASM_SIMD_OP(kExprI16x8ExtractLaneU), TO_BYTE(lane) #define WASM_SIMD_I16x8_REPLACE_LANE(lane, x, y) \ x, y, WASM_SIMD_OP(kExprI16x8ReplaceLane), TO_BYTE(lane) #define WASM_SIMD_I8x16_SPLAT(x) WASM_SIMD_SPLAT(I8x16, x) #define WASM_SIMD_I8x16_EXTRACT_LANE(lane, x) \ - x, WASM_SIMD_OP(kExprI8x16ExtractLane), TO_BYTE(lane) + x, WASM_SIMD_OP(kExprI8x16ExtractLaneS), TO_BYTE(lane) +#define WASM_SIMD_I8x16_EXTRACT_LANE_U(lane, x) \ + x, WASM_SIMD_OP(kExprI8x16ExtractLaneU), TO_BYTE(lane) #define WASM_SIMD_I8x16_REPLACE_LANE(lane, x, y) \ x, y, WASM_SIMD_OP(kExprI8x16ReplaceLane), TO_BYTE(lane) @@ -357,8 +460,17 @@ int64_t LessEqual(double a, double b) { return a <= b ? -1 : 0; } #define WASM_SIMD_LOAD_MEM(index) \ index, WASM_SIMD_OP(kExprS128LoadMem), ZERO_ALIGNMENT, ZERO_OFFSET +#define WASM_SIMD_LOAD_MEM_OFFSET(offset, index) \ + index, WASM_SIMD_OP(kExprS128LoadMem), ZERO_ALIGNMENT, offset #define WASM_SIMD_STORE_MEM(index, val) \ index, val, WASM_SIMD_OP(kExprS128StoreMem), ZERO_ALIGNMENT, ZERO_OFFSET +#define WASM_SIMD_STORE_MEM_OFFSET(offset, index, val) \ + index, val, WASM_SIMD_OP(kExprS128StoreMem), ZERO_ALIGNMENT, offset + +#define WASM_SIMD_F64x2_QFMA(a, b, c) a, b, c, WASM_SIMD_OP(kExprF64x2Qfma) +#define WASM_SIMD_F64x2_QFMS(a, b, c) a, b, c, WASM_SIMD_OP(kExprF64x2Qfms) +#define WASM_SIMD_F32x4_QFMA(a, b, c) a, b, c, WASM_SIMD_OP(kExprF32x4Qfma) +#define WASM_SIMD_F32x4_QFMS(a, b, c) a, b, c, WASM_SIMD_OP(kExprF32x4Qfms) // Runs tests of compiled code, using the interpreter as a reference. #define WASM_SIMD_COMPILED_TEST(name) \ @@ -589,10 +701,15 @@ void RunF32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WASM_SIMD_TEST(F32x4Abs) { RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Abs, std::abs); } + WASM_SIMD_TEST(F32x4Neg) { RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Neg, Negate); } +WASM_SIMD_TEST(F32x4Sqrt) { + RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Sqrt, Sqrt); +} + WASM_SIMD_TEST(F32x4RecipApprox) { RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipApprox, base::Recip, false /* !exact */); @@ -725,6 +842,57 @@ WASM_SIMD_TEST(F32x4Le) { } #if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +WASM_SIMD_TEST_NO_LOWERING(F32x4Qfma) { + 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); + // Build fn to splat test values, perform compare op, and write the result. + byte value1 = 0, value2 = 1, value3 = 2; + BUILD(r, + WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_QFMA( + WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(value1)), + WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(value2)), + WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(value3)))), + WASM_ONE); + + for (FMOperation<float> x : qfma_vector<float>()) { + r.Call(x.a, x.b, x.c); + float expected = + ExpectFused(execution_tier) ? x.fused_result : x.unfused_result; + for (int i = 0; i < 4; i++) { + float actual = ReadLittleEndianValue<float>(&g[i]); + CheckFloatResult(x.a, x.b, expected, actual, true /* exact */); + } + } +} + +WASM_SIMD_TEST_NO_LOWERING(F32x4Qfms) { + 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); + // Build fn to splat test values, perform compare op, and write the result. + byte value1 = 0, value2 = 1, value3 = 2; + BUILD(r, + WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_QFMS( + WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(value1)), + WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(value2)), + WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(value3)))), + WASM_ONE); + + for (FMOperation<float> x : qfms_vector<float>()) { + r.Call(x.a, x.b, x.c); + float expected = + ExpectFused(execution_tier) ? x.fused_result : x.unfused_result; + for (int i = 0; i < 4; i++) { + float actual = ReadLittleEndianValue<float>(&g[i]); + CheckFloatResult(x.a, x.b, expected, actual, true /* exact */); + } + } +} +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 + +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 WASM_SIMD_TEST_NO_LOWERING(I64x2Splat) { WasmRunner<int32_t, int64_t> r(execution_tier, lower_simd); // Set up a global to hold output vector. @@ -803,7 +971,8 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2Neg) { void RunI64x2ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, Int64ShiftOp expected_op) { - for (int shift = 1; shift < 64; shift++) { + // 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); byte value = 0; @@ -918,6 +1087,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2GeU) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2GeU, UnsignedGreaterEqual); } +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 WASM_SIMD_TEST_NO_LOWERING(F64x2Splat) { WasmRunner<int32_t, double> r(execution_tier, lower_simd); @@ -941,6 +1111,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Splat) { } } +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 WASM_SIMD_TEST_NO_LOWERING(F64x2ExtractLaneWithI64x2) { WasmRunner<int64_t> r(execution_tier, lower_simd); BUILD(r, WASM_IF_ELSE_L( @@ -950,6 +1121,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2ExtractLaneWithI64x2) { WASM_I64V(1), WASM_I64V(0))); CHECK_EQ(1, r.Call()); } +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 WASM_SIMD_TEST_NO_LOWERING(F64x2ExtractLane) { WasmRunner<double, double> r(execution_tier, lower_simd); @@ -973,6 +1145,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2ExtractLane) { } } +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 WASM_SIMD_TEST_NO_LOWERING(I64x2ExtractWithF64x2) { WasmRunner<int64_t> r(execution_tier, lower_simd); BUILD(r, WASM_IF_ELSE_L( @@ -982,6 +1155,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 WASM_SIMD_TEST_NO_LOWERING(F64x2ReplaceLane) { WasmRunner<int32_t> r(execution_tier, lower_simd); @@ -1124,6 +1298,10 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Neg) { RunF64x2UnOpTest(execution_tier, lower_simd, kExprF64x2Neg, Negate); } +WASM_SIMD_TEST_NO_LOWERING(F64x2Sqrt) { + RunF64x2UnOpTest(execution_tier, lower_simd, kExprF64x2Sqrt, Sqrt); +} + void RunF64x2BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, DoubleBinOp expected_op) { WasmRunner<int32_t, double, double> r(execution_tier, lower_simd); @@ -1249,12 +1427,14 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Max) { RunF64x2BinOpTest(execution_tier, lower_simd, kExprF64x2Max, JSMax); } -#if V8_TARGET_ARCH_X64 +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 WASM_SIMD_TEST_NO_LOWERING(I64x2Mul) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2Mul, base::MulWithWraparound); } +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_X64 WASM_SIMD_TEST_NO_LOWERING(I64x2MinS) { RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2MinS, Minimum); } @@ -1273,7 +1453,57 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2MaxU) { UnsignedMaximum); } #endif // V8_TARGET_ARCH_X64 + +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +WASM_SIMD_TEST_NO_LOWERING(F64x2Qfma) { + 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); + // Build fn to splat test values, perform compare op, and write the result. + byte value1 = 0, value2 = 1, value3 = 2; + BUILD(r, + WASM_SET_GLOBAL(0, WASM_SIMD_F64x2_QFMA( + WASM_SIMD_F64x2_SPLAT(WASM_GET_LOCAL(value1)), + WASM_SIMD_F64x2_SPLAT(WASM_GET_LOCAL(value2)), + WASM_SIMD_F64x2_SPLAT(WASM_GET_LOCAL(value3)))), + WASM_ONE); + + for (FMOperation<double> x : qfma_vector<double>()) { + r.Call(x.a, x.b, x.c); + double expected = + ExpectFused(execution_tier) ? x.fused_result : x.unfused_result; + for (int i = 0; i < 2; i++) { + double actual = ReadLittleEndianValue<double>(&g[i]); + CheckDoubleResult(x.a, x.b, expected, actual, true /* exact */); + } + } +} + +WASM_SIMD_TEST_NO_LOWERING(F64x2Qfms) { + 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); + // Build fn to splat test values, perform compare op, and write the result. + byte value1 = 0, value2 = 1, value3 = 2; + BUILD(r, + WASM_SET_GLOBAL(0, WASM_SIMD_F64x2_QFMS( + WASM_SIMD_F64x2_SPLAT(WASM_GET_LOCAL(value1)), + WASM_SIMD_F64x2_SPLAT(WASM_GET_LOCAL(value2)), + WASM_SIMD_F64x2_SPLAT(WASM_GET_LOCAL(value3)))), + WASM_ONE); + + for (FMOperation<double> x : qfms_vector<double>()) { + r.Call(x.a, x.b, x.c); + double expected = + ExpectFused(execution_tier) ? x.fused_result : x.unfused_result; + for (int i = 0; i < 2; i++) { + double actual = ReadLittleEndianValue<double>(&g[i]); + CheckDoubleResult(x.a, x.b, expected, actual, true /* exact */); + } + } +} #endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32 WASM_SIMD_TEST(I32x4Splat) { WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); @@ -1652,7 +1882,8 @@ WASM_SIMD_TEST(I32x4GeU) { void RunI32x4ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, Int32ShiftOp expected_op) { - for (int shift = 1; shift < 32; shift++) { + // 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); byte value = 0; @@ -1902,7 +2133,8 @@ WASM_SIMD_TEST(I16x8LeU) { void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, Int16ShiftOp expected_op) { - for (int shift = 1; shift < 16; shift++) { + // 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); byte value = 0; @@ -1917,7 +2149,7 @@ void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, FOR_INT16_INPUTS(x) { r.Call(x); - float expected = expected_op(x, shift); + int16_t expected = expected_op(x, shift); for (int i = 0; i < 8; i++) { CHECK_EQ(expected, ReadLittleEndianValue<int16_t>(&g[i])); } @@ -2118,7 +2350,8 @@ WASM_SIMD_TEST(I8x16Mul) { void RunI8x16ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode opcode, Int8ShiftOp expected_op) { - for (int shift = 1; shift < 8; shift++) { + // 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); byte value = 0; @@ -2184,10 +2417,10 @@ WASM_SIMD_TEST_NO_LOWERING(I8x16ShrU) { format, WASM_GET_LOCAL(src1), WASM_GET_LOCAL(src2), \ WASM_SIMD_BINOP(kExprI##format##Ne, WASM_GET_LOCAL(mask), \ WASM_GET_LOCAL(zero)))), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 1), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, val2, 0), \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, val1, 1), \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, val1, 2), \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, val2, 3), WASM_ONE); \ \ CHECK_EQ(1, r.Call(0x12, 0x34)); \ } @@ -2222,10 +2455,10 @@ WASM_SIMD_SELECT_TEST(8x16) WASM_SET_LOCAL(mask, WASM_SIMD_SELECT(format, WASM_GET_LOCAL(src1), \ WASM_GET_LOCAL(src2), \ WASM_GET_LOCAL(mask))), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, combined, 1), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, combined, 2), \ - WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, val2, 0), \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, combined, 1), \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, combined, 2), \ + WASM_SIMD_CHECK_LANE_S(I##format, mask, I32, val2, 3), WASM_ONE); \ \ CHECK_EQ(1, r.Call(0x12, 0x34, 0x32)); \ } @@ -2454,6 +2687,62 @@ WASM_SIMD_TEST(S8x16Concat) { } } +#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 +struct SwizzleTestArgs { + const Shuffle input; + const Shuffle indices; + const Shuffle expected; +}; + +static constexpr SwizzleTestArgs swizzle_test_args[] = { + {{15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, + {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}}, + {{15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, + {15, 0, 14, 1, 13, 2, 12, 3, 11, 4, 10, 5, 9, 6, 8, 7}, + {0, 15, 1, 14, 2, 13, 3, 12, 4, 11, 5, 10, 6, 9, 7, 8}}, + {{15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, + {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}, + {15, 13, 11, 9, 7, 5, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0}}, + // all indices are out of range + {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + {16, 17, 18, 19, 20, 124, 125, 126, 127, -1, -2, -3, -4, -5, -6, -7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}; + +static constexpr Vector<const SwizzleTestArgs> swizzle_test_vector = + ArrayVector(swizzle_test_args); + +WASM_SIMD_TEST(S8x16Swizzle) { + // RunBinaryLaneOpTest set up the two globals to be consecutive integers, + // [0-15] and [16-31]. Using [0-15] as the indices will not sufficiently test + // swizzle since the expected result is a no-op, using [16-31] will result in + // all 0s. + WasmRunner<int32_t> r(execution_tier, lower_simd); + static const int kElems = kSimd128Size / sizeof(uint8_t); + uint8_t* dst = r.builder().AddGlobal<uint8_t>(kWasmS128); + uint8_t* src0 = r.builder().AddGlobal<uint8_t>(kWasmS128); + uint8_t* src1 = r.builder().AddGlobal<uint8_t>(kWasmS128); + BUILD( + r, + WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(kExprS8x16Swizzle, WASM_GET_GLOBAL(1), + WASM_GET_GLOBAL(2))), + WASM_ONE); + + for (SwizzleTestArgs si : swizzle_test_vector) { + for (int i = 0; i < kElems; i++) { + WriteLittleEndianValue<uint8_t>(&src0[i], si.input[i]); + WriteLittleEndianValue<uint8_t>(&src1[i], si.indices[i]); + } + + CHECK_EQ(1, r.Call()); + + for (int i = 0; i < kElems; i++) { + CHECK_EQ(ReadLittleEndianValue<uint8_t>(&dst[i]), si.expected[i]); + } + } +} +#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 + // Combine 3 shuffles a, b, and c by applying both a and b and then applying c // to those two results. Shuffle Combine(const Shuffle& a, const Shuffle& b, const Shuffle& c) { @@ -2487,7 +2776,7 @@ void AppendShuffle(const Shuffle& shuffle, std::vector<byte>* buffer) { for (size_t i = 0; i < kSimd128Size; ++i) buffer->push_back((shuffle[i])); } -void BuildShuffle(std::vector<Shuffle>& shuffles, // NOLINT(runtime/references) +void BuildShuffle(const std::vector<Shuffle>& shuffles, std::vector<byte>* buffer) { // Perform the leaf shuffles on globals 0 and 1. size_t row_index = (shuffles.size() - 1) / 2; @@ -2504,7 +2793,7 @@ void BuildShuffle(std::vector<Shuffle>& shuffles, // NOLINT(runtime/references) } row_index /= 2; } while (row_index != 0); - byte epilog[] = {kExprSetGlobal, static_cast<byte>(0), WASM_ONE}; + byte epilog[] = {kExprGlobalSet, static_cast<byte>(0), WASM_ONE}; for (size_t j = 0; j < arraysize(epilog); ++j) buffer->push_back(epilog[j]); } @@ -2895,11 +3184,34 @@ WASM_SIMD_TEST(SimdLoadStoreLoad) { r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); // Load memory, store it, then reload it and extract the first lane. Use a // non-zero offset into the memory of 1 lane (4 bytes) to test indexing. - BUILD(r, WASM_SIMD_STORE_MEM(WASM_I32V(4), WASM_SIMD_LOAD_MEM(WASM_I32V(4))), - WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_I32V(4)))); + BUILD(r, WASM_SIMD_STORE_MEM(WASM_I32V(8), WASM_SIMD_LOAD_MEM(WASM_I32V(4))), + WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_I32V(8)))); + + FOR_INT32_INPUTS(i) { + int32_t expected = i; + r.builder().WriteMemory(&memory[1], expected); + CHECK_EQ(expected, r.Call()); + } +} + +WASM_SIMD_TEST(SimdLoadStoreLoadMemargOffset) { + WasmRunner<int32_t> r(execution_tier, lower_simd); + int32_t* memory = + r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); + constexpr byte offset_1 = 4; + constexpr byte offset_2 = 8; + // Load from memory at offset_1, store to offset_2, load from offset_2, and + // extract first lane. We use non-zero memarg offsets to test offset decoding. + BUILD( + r, + WASM_SIMD_STORE_MEM_OFFSET( + offset_2, WASM_ZERO, WASM_SIMD_LOAD_MEM_OFFSET(offset_1, WASM_ZERO)), + WASM_SIMD_I32x4_EXTRACT_LANE( + 0, WASM_SIMD_LOAD_MEM_OFFSET(offset_2, WASM_ZERO))); FOR_INT32_INPUTS(i) { int32_t expected = i; + // Index 1 of memory (int32_t) will be bytes 4 to 8. r.builder().WriteMemory(&memory[1], expected); CHECK_EQ(expected, r.Call()); } @@ -3040,8 +3352,48 @@ WASM_SIMD_TEST_NO_LOWERING(I16x8GtUMixed) { UnsignedGreater); } +#define WASM_EXTRACT_I16x8_TEST(Sign, Type) \ + WASM_SIMD_TEST(I16X8ExtractLane##Sign) { \ + WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); \ + byte int_val = r.AllocateLocal(kWasmI32); \ + byte simd_val = r.AllocateLocal(kWasmS128); \ + BUILD(r, \ + WASM_SET_LOCAL(simd_val, \ + WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(int_val))), \ + WASM_SIMD_CHECK_LANE_U(I16x8, simd_val, I32, int_val, 0), \ + WASM_SIMD_CHECK_LANE_U(I16x8, simd_val, I32, int_val, 2), \ + WASM_SIMD_CHECK_LANE_U(I16x8, simd_val, I32, int_val, 4), \ + WASM_SIMD_CHECK_LANE_U(I16x8, simd_val, I32, int_val, 6), WASM_ONE); \ + FOR_##Type##_INPUTS(x) { CHECK_EQ(1, r.Call(x)); } \ + } +WASM_EXTRACT_I16x8_TEST(S, UINT16) WASM_EXTRACT_I16x8_TEST(I, INT16) +#undef WASM_EXTRACT_I16x8_TEST + +#define WASM_EXTRACT_I8x16_TEST(Sign, Type) \ + WASM_SIMD_TEST(I8x16ExtractLane##Sign) { \ + WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); \ + byte int_val = r.AllocateLocal(kWasmI32); \ + byte simd_val = r.AllocateLocal(kWasmS128); \ + BUILD(r, \ + WASM_SET_LOCAL(simd_val, \ + WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(int_val))), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 1), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 3), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 5), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 7), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 9), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 10), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 11), \ + WASM_SIMD_CHECK_LANE_U(I8x16, simd_val, I32, int_val, 13), \ + WASM_ONE); \ + FOR_##Type##_INPUTS(x) { CHECK_EQ(1, r.Call(x)); } \ + } + WASM_EXTRACT_I8x16_TEST(S, UINT8) WASM_EXTRACT_I8x16_TEST(I, INT8) +#undef WASM_EXTRACT_I8x16_TEST + #undef WASM_SIMD_TEST -#undef WASM_SIMD_CHECK_LANE +#undef WASM_SIMD_CHECK_LANE_S +#undef WASM_SIMD_CHECK_LANE_U #undef TO_BYTE #undef WASM_SIMD_OP #undef WASM_SIMD_SPLAT @@ -3064,13 +3416,17 @@ WASM_SIMD_TEST_NO_LOWERING(I16x8GtUMixed) { #undef WASM_SIMD_I32x4_REPLACE_LANE #undef WASM_SIMD_I16x8_SPLAT #undef WASM_SIMD_I16x8_EXTRACT_LANE +#undef WASM_SIMD_I16x8_EXTRACT_LANE_U #undef WASM_SIMD_I16x8_REPLACE_LANE #undef WASM_SIMD_I8x16_SPLAT #undef WASM_SIMD_I8x16_EXTRACT_LANE +#undef WASM_SIMD_I8x16_EXTRACT_LANE_U #undef WASM_SIMD_I8x16_REPLACE_LANE #undef WASM_SIMD_S8x16_SHUFFLE_OP #undef WASM_SIMD_LOAD_MEM +#undef WASM_SIMD_LOAD_MEM_OFFSET #undef WASM_SIMD_STORE_MEM +#undef WASM_SIMD_STORE_MEM_OFFSET #undef WASM_SIMD_SELECT_TEST #undef WASM_SIMD_NON_CANONICAL_SELECT_TEST #undef WASM_SIMD_COMPILED_TEST @@ -3078,6 +3434,10 @@ WASM_SIMD_TEST_NO_LOWERING(I16x8GtUMixed) { #undef WASM_SIMD_TEST_NO_LOWERING #undef WASM_SIMD_ANYTRUE_TEST #undef WASM_SIMD_ALLTRUE_TEST +#undef WASM_SIMD_F64x2_QFMA +#undef WASM_SIMD_F64x2_QFMS +#undef WASM_SIMD_F32x4_QFMA +#undef WASM_SIMD_F32x4_QFMS } // namespace test_run_wasm_simd } // namespace wasm diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index 26df61ceb8..aa6195b8b3 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -49,8 +49,8 @@ WASM_EXEC_TEST(Int32Const_many) { WASM_EXEC_TEST(GraphTrimming) { // This WebAssembly code requires graph trimming in the TurboFan compiler. WasmRunner<int32_t, int32_t> r(execution_tier); - BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS, - kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable); + BUILD(r, kExprLocalGet, 0, kExprLocalGet, 0, kExprLocalGet, 0, kExprI32RemS, + kExprI32Eq, kExprLocalGet, 0, kExprI32DivS, kExprUnreachable); r.Call(1); } @@ -1810,18 +1810,18 @@ WASM_EXEC_TEST(CheckMachIntsZero) { BUILD(r, // -- /**/ kExprLoop, kLocalVoid, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprIf, kLocalVoid, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprI32LoadMem, 0, 0, // -- /* */ kExprIf, kLocalVoid, // -- /* */ kExprI32Const, 127, // -- /* */ kExprReturn, // -- /* */ kExprEnd, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprI32Const, 4, // -- /* */ kExprI32Sub, // -- - /* */ kExprTeeLocal, 0, // -- + /* */ kExprLocalTee, 0, // -- /* */ kExprBr, DEPTH_0, // -- /* */ kExprEnd, // -- /**/ kExprEnd, // -- @@ -2012,16 +2012,16 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { FunctionSig* sig = WasmOpcodes::Signature(opcode); if (sig->parameter_count() == 1) { - byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode), + byte code[] = {WASM_NO_LOCALS, kExprLocalGet, 0, static_cast<byte>(opcode), WASM_END}; TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, code + arraysize(code)); } else { CHECK_EQ(2, sig->parameter_count()); byte code[] = {WASM_NO_LOCALS, - kExprGetLocal, + kExprLocalGet, 0, - kExprGetLocal, + kExprLocalGet, 1, static_cast<byte>(opcode), WASM_END}; @@ -2667,7 +2667,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { // Store the result in a local. byte local_index = r.AllocateLocal(ValueTypes::ValueTypeFor(result)); - ADD_CODE(code, kExprSetLocal, local_index); + ADD_CODE(code, kExprLocalSet, local_index); // Store the result in memory. ADD_CODE(code, @@ -2761,10 +2761,11 @@ void RunMultiReturnSelect(ExecutionTier execution_tier, const T* inputs) { WASM_GET_LOCAL(3)), WASM_DROP); } else { - BUILD(r, WASM_CALL_FUNCTION(r1.function_index(), WASM_GET_LOCAL(0), - WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), - WASM_GET_LOCAL(3)), - kExprSetLocal, 0, WASM_DROP, WASM_GET_LOCAL(0)); + BUILD(r, + WASM_CALL_FUNCTION(r1.function_index(), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), + WASM_GET_LOCAL(3)), + kExprLocalSet, 0, WASM_DROP, WASM_GET_LOCAL(0)); } T expected = inputs[k == 0 ? i : j]; @@ -3330,7 +3331,7 @@ static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) { std::vector<byte> code; for (byte p = 0; p < num_params; ++p) { - ADD_CODE(code, kExprGetLocal, p); + ADD_CODE(code, kExprLocalGet, p); } ADD_CODE(code, kExprI32Const, 0); ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO); diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc index 795fa30e72..f9089b7821 100644 --- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc +++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc @@ -194,17 +194,17 @@ ZoneBuffer GetValidModuleBytes(Zone* zone) { WasmModuleBuilder builder(zone); { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 0, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 0, kExprEnd}; f->EmitCode(code, arraysize(code)); } { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 1, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 1, kExprEnd}; f->EmitCode(code, arraysize(code)); } { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 2, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 2, kExprEnd}; f->EmitCode(code, arraysize(code)); } builder.WriteTo(&buffer); @@ -317,17 +317,17 @@ ZoneBuffer GetModuleWithInvalidSection(Zone* zone) { WasmInitExpr(WasmInitExpr::kGlobalIndex, 12)); { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 0, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 0, kExprEnd}; f->EmitCode(code, arraysize(code)); } { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 1, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 1, kExprEnd}; f->EmitCode(code, arraysize(code)); } { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 2, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 2, kExprEnd}; f->EmitCode(code, arraysize(code)); } builder.WriteTo(&buffer); @@ -442,7 +442,7 @@ STREAM_TEST(TestErrorInCodeSectionDetectedByModuleDecoder) { uint8_t code[] = { U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -481,7 +481,7 @@ STREAM_TEST(TestErrorInCodeSectionDetectedByStreamingDecoder) { uint8_t code[] = { U32V_1(26), // !!! invalid body size !!! U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -520,7 +520,7 @@ STREAM_TEST(TestErrorInCodeSectionDetectedByCompiler) { uint8_t code[] = { U32V_1(4), // !!! invalid body size !!! U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; uint8_t invalid_code[] = { @@ -679,7 +679,7 @@ STREAM_TEST(TestAbortAfterFunctionGotCompiled1) { uint8_t code[] = { U32V_1(4), // !!! invalid body size !!! U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -713,7 +713,7 @@ STREAM_TEST(TestAbortAfterFunctionGotCompiled2) { uint8_t code[] = { U32V_1(4), // !!! invalid body size !!! U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -745,7 +745,7 @@ STREAM_TEST(TestAbortAfterCodeSection1) { uint8_t code[] = { U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -781,7 +781,7 @@ STREAM_TEST(TestAbortAfterCodeSection2) { uint8_t code[] = { U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -815,7 +815,7 @@ STREAM_TEST(TestAbortAfterCompilationError1) { uint8_t code[] = { U32V_1(4), // !!! invalid body size !!! U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; uint8_t invalid_code[] = { @@ -857,7 +857,7 @@ STREAM_TEST(TestAbortAfterCompilationError2) { uint8_t code[] = { U32V_1(4), // !!! invalid body size !!! U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; uint8_t invalid_code[] = { @@ -934,7 +934,7 @@ STREAM_TEST(TestModuleWithMultipleFunctions) { uint8_t code[] = { U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -970,7 +970,7 @@ STREAM_TEST(TestModuleWithDataSection) { uint8_t code[] = { U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { @@ -1016,7 +1016,7 @@ STREAM_TEST(TestModuleWithImportedFunction) { builder.AddImport(ArrayVector("Test"), sigs.i_iii()); { WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); - uint8_t code[] = {kExprGetLocal, 0, kExprEnd}; + uint8_t code[] = {kExprLocalGet, 0, kExprEnd}; f->EmitCode(code, arraysize(code)); } builder.WriteTo(&buffer); @@ -1047,7 +1047,7 @@ STREAM_TEST(TestModuleWithErrorAfterDataSection) { U32V_1(1), // functions count U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, // some code + kExprLocalGet, // some code 0, // some code kExprEnd, // some code kDataSectionCode, // section code @@ -1133,7 +1133,7 @@ STREAM_TEST(TestSetModuleCompiledCallback) { uint8_t code[] = { U32V_1(4), // body size U32V_1(0), // locals count - kExprGetLocal, 0, kExprEnd // body + kExprLocalGet, 0, kExprEnd // body }; const uint8_t bytes[] = { diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc index e287b1139e..798e1d46da 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc @@ -22,10 +22,11 @@ namespace wasm { namespace { void CheckLocations( - WasmModuleObject module_object, debug::Location start, debug::Location end, + NativeModule* native_module, debug::Location start, debug::Location end, std::initializer_list<debug::Location> expected_locations_init) { std::vector<debug::BreakLocation> locations; - bool success = module_object.GetPossibleBreakpoints(start, end, &locations); + bool success = WasmModuleObject::GetPossibleBreakpoints(native_module, start, + end, &locations); CHECK(success); printf("got %d locations: ", static_cast<int>(locations.size())); @@ -45,10 +46,11 @@ void CheckLocations( } } -void CheckLocationsFail(WasmModuleObject module_object, debug::Location start, +void CheckLocationsFail(NativeModule* native_module, debug::Location start, debug::Location end) { std::vector<debug::BreakLocation> locations; - bool success = module_object.GetPossibleBreakpoints(start, end, &locations); + bool success = WasmModuleObject::GetPossibleBreakpoints(native_module, start, + end, &locations); CHECK(!success); } @@ -63,8 +65,12 @@ class BreakHandler : public debug::DebugDelegate { struct BreakPoint { int position; Action action; + std::function<void(void)> pre_action; BreakPoint(int position, Action action) - : position(position), action(action) {} + : position(position), action(action), pre_action([]() {}) {} + BreakPoint(int position, Action action, + std::function<void(void)> pre_action) + : position(position), action(action), pre_action(pre_action) {} }; explicit BreakHandler(Isolate* isolate, @@ -96,6 +102,7 @@ class BreakHandler : public debug::DebugDelegate { auto summ = FrameSummary::GetTop(frame_it.frame()).AsWasmInterpreted(); CHECK_EQ(expected_breaks_[count_].position, summ.byte_offset()); + expected_breaks_[count_].pre_action(); Action next_action = expected_breaks_[count_].action; switch (next_action) { case Continue: @@ -112,22 +119,21 @@ class BreakHandler : public debug::DebugDelegate { } }; -void SetBreakpoint(WasmRunnerBase& runner, // NOLINT(runtime/references) - int function_index, int byte_offset, - int expected_set_byte_offset = -1) { +Handle<BreakPoint> SetBreakpoint(WasmRunnerBase* runner, int function_index, + int byte_offset, + int expected_set_byte_offset = -1) { int func_offset = - runner.builder().GetFunctionAt(function_index)->code.offset(); + runner->builder().GetFunctionAt(function_index)->code.offset(); int code_offset = func_offset + byte_offset; if (expected_set_byte_offset == -1) expected_set_byte_offset = byte_offset; - Handle<WasmInstanceObject> instance = runner.builder().instance_object(); - Handle<WasmModuleObject> module_object(instance->module_object(), - runner.main_isolate()); + 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(WasmModuleObject::SetBreakPoint(module_object, &code_offset, - break_point)); + runner->main_isolate()->factory()->NewBreakPoint( + break_index++, runner->main_isolate()->factory()->empty_string()); + CHECK(WasmModuleObject::SetBreakPoint(script, &code_offset, break_point)); int set_byte_offset = code_offset - func_offset; CHECK_EQ(expected_set_byte_offset, set_byte_offset); // Also set breakpoint on the debug info of the instance directly, since the @@ -135,6 +141,24 @@ void SetBreakpoint(WasmRunnerBase& runner, // NOLINT(runtime/references) Handle<WasmDebugInfo> debug_info = WasmInstanceObject::GetOrCreateDebugInfo(instance); WasmDebugInfo::SetBreakpoint(debug_info, function_index, set_byte_offset); + + return break_point; +} + +void ClearBreakpoint(WasmRunnerBase* runner, int function_index, + int byte_offset, Handle<BreakPoint> break_point) { + int func_offset = + runner->builder().GetFunctionAt(function_index)->code.offset(); + int code_offset = func_offset + byte_offset; + Handle<WasmInstanceObject> instance = runner->builder().instance_object(); + Handle<Script> script(instance->module_object().script(), + runner->main_isolate()); + CHECK(WasmModuleObject::ClearBreakPoint(script, code_offset, break_point)); + // Also clear breakpoint on the debug info of the instance directly, since the + // instance chain is not setup properly in tests. + Handle<WasmDebugInfo> debug_info = + WasmInstanceObject::GetOrCreateDebugInfo(instance); + WasmDebugInfo::ClearBreakpoint(debug_info, function_index, byte_offset); } // Wrapper with operator<<. @@ -247,25 +271,25 @@ WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) { BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_ZERO, WASM_ONE)); WasmInstanceObject instance = *runner.builder().instance_object(); - WasmModuleObject module_object = instance.module_object(); + NativeModule* native_module = instance.module_object().native_module(); std::vector<debug::Location> locations; // Check all locations for function 0. - CheckLocations(module_object, {0, 0}, {1, 0}, + CheckLocations(native_module, {0, 0}, {1, 0}, {{0, 1}, {0, 2}, {0, 4}, {0, 6}, {0, 7}}); // Check a range ending at an instruction. - CheckLocations(module_object, {0, 2}, {0, 4}, {{0, 2}}); + CheckLocations(native_module, {0, 2}, {0, 4}, {{0, 2}}); // Check a range ending one behind an instruction. - CheckLocations(module_object, {0, 2}, {0, 5}, {{0, 2}, {0, 4}}); + CheckLocations(native_module, {0, 2}, {0, 5}, {{0, 2}, {0, 4}}); // Check a range starting at an instruction. - CheckLocations(module_object, {0, 7}, {0, 8}, {{0, 7}}); + CheckLocations(native_module, {0, 7}, {0, 8}, {{0, 7}}); // Check from an instruction to beginning of next function. - CheckLocations(module_object, {0, 7}, {1, 0}, {{0, 7}}); + CheckLocations(native_module, {0, 7}, {1, 0}, {{0, 7}}); // Check from end of one function (no valid instruction position) to beginning // of next function. Must be empty, but not fail. - CheckLocations(module_object, {0, 8}, {1, 0}, {}); + CheckLocations(native_module, {0, 8}, {1, 0}, {}); // Check from one after the end of the function. Must fail. - CheckLocationsFail(module_object, {0, 9}, {1, 0}); + CheckLocationsFail(native_module, {0, 9}, {1, 0}); } WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) { @@ -276,7 +300,7 @@ WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) { Handle<JSFunction> main_fun_wrapper = runner.builder().WrapCode(runner.function_index()); - SetBreakpoint(runner, runner.function_index(), 4, 4); + SetBreakpoint(&runner, runner.function_index(), 4, 4); BreakHandler count_breaks(isolate, {{4, BreakHandler::Continue}}); @@ -298,7 +322,7 @@ WASM_COMPILED_EXEC_TEST(WasmSimpleStepping) { runner.builder().WrapCode(runner.function_index()); // Set breakpoint at the first I32Const. - SetBreakpoint(runner, runner.function_index(), 1, 1); + SetBreakpoint(&runner, runner.function_index(), 1, 1); BreakHandler count_breaks(isolate, { @@ -340,12 +364,12 @@ WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) { Handle<JSFunction> main_fun_wrapper = runner.builder().WrapCode(f2.function_index()); - // Set first breakpoint on the GetLocal (offset 19) before the Call. - SetBreakpoint(runner, f2.function_index(), 19, 19); + // Set first breakpoint on the LocalGet (offset 19) before the Call. + SetBreakpoint(&runner, f2.function_index(), 19, 19); BreakHandler count_breaks(isolate, { - {19, BreakHandler::StepIn}, // GetLocal + {19, BreakHandler::StepIn}, // LocalGet {21, BreakHandler::StepIn}, // Call {1, BreakHandler::StepOut}, // in f2 {23, BreakHandler::Continue} // After Call @@ -377,7 +401,7 @@ WASM_COMPILED_EXEC_TEST(WasmGetLocalsAndStack) { // Set breakpoint at the first instruction (7 bytes for local decls: num // entries + 3x<count, type>). - SetBreakpoint(runner, runner.function_index(), 7, 7); + SetBreakpoint(&runner, runner.function_index(), 7, 7); CollectValuesBreakHandler break_handler( isolate, @@ -401,6 +425,104 @@ WASM_COMPILED_EXEC_TEST(WasmGetLocalsAndStack) { CHECK(!Execution::Call(isolate, main_fun_wrapper, global, 1, args).is_null()); } +WASM_COMPILED_EXEC_TEST(WasmRemoveBreakPoint) { + WasmRunner<int> runner(execution_tier); + Isolate* isolate = runner.main_isolate(); + + BUILD(runner, WASM_NOP, WASM_NOP, WASM_NOP, WASM_NOP, WASM_NOP, + WASM_I32V_1(14)); + + Handle<JSFunction> main_fun_wrapper = + runner.builder().WrapCode(runner.function_index()); + + SetBreakpoint(&runner, runner.function_index(), 1, 1); + SetBreakpoint(&runner, runner.function_index(), 2, 2); + Handle<BreakPoint> to_delete = + SetBreakpoint(&runner, runner.function_index(), 3, 3); + SetBreakpoint(&runner, runner.function_index(), 4, 4); + + BreakHandler count_breaks(isolate, {{1, BreakHandler::Continue}, + {2, BreakHandler::Continue, + [&runner, &to_delete]() { + ClearBreakpoint( + &runner, runner.function_index(), + 3, to_delete); + }}, + {4, BreakHandler::Continue}}); + + Handle<Object> global(isolate->context().global_object(), isolate); + MaybeHandle<Object> retval = + Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr); + CHECK(!retval.is_null()); + int result; + CHECK(retval.ToHandleChecked()->ToInt32(&result)); + CHECK_EQ(14, result); +} + +WASM_COMPILED_EXEC_TEST(WasmRemoveLastBreakPoint) { + WasmRunner<int> runner(execution_tier); + Isolate* isolate = runner.main_isolate(); + + BUILD(runner, WASM_NOP, WASM_NOP, WASM_NOP, WASM_NOP, WASM_NOP, + WASM_I32V_1(14)); + + Handle<JSFunction> main_fun_wrapper = + runner.builder().WrapCode(runner.function_index()); + + SetBreakpoint(&runner, runner.function_index(), 1, 1); + SetBreakpoint(&runner, runner.function_index(), 2, 2); + Handle<BreakPoint> to_delete = + SetBreakpoint(&runner, runner.function_index(), 3, 3); + + BreakHandler count_breaks( + isolate, {{1, BreakHandler::Continue}, + {2, BreakHandler::Continue, [&runner, &to_delete]() { + ClearBreakpoint(&runner, runner.function_index(), 3, + to_delete); + }}}); + + Handle<Object> global(isolate->context().global_object(), isolate); + MaybeHandle<Object> retval = + Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr); + CHECK(!retval.is_null()); + int result; + CHECK(retval.ToHandleChecked()->ToInt32(&result)); + CHECK_EQ(14, result); +} + +WASM_COMPILED_EXEC_TEST(WasmRemoveAllBreakPoint) { + WasmRunner<int> runner(execution_tier); + Isolate* isolate = runner.main_isolate(); + + BUILD(runner, WASM_NOP, WASM_NOP, WASM_NOP, WASM_NOP, WASM_NOP, + WASM_I32V_1(14)); + + Handle<JSFunction> main_fun_wrapper = + runner.builder().WrapCode(runner.function_index()); + + Handle<BreakPoint> bp1 = + SetBreakpoint(&runner, runner.function_index(), 1, 1); + Handle<BreakPoint> bp2 = + SetBreakpoint(&runner, runner.function_index(), 2, 2); + Handle<BreakPoint> bp3 = + SetBreakpoint(&runner, runner.function_index(), 3, 3); + + BreakHandler count_breaks( + isolate, {{1, BreakHandler::Continue, [&runner, &bp1, &bp2, &bp3]() { + ClearBreakpoint(&runner, runner.function_index(), 1, bp1); + ClearBreakpoint(&runner, runner.function_index(), 3, bp3); + ClearBreakpoint(&runner, runner.function_index(), 2, bp2); + }}}); + + Handle<Object> global(isolate->context().global_object(), isolate); + MaybeHandle<Object> retval = + Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr); + CHECK(!retval.is_null()); + int result; + CHECK(retval.ToHandleChecked()->ToInt32(&result)); + CHECK_EQ(14, result); +} + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc b/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc index 299c039698..15267215e1 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc @@ -22,10 +22,8 @@ std::shared_ptr<NativeModule> NewModule(Isolate* isolate) { std::shared_ptr<WasmModule> module(new WasmModule); bool can_request_more = false; size_t size = 16384; - auto native_module = isolate->wasm_engine()->NewNativeModule( + return isolate->wasm_engine()->NewNativeModule( isolate, kAllWasmFeatures, size, can_request_more, std::move(module)); - native_module->SetRuntimeStubs(isolate); - return native_module; } TEST(CacheHit) { diff --git a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc index 736475ff55..75e927fafe 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc @@ -32,28 +32,27 @@ namespace { template <typename T> class ArgPassingHelper { public: - ArgPassingHelper( - WasmRunnerBase& runner, // NOLINT(runtime/references) - WasmFunctionCompiler& inner_compiler, // NOLINT(runtime/references) - std::initializer_list<uint8_t> bytes_inner_function, - std::initializer_list<uint8_t> bytes_outer_function, - const T& expected_lambda) - : isolate_(runner.main_isolate()), + ArgPassingHelper(WasmRunnerBase* runner, WasmFunctionCompiler* inner_compiler, + std::initializer_list<uint8_t> bytes_inner_function, + std::initializer_list<uint8_t> bytes_outer_function, + const T& expected_lambda) + : isolate_(runner->main_isolate()), expected_lambda_(expected_lambda), debug_info_(WasmInstanceObject::GetOrCreateDebugInfo( - runner.builder().instance_object())) { + runner->builder().instance_object())) { std::vector<uint8_t> inner_code{bytes_inner_function}; - inner_compiler.Build(inner_code.data(), - inner_code.data() + inner_code.size()); + inner_compiler->Build(inner_code.data(), + inner_code.data() + inner_code.size()); std::vector<uint8_t> outer_code{bytes_outer_function}; - runner.Build(outer_code.data(), outer_code.data() + outer_code.size()); + runner->Build(outer_code.data(), outer_code.data() + outer_code.size()); - int funcs_to_redict[] = {static_cast<int>(inner_compiler.function_index())}; - runner.builder().SetExecutable(); + int funcs_to_redict[] = { + static_cast<int>(inner_compiler->function_index())}; + runner->builder().SetExecutable(); WasmDebugInfo::RedirectToInterpreter(debug_info_, ArrayVector(funcs_to_redict)); - main_fun_wrapper_ = runner.builder().WrapCode(runner.function_index()); + main_fun_wrapper_ = runner->builder().WrapCode(runner->function_index()); } template <typename... Args> @@ -82,8 +81,7 @@ class ArgPassingHelper { template <typename T> static ArgPassingHelper<T> GetHelper( - WasmRunnerBase& runner, // NOLINT(runtime/references) - WasmFunctionCompiler& inner_compiler, // NOLINT(runtime/references) + WasmRunnerBase* runner, WasmFunctionCompiler* inner_compiler, std::initializer_list<uint8_t> bytes_inner_function, std::initializer_list<uint8_t> bytes_outer_function, const T& expected_lambda) { @@ -99,7 +97,7 @@ TEST(TestArgumentPassing_int32) { WasmFunctionCompiler& f2 = runner.NewFunction<int32_t, int32_t>(); auto helper = GetHelper( - runner, f2, + &runner, &f2, {// Return 2*<0> + 1. WASM_I32_ADD(WASM_I32_MUL(WASM_I32V_1(2), WASM_GET_LOCAL(0)), WASM_ONE)}, {// Call f2 with param <0>. @@ -117,7 +115,7 @@ TEST(TestArgumentPassing_double_int64) { WasmFunctionCompiler& f2 = runner.NewFunction<double, int64_t>(); auto helper = GetHelper( - runner, f2, + &runner, &f2, {// Return (double)<0>. WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))}, {// Call f2 with param (<0> | (<1> << 32)). @@ -150,7 +148,7 @@ TEST(TestArgumentPassing_int64_double) { WasmFunctionCompiler& f2 = runner.NewFunction<int64_t, double>(); auto helper = GetHelper( - runner, f2, + &runner, &f2, {// Return (int64_t)<0>. WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))}, {// Call f2 with param <0>, convert returned value back to double. @@ -169,7 +167,7 @@ TEST(TestArgumentPassing_float_double) { WasmFunctionCompiler& f2 = runner.NewFunction<double, float>(); auto helper = GetHelper( - runner, f2, + &runner, &f2, {// Return 2*(double)<0> + 1. WASM_F64_ADD( WASM_F64_MUL(WASM_F64(2), WASM_F64_CONVERT_F32(WASM_GET_LOCAL(0))), @@ -186,7 +184,7 @@ TEST(TestArgumentPassing_double_double) { WasmRunner<double, double, double> runner(ExecutionTier::kTurbofan); WasmFunctionCompiler& f2 = runner.NewFunction<double, double, double>(); - auto helper = GetHelper(runner, f2, + auto helper = GetHelper(&runner, &f2, {// Return <0> + <1>. WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}, {// Call f2 with params <0>, <1>. @@ -208,7 +206,7 @@ TEST(TestArgumentPassing_AllTypes) { runner.NewFunction<double, int32_t, int64_t, float, double>(); auto helper = GetHelper( - runner, f2, + &runner, &f2, { // Convert all arguments to double, add them and return the sum. WASM_F64_ADD( // <0+1+2> + <3> diff --git a/deps/v8/test/cctest/wasm/test-wasm-serialization.cc b/deps/v8/test/cctest/wasm/test-wasm-serialization.cc index 1ff2a899ad..c6486650ef 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-serialization.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-serialization.cc @@ -11,7 +11,6 @@ #include "src/utils/version.h" #include "src/wasm/module-decoder.h" #include "src/wasm/wasm-engine.h" -#include "src/wasm/wasm-memory.h" #include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-objects-inl.h" @@ -272,9 +271,8 @@ TEST(BlockWasmCodeGenAtDeserialization) { Cleanup(); } -namespace { - -void TestTransferrableWasmModules(bool should_share) { +UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { + FlagScope<bool> flag_scope_engine(&FLAG_wasm_shared_engine, true); i::wasm::WasmEngine::InitializeOncePerProcess(); v8::internal::AccountingAllocator allocator; Zone zone(&allocator, ZONE_NAME); @@ -285,7 +283,7 @@ void TestTransferrableWasmModules(bool should_share) { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* from_isolate = v8::Isolate::New(create_params); - std::vector<v8::WasmModuleObject::TransferrableModule> store; + std::vector<v8::CompiledWasmModule> store; std::shared_ptr<NativeModule> original_native_module; { v8::HandleScope scope(from_isolate); @@ -293,7 +291,7 @@ void TestTransferrableWasmModules(bool should_share) { Isolate* from_i_isolate = reinterpret_cast<Isolate*>(from_isolate); testing::SetupIsolateForWasmModule(from_i_isolate); - ErrorThrower thrower(from_i_isolate, "TestTransferrableWasmModules"); + ErrorThrower thrower(from_i_isolate, "TestCompiledWasmModulesTransfer"); auto enabled_features = WasmFeaturesFromIsolate(from_i_isolate); MaybeHandle<WasmModuleObject> maybe_module_object = from_i_isolate->wasm_engine()->SyncCompile( @@ -304,7 +302,7 @@ void TestTransferrableWasmModules(bool should_share) { v8::Local<v8::WasmModuleObject> v8_module = v8::Local<v8::WasmModuleObject>::Cast( v8::Utils::ToLocal(Handle<JSObject>::cast(module_object))); - store.push_back(v8_module->GetTransferrableModule()); + store.push_back(v8_module->GetCompiledModule()); original_native_module = module_object->shared_native_module(); } @@ -315,14 +313,13 @@ void TestTransferrableWasmModules(bool should_share) { LocalContext env(to_isolate); v8::MaybeLocal<v8::WasmModuleObject> transferred_module = - v8::WasmModuleObject::FromTransferrableModule(to_isolate, store[0]); + v8::WasmModuleObject::FromCompiledModule(to_isolate, store[0]); CHECK(!transferred_module.IsEmpty()); Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast( v8::Utils::OpenHandle(*transferred_module.ToLocalChecked())); std::shared_ptr<NativeModule> transferred_native_module = module_object->shared_native_module(); - bool is_sharing = (original_native_module == transferred_native_module); - CHECK_EQ(should_share, is_sharing); + CHECK_EQ(original_native_module, transferred_native_module); } to_isolate->Dispose(); } @@ -330,19 +327,6 @@ void TestTransferrableWasmModules(bool should_share) { from_isolate->Dispose(); } -} // namespace - -UNINITIALIZED_TEST(TransferrableWasmModulesCloned) { - FlagScope<bool> flag_scope_code(&FLAG_wasm_shared_code, false); - TestTransferrableWasmModules(false); -} - -UNINITIALIZED_TEST(TransferrableWasmModulesShared) { - FlagScope<bool> flag_scope_engine(&FLAG_wasm_shared_engine, true); - FlagScope<bool> flag_scope_code(&FLAG_wasm_shared_code, true); - TestTransferrableWasmModules(true); -} - #undef EMIT_CODE_WITH_END } // namespace test_wasm_serialization diff --git a/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc b/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc index b5bacf57d4..2d6e930397 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc @@ -27,7 +27,7 @@ namespace test_wasm_shared_engine { class SharedEngine { public: explicit SharedEngine(size_t max_committed = kMaxWasmCodeMemory) - : wasm_engine_(base::make_unique<WasmEngine>()) {} + : wasm_engine_(std::make_unique<WasmEngine>()) {} ~SharedEngine() { // Ensure no remaining uses exist. CHECK(wasm_engine_.unique()); @@ -112,19 +112,19 @@ class SharedEngineIsolate { class SharedEngineThread : public v8::base::Thread { public: SharedEngineThread(SharedEngine* engine, - std::function<void(SharedEngineIsolate&)> callback) + std::function<void(SharedEngineIsolate*)> callback) : Thread(Options("SharedEngineThread")), engine_(engine), callback_(callback) {} void Run() override { SharedEngineIsolate isolate(engine_); - callback_(isolate); + callback_(&isolate); } private: SharedEngine* engine_; - std::function<void(SharedEngineIsolate&)> callback_; + std::function<void(SharedEngineIsolate*)> callback_; }; namespace { @@ -159,43 +159,39 @@ class MockInstantiationResolver : public InstantiationResultResolver { class MockCompilationResolver : public CompilationResultResolver { public: - MockCompilationResolver( - SharedEngineIsolate& isolate, // NOLINT(runtime/references) - Handle<Object>* out_instance) + MockCompilationResolver(SharedEngineIsolate* isolate, + Handle<Object>* out_instance) : isolate_(isolate), out_instance_(out_instance) {} void OnCompilationSucceeded(Handle<WasmModuleObject> result) override { - isolate_.isolate()->wasm_engine()->AsyncInstantiate( - isolate_.isolate(), - base::make_unique<MockInstantiationResolver>(out_instance_), result, - {}); + isolate_->isolate()->wasm_engine()->AsyncInstantiate( + isolate_->isolate(), + std::make_unique<MockInstantiationResolver>(out_instance_), result, {}); } void OnCompilationFailed(Handle<Object> error_reason) override { UNREACHABLE(); } private: - SharedEngineIsolate& isolate_; + SharedEngineIsolate* isolate_; Handle<Object>* out_instance_; }; -void PumpMessageLoop( - SharedEngineIsolate& isolate) { // NOLINT(runtime/references) +void PumpMessageLoop(SharedEngineIsolate* isolate) { v8::platform::PumpMessageLoop(i::V8::GetCurrentPlatform(), - isolate.v8_isolate(), + isolate->v8_isolate(), platform::MessageLoopBehavior::kWaitForWork); - isolate.isolate()->default_microtask_queue()->RunMicrotasks( - isolate.isolate()); + isolate->isolate()->default_microtask_queue()->RunMicrotasks( + isolate->isolate()); } Handle<WasmInstanceObject> CompileAndInstantiateAsync( - SharedEngineIsolate& isolate, // NOLINT(runtime/references) - ZoneBuffer* buffer) { - Handle<Object> maybe_instance = handle(Smi::kZero, isolate.isolate()); - auto enabled_features = WasmFeaturesFromIsolate(isolate.isolate()); + SharedEngineIsolate* isolate, ZoneBuffer* buffer) { + Handle<Object> maybe_instance = handle(Smi::kZero, isolate->isolate()); + auto enabled_features = WasmFeaturesFromIsolate(isolate->isolate()); constexpr const char* kAPIMethodName = "Test.CompileAndInstantiateAsync"; - isolate.isolate()->wasm_engine()->AsyncCompile( - isolate.isolate(), enabled_features, - base::make_unique<MockCompilationResolver>(isolate, &maybe_instance), + isolate->isolate()->wasm_engine()->AsyncCompile( + isolate->isolate(), enabled_features, + std::make_unique<MockCompilationResolver>(isolate, &maybe_instance), ModuleWireBytes(buffer->begin(), buffer->end()), true, kAPIMethodName); while (!maybe_instance->IsWasmInstanceObject()) PumpMessageLoop(isolate); Handle<WasmInstanceObject> instance = @@ -261,17 +257,19 @@ TEST(SharedEngineRunImported) { TEST(SharedEngineRunThreadedBuildingSync) { SharedEngine engine; - SharedEngineThread thread1(&engine, [](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 23); - Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer); - CHECK_EQ(23, isolate.Run(instance)); + SharedEngineThread thread1(&engine, [](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + ZoneBuffer* buffer = BuildReturnConstantModule(isolate->zone(), 23); + Handle<WasmInstanceObject> instance = + isolate->CompileAndInstantiate(buffer); + CHECK_EQ(23, isolate->Run(instance)); }); - SharedEngineThread thread2(&engine, [](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 42); - Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer); - CHECK_EQ(42, isolate.Run(instance)); + SharedEngineThread thread2(&engine, [](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + ZoneBuffer* buffer = BuildReturnConstantModule(isolate->zone(), 42); + Handle<WasmInstanceObject> instance = + isolate->CompileAndInstantiate(buffer); + CHECK_EQ(42, isolate->Run(instance)); }); CHECK(thread1.Start()); CHECK(thread2.Start()); @@ -281,19 +279,19 @@ TEST(SharedEngineRunThreadedBuildingSync) { TEST(SharedEngineRunThreadedBuildingAsync) { SharedEngine engine; - SharedEngineThread thread1(&engine, [](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 23); + SharedEngineThread thread1(&engine, [](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + ZoneBuffer* buffer = BuildReturnConstantModule(isolate->zone(), 23); Handle<WasmInstanceObject> instance = CompileAndInstantiateAsync(isolate, buffer); - CHECK_EQ(23, isolate.Run(instance)); + CHECK_EQ(23, isolate->Run(instance)); }); - SharedEngineThread thread2(&engine, [](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 42); + SharedEngineThread thread2(&engine, [](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + ZoneBuffer* buffer = BuildReturnConstantModule(isolate->zone(), 42); Handle<WasmInstanceObject> instance = CompileAndInstantiateAsync(isolate, buffer); - CHECK_EQ(42, isolate.Run(instance)); + CHECK_EQ(42, isolate->Run(instance)); }); CHECK(thread1.Start()); CHECK(thread2.Start()); @@ -311,15 +309,15 @@ TEST(SharedEngineRunThreadedExecution) { Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer); module = isolate.ExportInstance(instance); } - SharedEngineThread thread1(&engine, [module](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - Handle<WasmInstanceObject> instance = isolate.ImportInstance(module); - CHECK_EQ(23, isolate.Run(instance)); + SharedEngineThread thread1(&engine, [module](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + Handle<WasmInstanceObject> instance = isolate->ImportInstance(module); + CHECK_EQ(23, isolate->Run(instance)); }); - SharedEngineThread thread2(&engine, [module](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - Handle<WasmInstanceObject> instance = isolate.ImportInstance(module); - CHECK_EQ(23, isolate.Run(instance)); + SharedEngineThread thread2(&engine, [module](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + Handle<WasmInstanceObject> instance = isolate->ImportInstance(module); + CHECK_EQ(23, isolate->Run(instance)); }); CHECK(thread1.Start()); CHECK(thread2.Start()); @@ -340,23 +338,23 @@ TEST(SharedEngineRunThreadedTierUp) { constexpr int kNumberOfThreads = 5; std::list<SharedEngineThread> threads; for (int i = 0; i < kNumberOfThreads; ++i) { - threads.emplace_back(&engine, [module](SharedEngineIsolate& isolate) { + threads.emplace_back(&engine, [module](SharedEngineIsolate* isolate) { constexpr int kNumberOfIterations = 100; - HandleScope scope(isolate.isolate()); - Handle<WasmInstanceObject> instance = isolate.ImportInstance(module); + HandleScope scope(isolate->isolate()); + Handle<WasmInstanceObject> instance = isolate->ImportInstance(module); for (int j = 0; j < kNumberOfIterations; ++j) { - CHECK_EQ(23, isolate.Run(instance)); + CHECK_EQ(23, isolate->Run(instance)); } }); } - threads.emplace_back(&engine, [module](SharedEngineIsolate& isolate) { - HandleScope scope(isolate.isolate()); - Handle<WasmInstanceObject> instance = isolate.ImportInstance(module); + threads.emplace_back(&engine, [module](SharedEngineIsolate* isolate) { + HandleScope scope(isolate->isolate()); + Handle<WasmInstanceObject> instance = isolate->ImportInstance(module); WasmFeatures detected = kNoWasmFeatures; WasmCompilationUnit::CompileWasmFunction( - isolate.isolate(), module.get(), &detected, + isolate->isolate(), module.get(), &detected, &module->module()->functions[0], ExecutionTier::kTurbofan); - CHECK_EQ(23, isolate.Run(instance)); + CHECK_EQ(23, isolate->Run(instance)); }); for (auto& thread : threads) CHECK(thread.Start()); for (auto& thread : threads) thread.Join(); diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc index 528d71f53c..09d64e5d97 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc @@ -10,7 +10,6 @@ #include "src/wasm/graph-builder-interface.h" #include "src/wasm/module-compiler.h" #include "src/wasm/wasm-import-wrapper-cache.h" -#include "src/wasm/wasm-memory.h" #include "src/wasm/wasm-objects-inl.h" namespace v8 { @@ -75,29 +74,23 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size, SharedFlag shared) { CHECK_NULL(mem_start_); CHECK_EQ(0, mem_size_); DCHECK(!instance_object_->has_memory_object()); - DCHECK_IMPLIES(test_module_->origin == kWasmOrigin, - size % kWasmPageSize == 0); + uint32_t initial_pages = RoundUp(size, kWasmPageSize) / kWasmPageSize; + uint32_t maximum_pages = (test_module_->maximum_pages != 0) + ? test_module_->maximum_pages + : initial_pages; test_module_->has_memory = true; - uint32_t max_size = - (test_module_->maximum_pages != 0) ? test_module_->maximum_pages : size; - uint32_t alloc_size = RoundUp(size, kWasmPageSize); - Handle<JSArrayBuffer> new_buffer; - if (shared == SharedFlag::kShared) { - CHECK(NewSharedArrayBuffer(isolate_, alloc_size, max_size) - .ToHandle(&new_buffer)); - } else { - CHECK(NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer)); - } - CHECK(!new_buffer.is_null()); - mem_start_ = reinterpret_cast<byte*>(new_buffer->backing_store()); - mem_size_ = size; - CHECK(size == 0 || mem_start_); - memset(mem_start_, 0, size); // Create the WasmMemoryObject. Handle<WasmMemoryObject> memory_object = - WasmMemoryObject::New(isolate_, new_buffer, max_size); + WasmMemoryObject::New(isolate_, initial_pages, maximum_pages, shared) + .ToHandleChecked(); instance_object_->set_memory_object(*memory_object); + + mem_start_ = + reinterpret_cast<byte*>(memory_object->array_buffer().backing_store()); + mem_size_ = size; + CHECK(size == 0 || mem_start_); + WasmMemoryObject::AddInstance(isolate_, memory_object, instance_object_); // TODO(wasm): Delete the following two lines when test-run-wasm will use a // multiple of kPageSize as memory size. At the moment, the effect of these @@ -328,7 +321,6 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() { auto native_module = isolate_->wasm_engine()->NewNativeModule( isolate_, enabled_features_, test_module_); native_module->SetWireBytes(OwnedVector<const uint8_t>()); - native_module->SetRuntimeStubs(isolate_); Handle<WasmModuleObject> module_object = WasmModuleObject::New(isolate_, std::move(native_module), script); @@ -487,7 +479,7 @@ Handle<Code> WasmFunctionWrapper::GetWrapperCode() { CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); OFStream os(tracing_scope.file()); - code->Disassemble("wasm wrapper", os); + code->Disassemble("wasm wrapper", os, isolate); } #endif } diff --git a/deps/v8/test/common/assembler-tester.h b/deps/v8/test/common/assembler-tester.h index 4c3d8ff618..17e376ef60 100644 --- a/deps/v8/test/common/assembler-tester.h +++ b/deps/v8/test/common/assembler-tester.h @@ -5,6 +5,8 @@ #ifndef V8_TEST_COMMON_ASSEMBLER_TESTER_H_ #define V8_TEST_COMMON_ASSEMBLER_TESTER_H_ +#include <memory> + #include "src/codegen/assembler.h" #include "src/codegen/code-desc.h" @@ -74,7 +76,7 @@ class TestingAssemblerBuffer : public AssemblerBuffer { static inline std::unique_ptr<TestingAssemblerBuffer> AllocateAssemblerBuffer( size_t requested = v8::internal::AssemblerBase::kMinimalBufferSize, void* address = nullptr) { - return base::make_unique<TestingAssemblerBuffer>(requested, address); + return std::make_unique<TestingAssemblerBuffer>(requested, address); } } // namespace internal diff --git a/deps/v8/test/common/wasm/wasm-macro-gen.h b/deps/v8/test/common/wasm/wasm-macro-gen.h index ed20641c65..d007fbd002 100644 --- a/deps/v8/test/common/wasm/wasm-macro-gen.h +++ b/deps/v8/test/common/wasm/wasm-macro-gen.h @@ -27,12 +27,14 @@ #define ACTIVE_NO_INDEX 0 #define PASSIVE 1 #define ACTIVE_WITH_INDEX 2 +#define PASSIVE_WITH_ELEMENTS 5 +#define ACTIVE_WITH_ELEMENTS 6 // The table index field in an element segment was repurposed as a flags field. // To specify a table index, we have to set the flag value to 2, followed by // the table index. -#define TABLE_INDEX0 U32V_1(ACTIVE_NO_INDEX) -#define TABLE_INDEX(v) U32V_1(ACTIVE_WITH_INDEX), U32V_1(v) +#define TABLE_INDEX0 static_cast<byte>(ACTIVE_NO_INDEX) +#define TABLE_INDEX(v) static_cast<byte>(ACTIVE_WITH_INDEX), U32V_1(v) #define ZERO_ALIGNMENT 0 #define ZERO_OFFSET 0 @@ -361,13 +363,13 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { #define WASM_REF_FUNC(val) kExprRefFunc, val #define WASM_REF_IS_NULL(val) val, kExprRefIsNull -#define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) -#define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index) -#define WASM_TEE_LOCAL(index, val) val, kExprTeeLocal, static_cast<byte>(index) +#define WASM_GET_LOCAL(index) kExprLocalGet, static_cast<byte>(index) +#define WASM_SET_LOCAL(index, val) val, kExprLocalSet, static_cast<byte>(index) +#define WASM_TEE_LOCAL(index, val) val, kExprLocalTee, static_cast<byte>(index) #define WASM_DROP kExprDrop -#define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index) +#define WASM_GET_GLOBAL(index) kExprGlobalGet, static_cast<byte>(index) #define WASM_SET_GLOBAL(index, val) \ - val, kExprSetGlobal, static_cast<byte>(index) + val, kExprGlobalSet, static_cast<byte>(index) #define WASM_TABLE_GET(table_index, index) \ index, kExprTableGet, static_cast<byte>(table_index) #define WASM_TABLE_SET(table_index, index, val) \ @@ -442,15 +444,15 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \ kExprEnd, kExprEnd #define WASM_INC_LOCAL(index) \ - kExprGetLocal, static_cast<byte>(index), kExprI32Const, 1, kExprI32Add, \ - kExprTeeLocal, static_cast<byte>(index) + kExprLocalGet, static_cast<byte>(index), kExprI32Const, 1, kExprI32Add, \ + kExprLocalTee, static_cast<byte>(index) #define WASM_INC_LOCAL_BYV(index, count) \ - kExprGetLocal, static_cast<byte>(index), kExprI32Const, \ - static_cast<byte>(count), kExprI32Add, kExprTeeLocal, \ + kExprLocalGet, static_cast<byte>(index), kExprI32Const, \ + static_cast<byte>(count), kExprI32Add, kExprLocalTee, \ static_cast<byte>(index) #define WASM_INC_LOCAL_BY(index, count) \ - kExprGetLocal, static_cast<byte>(index), kExprI32Const, \ - static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ + kExprLocalGet, static_cast<byte>(index), kExprI32Const, \ + static_cast<byte>(count), kExprI32Add, kExprLocalSet, \ static_cast<byte>(index) #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) diff --git a/deps/v8/test/debugger/debug/debug-evaluate-shadowed-context-3.js b/deps/v8/test/debugger/debug/debug-evaluate-shadowed-context-3.js new file mode 100644 index 0000000000..2a41109565 --- /dev/null +++ b/deps/v8/test/debugger/debug/debug-evaluate-shadowed-context-3.js @@ -0,0 +1,39 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test that debug-evaluate properly shadows stack-allocated variables. + +Debug = debug.Debug + +let exception = null; +function listener(event, exec_state, event_data, data) { + if (event != Debug.DebugEvent.Break) return; + try { + assertEquals(2, exec_state.frame(0).evaluate("b").value()); + assertEquals(3, exec_state.frame(0).evaluate("c").value()) + assertThrows(() => exec_state.frame(0).evaluate("a").value()); + } catch (e) { + exception = e; + print(e + e.stack); + } +} + +Debug.setListener(listener); + +(function f() { + let a = 1; + let b = 2; + let c = 3; + () => a + c; // a and c are context-allocated + return function g() { + let a = 2; // a is stack-allocated + return function h() { + b; // b is allocated onto f's context. + debugger; + } + } +})()()(); + +Debug.setListener(null); +assertNull(exception); diff --git a/deps/v8/test/debugger/debug/es6/generators-relocation.js b/deps/v8/test/debugger/debug/es6/generators-relocation.js index 78413fde6e..13ebb01d0f 100644 --- a/deps/v8/test/debugger/debug/es6/generators-relocation.js +++ b/deps/v8/test/debugger/debug/es6/generators-relocation.js @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --expose-gc var Debug = debug.Debug; @@ -28,6 +29,8 @@ function RunTest(formals_and_body, args, value1, value2) { // function and relocation of the suspended generator activation. Debug.setListener(listener); + gc(); + // Add a breakpoint on line 3 (the second yield). var bp = Debug.setBreakPoint(gen, 3); diff --git a/deps/v8/test/debugger/debugger.status b/deps/v8/test/debugger/debugger.status index 503e5e7145..85e4cec3ee 100644 --- a/deps/v8/test/debugger/debugger.status +++ b/deps/v8/test/debugger/debugger.status @@ -11,6 +11,9 @@ # not work, but we expect it to not crash. 'debug/debug-step-turbofan': [PASS, FAIL], + # BUG (v8:9721) + 'debug/es6/generators-relocation': [FAIL], + # Issue 3641: The new 'then' semantics suppress some exceptions. # These tests may be changed or removed when 'chain' is deprecated. 'debug/es6/debug-promises/reject-with-throw-in-reject': [FAIL], @@ -136,4 +139,10 @@ '*': [SKIP], }], # variant == jitless and not embedded_builtins +############################################################################## +['variant == turboprop', { + # Deopts differently than TurboFan. + 'debug/debug-optimize': [SKIP], +}], # variant == turboprop + ] diff --git a/deps/v8/test/debugger/regress/regress-9482.js b/deps/v8/test/debugger/regress/regress-9482.js new file mode 100644 index 0000000000..e07c660a08 --- /dev/null +++ b/deps/v8/test/debugger/regress/regress-9482.js @@ -0,0 +1,32 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Debug = debug.Debug +var exception = null; + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + assertEquals("n", exec_state.frame(0).evaluate("n").value()); + assertEquals("m", exec_state.frame(0).evaluate("m").value()); + } + } catch(e) { + exception = e; + print(e, e.stack); + } +}; + +Debug.setListener(listener); + +(function foo () { + var n = "n"; + var m = "m"; + (function bar() { + assertEquals("m", eval("m")); // force context-allocation. + debugger; + })(); +})(); + +assertNull(exception); +Debug.setListener(null); diff --git a/deps/v8/test/fuzzer/fuzzer-support.cc b/deps/v8/test/fuzzer/fuzzer-support.cc index 5d6861dd62..6235ea5f82 100644 --- a/deps/v8/test/fuzzer/fuzzer-support.cc +++ b/deps/v8/test/fuzzer/fuzzer-support.cc @@ -63,7 +63,7 @@ std::unique_ptr<FuzzerSupport> FuzzerSupport::fuzzer_support_; void FuzzerSupport::InitializeFuzzerSupport(int* argc, char*** argv) { DCHECK_NULL(FuzzerSupport::fuzzer_support_); FuzzerSupport::fuzzer_support_ = - v8::base::make_unique<v8_fuzzer::FuzzerSupport>(argc, argv); + std::make_unique<v8_fuzzer::FuzzerSupport>(argc, argv); } // static diff --git a/deps/v8/test/fuzzer/fuzzer-support.h b/deps/v8/test/fuzzer/fuzzer-support.h index 229c8c6b49..7b967073b5 100644 --- a/deps/v8/test/fuzzer/fuzzer-support.h +++ b/deps/v8/test/fuzzer/fuzzer-support.h @@ -5,6 +5,8 @@ #ifndef TEST_FUZZER_FUZZER_SUPPORT_H_ #define TEST_FUZZER_FUZZER_SUPPORT_H_ +#include <memory> + #include "include/libplatform/libplatform.h" #include "include/v8.h" diff --git a/deps/v8/test/fuzzer/wasm-compile.cc b/deps/v8/test/fuzzer/wasm-compile.cc index 29f2ebb02d..10e41e1039 100644 --- a/deps/v8/test/fuzzer/wasm-compile.cc +++ b/deps/v8/test/fuzzer/wasm-compile.cc @@ -322,7 +322,7 @@ class WasmGenerator { return Generate<wanted_type>(data); } - if (opcode != kExprGetLocal) Generate(local.type, data); + if (opcode != kExprLocalGet) Generate(local.type, data); builder_->EmitWithU32V(opcode, local.index); if (wanted_type != kWasmStmt && local.type != wanted_type) { Convert(local.type, wanted_type); @@ -332,14 +332,14 @@ class WasmGenerator { template <ValueType wanted_type> void get_local(DataRange* data) { static_assert(wanted_type != kWasmStmt, "illegal type"); - local_op<wanted_type>(data, kExprGetLocal); + local_op<wanted_type>(data, kExprLocalGet); } - void set_local(DataRange* data) { local_op<kWasmStmt>(data, kExprSetLocal); } + void set_local(DataRange* data) { local_op<kWasmStmt>(data, kExprLocalSet); } template <ValueType wanted_type> void tee_local(DataRange* data) { - local_op<wanted_type>(data, kExprTeeLocal); + local_op<wanted_type>(data, kExprLocalTee); } template <size_t num_bytes> @@ -377,7 +377,7 @@ class WasmGenerator { } if (is_set) Generate(global.type, data); - builder_->EmitWithU32V(is_set ? kExprSetGlobal : kExprGetGlobal, + builder_->EmitWithU32V(is_set ? kExprGlobalSet : kExprGlobalGet, global.index); if (!is_set && global.type != wanted_type) { Convert(global.type, wanted_type); @@ -465,7 +465,7 @@ class WasmGenerator { template <ValueType T1, ValueType T2, ValueType... Ts> void Generate(DataRange* data) { - // TODO(clemensh): Implement a more even split. + // TODO(clemensb): Implement a more even split. auto first_data = data->split(); Generate<T1>(&first_data); Generate<T2, Ts...>(data); diff --git a/deps/v8/test/fuzzer/wasm-fuzzer-common.h b/deps/v8/test/fuzzer/wasm-fuzzer-common.h index 8ab802a702..bca9a2c433 100644 --- a/deps/v8/test/fuzzer/wasm-fuzzer-common.h +++ b/deps/v8/test/fuzzer/wasm-fuzzer-common.h @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <memory> #include "src/wasm/module-decoder.h" #include "src/wasm/wasm-interpreter.h" diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js index dc96406d4a..0541ce02bb 100644 --- a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js @@ -11,14 +11,14 @@ utils.load('test/mjsunit/wasm/wasm-module-builder.js'); var builder = new WasmModuleBuilder(); builder.addFunction('fib', kSig_i_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32LeS, // i < 2 ? kExprBrIf, 0, // --> return i kExprI32Const, 1, kExprI32Sub, // i - 1 kExprCallFunction, 0, // fib(i - 1) - kExprGetLocal, 0, kExprI32Const, 2, kExprI32Sub, // i - 2 + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Sub, // i - 2 kExprCallFunction, 0, // fib(i - 2) kExprI32Add ]) diff --git a/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt b/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt index 4be4e96efe..28708d7950 100644 --- a/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt @@ -110,26 +110,6 @@ Running test: testScopesPaused } [1] : { endLocation : { - columnNumber : 3 - lineNumber : 15 - scriptId : <scriptId> - } - name : run - object : { - className : Object - description : Object - objectId : <objectId> - type : object - } - startLocation : { - columnNumber : 9 - lineNumber : 11 - scriptId : <scriptId> - } - type : block - } - [2] : { - endLocation : { columnNumber : 1 lineNumber : 19 scriptId : <scriptId> @@ -148,7 +128,7 @@ Running test: testScopesPaused } type : local } - [3] : { + [2] : { object : { className : global description : global diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt b/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt index 012ab4b0b9..4fb08f6319 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt +++ b/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt @@ -30,13 +30,6 @@ paused at: paused at: debugger; - Promise.resolve().#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.resolve().then(v => v #* 2); } @@ -54,13 +47,6 @@ paused at: paused at: debugger; - p.#then(v => v * 2); - resolveCallback(); - -asyncCallStackTraceId is set - -paused at: - debugger; p.then(v => v #* 2); resolveCallback(); @@ -78,13 +64,6 @@ paused at: paused at: debugger; - Promise.resolve().#then(v => v * 2); - Promise.resolve().then(v => v * 4); - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.resolve().then(v => v #* 2); Promise.resolve().then(v => v * 4); @@ -107,13 +86,6 @@ paused at: paused at: Promise.resolve().then(v => v * 2); - Promise.resolve().#then(v => v * 4); -} - -asyncCallStackTraceId is set - -paused at: - Promise.resolve().then(v => v * 2); Promise.resolve().then(v => v #* 4); } @@ -130,13 +102,6 @@ paused at: debugger; paused at: - debugger; - Promise.resolve().#then(v => v * 2); - debugger; - -asyncCallStackTraceId is set - -paused at: Promise.resolve().then(v => v * 2); #debugger; Promise.resolve().then(v => v * 4); @@ -148,13 +113,6 @@ paused at: paused at: debugger; - Promise.resolve().#then(v => v * 4); -} - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.resolve().then(v => v #* 4); } @@ -172,13 +130,6 @@ paused at: paused at: debugger; - Promise.all([ Promise.resolve(), Promise.resolve() ]).#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.all([ Promise.resolve(), Promise.resolve() ]).then(v => v #* 2); } @@ -196,13 +147,6 @@ paused at: paused at: debugger; - createPromise().#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; createPromise().then(v => v #* 2); } @@ -220,13 +164,6 @@ paused at: paused at: debugger; - createPromise().#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; createPromise().then(v => v #* 2); } @@ -273,13 +210,6 @@ paused at: paused at: - await foo(); - foo().#then(boo); - - -asyncCallStackTraceId is set - -paused at: function boo() { #} } diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js b/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js index be26bc11de..716d860f08 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js +++ b/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js @@ -12,9 +12,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -26,9 +23,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - await Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); @@ -43,9 +37,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); await InspectorTest.waitForPendingTasks(); @@ -57,9 +48,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -69,20 +57,14 @@ InspectorTest.runAsyncTestSuite([ Protocol.Runtime.evaluate({expression: 'setTimeout(() => 42, 0)'}); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); } ]); async function waitPauseAndDumpLocation() { - var {params: {callFrames, asyncCallStackTraceId}} = + var {params: {callFrames}} = await Protocol.Debugger.oncePaused(); - if (!asyncCallStackTraceId) { - InspectorTest.log('paused at:'); - await session.logSourceLocation(callFrames[0].location); - } - return asyncCallStackTraceId; + InspectorTest.log('paused at:'); + await session.logSourceLocation(callFrames[0].location); } diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call.js b/deps/v8/test/inspector/debugger/pause-on-async-call.js index 24e7fc6647..c6104a1ae2 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call.js +++ b/deps/v8/test/inspector/debugger/pause-on-async-call.js @@ -90,9 +90,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -103,9 +100,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -116,9 +110,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepInto(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -131,9 +122,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -144,16 +132,10 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -164,9 +146,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -178,9 +157,6 @@ InspectorTest.runAsyncTestSuite([ await waitPauseAndDumpLocation(); await Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js'] }); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -192,9 +168,6 @@ InspectorTest.runAsyncTestSuite([ await waitPauseAndDumpLocation(); await Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -205,17 +178,11 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - if (parentStackTraceId) - InspectorTest.log( - 'ERROR: we should not report parent stack trace id on async call'); + await waitPauseAndDumpLocation(); Protocol.Debugger.stepOut(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - parentStackTraceId = await waitPauseAndDumpLocation(); - if (parentStackTraceId) - InspectorTest.log( - 'ERROR: we should not report parent stack trace id on async call'); + await waitPauseAndDumpLocation(); Protocol.Debugger.stepOut(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); @@ -223,9 +190,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOut(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); @@ -233,12 +197,8 @@ InspectorTest.runAsyncTestSuite([ ]); async function waitPauseAndDumpLocation() { - var {params: {callFrames, asyncCallStackTraceId}} = + var {params: {callFrames}} = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); await session.logSourceLocation(callFrames[0].location); - if (asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is set\n'); - } - return asyncCallStackTraceId; } diff --git a/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt b/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt index 5f61c89c1a..72f896567f 100644 --- a/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt @@ -1,13 +1,7 @@ Test for Debugger.stepInto with breakOnAsyncCall. Running test: testSetTimeout -(anonymous) (test.js:0:0) -asyncCallStackTraceId is set (anonymous) (test.js:0:17) -asyncCallStackTraceId is empty Running test: testPromiseThen -(anonymous) (test.js:0:2) -asyncCallStackTraceId is set (anonymous) (test.js:0:13) -asyncCallStackTraceId is empty diff --git a/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js b/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js index d47df9f7eb..417f4a3936 100644 --- a/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js +++ b/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js @@ -17,21 +17,8 @@ InspectorTest.runAsyncTestSuite([ }); await pausedPromise; Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {callFrames, asyncCallStackTraceId}} = - await Protocol.Debugger.oncePaused(); + let {params: {callFrames}} = await Protocol.Debugger.oncePaused(); session.logCallFrames(callFrames); - if (asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is set'); - } - Protocol.Debugger.pauseOnAsyncCall( - {parentStackTraceId: asyncCallStackTraceId}); - pausedPromise = Protocol.Debugger.oncePaused(); - Protocol.Debugger.resume(); - ({params: {callFrames, asyncCallStackTraceId}} = await pausedPromise); - session.logCallFrames(callFrames); - if (!asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is empty'); - } await Protocol.Debugger.disable(); }, @@ -45,21 +32,8 @@ InspectorTest.runAsyncTestSuite([ Protocol.Runtime.evaluate({expression: 'p.then(() => 42)//# sourceURL=test.js'}); await pausedPromise; Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {callFrames, asyncCallStackTraceId}} = - await Protocol.Debugger.oncePaused(); - session.logCallFrames(callFrames); - if (asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is set'); - } - Protocol.Debugger.pauseOnAsyncCall( - {parentStackTraceId: asyncCallStackTraceId}); - pausedPromise = Protocol.Debugger.oncePaused(); - Protocol.Debugger.resume(); - ({params: {callFrames, asyncCallStackTraceId}} = await pausedPromise); + let {params: {callFrames}} = await Protocol.Debugger.oncePaused(); session.logCallFrames(callFrames); - if (!asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is empty'); - } await Protocol.Debugger.disable(); } ]); diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt b/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt index 8bf702b355..ce82054f06 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt @@ -2,7 +2,6 @@ Test for step-into remote async task Setup debugger agents.. Pause before stack trace is captured.. Run stepInto with breakOnAsyncCall flag -Call pauseOnAsyncCall Trigger external async task on another context group Dump stack trace boo (target.js:1:22) diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt index 4b2fba9856..ba93facf00 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt @@ -2,7 +2,6 @@ Test for step-into remote async task. Setup debugger agents.. Pause before stack trace is captured.. Run stepInto with breakOnAsyncCall flag -Call pauseOnAsyncCall Trigger external async task on another context group Dump stack trace boo (target.js:1:22) diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js index fec786422e..132c0690f1 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js @@ -42,13 +42,6 @@ session.setupScriptMap(); InspectorTest.log('Run stepInto with breakOnAsyncCall flag'); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {asyncCallStackTraceId}} = await Protocol.Debugger.oncePaused(); - - InspectorTest.log('Call pauseOnAsyncCall'); - Protocol.Debugger.pauseOnAsyncCall({ - parentStackTraceId: asyncCallStackTraceId, - }); - Protocol.Debugger.resume(); InspectorTest.log('Trigger external async task on another context group'); let stackTraceId = (await evaluatePromise).result.result.value; diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task.js b/deps/v8/test/inspector/debugger/step-into-external-async-task.js index b0d55c950d..59b78c1630 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task.js +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task.js @@ -62,13 +62,6 @@ session2.setupScriptMap(); InspectorTest.log('Run stepInto with breakOnAsyncCall flag'); Protocol1.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {asyncCallStackTraceId}} = await Protocol1.Debugger.oncePaused(); - - InspectorTest.log('Call pauseOnAsyncCall'); - Protocol2.Debugger.pauseOnAsyncCall({ - parentStackTraceId: asyncCallStackTraceId, - }); - Protocol1.Debugger.resume(); InspectorTest.log('Trigger external async task on another context group'); let stackTraceId = (await evaluatePromise).result.result.value; diff --git a/deps/v8/test/inspector/debugger/wasm-anyref-global.js b/deps/v8/test/inspector/debugger/wasm-anyref-global.js index d4c88ac694..d9f63d2d20 100644 --- a/deps/v8/test/inspector/debugger/wasm-anyref-global.js +++ b/deps/v8/test/inspector/debugger/wasm-anyref-global.js @@ -15,7 +15,7 @@ let {session, contextGroup, Protocol} = builder.addImportedGlobal('m', 'global', kWasmAnyRef, false); builder.addFunction('func', kSig_v_v) .addBody([ - kExprGetGlobal, 0, // + kExprGlobalGet, 0, // kExprDrop, // ]) .exportAs('main'); diff --git a/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt b/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt index fba9bb4cf2..d07f035f78 100644 --- a/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt @@ -1,5 +1,5 @@ Tests that cloning a module notifies the debugger -Got URL: wasm://wasm/wasm-cae8f226/wasm-cae8f226-0 -Got URL: wasm://wasm/wasm-cae8f226/wasm-cae8f226-0 -Got URL: wasm://wasm/wasm-cae8f226/wasm-cae8f226-0 +Got URL: wasm://wasm/wasm-95d1e44e/wasm-95d1e44e-0 +Got URL: wasm://wasm/wasm-95d1e44e/wasm-95d1e44e-0 +Got URL: wasm://wasm/wasm-95d1e44e/wasm-95d1e44e-0 Done! diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt index 8fec6bc2df..519d77911b 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt @@ -2,9 +2,9 @@ Tests breakable locations in wasm Running testFunction... Script nr 0 parsed. URL: v8://test/setup Script nr 1 parsed. URL: v8://test/runTestFunction -Script nr 2 parsed. URL: wasm://wasm/wasm-354ada0e/wasm-354ada0e-0 +Script nr 2 parsed. URL: wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0 This is a wasm script (nr 0). -Script nr 3 parsed. URL: wasm://wasm/wasm-354ada0e/wasm-354ada0e-1 +Script nr 3 parsed. URL: wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1 This is a wasm script (nr 1). Querying breakable locations for all wasm scripts now... Requesting all breakable locations in wasm script 0 @@ -38,51 +38,51 @@ Requesting breakable locations in lines [4,6) [0] 4:6 || >call 0 [1] 5:4 || >end Setting a breakpoint on each breakable location... -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:2:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:2:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:3:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:3:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:4:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:4:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:5:0 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:5:0 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:1:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:1:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:2:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:2:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:3:4 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:3:4 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:4:6 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:4:6 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:5:4 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:5:4 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:6:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:6:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:7:0 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:7:0 Success! Running wasm code... Missing breakpoints: 11 Script nr 4 parsed. URL: v8://test/runWasm -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:1:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:1:2 Missing breakpoints: 10 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:2:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:2:2 Missing breakpoints: 9 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:3:4 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:3:4 Missing breakpoints: 8 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:4:6 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:4:6 Missing breakpoints: 7 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:2:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:2:2 Missing breakpoints: 6 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:3:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:3:2 Missing breakpoints: 5 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:4:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:4:2 Missing breakpoints: 4 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:5:0 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:5:0 Missing breakpoints: 3 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:5:4 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:5:4 Missing breakpoints: 2 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:6:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:6:2 Missing breakpoints: 1 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:7:0 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:7:0 Missing breakpoints: 0 Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js index f0c20b3955..62f50749f3 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js @@ -16,12 +16,12 @@ var func_idx = builder.addFunction('helper', kSig_v_v) .addBody([ kExprNop, kExprI32Const, 12, - kExprSetLocal, 0, + kExprLocalSet, 0, ]).index; builder.addFunction('main', kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, kWasmStmt, kExprBlock, kWasmStmt, kExprCallFunction, func_idx, diff --git a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js index c1353da86b..a9a096d65b 100644 --- a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js +++ b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js @@ -12,7 +12,7 @@ var builder = new WasmModuleBuilder(); builder.addFunction('wasm_func', kSig_i_i) .addBody([ // clang-format off - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, // clang-format on diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info.js b/deps/v8/test/inspector/debugger/wasm-scope-info.js index 116b0ce146..2a5e2961ac 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info.js +++ b/deps/v8/test/inspector/debugger/wasm-scope-info.js @@ -41,21 +41,21 @@ async function instantiateWasm() { ['i32Arg', undefined, 'i64_local', 'unicode☼f64']) .addBody([ // Set param 0 to 11. - kExprI32Const, 11, kExprSetLocal, 0, + kExprI32Const, 11, kExprLocalSet, 0, // Set local 1 to 47. - kExprI32Const, 47, kExprSetLocal, 1, + kExprI32Const, 47, kExprLocalSet, 1, // Set local 2 to 0x7FFFFFFFFFFFFFFF (max i64). kExprI64Const, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, - kExprSetLocal, 2, + kExprLocalSet, 2, // Set local 2 to 0x8000000000000000 (min i64). kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7f, - kExprSetLocal, 2, + kExprLocalSet, 2, // Set local 3 to 1/7. kExprI32Const, 1, kExprF64UConvertI32, kExprI32Const, 7, - kExprF64UConvertI32, kExprF64Div, kExprSetLocal, 3, + kExprF64UConvertI32, kExprF64Div, kExprLocalSet, 3, // Set global 0 to 15 - kExprI32Const, 15, kExprSetGlobal, 0, + kExprI32Const, 15, kExprGlobalSet, 0, ]) .exportAs('main'); diff --git a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt index 0afcc861c4..210292c858 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt @@ -1,16 +1,23 @@ Tests how wasm scripts are reported -Check that inspector gets two wasm scripts at module creation time. -Script #0 parsed. URL: v8://test/testFunction -Script #1 parsed. URL: -Script #2 parsed. URL: v8://test/runTestRunction -Script #3 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-0 -Script #4 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-1 -Source for wasm://wasm/wasm-7b04570e/wasm-7b04570e-0: +Check that each inspector gets two wasm scripts at module creation time. +Session #1: Script #0 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0. Source map URL: +Session #1: Script #1 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1. Source map URL: +Session #2: Script #0 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0. Source map URL: +Session #2: Script #1 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1. Source map URL: +Session #1: Script #2 parsed. URL: wasm://wasm/wasm-74f86b7e. Source map URL: wasm://dwarf +Session #2: Script #2 parsed. URL: wasm://wasm/wasm-74f86b7e. Source map URL: wasm://dwarf +Session #1: Script #3 parsed. URL: wasm://wasm/wasm-3754e3fe. Source map URL: abc +Session #2: Script #3 parsed. URL: wasm://wasm/wasm-3754e3fe. Source map URL: abc +Session #1: Script #4 parsed. URL: wasm://wasm/wasm-2bd2e40e. Source map URL: abc +Session #2: Script #4 parsed. URL: wasm://wasm/wasm-2bd2e40e. Source map URL: abc +Session #1: Script #5 parsed. URL: wasm://wasm/wasm-f568e726. Source map URL: abc +Session #2: Script #5 parsed. URL: wasm://wasm/wasm-f568e726. Source map URL: abc +Session #1: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0: func $nopFunction nop end -Source for wasm://wasm/wasm-7b04570e/wasm-7b04570e-1: +Session #1: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1: func $main block i32.const 2 @@ -18,3 +25,48 @@ func $main end end +Session #2: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0: +func $nopFunction + nop +end + +Session #2: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1: +func $main + block + i32.const 2 + drop + end +end + +Session #1: Source for wasm://wasm/wasm-74f86b7e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-74f86b7e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #1: Source for wasm://wasm/wasm-3754e3fe: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-3754e3fe: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #1: Source for wasm://wasm/wasm-2bd2e40e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-2bd2e40e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #1: Source for wasm://wasm/wasm-f568e726: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-f568e726: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] diff --git a/deps/v8/test/inspector/debugger/wasm-scripts.js b/deps/v8/test/inspector/debugger/wasm-scripts.js index 04e5ec88c1..72d886b0e5 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts.js +++ b/deps/v8/test/inspector/debugger/wasm-scripts.js @@ -4,68 +4,140 @@ // Flags: --expose-wasm -let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scripts are reported'); +InspectorTest.log("Tests how wasm scripts are reported"); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +let contextGroup = new InspectorTest.ContextGroup(); +let sessions = [ + // Main session. + trackScripts(), + // Extra session to verify that all inspectors get same messages. + // See https://bugs.chromium.org/p/v8/issues/detail?id=9725. + trackScripts(), +]; -// Add two empty functions. Both should be registered as individual scripts at -// module creation time. -var builder = new WasmModuleBuilder(); -builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]); -builder.addFunction('main', kSig_v_v) - .addBody([kExprBlock, kWasmStmt, kExprI32Const, 2, kExprDrop, kExprEnd]) - .exportAs('main'); -var module_bytes = builder.toArray(); +utils.load('test/mjsunit/wasm/wasm-module-builder.js'); -function testFunction(bytes) { - var buffer = new ArrayBuffer(bytes.length); - var view = new Uint8Array(buffer); - for (var i = 0; i < bytes.length; i++) { - view[i] = bytes[i] | 0; +// Create module with given custom sections. +function createModule(...customSections) { + var builder = new WasmModuleBuilder(); + builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]); + builder.addFunction('main', kSig_v_v) + .addBody([kExprBlock, kWasmStmt, kExprI32Const, 2, kExprDrop, kExprEnd]) + .exportAs('main'); + for (var { name, value } of customSections) { + builder.addCustomSection(name, value); } + return builder.toArray(); +} +function testFunction(bytes) { // Compilation triggers registration of wasm scripts. - new WebAssembly.Module(buffer); + new WebAssembly.Module(new Uint8Array(bytes)); } contextGroup.addScript(testFunction.toString(), 0, 0, 'v8://test/testFunction'); -contextGroup.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); -Protocol.Debugger.enable(); -Protocol.Debugger.onScriptParsed(handleScriptParsed); InspectorTest.log( - 'Check that inspector gets two wasm scripts at module creation time.'); -Protocol.Runtime + 'Check that each inspector gets two wasm scripts at module creation time.'); + +// Sample .debug_info section. +// Content doesn't matter, as we don't try to parse it in V8, +// but should be non-empty to check that we're skipping it correctly. +const dwarfSection = { name: '.debug_info', value: [1, 2, 3, 4, 5] }; + +// Sample sourceMappingURL section set to "abc". +const sourceMapSection = { name: 'sourceMappingURL', value: [3, 97, 98, 99] }; + +sessions[0].Protocol.Runtime .evaluate({ - 'expression': '//# sourceURL=v8://test/runTestRunction\n' + - 'testFunction(module_bytes)' + 'expression': `//# sourceURL=v8://test/runTestRunction + + // no debug info + testFunction([${createModule()}]); + + // DWARF + testFunction([${createModule(dwarfSection)}]); + + // Source map + testFunction([${createModule(sourceMapSection)}]); + + // DWARF + source map + testFunction([${createModule(dwarfSection, sourceMapSection)}]); + + // Source map + DWARF (different order) + testFunction([${createModule(sourceMapSection, dwarfSection)}]); + ` }) - .then(checkFinished); + .then(() => ( + // At this point all scripts were parsed. + // Stop tracking and wait for script sources in each session. + Promise.all(sessions.map(session => session.getScripts())) + )) + .catch(err => { + InspectorTest.log(err.stack); + }) + .then(() => InspectorTest.completeTest()); + +function decodeBase64(base64) { + const LOOKUP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + + const paddingLength = base64.match(/=*$/)[0].length; + const bytesLength = base64.length * 0.75 - paddingLength; -var num_scripts = 0; -var missing_sources = 0; + let bytes = new Uint8Array(bytesLength); + + for (let i = 0, p = 0; i < base64.length; i += 4, p += 3) { + let bits = 0; + for (let j = 0; j < 4; j++) { + bits <<= 6; + const c = base64[i + j]; + if (c !== '=') bits |= LOOKUP.indexOf(c); + } + for (let j = p + 2; j >= p; j--) { + if (j < bytesLength) bytes[j] = bits; + bits >>= 8; + } + } -function checkFinished() { - if (missing_sources == 0) - InspectorTest.completeTest(); + return bytes; } -function handleScriptParsed(messageObject) -{ - var url = messageObject.params.url; - InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url); - ++num_scripts; - - if (url.startsWith("wasm://")) { - ++missing_sources; - function dumpScriptSource(message) { - InspectorTest.log("Source for " + url + ":"); - InspectorTest.log(message.result.scriptSource); - --missing_sources; +function trackScripts(debuggerParams) { + let {id: sessionId, Protocol} = contextGroup.connect(); + let scripts = []; + + Protocol.Debugger.enable(debuggerParams); + Protocol.Debugger.onScriptParsed(handleScriptParsed); + + async function loadScript({url, scriptId, sourceMapURL}) { + InspectorTest.log(`Session #${sessionId}: Script #${scripts.length} parsed. URL: ${url}. Source map URL: ${sourceMapURL}`); + let scriptSource; + if (sourceMapURL) { + let {result: {bytecode}} = await Protocol.Debugger.getWasmBytecode({scriptId}); + // Binary value is represented as base64 in JSON, decode it. + bytecode = decodeBase64(bytecode); + // Check that it can be parsed back to a WebAssembly module. + let module = new WebAssembly.Module(bytecode); + scriptSource = ` +Raw: ${Array.from(bytecode, b => ('0' + b.toString(16)).slice(-2)).join(' ')} +Imports: [${WebAssembly.Module.imports(module).map(i => `${i.name}: ${i.kind} from "${i.module}"`).join(', ')}] +Exports: [${WebAssembly.Module.exports(module).map(e => `${e.name}: ${e.kind}`).join(', ')}] + `.trim(); + } else { + ({result: {scriptSource}} = await Protocol.Debugger.getScriptSource({scriptId})); } + InspectorTest.log(`Session #${sessionId}: Source for ${url}:`); + InspectorTest.log(scriptSource); + } - Protocol.Debugger.getScriptSource({scriptId: messageObject.params.scriptId}) - .then(dumpScriptSource.bind(null)) - .then(checkFinished); + function handleScriptParsed({params}) { + if (params.url.startsWith("wasm://")) { + scripts.push(loadScript(params)); + } } + + return { + Protocol, + getScripts: () => Promise.all(scripts), + }; } diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt index 406d39dd95..29ee78c65a 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt @@ -1,13 +1,13 @@ Tests stepping through wasm scripts. Instantiating. Waiting for two wasm scripts (ignoring first non-wasm script). -Source of script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0: +Source of script wasm://wasm/wasm-18214bfe/wasm-18214bfe-0: 1: func $wasm_A 2: nop 3: nop 4: end -Source of script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1: +Source of script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1: 1: func $wasm_B (param i32) 2: loop 3: local.get 0 @@ -22,12 +22,12 @@ Source of script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1: 12: end 13: end -Setting breakpoint on line 8 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 7 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 6 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 5 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 3 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 4 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 +Setting breakpoint on line 8 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 7 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 6 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 5 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 3 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 4 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 Calling main(4) Breaking on line 3 Breaking on line 4 diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js index a9b676f8a7..1696a0f59c 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js @@ -17,12 +17,12 @@ builder.addFunction('wasm_B', kSig_v_i) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprCallFunction, func_a_idx, // - kExprBr, 1, // continue kExprEnd, // - diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt index c951dce4ba..4a1fd58f2b 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt @@ -3,10 +3,10 @@ Installing code an global variable. Calling instantiate function. Waiting for two wasm scripts to be parsed. Ignoring script with url v8://test/callInstantiate -Got wasm script: wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0 -Requesting source for wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0... -Got wasm script: wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Requesting source for wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1... +Got wasm script: wasm://wasm/wasm-18214bfe/wasm-18214bfe-0 +Requesting source for wasm://wasm/wasm-18214bfe/wasm-18214bfe-0... +Got wasm script: wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Requesting source for wasm://wasm/wasm-18214bfe/wasm-18214bfe-1... func $wasm_A nop nop @@ -26,13 +26,13 @@ func $wasm_B (param i32) end end -Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 +Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 { columnNumber : 6 lineNumber : 7 scriptId : <scriptId> } -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -43,7 +43,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -54,7 +54,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:1:2: >nop at wasm_A (1:2): - scope (global): -- skipped @@ -70,7 +70,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:2:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:2:2: >nop at wasm_A (2:2): - scope (global): -- skipped @@ -86,7 +86,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped @@ -97,7 +97,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -108,7 +108,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -119,7 +119,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped @@ -130,7 +130,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.resume called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -141,7 +141,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -152,7 +152,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:1:2: >nop at wasm_A (1:2): - scope (global): -- skipped @@ -168,7 +168,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped @@ -179,7 +179,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:1:2: >loop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:1:2: >loop at wasm_B (1:2): - scope (global): -- skipped @@ -190,7 +190,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:2:4: >local.get 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:2:4: >local.get 0 at wasm_B (2:4): - scope (global): -- skipped @@ -201,7 +201,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:3:4: >if +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:3:4: >if at wasm_B (3:4): - scope (global): -- skipped @@ -212,7 +212,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:4:6: >local.get 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:4:6: >local.get 0 at wasm_B (4:6): - scope (global): -- skipped @@ -223,7 +223,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:5:6: >i32.const 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:5:6: >i32.const 1 at wasm_B (5:6): - scope (global): -- skipped @@ -234,7 +234,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:6:6: >i32.sub +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:6:6: >i32.sub at wasm_B (6:6): - scope (global): -- skipped @@ -245,7 +245,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -256,7 +256,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -267,7 +267,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:1:2: >nop at wasm_A (1:2): - scope (global): -- skipped @@ -283,7 +283,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:2:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:2:2: >nop at wasm_A (2:2): - scope (global): -- skipped @@ -299,7 +299,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:3:0: >end +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:3:0: >end at wasm_A (3:0): - scope (global): -- skipped @@ -315,7 +315,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt index 34f9cf1df9..325049fffb 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt @@ -1,16 +1,16 @@ Tests stepping through wasm scripts with source maps Installing code an global variable and instantiate. -Got wasm script: wasm-9b4bf87e +Got wasm script: wasm://wasm/wasm-3697f0fe Script sourceMapURL: abc -Requesting source for wasm-9b4bf87e... +Requesting source for wasm://wasm/wasm-3697f0fe... Source retrieved without error: true -Setting breakpoint on offset 54 (on the setlocal before the call), url wasm-9b4bf87e +Setting breakpoint on offset 54 (on the setlocal before the call), url wasm://wasm/wasm-3697f0fe { columnNumber : 54 lineNumber : 0 scriptId : <scriptId> } -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -21,7 +21,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -32,7 +32,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:38 +Paused at wasm://wasm/wasm-3697f0fe:0:38 at wasm_A (0:38): - scope (global): -- skipped @@ -48,7 +48,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm-9b4bf87e:0:39 +Paused at wasm://wasm/wasm-3697f0fe:0:39 at wasm_A (0:39): - scope (global): -- skipped @@ -64,7 +64,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped @@ -75,7 +75,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -86,7 +86,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -97,7 +97,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped @@ -108,7 +108,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.resume called -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -119,7 +119,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -130,7 +130,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:38 +Paused at wasm://wasm/wasm-3697f0fe:0:38 at wasm_A (0:38): - scope (global): -- skipped @@ -146,7 +146,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped @@ -157,7 +157,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:43 +Paused at wasm://wasm/wasm-3697f0fe:0:43 at wasm_B (0:43): - scope (global): -- skipped @@ -168,7 +168,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:45 +Paused at wasm://wasm/wasm-3697f0fe:0:45 at wasm_B (0:45): - scope (global): -- skipped @@ -179,7 +179,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:47 +Paused at wasm://wasm/wasm-3697f0fe:0:47 at wasm_B (0:47): - scope (global): -- skipped @@ -190,7 +190,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:49 +Paused at wasm://wasm/wasm-3697f0fe:0:49 at wasm_B (0:49): - scope (global): -- skipped @@ -201,7 +201,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:51 +Paused at wasm://wasm/wasm-3697f0fe:0:51 at wasm_B (0:51): - scope (global): -- skipped @@ -212,7 +212,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:53 +Paused at wasm://wasm/wasm-3697f0fe:0:53 at wasm_B (0:53): - scope (global): -- skipped @@ -223,7 +223,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -234,7 +234,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -245,7 +245,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:38 +Paused at wasm://wasm/wasm-3697f0fe:0:38 at wasm_A (0:38): - scope (global): -- skipped @@ -261,7 +261,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:39 +Paused at wasm://wasm/wasm-3697f0fe:0:39 at wasm_A (0:39): - scope (global): -- skipped @@ -277,7 +277,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:40 +Paused at wasm://wasm/wasm-3697f0fe:0:40 at wasm_A (0:40): - scope (global): -- skipped @@ -293,7 +293,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js index 1c9ec95577..57b2fd581c 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js @@ -17,12 +17,12 @@ builder.addFunction('wasm_B', kSig_v_i) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprCallFunction, func_a_idx, // - kExprBr, 1, // continue kExprEnd, // - diff --git a/deps/v8/test/inspector/debugger/wasm-stepping.js b/deps/v8/test/inspector/debugger/wasm-stepping.js index 0fda6b73be..01d83b6696 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping.js @@ -6,9 +6,9 @@ let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping thro utils.load('test/mjsunit/wasm/wasm-module-builder.js'); -var builder = new WasmModuleBuilder(); +let builder = new WasmModuleBuilder(); -var func_a_idx = +let func_a_idx = builder.addFunction('wasm_A', kSig_v_v).addBody([kExprNop, kExprNop]).index; // wasm_B calls wasm_A <param0> times. @@ -16,12 +16,12 @@ builder.addFunction('wasm_B', kSig_v_i) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprCallFunction, func_a_idx, // - kExprBr, 1, // continue kExprEnd, // - @@ -30,26 +30,26 @@ builder.addFunction('wasm_B', kSig_v_i) ]) .exportAs('main'); -var module_bytes = builder.toArray(); +let module_bytes = builder.toArray(); function instantiate(bytes) { - var buffer = new ArrayBuffer(bytes.length); - var view = new Uint8Array(buffer); - for (var i = 0; i < bytes.length; ++i) { + let buffer = new ArrayBuffer(bytes.length); + let view = new Uint8Array(buffer); + for (let i = 0; i < bytes.length; ++i) { view[i] = bytes[i] | 0; } - var module = new WebAssembly.Module(buffer); + let module = new WebAssembly.Module(buffer); // Set global variable. instance = new WebAssembly.Instance(module); } -var evalWithUrl = (code, url) => Protocol.Runtime.evaluate( +let evalWithUrl = (code, url) => Protocol.Runtime.evaluate( {'expression': code + '\n//# sourceURL=v8://test/' + url}); Protocol.Debugger.onPaused(handlePaused); -var wasm_B_scriptId; -var step_actions = [ +let wasm_B_scriptId; +let step_actions = [ 'stepInto', // == stepOver, to call instruction 'stepInto', // into call to wasm_A 'stepOver', // over first nop @@ -69,38 +69,33 @@ var step_actions = [ // then just resume. 'resume' ]; -for (var action of step_actions) { +for (let action of step_actions) { InspectorTest.logProtocolCommandCalls('Debugger.' + action) } -var sources = {}; -var urls = {}; -var afterTwoSourcesCallback; - -Protocol.Debugger.enable() - .then(() => InspectorTest.log('Installing code an global variable.')) - .then( - () => evalWithUrl('var instance;\n' + instantiate.toString(), 'setup')) - .then(() => InspectorTest.log('Calling instantiate function.')) - .then( - () => - (evalWithUrl( - 'instantiate(' + JSON.stringify(module_bytes) + ')', - 'callInstantiate'), - 0)) - .then(waitForTwoWasmScripts) - .then( - () => InspectorTest.log( - 'Setting breakpoint on line 7 (on the setlocal before the call), url ' + - urls[wasm_B_scriptId])) - .then( - () => Protocol.Debugger.setBreakpoint( - {'location': {'scriptId': wasm_B_scriptId, 'lineNumber': 7}})) - .then(printFailure) - .then(msg => InspectorTest.logMessage(msg.result.actualLocation)) - .then(() => evalWithUrl('instance.exports.main(4)', 'runWasm')) - .then(() => InspectorTest.log('exports.main returned!')) - .then(() => InspectorTest.log('Finished!')) - .then(InspectorTest.completeTest); +let sources = {}; +let urls = {}; +let afterTwoSourcesCallback; + +(async function Test() { + await Protocol.Debugger.enable(); + InspectorTest.log('Installing code an global variable.'); + await evalWithUrl('var instance;\n' + instantiate.toString(), 'setup'); + InspectorTest.log('Calling instantiate function.'); + evalWithUrl( + 'instantiate(' + JSON.stringify(module_bytes) + ')', 'callInstantiate'); + await waitForTwoWasmScripts(); + InspectorTest.log( + 'Setting breakpoint on line 7 (on the setlocal before the call), url ' + + urls[wasm_B_scriptId]); + let msg = await Protocol.Debugger.setBreakpoint( + {'location': {'scriptId': wasm_B_scriptId, 'lineNumber': 7}}); + printFailure(msg); + InspectorTest.logMessage(msg.result.actualLocation); + await evalWithUrl('instance.exports.main(4)', 'runWasm'); + InspectorTest.log('exports.main returned!'); + InspectorTest.log('Finished!'); + InspectorTest.completeTest(); +})(); function printFailure(message) { if (!message.result) { @@ -109,41 +104,37 @@ function printFailure(message) { return message; } -function waitForTwoWasmScripts() { - var num = 0; +async function waitForTwoWasmScripts() { + let num = 0; InspectorTest.log('Waiting for two wasm scripts to be parsed.'); - var promise = new Promise(fulfill => gotBothSources = fulfill); - function waitForMore() { - if (num == 2) return promise; - Protocol.Debugger.onceScriptParsed() - .then(handleNewScript) - .then(waitForMore); + let source_promises = []; + async function getWasmSource(scriptId) { + let msg = await Protocol.Debugger.getScriptSource({scriptId: scriptId}); + printFailure(msg); + InspectorTest.log(msg.result.scriptSource); + sources[scriptId] = msg.result.scriptSource; } - function handleNewScript(msg) { - var url = msg.params.url; + while (num < 2) { + let msg = await Protocol.Debugger.onceScriptParsed(); + let url = msg.params.url; if (!url.startsWith('wasm://')) { InspectorTest.log('Ignoring script with url ' + url); - return; + continue; } num += 1; - var scriptId = msg.params.scriptId; + let scriptId = msg.params.scriptId; urls[scriptId] = url; InspectorTest.log('Got wasm script: ' + url); if (url.substr(-2) == '-1') wasm_B_scriptId = scriptId; InspectorTest.log('Requesting source for ' + url + '...'); - Protocol.Debugger.getScriptSource({scriptId: scriptId}) - .then(printFailure) - .then(msg => sources[scriptId] = msg.result.scriptSource) - .then(InspectorTest.log) - .then(() => Object.keys(sources).length == 2 ? gotBothSources() : 0); + source_promises.push(getWasmSource(scriptId)); } - waitForMore(); - return promise; + await Promise.all(source_promises); } function printPauseLocation(scriptId, lineNr, columnNr) { - var lines = sources[scriptId].split('\n'); - var line = '<illegal line number>'; + let lines = sources[scriptId].split('\n'); + let line = '<illegal line number>'; if (lineNr < lines.length) { line = lines[lineNr]; if (columnNr < line.length) { @@ -157,7 +148,7 @@ function printPauseLocation(scriptId, lineNr, columnNr) { async function getValueString(value) { if (value.type == 'object') { - var msg = await Protocol.Runtime.callFunctionOn({ + let msg = await Protocol.Runtime.callFunctionOn({ objectId: value.objectId, functionDeclaration: 'function () { return JSON.stringify(this); }' }); @@ -169,24 +160,24 @@ async function getValueString(value) { async function dumpProperties(message) { printFailure(message); - for (var value of message.result.result) { - var value_str = await getValueString(value.value); + for (let value of message.result.result) { + let value_str = await getValueString(value.value); InspectorTest.log(' ' + value.name + ': ' + value_str); } } async function dumpScopeChainsOnPause(message) { - for (var frame of message.params.callFrames) { - var functionName = frame.functionName || '(anonymous)'; - var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumber; - var columnNumber = frame.location ? frame.location.columnNumber : frame.columnNumber; + for (let frame of message.params.callFrames) { + let functionName = frame.functionName || '(anonymous)'; + let lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumber; + let columnNumber = frame.location ? frame.location.columnNumber : frame.columnNumber; InspectorTest.log(`at ${functionName} (${lineNumber}:${columnNumber}):`); - for (var scope of frame.scopeChain) { + for (let scope of frame.scopeChain) { InspectorTest.logObject(' - scope (' + scope.type + '):'); if (scope.type == 'global') { InspectorTest.logObject(' -- skipped'); } else { - var properties = await Protocol.Runtime.getProperties( + let properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); await dumpProperties(properties); } @@ -194,9 +185,10 @@ async function dumpScopeChainsOnPause(message) { } } -function handlePaused(msg) { - var loc = msg.params.callFrames[0].location; +async function handlePaused(msg) { + let loc = msg.params.callFrames[0].location; printPauseLocation(loc.scriptId, loc.lineNumber, loc.columnNumber); - dumpScopeChainsOnPause(msg) - .then(Protocol.Debugger[step_actions.shift() || 'resume']); + await dumpScopeChainsOnPause(msg); + let action = step_actions.shift() || 'resume'; + await Protocol.Debugger[action](); } diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc index 0a4cd48e92..0f39bc9417 100644 --- a/deps/v8/test/inspector/inspector-test.cc +++ b/deps/v8/test/inspector/inspector-test.cc @@ -968,8 +968,8 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { data->StoreCurrentStackTrace(description_view); v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, sizeof(id)); - *static_cast<v8_inspector::V8StackTraceId*>(buffer->GetContents().Data()) = - id; + *static_cast<v8_inspector::V8StackTraceId*>( + buffer->GetBackingStore()->Data()) = id; args.GetReturnValue().Set(buffer); } @@ -983,7 +983,7 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { IsolateData* data = IsolateData::FromContext(context); v8_inspector::V8StackTraceId* id = static_cast<v8_inspector::V8StackTraceId*>( - args[0].As<v8::ArrayBuffer>()->GetContents().Data()); + args[0].As<v8::ArrayBuffer>()->GetBackingStore()->Data()); data->ExternalAsyncTaskStarted(*id); } @@ -997,7 +997,7 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { IsolateData* data = IsolateData::FromContext(context); v8_inspector::V8StackTraceId* id = static_cast<v8_inspector::V8StackTraceId*>( - args[0].As<v8::ArrayBuffer>()->GetContents().Data()); + args[0].As<v8::ArrayBuffer>()->GetBackingStore()->Data()); data->ExternalAsyncTaskFinished(*id); } diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc index ae41264072..8011007e34 100644 --- a/deps/v8/test/inspector/isolate-data.cc +++ b/deps/v8/test/inspector/isolate-data.cc @@ -61,8 +61,9 @@ IsolateData::IsolateData(TaskRunner* task_runner, : task_runner_(task_runner), setup_global_tasks_(std::move(setup_global_tasks)) { v8::Isolate::CreateParams params; - params.array_buffer_allocator = - v8::ArrayBuffer::Allocator::NewDefaultAllocator(); + array_buffer_allocator_.reset( + v8::ArrayBuffer::Allocator::NewDefaultAllocator()); + params.array_buffer_allocator = array_buffer_allocator_.get(); params.snapshot_blob = startup_data; params.only_terminate_in_safe_scope = true; isolate_.reset(v8::Isolate::New(params)); diff --git a/deps/v8/test/inspector/isolate-data.h b/deps/v8/test/inspector/isolate-data.h index d569ab11e0..fc15c3b5f3 100644 --- a/deps/v8/test/inspector/isolate-data.h +++ b/deps/v8/test/inspector/isolate-data.h @@ -6,6 +6,7 @@ #define V8_TEST_INSPECTOR_PROTOCOL_ISOLATE_DATA_H_ #include <map> +#include <memory> #include "include/v8-inspector.h" #include "include/v8-platform.h" @@ -129,6 +130,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { TaskRunner* task_runner_; SetupGlobalTasks setup_global_tasks_; + std::unique_ptr<v8::ArrayBuffer::Allocator> array_buffer_allocator_; std::unique_ptr<v8::Isolate, IsolateDeleter> isolate_; std::unique_ptr<v8_inspector::V8Inspector> inspector_; int last_context_group_id_ = 0; diff --git a/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks-expected.txt b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks-expected.txt new file mode 100644 index 0000000000..a6be5b9121 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks-expected.txt @@ -0,0 +1,72 @@ +Tests that Runtime.evaluate can run with breaks disabled. +Test disableBreaks: false +paused +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test disableBreaks: true +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test calling out with disableBreaks: false +paused +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test calling out with disableBreaks: true +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test Debugger.pause with disableBreaks: false +{ + id : <messageId> + result : { + } +} +paused +{ + id : <messageId> + result : { + result : { + description : 1 + type : number + value : 1 + } + } +} +Test Debugger.pause with disableBreaks: true +{ + id : <messageId> + result : { + } +} +{ + id : <messageId> + result : { + result : { + description : 1 + type : number + value : 1 + } + } +} diff --git a/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks.js b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks.js new file mode 100644 index 0000000000..43ddc5278c --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks.js @@ -0,0 +1,60 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = InspectorTest.start("Tests that Runtime.evaluate can run with breaks disabled."); + +session.setupScriptMap(); +contextGroup.addScript(` + function f() { + debugger; + } //# sourceURL=test.js`); +Protocol.Runtime.enable(); +Protocol.Debugger.enable(); + +Protocol.Debugger.onPaused(message => { + InspectorTest.log("paused"); + Protocol.Debugger.resume(); +}); + +(async function() { + InspectorTest.log("Test disableBreaks: false"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "debugger;", + disableBreaks: false + })); + + InspectorTest.log("Test disableBreaks: true"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "debugger;", + disableBreaks: true + })); + + InspectorTest.log("Test calling out with disableBreaks: false"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "f();", + disableBreaks: false + })); + + InspectorTest.log("Test calling out with disableBreaks: true"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "f();", + disableBreaks: true + })); + + InspectorTest.log("Test Debugger.pause with disableBreaks: false"); + InspectorTest.logMessage(await Protocol.Debugger.pause()); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "1", + disableBreaks: false + })); + + InspectorTest.log("Test Debugger.pause with disableBreaks: true"); + InspectorTest.logMessage(await Protocol.Debugger.pause()); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "1", + disableBreaks: true + })); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/task-runner.h b/deps/v8/test/inspector/task-runner.h index 41a5729571..afc3c39ab2 100644 --- a/deps/v8/test/inspector/task-runner.h +++ b/deps/v8/test/inspector/task-runner.h @@ -6,6 +6,7 @@ #define V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ #include <map> +#include <memory> #include "include/v8-inspector.h" #include "include/v8-platform.h" diff --git a/deps/v8/test/intl/assert.js b/deps/v8/test/intl/assert.js index a6367a8cf2..ae1646cc02 100644 --- a/deps/v8/test/intl/assert.js +++ b/deps/v8/test/intl/assert.js @@ -157,7 +157,7 @@ function assertThrows(code, type_opt, cause_opt) { assertInstanceof(e, type_opt); } if (arguments.length >= 3) { - assertEquals(cause_opt, e.type, 'thrown exception type mismatch'); + assertEquals(cause_opt, e.message, 'thrown exception type mismatch'); } // Success. return; diff --git a/deps/v8/test/intl/bigint/tolocalestring.js b/deps/v8/test/intl/bigint/tolocalestring.js index d0b6792ea8..449d644546 100644 --- a/deps/v8/test/intl/bigint/tolocalestring.js +++ b/deps/v8/test/intl/bigint/tolocalestring.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-bigint - var locales = [ "en", // "1,234,567,890,123,456" "de", // "1.234.567.890.123.456" diff --git a/deps/v8/test/intl/date-format/check-calendar.js b/deps/v8/test/intl/date-format/check-calendar.js index b6c7c58ea3..f9e5565f60 100644 --- a/deps/v8/test/intl/date-format/check-calendar.js +++ b/deps/v8/test/intl/date-format/check-calendar.js @@ -7,6 +7,15 @@ let invalidCalendar = [ "invalid", "abce", + "abc-defghi", +]; + +let illFormedCalendar = [ + "", + "i", + "ij", + "abcdefghi", + "abc-ab", ]; // https://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xml @@ -36,8 +45,17 @@ let locales = [ "ar", ]; - invalidCalendar.forEach(function(calendar) { + locales.forEach(function(base) { + var df; + assertDoesNotThrow(() => df = new Intl.DateTimeFormat([base], {calendar})); + assertEquals( + (new Intl.DateTimeFormat([base])).resolvedOptions().calendar, + df.resolvedOptions().calendar); + }); +}); + +illFormedCalendar.forEach(function(calendar) { assertThrows( () => new Intl.DateTimeFormat(["en"], {calendar}), RangeError); diff --git a/deps/v8/test/intl/date-format/check-numbering-system.js b/deps/v8/test/intl/date-format/check-numbering-system.js index 0bb71c5358..aa6ac8728e 100644 --- a/deps/v8/test/intl/date-format/check-numbering-system.js +++ b/deps/v8/test/intl/date-format/check-numbering-system.js @@ -10,6 +10,15 @@ let invalidNumberingSystem = [ "finance", "native", "traditio", + "abc-defghi", +]; + +let illFormedNumberingSystem = [ + "", + "i", + "ij", + "abcdefghi", + "abc-ab", ]; // https://tc39.github.io/ecma402/#table-numbering-system-digits @@ -43,13 +52,22 @@ let locales = [ "ar", ]; - invalidNumberingSystem.forEach(function(numberingSystem) { + locales.forEach(function(base) { + var df; + assertDoesNotThrow( + () => df = new Intl.DateTimeFormat([base], {numberingSystem})); + assertEquals( + (new Intl.DateTimeFormat([base])).resolvedOptions().numberingSystem, + df.resolvedOptions().numberingSystem); + }); +}); + +illFormedNumberingSystem.forEach(function(numberingSystem) { assertThrows( () => new Intl.DateTimeFormat(["en"], {numberingSystem}), RangeError); -} -); +}); let value = new Date(); validNumberingSystem.forEach(function(numberingSystem) { diff --git a/deps/v8/test/intl/date-format/constructor-calendar-numberingSytem-order.js b/deps/v8/test/intl/date-format/constructor-calendar-numberingSytem-order.js new file mode 100644 index 0000000000..75b4a456d4 --- /dev/null +++ b/deps/v8/test/intl/date-format/constructor-calendar-numberingSytem-order.js @@ -0,0 +1,35 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-add-calendar-numbering-system +const actual = []; + +const options = { + get localeMatcher() { + actual.push("localeMatcher"); + return undefined; + }, + get calendar() { + actual.push("calendar"); + return undefined; + }, + get numberingSystem() { + actual.push("numberingSystem"); + return undefined; + }, + get hour12() { + actual.push("hour12"); + return undefined; + }, +}; + +const expected = [ + "localeMatcher", + "calendar", + "numberingSystem", + "hour12" +]; + +let df = new Intl.DateTimeFormat(undefined, options); +assertEquals(actual.join(":"), expected.join(":")); diff --git a/deps/v8/test/intl/date-format/constructor-date-style-order.js b/deps/v8/test/intl/date-format/constructor-date-style-order.js index 8e601b48d3..b148d8eea7 100644 --- a/deps/v8/test/intl/date-format/constructor-date-style-order.js +++ b/deps/v8/test/intl/date-format/constructor-date-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/deps/v8/test/intl/date-format/constructor-date-time-style-order.js b/deps/v8/test/intl/date-format/constructor-date-time-style-order.js index d4d114662f..8152b17618 100644 --- a/deps/v8/test/intl/date-format/constructor-date-time-style-order.js +++ b/deps/v8/test/intl/date-format/constructor-date-time-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/deps/v8/test/intl/date-format/constructor-date-time-style.js b/deps/v8/test/intl/date-format/constructor-date-time-style.js index f4bc40b396..477c5c5a01 100644 --- a/deps/v8/test/intl/date-format/constructor-date-time-style.js +++ b/deps/v8/test/intl/date-format/constructor-date-time-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - var validStyle = ["full", "long", "medium", "short", undefined]; var invalidStyle = ["narrow", "numeric"]; diff --git a/deps/v8/test/intl/date-format/constructor-no-style-order.js b/deps/v8/test/intl/date-format/constructor-no-style-order.js index bd4bc4cc37..a671968367 100644 --- a/deps/v8/test/intl/date-format/constructor-no-style-order.js +++ b/deps/v8/test/intl/date-format/constructor-no-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/deps/v8/test/intl/date-format/constructor-time-style-order.js b/deps/v8/test/intl/date-format/constructor-time-style-order.js index d35f21a196..b3c8850dde 100644 --- a/deps/v8/test/intl/date-format/constructor-time-style-order.js +++ b/deps/v8/test/intl/date-format/constructor-time-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/deps/v8/test/intl/date-format/en-format-range-to-parts.js b/deps/v8/test/intl/date-format/en-format-range-to-parts.js index c2421812f8..9d9b2b8193 100644 --- a/deps/v8/test/intl/date-format/en-format-range-to-parts.js +++ b/deps/v8/test/intl/date-format/en-format-range-to-parts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-date-format-range - const date1 = new Date("2019-01-03T03:20"); const date2 = new Date("2019-01-05T19:33"); const date3 = new Date("2019-01-05T22:57"); diff --git a/deps/v8/test/intl/date-format/format-range-to-parts.js b/deps/v8/test/intl/date-format/format-range-to-parts.js index b2eac1765c..3ffd61ba7e 100644 --- a/deps/v8/test/intl/date-format/format-range-to-parts.js +++ b/deps/v8/test/intl/date-format/format-range-to-parts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-date-format-range - let descriptor = Object.getOwnPropertyDescriptor( Intl.DateTimeFormat.prototype, "formatRangeToParts"); assertTrue(descriptor.writable); diff --git a/deps/v8/test/intl/date-format/format-range.js b/deps/v8/test/intl/date-format/format-range.js index f00f228b07..066e53e1bd 100644 --- a/deps/v8/test/intl/date-format/format-range.js +++ b/deps/v8/test/intl/date-format/format-range.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-date-format-range - let descriptor = Object.getOwnPropertyDescriptor( Intl.DateTimeFormat.prototype, "formatRange"); assertTrue(descriptor.writable); diff --git a/deps/v8/test/intl/date-format/format-with-extensions.js b/deps/v8/test/intl/date-format/format-with-extensions.js index b9eb0fcb1e..9aa37e1f32 100644 --- a/deps/v8/test/intl/date-format/format-with-extensions.js +++ b/deps/v8/test/intl/date-format/format-with-extensions.js @@ -20,18 +20,9 @@ function checkFormat(locale, options, expected) { assertEquals(expected.formatted, formatted); } -// Even though the calendar is Chinese, the best pattern search for formatting -// should be done in the base locale (i.e. en or en-GB instead of -// en-u-ca-chinese or en-GB-u-ca-chinese). Otherwise, {year: 'numeric'} would -// results in '35 (wu-su)' where 'wu-su' is the designation for year 35 in the -// 60-year cycle. See https://github.com/tc39/ecma402/issues/225 . [ ["en", "gregory", "latn", "2018"], ["en-GB", "gregory", "latn", "2018"], - ["en-u-ca-chinese", "chinese", "latn", "35"], - ["en-GB-u-ca-chinese", "chinese", "latn", "35"], - ["en-u-ca-chinese-nu-deva", "chinese", "deva", "३५"], - ["en-GB-u-ca-chinese-nu-deva", "chinese", "deva", "३५"], ].forEach(function(entry) { checkFormat(entry[0], {year: 'numeric'}, { cal: entry[1], @@ -48,9 +39,6 @@ const enGBTypes = ["day", "literal", "month", "literal", "year"]; ["en", "gregory", "latn", "6/21/2018", enUSTypes], ["en-GB", "gregory", "latn", "21/06/2018", enGBTypes], ["en-u-nu-deva", "gregory", "deva", "६/२१/२०१८", enUSTypes], - ["en-u-ca-chinese", "chinese", "latn", "5/8/35", enUSTypes], - ["en-GB-u-ca-chinese", "chinese", "latn", "08/05/35", enGBTypes], - ["en-u-ca-chinese-nu-deva", "chinese", "deva", "५/८/३५", enUSTypes], ].forEach(function(entry) { checkFormat(entry[0], {}, { cal: entry[1], diff --git a/deps/v8/test/intl/date-format/property-override-date-style.js b/deps/v8/test/intl/date-format/property-override-date-style.js index 542ef5eb27..c7965a41c5 100644 --- a/deps/v8/test/intl/date-format/property-override-date-style.js +++ b/deps/v8/test/intl/date-format/property-override-date-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Checks for security holes introduced by Object.property overrides. // For example: // Object.defineProperty(Array.prototype, 'locale', { @@ -34,8 +32,6 @@ var expectedProperties = [ 'calendar', 'numberingSystem', 'timeZone', - 'hourCycle', - 'hour12', 'dateStyle', ]; diff --git a/deps/v8/test/intl/date-format/property-override-date-time-style.js b/deps/v8/test/intl/date-format/property-override-date-time-style.js index 8977be2967..6cb7af171f 100644 --- a/deps/v8/test/intl/date-format/property-override-date-time-style.js +++ b/deps/v8/test/intl/date-format/property-override-date-time-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Checks for security holes introduced by Object.property overrides. // For example: // Object.defineProperty(Array.prototype, 'locale', { diff --git a/deps/v8/test/intl/date-format/property-override-time-style.js b/deps/v8/test/intl/date-format/property-override-time-style.js index ab8fa22d0b..50cb6e26f1 100644 --- a/deps/v8/test/intl/date-format/property-override-time-style.js +++ b/deps/v8/test/intl/date-format/property-override-time-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Checks for security holes introduced by Object.property overrides. // For example: // Object.defineProperty(Array.prototype, 'locale', { diff --git a/deps/v8/test/intl/date-format/related-year.js b/deps/v8/test/intl/date-format/related-year.js new file mode 100644 index 0000000000..a3d9e9dcb4 --- /dev/null +++ b/deps/v8/test/intl/date-format/related-year.js @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-other-calendars +// Test it will output relatedYear and yearName + +let df = new Intl.DateTimeFormat("zh-u-ca-chinese", {year: "numeric"}) +let date = new Date(2019, 5, 1); +assertEquals("2019己亥年", df.format(date)); +assertEquals([{type: "relatedYear", value: "2019"}, + {type: "yearName", value: "己亥"}, + {type: "literal", value: "年"}], + df.formatToParts(date)); diff --git a/deps/v8/test/intl/general/case-mapping.js b/deps/v8/test/intl/general/case-mapping.js index 79d1624821..606af09c44 100644 --- a/deps/v8/test/intl/general/case-mapping.js +++ b/deps/v8/test/intl/general/case-mapping.js @@ -125,9 +125,6 @@ assertEquals("abci\u0307", "aBcI\u0307".toLowerCase()); // Anything other than 'tr' and 'az' behave like root for U+0307. assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("fil")); assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("zh-Hant-TW")); -assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("i-klingon")); -assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("i-enochian")); -assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("x-foobar")); // Up to 8 chars are allowed for the primary language tag in BCP 47. assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("longlang")); diff --git a/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js b/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js index 808e50d208..16bf369601 100644 --- a/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js +++ b/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js @@ -8,18 +8,8 @@ // v8 works around that ICU issue. // See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry . ["cel-gaulish", "cel-gaulish"], - ["i-default", "i-default"], - ["i-mingo", "i-mingo"], - ["i-enochian", "i-enochian"], - ["zh-min", "zh-min"], // Matching should be case-insensitive. - ["I-default", "i-default"], - ["i-DEFAULT", "i-default"], - ["I-DEFAULT", "i-default"], - ["i-DEfauLT", "i-default"], - ["zh-Min", "zh-min"], - ["Zh-min", "zh-min"], ].forEach(([inputLocale, expectedLocale]) => { const canonicalLocales = Intl.getCanonicalLocales(inputLocale); assertEquals(canonicalLocales.length, 1); diff --git a/deps/v8/test/intl/general/language_tags_with_preferred_values.js b/deps/v8/test/intl/general/language_tags_with_preferred_values.js index 4f2fbbfb2e..462bcfb8f7 100644 --- a/deps/v8/test/intl/general/language_tags_with_preferred_values.js +++ b/deps/v8/test/intl/general/language_tags_with_preferred_values.js @@ -9,8 +9,6 @@ // Matching should be case-insensitive. ["sgn-De", "gsg"], - ["sgn-BE-FR", "sfb"], - ["Sgn-bE-Fr", "sfb"], // deprecated region tag ["und-Latn-dd", "und-Latn-DE"], diff --git a/deps/v8/test/intl/general/supported-locales-of.js b/deps/v8/test/intl/general/supported-locales-of.js index eb5c426f07..84984c1d25 100644 --- a/deps/v8/test/intl/general/supported-locales-of.js +++ b/deps/v8/test/intl/general/supported-locales-of.js @@ -83,16 +83,15 @@ for (const service of services) { privateuseLocale = service.supportedLocalesOf("en-US-x-twain"); assertEquals("en-US-x-twain", privateuseLocale[0]); - privateuseLocale2 = service.supportedLocalesOf("x-twain"); - assertEquals(undefined, privateuseLocale2[0]); + assertThrows(() => service.supportedLocalesOf("x-twain"), RangeError); + if (service != Intl.PluralRules) { grandfatheredLocale = service.supportedLocalesOf("art-lojban"); assertEquals(undefined, grandfatheredLocale[0]); } - grandfatheredLocale2 = service.supportedLocalesOf("i-pwn"); - assertEquals(undefined, grandfatheredLocale2[0]); + assertThrows(() => service.supportedLocalesOf("x-pwn"), RangeError); unicodeInPrivateuseLocale = service.supportedLocalesOf( "en-US-x-u-co-phonebk" diff --git a/deps/v8/test/intl/intl.status b/deps/v8/test/intl/intl.status index ba54743d67..669f5d93d5 100644 --- a/deps/v8/test/intl/intl.status +++ b/deps/v8/test/intl/intl.status @@ -36,9 +36,6 @@ # https://code.google.com/p/v8/issues/detail?id=9312 'regress-9312': [FAIL], - - # Slow tests. - 'regress-903566': [PASS, SLOW], }], # ALWAYS ['variant == no_wasm_traps', { @@ -72,12 +69,6 @@ }], # 'system == android' ############################################################################## -['variant == stress', { - # Too slow. - 'regress-903566': [SKIP], -}], # 'variant == stress' - -############################################################################## ['variant == jitless and not embedded_builtins', { '*': [SKIP], }], # variant == jitless and not embedded_builtins diff --git a/deps/v8/test/intl/list-format/resolved-options.js b/deps/v8/test/intl/list-format/resolved-options.js index 42687990f9..a2cfff8606 100644 --- a/deps/v8/test/intl/list-format/resolved-options.js +++ b/deps/v8/test/intl/list-format/resolved-options.js @@ -144,7 +144,3 @@ assertEquals( assertEquals( 'ar', (new Intl.ListFormat(['xyz', 'ar'])).resolvedOptions().locale); - -assertEquals( - 'ar', - (new Intl.ListFormat(['i-default', 'ar'])).resolvedOptions().locale); diff --git a/deps/v8/test/intl/number-format/check-numbering-system.js b/deps/v8/test/intl/number-format/check-numbering-system.js index cd7884b8dc..c9df98a671 100644 --- a/deps/v8/test/intl/number-format/check-numbering-system.js +++ b/deps/v8/test/intl/number-format/check-numbering-system.js @@ -10,6 +10,15 @@ let invalidNumberingSystem = [ "finance", "native", "traditio", + "abc-defghi", +]; + +let illFormedNumberingSystem = [ + "", + "i", + "ij", + "abcdefghi", + "abc-ab", ]; // https://tc39.github.io/ecma402/#table-numbering-system-digits @@ -45,11 +54,21 @@ let locales = [ invalidNumberingSystem.forEach(function(numberingSystem) { + locales.forEach(function(base) { + var df; + assertDoesNotThrow( + () => df = new Intl.NumberFormat([base], {numberingSystem})); + assertEquals( + (new Intl.NumberFormat([base])).resolvedOptions().numberingSystem, + df.resolvedOptions().numberingSystem); + }); +}); + +illFormedNumberingSystem.forEach(function(numberingSystem) { assertThrows( () => new Intl.NumberFormat(["en"], {numberingSystem}), RangeError); -} -); +}); let value = 1234567.89; validNumberingSystem.forEach(function(numberingSystem) { diff --git a/deps/v8/test/intl/number-format/constructor-numberingSytem-order.js b/deps/v8/test/intl/number-format/constructor-numberingSytem-order.js new file mode 100644 index 0000000000..8c284967ff --- /dev/null +++ b/deps/v8/test/intl/number-format/constructor-numberingSytem-order.js @@ -0,0 +1,30 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-add-calendar-numbering-system +const actual = []; + +const options = { + get localeMatcher() { + actual.push("localeMatcher"); + return undefined; + }, + get numberingSystem() { + actual.push("numberingSystem"); + return undefined; + }, + get style() { + actual.push("style"); + return undefined; + }, +}; + +const expected = [ + "localeMatcher", + "numberingSystem", + "style" +]; + +let nf = new Intl.NumberFormat(undefined, options); +assertEquals(actual.join(":"), expected.join(":")); diff --git a/deps/v8/test/intl/number-format/property-override.js b/deps/v8/test/intl/number-format/property-override.js deleted file mode 100644 index 590b1c2e4b..0000000000 --- a/deps/v8/test/intl/number-format/property-override.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2013 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Checks for security holes introduced by Object.property overrides. -// For example: -// Object.defineProperty(Array.prototype, 'locale', { -// set: function(value) { -// throw new Error('blah'); -// }, -// configurable: true, -// enumerable: false -// }); -// -// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us'). -// -// Update both number-format.js and number-format.cc so they have the same -// list of properties. - -// Flags: --noharmony-intl-numberformat-unified - -// First get supported properties. -var properties = []; -// Some properties are optional and won't show up in resolvedOptions if -// they were not requested - currency, currencyDisplay, -// minimumSignificantDigits and maximumSignificantDigits - so we request them. -var options = Intl.NumberFormat( - undefined, {style: 'currency', currency: 'USD', currencyDisplay: 'name', - minimumSignificantDigits: 1, maximumSignificantDigits: 5}). - resolvedOptions(); -for (var prop in options) { - if (options.hasOwnProperty(prop)) { - properties.push(prop); - } -} - -var expectedProperties = [ - 'style', 'locale', 'numberingSystem', - 'currency', 'currencyDisplay', 'useGrouping', - 'minimumIntegerDigits', 'minimumFractionDigits', - 'maximumFractionDigits', 'minimumSignificantDigits', - 'maximumSignificantDigits' -]; - -assertEquals(expectedProperties.length, properties.length); - -properties.forEach(function(prop) { - assertFalse(expectedProperties.indexOf(prop) === -1); -}); - -taintProperties(properties); - -var locale = Intl.NumberFormat(undefined, - {currency: 'USD', currencyDisplay: 'name', - minimumIntegerDigits: 2, - numberingSystem: 'latn'}). - resolvedOptions().locale; diff --git a/deps/v8/test/intl/number-format/unified/compact-display.js b/deps/v8/test/intl/number-format/unified/compact-display.js index 228a2b6259..666cab86f4 100644 --- a/deps/v8/test/intl/number-format/unified/compact-display.js +++ b/deps/v8/test/intl/number-format/unified/compact-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - const testData = [ ["short"], ["long"], diff --git a/deps/v8/test/intl/number-format/unified/constructor-order.js b/deps/v8/test/intl/number-format/unified/constructor-order.js index be716371f5..f32f0b1696 100644 --- a/deps/v8/test/intl/number-format/unified/constructor-order.js +++ b/deps/v8/test/intl/number-format/unified/constructor-order.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Similar to constructor-order.js but also consider the new options // in https://tc39-transfer.github.io/proposal-unified-intl-numberformat/ diff --git a/deps/v8/test/intl/number-format/unified/currency-display.js b/deps/v8/test/intl/number-format/unified/currency-display.js index effd026778..3c407f27cb 100644 --- a/deps/v8/test/intl/number-format/unified/currency-display.js +++ b/deps/v8/test/intl/number-format/unified/currency-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test defaults let nf = new Intl.NumberFormat(); assertEquals(undefined, nf.resolvedOptions().currencyDisplay); diff --git a/deps/v8/test/intl/number-format/unified/currency-sign.js b/deps/v8/test/intl/number-format/unified/currency-sign.js index 3f2941a8e9..9bfecf8c9b 100644 --- a/deps/v8/test/intl/number-format/unified/currency-sign.js +++ b/deps/v8/test/intl/number-format/unified/currency-sign.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); assertEquals(undefined, nf.resolvedOptions().currencySign); diff --git a/deps/v8/test/intl/number-format/unified/no-compact-display.js b/deps/v8/test/intl/number-format/unified/no-compact-display.js index 95611e90fc..36d75722ea 100644 --- a/deps/v8/test/intl/number-format/unified/no-compact-display.js +++ b/deps/v8/test/intl/number-format/unified/no-compact-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Except when the notation is "compact", the resolvedOptions().compactDisplay // should be undefined. // diff --git a/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js b/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js index 280771b2e7..da91f4ba96 100644 --- a/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js +++ b/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test notation: "engineering" with formatToParts. const nf = Intl.NumberFormat("en", {notation: "engineering"}); diff --git a/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js b/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js index 9ffd5f8709..ade723dbe3 100644 --- a/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js +++ b/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test notation: "scientific" with formatToParts. const nf = Intl.NumberFormat("en", {notation: "scientific"}); diff --git a/deps/v8/test/intl/number-format/unified/notation.js b/deps/v8/test/intl/number-format/unified/notation.js index b26ee01f5c..3711644f52 100644 --- a/deps/v8/test/intl/number-format/unified/notation.js +++ b/deps/v8/test/intl/number-format/unified/notation.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test defaults. let nf = new Intl.NumberFormat(); diff --git a/deps/v8/test/intl/number-format/unified/percent.js b/deps/v8/test/intl/number-format/unified/percent.js index 9918210ec7..c4de0f7fec 100644 --- a/deps/v8/test/intl/number-format/unified/percent.js +++ b/deps/v8/test/intl/number-format/unified/percent.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified -// // Test the handling of "percent" w/ "unit" let nf1 = new Intl.NumberFormat("en-US", { diff --git a/deps/v8/test/intl/number-format/unified/sign-display.js b/deps/v8/test/intl/number-format/unified/sign-display.js index c71f57e67c..18b74c9f0b 100644 --- a/deps/v8/test/intl/number-format/unified/sign-display.js +++ b/deps/v8/test/intl/number-format/unified/sign-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); assertEquals("auto", nf.resolvedOptions().signDisplay); diff --git a/deps/v8/test/intl/number-format/unified/style-unit.js b/deps/v8/test/intl/number-format/unified/style-unit.js index 72eb0a782d..757c0093c2 100644 --- a/deps/v8/test/intl/number-format/unified/style-unit.js +++ b/deps/v8/test/intl/number-format/unified/style-unit.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); diff --git a/deps/v8/test/intl/number-format/unified/unit-display.js b/deps/v8/test/intl/number-format/unified/unit-display.js index d4d814d70e..d451fda324 100644 --- a/deps/v8/test/intl/number-format/unified/unit-display.js +++ b/deps/v8/test/intl/number-format/unified/unit-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); assertEquals(undefined, nf.resolvedOptions().unitDisplay); diff --git a/deps/v8/test/intl/regress-1003748.js b/deps/v8/test/intl/regress-1003748.js new file mode 100644 index 0000000000..89ef559e16 --- /dev/null +++ b/deps/v8/test/intl/regress-1003748.js @@ -0,0 +1,18 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let usd = new Intl.NumberFormat('en', + { style: 'currency', currency: 'USD' }).resolvedOptions(); +assertEquals(2, usd.maximumFractionDigits); +assertEquals(2, usd.minimumFractionDigits); + +let jpy = new Intl.NumberFormat('en', + { style: 'currency', currency: 'JPY' }).resolvedOptions(); +assertEquals(0, jpy.maximumFractionDigits); +assertEquals(0, jpy.minimumFractionDigits); + +let krw = new Intl.NumberFormat('en', + { style: 'currency', currency: 'KRW' }).resolvedOptions(); +assertEquals(0, krw.maximumFractionDigits); +assertEquals(0, krw.minimumFractionDigits); diff --git a/deps/v8/test/intl/regress-1012579.js b/deps/v8/test/intl/regress-1012579.js new file mode 100644 index 0000000000..9051a0004c --- /dev/null +++ b/deps/v8/test/intl/regress-1012579.js @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let longLocale = 'de-u-cf-cu-em-kk-kr-ks-kv-lb-lw-ms-nu-rg-sd-ss-tz'; +rtf = new Intl.RelativeTimeFormat(longLocale); diff --git a/deps/v8/test/intl/regress-8725514.js b/deps/v8/test/intl/regress-8725514.js index 82f884a093..f1bf92b7cc 100644 --- a/deps/v8/test/intl/regress-8725514.js +++ b/deps/v8/test/intl/regress-8725514.js @@ -6,5 +6,5 @@ Object.prototype.__defineGetter__('x', function () { return -2147483648; }); -var f = ["x-u-foo"]; +var f = ["en-US"]; Intl.NumberFormat(f); diff --git a/deps/v8/test/intl/regress-903566.js b/deps/v8/test/intl/regress-903566.js index 9346fa63a8..65f604f452 100644 --- a/deps/v8/test/intl/regress-903566.js +++ b/deps/v8/test/intl/regress-903566.js @@ -13,7 +13,9 @@ let arr = ["a","b","c"]; // Test under no HasHoleyElements(); assertFalse(%HasHoleyElements(arr)); assertDoesNotThrow(()=>(new Intl.ListFormat()).format(arr)); -for (var i = 0; i < 10000; i++) { +// ICU uses bubblesort, so keep the array reasonably small (as of mid-2019: +// 100 entries -> 1ms, 1,000 entries -> 64ms, 10,000 entries -> 5s). +for (var i = 0; i < 100; i++) { arr.push("xx"); } assertFalse(%HasHoleyElements(arr)); diff --git a/deps/v8/test/intl/regress-9356.js b/deps/v8/test/intl/regress-9356.js new file mode 100644 index 0000000000..a355aa1b9e --- /dev/null +++ b/deps/v8/test/intl/regress-9356.js @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertFalse(/ſ/i.test('ſ'.toUpperCase())); +assertFalse(/ſ/i.test('ſ'.toUpperCase()[0])); +assertTrue(/ſ/i.test('ſ')); +assertTrue(/ſ/i.test('ſ'[0])); +assertFalse(/ſ/i.test('s'.toUpperCase())); +assertFalse(/ſ/i.test('s'.toUpperCase()[0])); +assertFalse(/ſ/i.test('S'.toUpperCase())); +assertFalse(/ſ/i.test('S'.toUpperCase()[0])); +assertFalse(/ſ/i.test('S')); +assertFalse(/ſ/i.test('S'[0])); diff --git a/deps/v8/test/intl/regress-9408.js b/deps/v8/test/intl/regress-9408.js index 88883981f3..d5cfb11345 100644 --- a/deps/v8/test/intl/regress-9408.js +++ b/deps/v8/test/intl/regress-9408.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Test precision of compact-rounding let compact = {notation: "compact"}; diff --git a/deps/v8/test/intl/regress-9464.js b/deps/v8/test/intl/regress-9464.js new file mode 100644 index 0000000000..fc51d632f9 --- /dev/null +++ b/deps/v8/test/intl/regress-9464.js @@ -0,0 +1,51 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Number, BigInt and Intl.NumberFormat +assertThrows( + "new Intl.NumberFormat('en', { style: 'unit', unit: 'son'});", + RangeError, + "Invalid unit argument for Intl.NumberFormat() 'son'"); + +assertThrows( + "123n.toLocaleString('en', { style: 'unit', unit: 'son'});", + RangeError, + "Invalid unit argument for BigInt.prototype.toLocaleString() 'son'"); + +assertThrows( + "Math.PI.toLocaleString('en', { style: 'unit', unit: 'son'});", + RangeError, + "Invalid unit argument for Number.prototype.toLocaleString() 'son'"); + +// String and Intl.Collator +assertThrows( + "new Intl.Collator('en', { usage: 'mom'});", + RangeError, + "Value mom out of range for Intl.Collator options property usage"); + +assertThrows( + "'abc'.localeCompare('efg', 'en', { usage: 'mom'});", + RangeError, + "Value mom out of range for String.prototype.localeCompare options property usage"); + +// Date and Intl.DateTimeFormat +assertThrows( + "new Intl.DateTimeFormat('en', { hour: 'dad'});", + RangeError, + "Value dad out of range for Intl.DateTimeFormat options property hour"); + +assertThrows( + "(new Date).toLocaleDateString('en', { hour: 'dad'});", + RangeError, + "Value dad out of range for Date.prototype.toLocaleDateString options property hour"); + +assertThrows( + "(new Date).toLocaleString('en', { hour: 'dad'});", + RangeError, + "Value dad out of range for Date.prototype.toLocaleString options property hour"); + +assertThrows( + "(new Date).toLocaleTimeString('en', { hour: 'dad'});", + RangeError, + "Value dad out of range for Date.prototype.toLocaleTimeString options property hour"); diff --git a/deps/v8/test/intl/regress-9475.js b/deps/v8/test/intl/regress-9475.js index 3549ef8f38..68e2fdd7d7 100644 --- a/deps/v8/test/intl/regress-9475.js +++ b/deps/v8/test/intl/regress-9475.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Test format of all valid units won't throw exception. let validList = [ diff --git a/deps/v8/test/intl/regress-9513.js b/deps/v8/test/intl/regress-9513.js index e23b5cf77e..fc50df2418 100644 --- a/deps/v8/test/intl/regress-9513.js +++ b/deps/v8/test/intl/regress-9513.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Test Infinity, -Infinity, NaN won't crash with any notation in formatToParts. let validNotations = [ diff --git a/deps/v8/test/intl/regress-9731.js b/deps/v8/test/intl/regress-9731.js new file mode 100644 index 0000000000..3cabade5a1 --- /dev/null +++ b/deps/v8/test/intl/regress-9731.js @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertFalse(/k/i.test('\u212A')); +assertTrue(/k/i.test('K')); +assertTrue(/k/i.test('k')); + +assertFalse(/K/i.test('\u212A')); +assertTrue(/K/i.test('K')); +assertTrue(/K/i.test('k')); + +assertTrue(/\u212A/i.test('\u212A')); +assertFalse(/\u212A/i.test('k')); +assertFalse(/\u212A/i.test('K')); diff --git a/deps/v8/test/intl/regress-9747.js b/deps/v8/test/intl/regress-9747.js new file mode 100644 index 0000000000..8b51ddc275 --- /dev/null +++ b/deps/v8/test/intl/regress-9747.js @@ -0,0 +1,50 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let lf = new Intl.ListFormat("en"); + +// Test normal array +assertDoesNotThrow(() => lf.format(['a','b','c'])); +assertThrows("lf.format(['a','b',3])", TypeError, "Iterable yielded 3 which is not a string"); + +// Test sparse array +let sparse = ['a','b']; +sparse[10] = 'c'; +assertThrows("lf.format(sparse)", TypeError, "Iterable yielded undefined which is not a string"); + +// Test iterable of all String +let iterable_of_strings = { + [Symbol.iterator]() { + return this; + }, + count: 0, + next() { + if (this.count++ < 4) { + return {done: false, value: String(this.count)}; + } + return {done:true} + } +}; +assertDoesNotThrow(() => lf.format(iterable_of_strings)); + +// Test iterable of none String throw TypeError +let iterable_of_strings_and_number = { + [Symbol.iterator]() { + return this; + }, + count: 0, + next() { + this.count++; + if (this.count == 3) { + return {done:false, value: 3}; + } + if (this.count < 5) { + return {done: false, value: String(this.count)}; + } + return {done:true} + } +}; +assertThrows("lf.format(iterable_of_strings_and_number)", + TypeError, "Iterable yielded 3 which is not a string"); +assertEquals(3, iterable_of_strings_and_number.count); diff --git a/deps/v8/test/intl/regress-9786.js b/deps/v8/test/intl/regress-9786.js new file mode 100644 index 0000000000..e922dba5f7 --- /dev/null +++ b/deps/v8/test/intl/regress-9786.js @@ -0,0 +1,21 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-add-calendar-numbering-system + +// Well-formed but invalid calendar should not throw RangeError. +var calendar = "abc"; +var len = 3; +var expected = new Intl.DateTimeFormat("en").resolvedOptions().calendar; +var df; + +for (var i = 3; i < 20; i++, len++, calendar += "a") { + assertDoesNotThrow(() => df = new Intl.DateTimeFormat("en", {calendar}), + "Well-formed calendar should not throw"); + assertEquals(expected, df.resolvedOptions().calendar); + if (len == 8) { + calendar += "-ab"; + len = 2; + } +} diff --git a/deps/v8/test/intl/regress-9787.js b/deps/v8/test/intl/regress-9787.js new file mode 100644 index 0000000000..576c0f7d64 --- /dev/null +++ b/deps/v8/test/intl/regress-9787.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-add-calendar-numbering-system + +// ill-formed and valid calendar should throw RangeError. +assertThrows( + 'new Intl.DateTimeFormat("en", {calendar: "gregorian"})', + RangeError); diff --git a/deps/v8/test/intl/regress-9788.js b/deps/v8/test/intl/regress-9788.js new file mode 100644 index 0000000000..7a3679584f --- /dev/null +++ b/deps/v8/test/intl/regress-9788.js @@ -0,0 +1,29 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-add-calendar-numbering-system + +// Well-formed but invalid numberingSystem should not throw RangeError. +var numberingSystem = "abc"; +var len = 3; + +const intlClasses = [ + Intl.DateTimeFormat, + Intl.NumberFormat, + Intl.RelativeTimeFormat +]; + +intlClasses.forEach(function(cls) { + var expected = new cls("en").resolvedOptions().numberingSystem; + var obj; + for (var i = 3; i < 20; i++, len++, numberingSystem += "a") { + assertDoesNotThrow(() => obj = new cls("en", {numberingSystem}), + "Well-formed numberingSystem should not throw"); + assertEquals(expected, obj.resolvedOptions().numberingSystem); + if (len == 8) { + numberingSystem += "-ab"; + len = 2; + } + } +}); diff --git a/deps/v8/test/intl/regress-9812.js b/deps/v8/test/intl/regress-9812.js new file mode 100644 index 0000000000..c85f9e65c1 --- /dev/null +++ b/deps/v8/test/intl/regress-9812.js @@ -0,0 +1,65 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const locales = [ + "cs", + "cs-CZ", + "en-001", + "en-150", + "en-TV", + "es-419", + "es-AR", + "fil", + "fr-CA", + "id", + "in", + "lt", + "nl", + "pl", + "pt-PT", + "sr-ME", + "sv", + "uk", + "vi", +]; + +const calendars = [ + // Calendars we know have issues + "islamic", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "ethiopic-amete-alem", + "islamicc", + "ethioaa", + "islamic-rgsa", + + // Other calendars + "gregory", + "japanese", + "buddhist", + "roc", + "persian", + "islamic", + "hebrew", + "chinese", + "indian", + "coptic", + "ethiopic", + "iso8601", + "dangi", + "chinese", +]; + +let d1 = new Date(2019, 3, 4); +let d2 = new Date(2019, 5, 6); + +calendars.forEach(function(calendar) { + locales.forEach(function(baseLocale) { + let locale = `${baseLocale}-u-ca-${calendar}`; + assertDoesNotThrow( + () => (new Intl.DateTimeFormat(locale)).formatRange(d1, d2), + `Using Intl.DateFormat formatRange with ${locale} should not throw`); + }) +}) diff --git a/deps/v8/test/intl/regress-9849.js b/deps/v8/test/intl/regress-9849.js new file mode 100644 index 0000000000..0b406a0381 --- /dev/null +++ b/deps/v8/test/intl/regress-9849.js @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let d = new Date(271733878); +d.toLocaleString('en-u-nu-arab'); +d.toLocaleString('en-u-nu-arab', {dateStyle : 'full', timeStyle : 'full'}); +d.toLocaleString('en-u-nu-roman'); +d.toLocaleString('en-u-nu-roman', {dateStyle : 'full', timeStyle : 'full'}); +d.toLocaleString('sr-u-nu-roman'); +d.toLocaleString('sr-u-nu-roman', {dateStyle : 'full', timeStyle : 'full'}); +d.toLocaleString('sr-Cyrl-u-nu-roman'); +d.toLocaleString('sr-Cyrl-u-nu-roman', {dateStyle : 'full', timeStyle : 'full'}); +d.toLocaleString('zh-u-nu-roman', {dateStyle : 'full', timeStyle : 'full'}); +d.toLocaleString('ja-u-nu-cyrl', {dateStyle : 'full', timeStyle : 'full'}); diff --git a/deps/v8/test/intl/regress-992694.js b/deps/v8/test/intl/regress-992694.js new file mode 100644 index 0000000000..0729636989 --- /dev/null +++ b/deps/v8/test/intl/regress-992694.js @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Make sure the "hu" locale format the number group correctly. + +let number = 123456.789; +let expected = "123 456,79 Ft"; +assertEquals(expected, + (new Intl.NumberFormat('hu', { style: 'currency', currency: 'HUF'}).format(number))); +assertEquals(expected, + (new Intl.NumberFormat('hu-HU', { style: 'currency', currency: 'HUF' }).format(number))); diff --git a/deps/v8/test/intl/regress-997401.js b/deps/v8/test/intl/regress-997401.js new file mode 100644 index 0000000000..4c46acff7d --- /dev/null +++ b/deps/v8/test/intl/regress-997401.js @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test no crash with a very long locale. +let dtf = new Intl.DateTimeFormat( + 'de-u-cu-eur-em-default-hc-h23-ks-level1-lb-strict-lw-normal-ms-metric-nu-latn-rg-atzzzz-sd-atat1-ss-none-tz-atvie-va-posix'); diff --git a/deps/v8/test/intl/relative-time-format/check-numbering-system.js b/deps/v8/test/intl/relative-time-format/check-numbering-system.js new file mode 100644 index 0000000000..91f4b3aee0 --- /dev/null +++ b/deps/v8/test/intl/relative-time-format/check-numbering-system.js @@ -0,0 +1,85 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let invalidNumberingSystem = [ + "invalid", + "abce", + "finance", + "native", + "traditio", + "abc-defghi", +]; + +let illFormedNumberingSystem = [ + "", + "i", + "ij", + "abcdefghi", + "abc-ab", +]; + +// https://tc39.github.io/ecma402/#table-numbering-system-digits +let validNumberingSystem= [ + "arab", + "arabext", + "bali", + "beng", + "deva", + "fullwide", + "gujr", + "guru", + "hanidec", + "khmr", + "knda", + "laoo", + "latn", + "limb", + "mlym", + "mong", + "mymr", + "orya", + "tamldec", + "telu", + "thai", + "tibt", +]; + +let locales = [ + "en", + "ar", +]; + + +invalidNumberingSystem.forEach(function(numberingSystem) { + locales.forEach(function(base) { + var df; + assertDoesNotThrow( + () => df = new Intl.RelativeTimeFormat([base], {numberingSystem})); + assertEquals( + (new Intl.RelativeTimeFormat([base])).resolvedOptions().numberingSystem, + df.resolvedOptions().numberingSystem); + }); +}); + +illFormedNumberingSystem.forEach(function(numberingSystem) { + assertThrows( + () => new Intl.RelativeTimeFormat(["en"], {numberingSystem}), + RangeError); +}); + +let value = 1234567.89; +validNumberingSystem.forEach(function(numberingSystem) { + locales.forEach(function(base) { + let l = base + "-u-nu-" + numberingSystem; + let nf = new Intl.RelativeTimeFormat([base], {numberingSystem}); + assertEquals(l, nf.resolvedOptions().locale); + assertEquals(numberingSystem, nf.resolvedOptions().numberingSystem); + + // Test the formatting result is the same as passing in via u-nu- + // in the locale. + let nf2 = new Intl.RelativeTimeFormat([l]); + assertEquals(nf2.format(value, "day"), nf.format(value, "day")); + }); +} +); diff --git a/deps/v8/test/intl/relative-time-format/resolved-options.js b/deps/v8/test/intl/relative-time-format/resolved-options.js index 1caa4f86c9..53648320c9 100644 --- a/deps/v8/test/intl/relative-time-format/resolved-options.js +++ b/deps/v8/test/intl/relative-time-format/resolved-options.js @@ -156,7 +156,3 @@ assertEquals( assertThrows(() => Intl.RelativeTimeFormat.prototype.resolvedOptions.call(receiver), TypeError); } - -assertEquals( - 'ar', - (new Intl.RelativeTimeFormat(['i-default', 'ar'])).resolvedOptions().locale); diff --git a/deps/v8/test/js-perf-test/BytecodeHandlers/LdaGlobal.js b/deps/v8/test/js-perf-test/BytecodeHandlers/LdaGlobal.js new file mode 100644 index 0000000000..a986f5f18f --- /dev/null +++ b/deps/v8/test/js-perf-test/BytecodeHandlers/LdaGlobal.js @@ -0,0 +1,60 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function addBenchmark(name, test) { + new BenchmarkSuite(name, [1000], + [ + new Benchmark(name, false, false, 0, test) + ]); +} + +addBenchmark('LoadGlobal', ldaGlobal); +addBenchmark('LoadGlobalInsideTypeof', ldaGlobalInsideTypeof); + +var g_var = 10; + +function ldaGlobal() { + for (var i = 0; i < 1000; ++i) { + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; g_var; + } +} + +function ldaGlobalInsideTypeof() { + for (var i = 0; i < 1000; ++i) { + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + typeof(g_var); typeof(g_var); typeof(g_var); typeof(g_var); + } +} diff --git a/deps/v8/test/js-perf-test/JSTests3.json b/deps/v8/test/js-perf-test/JSTests3.json index 598e9fc6d1..e2b669614c 100644 --- a/deps/v8/test/js-perf-test/JSTests3.json +++ b/deps/v8/test/js-perf-test/JSTests3.json @@ -371,6 +371,17 @@ {"name": "Object-Lookup-Index-Number"}, {"name": "Object-Lookup-Index-String"} ] + }, + { + "name": "LdaGlobal", + "main": "run.js", + "resources": [ "LdaGlobal.js" ], + "test_flags": [ "LdaGlobal" ], + "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$", + "tests": [ + {"name": "LoadGlobal"}, + {"name": "LoadGlobalInsideTypeof"} + ] } ] }, diff --git a/deps/v8/test/message/fail/modules-import-top-level-await-fail-1.mjs b/deps/v8/test/message/fail/modules-import-top-level-await-fail-1.mjs new file mode 100644 index 0000000000..3a00ba67ae --- /dev/null +++ b/deps/v8/test/message/fail/modules-import-top-level-await-fail-1.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE +// +// Flags: --harmony-top-level-await + +import "modules-skip-1-top-level-await-fail.mjs" diff --git a/deps/v8/test/message/fail/modules-import-top-level-await-fail-1.out b/deps/v8/test/message/fail/modules-import-top-level-await-fail-1.out new file mode 100644 index 0000000000..2b2cb407a4 --- /dev/null +++ b/deps/v8/test/message/fail/modules-import-top-level-await-fail-1.out @@ -0,0 +1,3 @@ +*modules-skip-1-top-level-await-fail.mjs:7: ReferenceError: x is not defined +await x; +^ diff --git a/deps/v8/test/message/fail/modules-import-top-level-await-fail-2.mjs b/deps/v8/test/message/fail/modules-import-top-level-await-fail-2.mjs new file mode 100644 index 0000000000..c0bc4c22aa --- /dev/null +++ b/deps/v8/test/message/fail/modules-import-top-level-await-fail-2.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE +// +// Flags: --harmony-top-level-await + +import "modules-skip-2-top-level-await-fail.mjs" diff --git a/deps/v8/test/message/fail/modules-import-top-level-await-fail-2.out b/deps/v8/test/message/fail/modules-import-top-level-await-fail-2.out new file mode 100644 index 0000000000..208d53e1d2 --- /dev/null +++ b/deps/v8/test/message/fail/modules-import-top-level-await-fail-2.out @@ -0,0 +1,3 @@ +*modules-skip-2-top-level-await-fail.mjs:7: ReferenceError: ththsths is not defined +ththsths +^ diff --git a/deps/v8/test/message/fail/modules-skip-1-top-level-await-fail.mjs b/deps/v8/test/message/fail/modules-skip-1-top-level-await-fail.mjs new file mode 100644 index 0000000000..0642ddf366 --- /dev/null +++ b/deps/v8/test/message/fail/modules-skip-1-top-level-await-fail.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +await x; diff --git a/deps/v8/test/message/fail/modules-skip-2-top-level-await-fail.mjs b/deps/v8/test/message/fail/modules-skip-2-top-level-await-fail.mjs new file mode 100644 index 0000000000..19edc2c546 --- /dev/null +++ b/deps/v8/test/message/fail/modules-skip-2-top-level-await-fail.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import "modules-skip-3-top-level-await-fail.mjs" + +ththsths diff --git a/deps/v8/test/message/fail/modules-skip-3-top-level-await-fail.mjs b/deps/v8/test/message/fail/modules-skip-3-top-level-await-fail.mjs new file mode 100644 index 0000000000..caf3431b7f --- /dev/null +++ b/deps/v8/test/message/fail/modules-skip-3-top-level-await-fail.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +await 42; diff --git a/deps/v8/test/message/message.status b/deps/v8/test/message/message.status index 25c87b5e5c..45f0347b4c 100644 --- a/deps/v8/test/message/message.status +++ b/deps/v8/test/message/message.status @@ -38,7 +38,7 @@ }], # ALWAYS # Liftoff is currently only sufficiently implemented on x64 and ia32. -# TODO(clemensh): Implement on all other platforms (crbug.com/v8/6600). +# TODO(clemensb): Implement on all other platforms (crbug.com/v8/6600). ['arch != x64 and arch != ia32', { 'wasm-trace-memory-liftoff': [SKIP], }], # arch != x64 and arch != ia32 diff --git a/deps/v8/test/message/wasm-trace-memory-interpreted.js b/deps/v8/test/message/wasm-trace-memory-interpreted.js index fdac585b39..401707f581 100644 --- a/deps/v8/test/message/wasm-trace-memory-interpreted.js +++ b/deps/v8/test/message/wasm-trace-memory-interpreted.js @@ -3,5 +3,6 @@ // found in the LICENSE file. // Flags: --no-stress-opt --expose-wasm --trace-wasm-memory --wasm-interpret-all +// Flags: --experimental-wasm-simd load("test/message/wasm-trace-memory.js"); diff --git a/deps/v8/test/message/wasm-trace-memory-interpreted.out b/deps/v8/test/message/wasm-trace-memory-interpreted.out index 248d67e827..e390f10fe3 100644 --- a/deps/v8/test/message/wasm-trace-memory-interpreted.out +++ b/deps/v8/test/message/wasm-trace-memory-interpreted.out @@ -7,3 +7,5 @@ interpreter func: 2+0x3 load from 00000002 val: f32:68169720922112.00000 interpreter func: 4+0x5 store to 00000004 val: i8:171 / ab interpreter func: 0+0x3 load from 00000002 val: i32:1454047232 / 56ab0000 interpreter func: 2+0x3 load from 00000002 val: f32:94008244174848.000000 / 56ab0000 +interpreter func: 6+0x7 store to 00000004 val: s128:48879 48879 48879 48879 / 0000beef 0000beef 0000beef 0000beef +interpreter func: 5+0x3 load from 00000002 val: s128:-1091633152 -1091633152 -1091633152 -1091633152 / beef0000 beef0000 beef0000 beef0000 diff --git a/deps/v8/test/message/wasm-trace-memory-liftoff.js b/deps/v8/test/message/wasm-trace-memory-liftoff.js index a23eca4a0f..b50d33dbe8 100644 --- a/deps/v8/test/message/wasm-trace-memory-liftoff.js +++ b/deps/v8/test/message/wasm-trace-memory-liftoff.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --no-stress-opt --trace-wasm-memory --liftoff --no-future -// Flags: --no-wasm-tier-up +// Flags: --no-wasm-tier-up --experimental-wasm-simd +// liftoff does not support simd128, so the s128 load and store traces are in +// the turbofan tier and not liftoff load("test/message/wasm-trace-memory.js"); diff --git a/deps/v8/test/message/wasm-trace-memory-liftoff.out b/deps/v8/test/message/wasm-trace-memory-liftoff.out index 31fdefde3d..cdd8e765d9 100644 --- a/deps/v8/test/message/wasm-trace-memory-liftoff.out +++ b/deps/v8/test/message/wasm-trace-memory-liftoff.out @@ -7,3 +7,5 @@ liftoff func: 2+0x3 load from 00000002 val: f32:68169720922112.00000 liftoff func: 4+0x5 store to 00000004 val: i8:171 / ab liftoff func: 0+0x3 load from 00000002 val: i32:1454047232 / 56ab0000 liftoff func: 2+0x3 load from 00000002 val: f32:94008244174848.000000 / 56ab0000 +turbofan func: 6+0x7 store to 00000004 val: s128:48879 48879 48879 48879 / 0000beef 0000beef 0000beef 0000beef +turbofan func: 5+0x3 load from 00000002 val: s128:-1091633152 -1091633152 -1091633152 -1091633152 / beef0000 beef0000 beef0000 beef0000 diff --git a/deps/v8/test/message/wasm-trace-memory.js b/deps/v8/test/message/wasm-trace-memory.js index 23425f4ddb..de2f1159e9 100644 --- a/deps/v8/test/message/wasm-trace-memory.js +++ b/deps/v8/test/message/wasm-trace-memory.js @@ -3,26 +3,33 @@ // found in the LICENSE file. // Flags: --no-stress-opt --trace-wasm-memory --no-liftoff --no-future -// Flags: --no-wasm-tier-up +// Flags: --no-wasm-tier-up --experimental-wasm-simd load("test/mjsunit/wasm/wasm-module-builder.js"); var builder = new WasmModuleBuilder(); builder.addMemory(1); builder.addFunction('load', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0, kExprDrop]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprDrop]) .exportFunc(); builder.addFunction('load8', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0, kExprDrop]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0, kExprDrop]) .exportFunc(); builder.addFunction('loadf', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprF32LoadMem, 0, 0, kExprDrop]) + .addBody([kExprLocalGet, 0, kExprF32LoadMem, 0, 0, kExprDrop]) .exportFunc(); builder.addFunction('store', kSig_v_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0]) .exportFunc(); builder.addFunction('store8', kSig_v_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0]) + .exportFunc(); +builder.addFunction('load128', kSig_v_i) + .addBody([kExprLocalGet, 0, kSimdPrefix, kExprS128LoadMem, 0, 0, kExprDrop]) + .exportFunc(); +// SIMD is not exposed to JS, so use splat to construct a s128 value. +builder.addFunction('store128', kSig_v_ii) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kSimdPrefix, kExprI32x4Splat, kSimdPrefix, kExprS128StoreMem, 0, 0]) .exportFunc(); var module = builder.instantiate(); @@ -35,3 +42,5 @@ module.exports.loadf(2); module.exports.store8(4, 0xab); module.exports.load(2); module.exports.loadf(2); +module.exports.store128(4, 0xbeef); +module.exports.load128(2); diff --git a/deps/v8/test/message/wasm-trace-memory.out b/deps/v8/test/message/wasm-trace-memory.out index bc6b1b64ec..f41bc30fee 100644 --- a/deps/v8/test/message/wasm-trace-memory.out +++ b/deps/v8/test/message/wasm-trace-memory.out @@ -7,3 +7,5 @@ turbofan func: 2+0x3 load from 00000002 val: f32:68169720922112.00000 turbofan func: 4+0x5 store to 00000004 val: i8:171 / ab turbofan func: 0+0x3 load from 00000002 val: i32:1454047232 / 56ab0000 turbofan func: 2+0x3 load from 00000002 val: f32:94008244174848.000000 / 56ab0000 +turbofan func: 6+0x7 store to 00000004 val: s128:48879 48879 48879 48879 / 0000beef 0000beef 0000beef 0000beef +turbofan func: 5+0x3 load from 00000002 val: s128:-1091633152 -1091633152 -1091633152 -1091633152 / beef0000 beef0000 beef0000 beef0000 diff --git a/deps/v8/test/mjsunit/asm/regress-1013920.js b/deps/v8/test/mjsunit/asm/regress-1013920.js new file mode 100644 index 0000000000..f7a2e57d1d --- /dev/null +++ b/deps/v8/test/mjsunit/asm/regress-1013920.js @@ -0,0 +1,17 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function asm(stdlib, foreign, heap) { + "use asm"; + var heap32 = new stdlib.Uint32Array(heap); + function f() { return 0; } + return {f : f}; +} + +var heap = Reflect.construct( + SharedArrayBuffer, + [1024 * 1024], + ArrayBuffer.prototype.constructor); + +asm(this, {}, heap); diff --git a/deps/v8/test/mjsunit/bit-not.js b/deps/v8/test/mjsunit/bit-not.js index d0316a71ea..4ef1b7c2e3 100644 --- a/deps/v8/test/mjsunit/bit-not.js +++ b/deps/v8/test/mjsunit/bit-not.js @@ -62,16 +62,3 @@ testBitNot(0x80000000 - 0.12345, "float6"); testBitNot("0", "string0"); testBitNot("2.3", "string2.3"); testBitNot("-9.4", "string-9.4"); - - -// Try to test that we can deal with allocation failures in -// the fast path and just use the slow path instead. -function TryToGC() { - var x = 0x40000000; - // Put in an eval to foil Crankshaft. - eval(""); - for (var i = 0; i < 1000000; i++) { - assertEquals(~0x40000000, ~x); - } -} -TryToGC(); diff --git a/deps/v8/test/mjsunit/code-coverage-block-async.js b/deps/v8/test/mjsunit/code-coverage-block-async.js new file mode 100644 index 0000000000..111be213b6 --- /dev/null +++ b/deps/v8/test/mjsunit/code-coverage-block-async.js @@ -0,0 +1,122 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-always-opt --no-stress-flush-bytecode +// Flags: --no-stress-incremental-marking +// Files: test/mjsunit/code-coverage-utils.js + +%DebugToggleBlockCoverage(true); + +TestCoverage( +"await expressions", +` +async function f() { // 0000 + await 42; // 0050 + await 42; // 0100 +}; // 0150 +f(); // 0200 +%PerformMicrotaskCheckpoint(); // 0250 +`, +[{"start":0,"end":299,"count":1}, + {"start":0,"end":151,"count":1}] +); + +TestCoverage( +"for-await-of statements", +` +!async function() { // 0000 + for await (var x of [0,1,2,3]) { // 0050 + nop(); // 0100 + } // 0150 +}(); // 0200 +%PerformMicrotaskCheckpoint(); // 0250 +`, +[{"start":0,"end":299,"count":1}, + {"start":1,"end":201,"count":1}, + {"start":83,"end":153,"count":4}] +); + +TestCoverage( +"https://crbug.com/981313", +` +class Foo { // 0000 + async timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + } // 0200 +} // 0000 +new Foo().timeout(); // 0300 +`, +[ {"start":0, "end":349, "count":1}, + {"start":52, "end":203, "count":1}, + {"start":158,"end":182, "count":1}]); + +TestCoverage( + "test async generator coverage", +` +class Foo { // 0000 + async *timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + } // 0200 +} // 0000 +new Foo().timeout(); // 0300 +`, + [ {"start":0, "end":349, "count":1}, + {"start":52, "end":203, "count":1}, + {"start":158,"end":182, "count":0}]); + +TestCoverage( + "test async generator coverage with next call", +` +class Foo { // 0000 + async *timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + } // 0200 +} // 0000 +new Foo().timeout().next(); // 0300 +`, + [ {"start":0, "end":349, "count":1}, + {"start":52, "end":203, "count":1}, + {"start":158,"end":182, "count":1}]); + +TestCoverage( + "test two consecutive returns", +` +class Foo { // 0000 + timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + return new Promise( // 0200 + (r) => setTimeout(r, 10)); // 0000 + } // 0300 +} // 0000 +new Foo().timeout(); // 0400 +`, +[ {"start":0,"end":449,"count":1}, + {"start":52,"end":303,"count":1}, + {"start":184,"end":302,"count":0}, + {"start":158,"end":182,"count":1}] ); + + +TestCoverage( + "test async generator with two consecutive returns", +` +class Foo { // 0000 + async *timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + return new Promise( // 0200 + (r) => setTimeout(r, 10)); // 0000 + } // 0300 +} // 0000 +new Foo().timeout().next(); // 0400 +`, +[ {"start":0,"end":449,"count":1}, + {"start":52,"end":303,"count":1}, + {"start":184,"end":302,"count":0}, + {"start":158,"end":182,"count":1}] ); + +%DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/code-coverage-block.js b/deps/v8/test/mjsunit/code-coverage-block.js index a7bad5bf11..6cf81bcce0 100644 --- a/deps/v8/test/mjsunit/code-coverage-block.js +++ b/deps/v8/test/mjsunit/code-coverage-block.js @@ -206,21 +206,6 @@ TestCoverage( ); TestCoverage( -"for-await-of statements", -` -!async function() { // 0000 - for await (var x of [0,1,2,3]) { // 0050 - nop(); // 0100 - } // 0150 -}(); // 0200 -%PerformMicrotaskCheckpoint(); // 0250 -`, -[{"start":0,"end":299,"count":1}, - {"start":1,"end":201,"count":1}, - {"start":83,"end":153,"count":4}] -); - -TestCoverage( "while and do-while statements", ` function g() {} // 0000 @@ -659,20 +644,6 @@ try { // 0200 ); TestCoverage( -"await expressions", -` -async function f() { // 0000 - await 42; // 0050 - await 42; // 0100 -}; // 0150 -f(); // 0200 -%PerformMicrotaskCheckpoint(); // 0250 -`, -[{"start":0,"end":299,"count":1}, - {"start":0,"end":151,"count":1}] -); - -TestCoverage( "LogicalOrExpression assignment", ` const a = true || 99 // 0000 @@ -1097,4 +1068,19 @@ f(43); // 0450 {"start":204,"end":226,"count":1}] ); +TestCoverage( +"https://crbug.com/v8/9857", +`function foo() {}`, +[{"start":0,"end":17,"count":1}, + {"start":0,"end":17,"count":0}] +); + +TestCoverage( +"https://crbug.com/v8/9857", +`function foo() {function bar() {}}; foo()`, +[{"start":0,"end":41,"count":1}, + {"start":0,"end":34,"count":1}, + {"start":16,"end":33,"count":0}] +); + %DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/compiler/concurrent-inlining-1.js b/deps/v8/test/mjsunit/compiler/concurrent-inlining-1.js new file mode 100644 index 0000000000..9cbdbc863f --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/concurrent-inlining-1.js @@ -0,0 +1,26 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// This test ensures that we manage to serialize the global.gaga function for +// compilation and therefore are able to inline it. Since the call feedback in +// bar is megamorphic, this relies on recording the correct accumulator hint for +// the named load of obj.gaga while serializing bar (in turn while serializing +// foo). + +const global = this; +global.gaga = function gaga() { return true; }; + +function bar(obj) { return obj.gaga(); }; +function foo() { return %TurbofanStaticAssert(bar(global)); } + +%PrepareFunctionForOptimization(foo); +%PrepareFunctionForOptimization(bar); +%PrepareFunctionForOptimization(global.gaga); + +bar({gaga() {}}); +foo(); +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/compiler/concurrent-inlining-2.js b/deps/v8/test/mjsunit/compiler/concurrent-inlining-2.js new file mode 100644 index 0000000000..e3e63d195c --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/concurrent-inlining-2.js @@ -0,0 +1,26 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// This test ensures that we manage to serialize the global.gaga function for +// compilation and therefore are able to inline it. Since the call feedback in +// bar is megamorphic, this relies on recording the correct accumulator hint for +// the named load of obj.gaga while serializing bar (in turn while serializing +// foo). + +const global = this; +global.gaga = function gaga() { return true; }; + +function bar(obj) { return obj.gaga(); } +function foo(obj) { obj.gaga; %TurbofanStaticAssert(bar(obj)); } + +%PrepareFunctionForOptimization(foo); +%PrepareFunctionForOptimization(bar); +%PrepareFunctionForOptimization(global.gaga); + +bar({gaga() {}}); +foo(global); +%OptimizeFunctionOnNextCall(foo); +foo(global); diff --git a/deps/v8/test/mjsunit/compiler/promise-constructor.js b/deps/v8/test/mjsunit/compiler/promise-constructor.js index ab2d720755..27deeda9d5 100644 --- a/deps/v8/test/mjsunit/compiler/promise-constructor.js +++ b/deps/v8/test/mjsunit/compiler/promise-constructor.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --experimental-inline-promise-constructor +// Flags: --allow-natives-syntax // We have to patch mjsunit because normal assertion failures just throw // exceptions which are swallowed in a then clause. diff --git a/deps/v8/test/mjsunit/compiler/regress-9017.js b/deps/v8/test/mjsunit/compiler/regress-9017.js index 7cbd4e0178..c484e177c6 100644 --- a/deps/v8/test/mjsunit/compiler/regress-9017.js +++ b/deps/v8/test/mjsunit/compiler/regress-9017.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --noturbo-inlining --noturbo-verify-allocation +// This test invokes optimization manually, no need for stress modes: +// Flags: --nostress-opt --noalways-opt // Ensure that very large stack frames can be used successfully. // The flag --noturbo-verify-allocation is to make this run a little faster; it diff --git a/deps/v8/test/mjsunit/d8/d8-performance-measure-memory.js b/deps/v8/test/mjsunit/d8/d8-performance-measure-memory.js new file mode 100644 index 0000000000..baf6479fff --- /dev/null +++ b/deps/v8/test/mjsunit/d8/d8-performance-measure-memory.js @@ -0,0 +1,47 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test the performance.measureMemory() function of d8. This test only makes +// sense with d8. + +load('test/mjsunit/mjsunit.js'); + +function assertLessThanOrEqual(a, b) { + assertTrue(a <= b, `Expected ${a} <= ${b}`); +} + +function checkMeasureMemoryResult(result) { + assertTrue('total' in result); + assertTrue('jsMemoryEstimate' in result.total); + assertTrue('jsMemoryRange' in result.total); + assertEquals('number', typeof result.total.jsMemoryEstimate); + assertEquals(2, result.total.jsMemoryRange.length); + assertEquals('number', typeof result.total.jsMemoryRange[0]); + assertEquals('number', typeof result.total.jsMemoryRange[1]); + assertLessThanOrEqual(result.total.jsMemoryRange[0], + result.total.jsMemoryRange[1]); + assertLessThanOrEqual(result.total.jsMemoryRange[0], + result.total.jsMemoryEstimate); + assertLessThanOrEqual(result.total.jsMemoryEstimate, + result.total.jsMemoryRange[1]); +} + +if (this.performance && performance.measureMemory) { + assertPromiseResult((async () => { + let result = await performance.measureMemory(); + checkMeasureMemoryResult(result); + })()); + + assertPromiseResult((async () => { + let result = await performance.measureMemory({detailed: false}); + checkMeasureMemoryResult(result); + })()); + + assertPromiseResult((async () => { + let result = await performance.measureMemory({detailed: true}); + // TODO(ulan): Also check the detailed results once measureMemory + // supports them. + checkMeasureMemoryResult(result); + })()); +} diff --git a/deps/v8/test/mjsunit/es6/array-iterator-detached.js b/deps/v8/test/mjsunit/es6/array-iterator-detached.js index f385039b4d..4e4f664373 100644 --- a/deps/v8/test/mjsunit/es6/array-iterator-detached.js +++ b/deps/v8/test/mjsunit/es6/array-iterator-detached.js @@ -17,7 +17,7 @@ function Baseline() { %NeverOptimizeFunction(Baseline); assertThrows(Baseline, TypeError, - "Cannot perform Array Iterator.prototype.next on a neutered ArrayBuffer"); + "Cannot perform Array Iterator.prototype.next on a detached ArrayBuffer"); function Turbo(count = 10000) { let array = Array(10000); @@ -45,4 +45,4 @@ Turbo(10); %OptimizeFunctionOnNextCall(Turbo); assertThrows(Turbo, TypeError, - "Cannot perform Array Iterator.prototype.next on a neutered ArrayBuffer"); + "Cannot perform Array Iterator.prototype.next on a detached ArrayBuffer"); diff --git a/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js b/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js index b2ebfce6c9..8d896b93a2 100644 --- a/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js +++ b/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Test for conflicting variable bindings. +// Stress-testing this test is very slow and provides no useful coverage. +// Flags: --nostress-opt --noalways-opt function CheckException(e) { var string = e.toString(); diff --git a/deps/v8/test/mjsunit/es6/block-const-assign.js b/deps/v8/test/mjsunit/es6/block-const-assign.js index 541dc0d97b..5700d69d04 100644 --- a/deps/v8/test/mjsunit/es6/block-const-assign.js +++ b/deps/v8/test/mjsunit/es6/block-const-assign.js @@ -29,6 +29,9 @@ // when using an immutable binding in an assigment or with // prefix/postfix decrement/increment operators. +// Optimization stress is not useful for early syntax errors. +// Flags: --nostress-opt --noalways-opt + "use strict"; const decls = [ @@ -135,7 +138,8 @@ let usecontexts = [ function Test(program, error) { program = "'use strict'; " + program; try { - print(program, " // throw " + error.name); + // If you need to debug this test, enable the following line: + // print(program, " // throw " + error.name); eval(program); } catch (e) { assertInstanceof(e, error); diff --git a/deps/v8/test/mjsunit/es6/iterator-eager-deopt.js b/deps/v8/test/mjsunit/es6/iterator-eager-deopt.js new file mode 100644 index 0000000000..fe004c8c6d --- /dev/null +++ b/deps/v8/test/mjsunit/es6/iterator-eager-deopt.js @@ -0,0 +1,69 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The GetIterator bytecode is used to implement a part of the iterator +// protocol (https://tc39.es/ecma262/#sec-getiterator). Here, the +// bytecode performs multiple operations including some that have side-effects +// and may deoptimize eagerly or lazily. +// This test ensures the eager deoptimization is handled correctly. + +// Flags: --allow-natives-syntax --no-always-opt + +var getIteratorCount = 0; +var iteratorCount = 0; +var iteratorAfterEagerDeoptCount = 0; + +function foo(obj) { + // The following for-of loop uses the iterator protocol to iterate + // over the 'obj'. + // The GetIterator bytecode invovlves 3 steps: + // 1. method = GetMethod(obj, @@iterator) + // 2. iterator = Call(method, obj) + // 3. if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid. + for(var x of obj){} +} + +// This iterator gets inlined when the 'foo' function is JIT compiled for +// the first time. +var iterator = function() { + iteratorCount++; + return { + next: function() { + return { done: true }; + } + } +} + +var iteratorAfterEagerDeopt = function() { + iteratorAfterEagerDeoptCount++; + return { + next: function() { + return { done: true }; + } + } +} + +// Here, retrieval of function at @@iterator has side effect (increments the +// 'getIteratorCount'). Changing the value of 'iterator' in the JIT compiled +// 'foo' causes deoptimization after the count is incremented. Now the deopt +// cannot resume at the beginning of the bytecode because it would end up in +// incrementing the count again. +let y = { get [Symbol.iterator] () { + getIteratorCount++; + return iterator; + } + }; + +%PrepareFunctionForOptimization(foo); +foo(y); +foo(y); +%OptimizeFunctionOnNextCall(foo); + +// Change the value of 'iterator' to trigger eager deoptimization of 'foo'. +iterator = iteratorAfterEagerDeopt +foo(y); +assertUnoptimized(foo); +assertEquals(getIteratorCount, 3); +assertEquals(iteratorCount, 2); +assertEquals(iteratorAfterEagerDeoptCount, 1); diff --git a/deps/v8/test/mjsunit/es6/iterator-invalid-receiver-opt.js b/deps/v8/test/mjsunit/es6/iterator-invalid-receiver-opt.js new file mode 100644 index 0000000000..fac416b5b5 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/iterator-invalid-receiver-opt.js @@ -0,0 +1,51 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The GetIterator bytecode is used to implement a part of the iterator +// protocol (https://tc39.es/ecma262/#sec-getiterator). +// Here, call to the @@iterator property returns invalid JS receiver. +// This test ensures that the optimized version of the GetIterator bytecode +// incorporates exception handling mechanism without deoptimizing. + +// Flags: --allow-natives-syntax --opt + +var iteratorCount = 0; +var exceptionCount = 0; + +function foo(obj) { + // The following for-of loop uses the iterator protocol to iterate + // over the 'obj'. + // The GetIterator bytecode invovlves 3 steps: + // 1. method = GetMethod(obj, @@iterator) + // 2. iterator = Call(method, obj) + // 3. if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid. + try{ + for(let a of obj){ + assertUnreachable(); + } + } catch(e){ + exceptionCount++; + } +} + +// This iterator retuns '3' which is not a valid JSReceiver +var iterator = function() { + iteratorCount++; + return 3; +} + +let y = { + get [Symbol.iterator]() { + return iterator; + } +}; + +%PrepareFunctionForOptimization(foo); +foo(y); +foo(y); +%OptimizeFunctionOnNextCall(foo); +foo(y); +assertOptimized(foo); +assertEquals(iteratorCount, 3); +assertEquals(exceptionCount, 3); diff --git a/deps/v8/test/mjsunit/es6/iterator-lazy-deopt.js b/deps/v8/test/mjsunit/es6/iterator-lazy-deopt.js new file mode 100644 index 0000000000..f2b39a208d --- /dev/null +++ b/deps/v8/test/mjsunit/es6/iterator-lazy-deopt.js @@ -0,0 +1,71 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The GetIterator bytecode is used to implement a part of the iterator +// protocol (https://tc39.es/ecma262/#sec-getiterator). Here, the +// bytecode performs multiple operations including some that have side-effects +// and may deoptimize eagerly or lazily. +// This test ensures the lazy deoptimization is handled correctly. + +// Flags: --allow-natives-syntax --no-always-opt + +var triggerLazyDeopt = false +var iteratorCount = 0; +var iteratorAfterLazyDeoptCount = 0; +var getIteratorCount = 0; + +function foo(obj) { + // The following for-of loop uses the iterator protocol to iterate + // over the 'obj'. + // The GetIterator bytecode invovlves 3 steps: + // 1. method = GetMethod(obj, @@iterator) + // 2. iterator = Call(method, obj) + // 3. if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid. + for(var x of obj){} +} + +// This iterator gets inlined when the 'foo' function is JIT compiled for +// the first time. +var iterator = function() { + iteratorCount++; + return { + next: function() { + return { done: true }; + } + } +} + +iteratorAfterLazyDeopt = function() { + iteratorAfterLazyDeoptCount++; + return { + next: function() { + return { done: true }; + } + } +} +// Here, retrieval of function at @@iterator has side effect (increments the +// 'getIteratorCount').The lazy deoptimization is triggerred by setting the +// 'triggerLazyDeopt' to true after the count is incremented. Now the deopt +// cannot resume at the beginning of the bytecode because it would end up in +// incrementing the count again. +let y = { get [Symbol.iterator] () { + getIteratorCount++; + if(triggerLazyDeopt) { + %DeoptimizeFunction(foo); + iterator = iteratorAfterLazyDeopt + } + return iterator; + } + }; + +%PrepareFunctionForOptimization(foo); +foo(y); +foo(y); +%OptimizeFunctionOnNextCall(foo); +triggerLazyDeopt = true; +foo(y); +assertUnoptimized(foo); +assertEquals(getIteratorCount, 3); +assertEquals(iteratorCount, 2); +assertEquals(iteratorAfterLazyDeoptCount, 1); diff --git a/deps/v8/test/mjsunit/es6/large-classes-properties.js b/deps/v8/test/mjsunit/es6/large-classes-properties.js index fe3fb13b8f..c725d8376e 100644 --- a/deps/v8/test/mjsunit/es6/large-classes-properties.js +++ b/deps/v8/test/mjsunit/es6/large-classes-properties.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax +// This gets very slow with stress flags, and triggers optimization anyway: +// Flags: --nostress-opt --noalways-opt (function testLargeClassesProperties(){ // This is to test for dictionary mode when there more than diff --git a/deps/v8/test/mjsunit/global-proxy-globalThis.js b/deps/v8/test/mjsunit/global-proxy-globalThis.js new file mode 100644 index 0000000000..3b53d74792 --- /dev/null +++ b/deps/v8/test/mjsunit/global-proxy-globalThis.js @@ -0,0 +1,91 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + %OptimizeFunctionOnNextCall(foo); + assertSame(foo(), foo); +} + +// detachGlobal, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + assertSame(foo(), foo); + Realm.navigate(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} diff --git a/deps/v8/test/mjsunit/global-proxy-this.js b/deps/v8/test/mjsunit/global-proxy-this.js new file mode 100644 index 0000000000..32e7868650 --- /dev/null +++ b/deps/v8/test/mjsunit/global-proxy-this.js @@ -0,0 +1,91 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + %OptimizeFunctionOnNextCall(foo); + assertSame(foo(), foo); +} + +// detachGlobal, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + assertSame(foo(), foo); + Realm.navigate(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} diff --git a/deps/v8/test/mjsunit/harmony/modules-import-15-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-import-15-top-level-await.mjs new file mode 100644 index 0000000000..1feb3dae27 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-15-top-level-await.mjs @@ -0,0 +1,58 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await --allow-natives-syntax +// Flags: --harmony-dynamic-import + +var ran = false; + +async function test1() { + try { + let x = await import('modules-skip-8.mjs'); + %AbortJS('failure: should be unreachable'); + } catch(e) { + assertEquals('x is not defined', e.message); + ran = true; + } +} + +test1(); +%PerformMicrotaskCheckpoint(); +assertTrue(ran); + +ran = false; + +async function test2() { + try { + let x = await import('modules-skip-9.mjs'); + %AbortJS('failure: should be unreachable'); + } catch(e) { + assertInstanceof(e, SyntaxError); + assertEquals( + "The requested module 'modules-skip-empty.mjs' does not provide an " + + "export named 'default'", + e.message); + ran = true; + } +} + +test2(); +%PerformMicrotaskCheckpoint(); +assertTrue(ran); + +ran = false; + +async function test3() { + try { + let x = await import('nonexistent-file.mjs'); + %AbortJS('failure: should be unreachable'); + } catch(e) { + assertTrue(e.startsWith('Error reading')); + ran = true; + } +} + +test3(); +%PerformMicrotaskCheckpoint(); +assertTrue(ran); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-15.mjs b/deps/v8/test/mjsunit/harmony/modules-import-15.mjs index b4febd5787..8b313d6017 100644 --- a/deps/v8/test/mjsunit/harmony/modules-import-15.mjs +++ b/deps/v8/test/mjsunit/harmony/modules-import-15.mjs @@ -3,6 +3,9 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --harmony-dynamic-import +// +// Note: This test fails with top level await due to test1, which tries to +// import a module using top level await and expects it to fail. var ran = false; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-1.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-1.mjs new file mode 100644 index 0000000000..9c9dfc385b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-1.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, ['1', '2', '3', '4']); + +import 'modules-skip-1-rqstd-order.mjs'; +import 'modules-skip-2-rqstd-order.mjs'; +import 'modules-skip-3-rqstd-order.mjs'; +import 'modules-skip-4-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-2.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-2.mjs new file mode 100644 index 0000000000..374660ec79 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-2.mjs @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_dir_a', '2_dir_a', '3_dir_a', '4_dir_a', + '1', '2', '3', '4', + '1_dir_b', '2_dir_b', '3_dir_b', '4_dir_b']); + +import 'modules-skip-1-rqstd-order-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order-top-level-await.mjs'; +import 'modules-skip-4-rqstd-order-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-3.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-3.mjs new file mode 100644 index 0000000000..f145a75d5b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-3.mjs @@ -0,0 +1,13 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1', '2_dir_a', '3', '4_dir_a', '2', '4', '2_dir_b', '4_dir_b']); + +import 'modules-skip-1-rqstd-order.mjs'; +import 'modules-skip-2-rqstd-order-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order.mjs'; +import 'modules-skip-4-rqstd-order-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-4.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-4.mjs new file mode 100644 index 0000000000..57e6e54310 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-4.mjs @@ -0,0 +1,17 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_dir_a', '2_dir_a', '3_dir_a', '4_dir_a', + '1', '2', '3', '4', + '1_dir_b', '2_dir_b', '3_dir_b', '4_dir_b', + '1_ind', '2_ind', '3_ind', '4_ind', +]); + +import 'modules-skip-1-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-4-rqstd-order-indirect-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-5.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-5.mjs new file mode 100644 index 0000000000..e018705c33 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-5.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1', '2_dir_a', '3_dir_a', '4', + '2', '3', '2_dir_b', '3_dir_b', + '2_ind', +]); + +import 'modules-skip-1-rqstd-order.mjs'; +import 'modules-skip-2-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order-top-level-await.mjs'; +import 'modules-skip-4-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-6.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-6.mjs new file mode 100644 index 0000000000..8d3ed1f255 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-6.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_dir_a', '2_dir_a', '3', '4_dir_a', + '1', '2', '4', '1_dir_b', '2_dir_b', + '4_dir_b', '2_ind', +]); + +import 'modules-skip-1-rqstd-order-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order.mjs'; +import 'modules-skip-4-rqstd-order-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-7.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-7.mjs new file mode 100644 index 0000000000..64bbeb1eb4 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-7.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_udir_a', '1_udir_b', '2', +]); + +import 'modules-skip-1-rqstd-order-unreached-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-8.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-8.mjs new file mode 100644 index 0000000000..0d9fe3e381 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-8.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_udir_a', '1_udir_b', '2', '1_uind' +]); + +import 'modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-1.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-1.mjs new file mode 100644 index 0000000000..c8efa5d94e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-1.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-dynamic-import --harmony-top-level-await + +let promise_resolved = false; +let m = import('modules-skip-1.mjs'); +m.then( + () => { promise_resolved = true; }, + () => { %AbortJS('Promise rejected'); }); +await m; + +assertEquals(promise_resolved, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-2.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-2.mjs new file mode 100644 index 0000000000..0f74aa7ca9 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-2.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let m = import('modules-skip-1.mjs'); +let m_namespace = await m; + +assertEquals(42, m_namespace.life()); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-3.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-3.mjs new file mode 100644 index 0000000000..44c8145127 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-3.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let m1 = import('modules-skip-1.mjs'); +let m1_namespace = await m1; + +let m2 = import('modules-skip-3.mjs'); +let m2_namespace = await m2; + +assertEquals(42, m1_namespace.life()); +assertEquals('42', m2_namespace.stringlife); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-4.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-4.mjs new file mode 100644 index 0000000000..29730fa4a5 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-4.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-1-top-level-await.mjs' + +assertEquals(42, m.life()); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-5.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-5.mjs new file mode 100644 index 0000000000..f1e7813346 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-5.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-2-top-level-await.mjs' + +assertEquals(42, m.life()); +assertEquals('42', m.stringlife); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-6.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-6.mjs new file mode 100644 index 0000000000..f852895e4b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-6.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-3-top-level-await.mjs' + +assertEquals(42, m.life()); +assertEquals('42', m.stringlife); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-7.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-7.mjs new file mode 100644 index 0000000000..26f1440774 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-7.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --harmony-top-level-await --harmony-dynamic-import + +import * as m from 'modules-skip-6-top-level-await.mjs'; + +assertEquals(m.m1.life(), m.m2.life()); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-8.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-8.mjs new file mode 100644 index 0000000000..aa80c73edd --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-8.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-7-top-level-await.mjs' + +assertEquals(42, m.life); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-cycle.mjs new file mode 100644 index 0000000000..0ec478e59b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-cycle.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --harmony-top-level-await --harmony-dynamic-import + +import * as m1 from 'modules-skip-1-top-level-await-cycle.mjs' +import * as m2 from 'modules-skip-2-top-level-await-cycle.mjs' +import * as m3 from 'modules-skip-3-top-level-await-cycle.mjs' + +assertSame(m1.m1.m.m.life, m1.m2.m.m.life); +assertSame(m1.m1.m.m.life, m2.m.m.life); +assertSame(m1.m1.m.m.life, m3.m.m.life); + +let m4 = await import('modules-skip-1.mjs'); +assertSame(m1.m1.m.m.life, m4.life); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-1.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-1.mjs new file mode 100644 index 0000000000..1e22f15758 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-1.mjs @@ -0,0 +1,18 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let ran = false; +let m = import('modules-skip-2.mjs'); +await m.then( + () => { + assertUnreachable(); + }, + (e) => { + assertEquals(e.message, '42 is not the answer'); + ran = true; + }); + +assertEquals(ran, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-2.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-2.mjs new file mode 100644 index 0000000000..476cfbee15 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-2.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let ran = false; +try { + await import('modules-skip-2.mjs'); + assertUnreachable(); +} catch (e) { + assertEquals(e.message, '42 is not the answer'); + ran = true; +} + +assertEquals(ran, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-3.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-3.mjs new file mode 100644 index 0000000000..20de7ef06e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-3.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let ran = false; +try { + await import('modules-skip-4-top-level-await.mjs'); + assertUnreachable(); +} catch (e) { + assertEquals(e.message, '42 is not the answer'); + ran = true; +} + +assertEquals(ran, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..cbd357c86b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-1-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('1_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs new file mode 100644 index 0000000000..c6dff00d63 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-1-rqstd-order-unreached-top-level-await.mjs'; + +Function('return this;')().test262.push('1_uind'); + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..fcbe07a848 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-top-level-await.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (typeof Function('return this;')().test262 === 'undefined') { + Function('return this;')().test262 = ['1_dir_a']; +} else { + Function('return this;')().test262.push('1_dir_a'); +} +let m = import('modules-skip-1-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('1_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-unreached-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-unreached-top-level-await.mjs new file mode 100644 index 0000000000..f2b2104ad3 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-unreached-top-level-await.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (typeof Function('return this;')().test262 === 'undefined') { + Function('return this;')().test262 = ['1_udir_a']; +} else { + Function('return this;')().test262.push('1_udir_a'); +} +if (false) { + assertUnreachable(); + await 42; +} +Function('return this;')().test262.push('1_udir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order.mjs new file mode 100644 index 0000000000..5ac1882935 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (typeof Function('return this;')().test262 === 'undefined') { + Function('return this;')().test262 = ['1']; +} else { + Function('return this;')().test262.push('1'); +} diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await-cycle.mjs new file mode 100644 index 0000000000..601e80a1b1 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await-cycle.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-2-top-level-await-cycle.mjs'; +import * as m2 from 'modules-skip-3-top-level-await-cycle.mjs'; + +export { m1, m2 }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await.mjs new file mode 100644 index 0000000000..25973fe9ee --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await.mjs @@ -0,0 +1,11 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let m = import('modules-skip-1.mjs'); +let m_namespace = await m; + +export function life() { + return m_namespace.life(); +} + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..2305422b81 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-2-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('2_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..c2b20a53f2 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('2_dir_a'); +let m = import('modules-skip-2-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('2_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order.mjs new file mode 100644 index 0000000000..7dbd64c4cf --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('2'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await-cycle.mjs new file mode 100644 index 0000000000..3171bb88ea --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await-cycle.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m from 'modules-skip-4-top-level-await-cycle.mjs'; + +export { m }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await.mjs new file mode 100644 index 0000000000..4aa2f2cdcd --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await.mjs @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-3.mjs' + +let m2 = import('modules-skip-1-top-level-await.mjs'); +let m2_namespace = await m2; + +export let stringlife = m1.stringlife; + +export function life() { + return m2_namespace.life(); +} + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..2b4dae0063 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-3-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('3_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..f3b8904731 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('3_dir_a'); +let m = import('modules-skip-3-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('3_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order.mjs new file mode 100644 index 0000000000..bd70e70aa5 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('3'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await-cycle.mjs new file mode 100644 index 0000000000..3171bb88ea --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await-cycle.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m from 'modules-skip-4-top-level-await-cycle.mjs'; + +export { m }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await.mjs new file mode 100644 index 0000000000..eea2c7a29b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-1-top-level-await.mjs'; +import * as m2 from 'modules-skip-3.mjs'; + +export function life() { + return m1.life(); +} + +export let stringlife = m2.stringlife; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..7c75a9aadc --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-4-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('4_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..1659ba681e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('4_dir_a'); +let m = import('modules-skip-4-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('4_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order.mjs new file mode 100644 index 0000000000..7fdd12ca7a --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('4'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await-cycle.mjs new file mode 100644 index 0000000000..2b58e2399f --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await-cycle.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let m = await import('modules-skip-1.mjs'); + +export { m }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await.mjs new file mode 100644 index 0000000000..00576a23c1 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-5-top-level-await.mjs'; + +assertUnreachable(); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-5-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-5-top-level-await.mjs new file mode 100644 index 0000000000..28cf2a9c18 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-5-top-level-await.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +await import('modules-skip-2.mjs') diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-6-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-6-top-level-await.mjs new file mode 100644 index 0000000000..65849dba3e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-6-top-level-await.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-3-top-level-await.mjs'; + +let m2 = await import('modules-skip-1.mjs'); + +export { m1, m2 }; + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-7-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-7-top-level-await.mjs new file mode 100644 index 0000000000..bc7f22b771 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-7-top-level-await.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function sleeping_promise() { + return new Promise((resolve) => setTimeout(resolve)); +} + +export let life; + +await sleeping_promise(); +life = -1; +await sleeping_promise(); +life = (await import('modules-skip-1.mjs')).life(); diff --git a/deps/v8/test/mjsunit/harmony/private-accessors.js b/deps/v8/test/mjsunit/harmony/private-accessors.js index 3a828116a1..44ec2a0790 100644 --- a/deps/v8/test/mjsunit/harmony/private-accessors.js +++ b/deps/v8/test/mjsunit/harmony/private-accessors.js @@ -83,6 +83,30 @@ assertEquals('d', new C().getA().getD()); } +{ + assertThrows(() => { + class A { + [this.#a] = 1; + get #a() {} + } + }, TypeError); + + assertThrows(() => { + class A { + [this.#a] = 1; + set #a(val) {} + } + }, TypeError); + + assertThrows(() => { + class A { + [this.#a] = 1; + set #a(val) {} + get #a() {} + } + }, TypeError); +} + // Duplicate private accessors. // https://tc39.es/proposal-private-methods/#sec-static-semantics-early-errors { diff --git a/deps/v8/test/mjsunit/harmony/private-fields.js b/deps/v8/test/mjsunit/harmony/private-fields.js index 0c1c04bc75..067b208620 100644 --- a/deps/v8/test/mjsunit/harmony/private-fields.js +++ b/deps/v8/test/mjsunit/harmony/private-fields.js @@ -476,3 +476,12 @@ let c = new C; assertThrows(() => c.getA(), SyntaxError); } + +{ + assertThrows(() => { + class A { + [this.#a] = 1; + #a = 2; + } + }, TypeError); +} diff --git a/deps/v8/test/mjsunit/harmony/private-methods.js b/deps/v8/test/mjsunit/harmony/private-methods.js index fcd80823c1..b42e4f658c 100644 --- a/deps/v8/test/mjsunit/harmony/private-methods.js +++ b/deps/v8/test/mjsunit/harmony/private-methods.js @@ -295,3 +295,12 @@ assertEquals(1, new C().fn()); } + +{ + assertThrows(() => { + class A { + [this.#a] = 1; + #a() { } + } + }, TypeError); +} diff --git a/deps/v8/test/mjsunit/harmony/private-name-scopes.js b/deps/v8/test/mjsunit/harmony/private-name-scopes.js new file mode 100644 index 0000000000..e6060cf81a --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/private-name-scopes.js @@ -0,0 +1,137 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +{ + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + return class D { + exfil(obj) { return obj.#f; } + exfilEval(obj) { return eval("obj.#f"); } + }; + }) { + #f = "C.#f"; + }; + } + + const o = new O; + const c = new O.C; + const D = heritageFn(); + const d = new D; + assertEquals(d.exfil(o), "O.#f"); + assertEquals(d.exfilEval(o), "O.#f"); + assertThrows(() => d.exfil(c), TypeError); + assertThrows(() => d.exfilEval(c), TypeError); +} + +// Early errors + +assertThrows(() => eval("new class extends " + + "(class { m() { let x = this.#f; } }) " + + "{ #f }"), SyntaxError); + +assertThrows(() => eval("new class extends this.#foo { #foo }"), SyntaxError); + +// Runtime errors + +{ + // Test private name context chain recalc. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + return class D { exfil(obj) { return obj.#f; } } + }) { + #f = "C.#f"; + }; + } + + const o = new O; + const c = new O.C; + const D = heritageFn(); + const d = new D; + assertEquals(d.exfil(o), "O.#f"); + assertThrows(() => d.exfil(c), TypeError); +} + +{ + // Test private name context chain recalc with nested closures with context. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + let forceContext = 1; + return () => { + assertEquals(forceContext, 1); + return class D { exfil(obj) { return obj.#f; } } + }; + }) { + #f = "C.#f"; + }; + } + + const o = new O; + const c = new O.C; + const D = heritageFn()(); + const d = new D; + assertEquals(d.exfil(o), "O.#f"); + assertThrows(() => d.exfil(c), TypeError); +} + +{ + // Test private name context chain recalc where skipped class has no context. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C0 extends (class C1 extends (heritageFn = function (obj) { + if (obj) { return obj.#f; } + }) {}) { + #f = "C0.#f" + } + } + + const o = new O; + const c = new O.C; + assertEquals(heritageFn(o), "O.#f"); + assertThrows(() => heritageFn(c), TypeError); +} + +{ + // Test private name context chain recalc where skipping function has no + // context. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + return (obj) => { return obj.#f; } + }) { + #f = "C.#f"; + } + } + + const o = new O; + const c = new O.C; + assertEquals(heritageFn()(o), "O.#f"); + assertThrows(() => heritageFn()(c), TypeError); +} + +{ + // Test private name context chain recalc where neither skipped class nor + // skipping function has contexts. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C0 extends (class C1 extends (heritageFn = function () { + return (obj) => { return obj.#f; } + }) {}) { + #f = "C0.#f"; + } + } + + const o = new O; + const c = new O.C; + assertEquals(heritageFn()(o), "O.#f"); + assertThrows(() => heritageFn()(c), TypeError); +} diff --git a/deps/v8/test/mjsunit/harmony/regexp-match-indices.js b/deps/v8/test/mjsunit/harmony/regexp-match-indices.js new file mode 100644 index 0000000000..cc3710ce7e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-match-indices.js @@ -0,0 +1,105 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --harmony-regexp-match-indices + +// Sanity test. +{ + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaaz"); + + assertEquals(m.indices, [[1, 5], [4, 5]]); + assertEquals(m.indices.groups, {'Z': [4, 5]}) +} + +// Capture groups that are not matched return `undefined`. +{ + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaay"); + + assertEquals(m.indices, [[1, 4], undefined]); + assertEquals(m.indices.groups, {'Z': undefined}); +} + +// Two capture groups. +{ + const re = /a+(?<A>zz)?(?<B>ii)?/; + const m = re.exec("xaaazzii"); + + assertEquals(m.indices, [[1, 8], [4, 6], [6, 8]]); + assertEquals(m.indices.groups, {'A': [4, 6], 'B': [6, 8]}); +} + +// No capture groups. +{ + const re = /a+/; + const m = re.exec("xaaazzii"); + + assertEquals(m.indices [[1, 4]]); + assertEquals(m.indices.groups, undefined); +} + +// No match. +{ + const re = /a+/; + const m = re.exec("xzzii"); + + assertEquals(null, m); +} + +// Unnamed capture groups. +{ + const re = /a+(z)?/; + const m = re.exec("xaaaz") + + assertEquals(m.indices, [[1, 5], [4, 5]]); + assertEquals(m.indices.groups, undefined) +} + +// Named and unnamed capture groups. +{ + const re = /a+(z)?(?<Y>y)?/; + const m = re.exec("xaaazyy") + + assertEquals(m.indices, [[1, 6], [4, 5], [5, 6]]); + assertEquals(m.indices.groups, {'Y': [5, 6]}) +} + + +// Verify property overwrite. +{ + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaaz"); + + m.indices = null; + assertEquals(null, m.indices); +} + +// Mess with array prototype, we should still do the right thing. +{ + Object.defineProperty(Array.prototype, "groups", { + get: () => { + assertUnreachable(); + return null; + }, + set: (x) => { + assertUnreachable(); + } + }); + + Object.defineProperty(Array.prototype, "0", { + get: () => { + assertUnreachable(); + return null; + }, + set: (x) => { + assertUnreachable(); + } + }); + + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaaz"); + + assertEquals(m.indices.groups, {'Z': [4, 5]}) +} diff --git a/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js b/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js index 24724eea14..e4cdff5d36 100644 --- a/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js +++ b/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js @@ -9,11 +9,9 @@ function Alloc(size) { } function RunSomeAllocs(total, retained, size) { - print(`-------iterations = ${total}, retained = $ { retained } -------`); + print(`-------iterations = ${total}, retained = ${retained} -------`); var array = new Array(retained); for (var i = 0; i < total; i++) { - if ((i % 25) == 0) - print(`iteration $ { i }`); let pair = Alloc(size); // For some iterations, retain the memory, view, or both. switch (i % 3) { diff --git a/deps/v8/test/mjsunit/harmony/static-private-methods.js b/deps/v8/test/mjsunit/harmony/static-private-methods.js new file mode 100644 index 0000000000..ed81bb3038 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/static-private-methods.js @@ -0,0 +1,248 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-private-methods + +"use strict"; + +// Static private methods +{ + let store = 1; + class C { + static #a() { return store; } + static a() { return this.#a(); } + } + assertEquals(C.a(), store); + assertThrows(() => C.a.call(new C), TypeError); +} + +// Complementary static private accessors. +{ + let store = 1; + class C { + static get #a() { return store; } + static set #a(val) { store = val; } + static incA() { this.#a++; } + static getA() { return this.#a; } + static setA(val) { this.#a = val; } + } + assertEquals(C.getA(), 1); + C.incA(); + assertEquals(store, 2); + C.setA(3); + assertEquals(store, 3); + + assertThrows(() => C.incA.call(new C), TypeError); + assertThrows(() => C.getA.call(new C), TypeError); + assertThrows(() => C.setA.call(new C), TypeError); + + assertThrows(() => { const incA = C.incA; incA(); }, TypeError); + assertThrows(() => { const getA = C.getA; getA(); }, TypeError); + assertThrows(() => { const setA = C.setA; setA(); }, TypeError); +} + +// Static private methods accessed explicitly in an anonymous nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class { + static #a() { return 'Inner'; } + static a() { return this.#a(); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a(), 'Inner'); + assertThrows(() => obj.a.call(C), TypeError); + assertThrows(() => obj.a.call(new C), TypeError); +} + +// Static private methods accessed explicitly in a named nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class Inner { + static #a() { return 'Inner'; } + static a() { return this.#a(); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a(), 'Inner'); + assertThrows(() => obj.a.call(C), TypeError); + assertThrows(() => obj.a.call(new C), TypeError); +} + +// Static private methods accessed through eval in an anonymous nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class { + static #a() { return 'Inner'; } + static a(str) { return eval(str); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a('this.#a()'), 'Inner'); + assertThrows(() => C.a('Outer.#a()'), TypeError); +} + +// Static private methods accessed through eval in a named nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class Inner { + static #a() { return 'Inner'; } + static a(str) { return eval(str); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a('this.#a()'), 'Inner'); + assertEquals(C.a('Inner.#a()'), 'Inner'); + assertThrows(() => C.a('Outer.#a()'), TypeError); + assertThrows(() => C.run('(new Outer).#a()'), TypeError); +} + +// Static private methods in the outer class accessed through eval +// in a named nested class. +{ + class Outer { + static #a() { return 'Outer'; } + static test() { + return class Inner { + static run(str) { return eval(str); } + }; + } + } + + const C = Outer.test(); + assertEquals(C.run('Outer.#a()'), 'Outer'); + assertThrows(() => C.run('this.#a()'), TypeError); + assertThrows(() => C.run('Inner.#a()'), TypeError); + assertThrows(() => C.run('(new Outer).#a()'), TypeError); +} + +// Static private methods in the outer class accessed explicitly +// in a named nested class. +{ + class Outer { + static #a() { return 'Outer'; } + static test() { + return class Inner { + static getA(klass) { return klass.#a(); } + }; + } + } + + const C = Outer.test(); + assertEquals(C.getA(Outer), 'Outer'); + assertThrows(() => C.getA.call(C), TypeError); + assertThrows(() => C.getA.call(new Outer), TypeError); +} + +// Static private methods in the outer class accessed explicitly +// in an anonymous nested class. +{ + class Outer { + static #a() { return 'Outer'; } + static test() { + return class { + static getA(klass) { return klass.#a(); } + }; + } + } + + const C = Outer.test(); + assertEquals(C.getA(Outer), 'Outer'); + assertThrows(() => C.getA.call(C), TypeError); + assertThrows(() => C.getA.call(new Outer), TypeError); +} + +// Super property access in static private methods +{ + class A { + static a = 1; + } + + class B extends A { + static #a() { return super.a; } + static getA() { return this.#a(); } + } + + assertEquals(B.getA(), 1); +} + +// Invalid super property access in static private methods +{ + class A { + static #a() { return 1; } + static getA() { return this.#a(); } + } + + class B extends A { + static getA() { return super.getA(); } + } + + assertThrows(() => B.getA(), TypeError); +} + +// Static private methods accessed in eval. +{ + class C { + static #m(v) { return v; } + static test(str) { + return eval(str); + } + } + + assertEquals(C.test('this.#m(1)'), 1); +} + +// Test that the receiver is checked during run time. +{ + const C = class { + static #a() { } + static test(klass) { return klass.#a; } + }; + const test = C.test; + assertThrows(test, TypeError); +} + +// Duplicate static private accessors and methods. +{ + assertThrows('class C { static get #a() {} static get #a() {} }', SyntaxError); + assertThrows('class C { static get #a() {} static #a() {} }', SyntaxError); + assertThrows('class C { static get #a() {} get #a() {} }', SyntaxError); + assertThrows('class C { static get #a() {} set #a(val) {} }', SyntaxError); + assertThrows('class C { static get #a() {} #a() {} }', SyntaxError); + + assertThrows('class C { static set #a(val) {} static set #a(val) {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} static #a() {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} get #a() {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} set #a(val) {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} #a() {} }', SyntaxError); + + assertThrows('class C { static #a() {} static #a() {} }', SyntaxError); + assertThrows('class C { static #a() {} #a(val) {} }', SyntaxError); + assertThrows('class C { static #a() {} set #a(val) {} }', SyntaxError); + assertThrows('class C { static #a() {} get #a() {} }', SyntaxError); +} diff --git a/deps/v8/test/mjsunit/md5.js b/deps/v8/test/mjsunit/md5.js index 38dc802312..b2dbc1e45a 100644 --- a/deps/v8/test/mjsunit/md5.js +++ b/deps/v8/test/mjsunit/md5.js @@ -201,11 +201,9 @@ To know our further pleasure in this case,\n\ To old Free-town, our common judgment-place.\n\ Once more, on pain of death, all men depart.\n" -for (var i = 0; i < 4; ++i) { +for (var i = 0; i < 2; ++i) { plainText += plainText; } -assertEquals(hex_md5("abc"), "900150983cd24fb0d6963f7d28e17f72"); -for (var i = 0; i < 11; ++i) { - assertEquals(hex_md5(plainText), "1b8719c72d5d8bfd06e096ef6c6288c5"); -} +assertEquals("900150983cd24fb0d6963f7d28e17f72", hex_md5("abc")); +assertEquals("6c843ffbdd773e88ae4ac4a5df79a784", hex_md5(plainText)); diff --git a/deps/v8/test/mjsunit/messages.js b/deps/v8/test/mjsunit/messages.js index 916a7d554f..7c3521b685 100644 --- a/deps/v8/test/mjsunit/messages.js +++ b/deps/v8/test/mjsunit/messages.js @@ -166,13 +166,13 @@ for (constructor of typedArrayConstructors) { const ta = new constructor([1]); %ArrayBufferDetach(ta.buffer); ta.find(() => {}); - }, "Cannot perform %TypedArray%.prototype.find on a neutered ArrayBuffer", TypeError); + }, "Cannot perform %TypedArray%.prototype.find on a detached ArrayBuffer", TypeError); test(() => { const ta = new constructor([1]); %ArrayBufferDetach(ta.buffer); ta.findIndex(() => {}); - }, "Cannot perform %TypedArray%.prototype.findIndex on a neutered ArrayBuffer", TypeError); + }, "Cannot perform %TypedArray%.prototype.findIndex on a detached ArrayBuffer", TypeError); } // kFirstArgumentNotRegExp diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index 134a49f748..f0d473f84a 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -81,6 +81,9 @@ 'wasm/shared-memory-worker-explicit-gc-stress': [PASS, ['mode == debug', SKIP], ['tsan', SKIP]], 'wasm/shared-memory-worker-gc-stress': [PASS, ['mode == debug', SKIP]], + # Slow in simulator runs. + 'random-bit-correlations': [PASS, ['simulator_run == True', SLOW]], + ############################################################################## # Only RegExp stuff tested, no need for extensive optimizing compiler tests. 'regexp-global': [PASS, NO_VARIANTS], @@ -292,7 +295,6 @@ 'compare-known-objects-slow': [SKIP], 'compiler/array-multiple-receiver-maps': [SKIP], # Tests taking too long - 'packed-elements': [SKIP], 'regress/regress-1122': [SKIP], 'regress/regress-331444': [SKIP], 'regress/regress-353551': [SKIP], @@ -377,6 +379,7 @@ 'regress/regress-6838-2': [SKIP], 'regress/regress-6838-3': [SKIP], 'regress/regress-9022': [SKIP], + 'regress/regress-9832': [SKIP], 'regress/regress-crbug-934138': [SKIP], 'regress/regress-crbug-976934': [SKIP], @@ -393,13 +396,14 @@ 'regress/regress-crbug-759327': [SKIP], 'regress/regress-crbug-898974': [SKIP], 'regexp-tier-up': [SKIP], + 'regexp-tier-up-multiple': [SKIP], + 'regress/regress-996234': [SKIP], # These tests check that we can trace the compiler. 'tools/compiler-trace-flags': [SKIP], 'tools/compiler-trace-flags-wasm': [SKIP], # Too slow on arm64 simulator and debug: https://crbug.com/v8/7783 - 'bit-not': [PASS, ['arch == arm64 and mode == debug and simulator_run', SKIP]], 'md5': [PASS, ['arch == arm64 and mode == debug and simulator_run', SKIP]], # Slow with pointer compression. @@ -470,15 +474,15 @@ 'array-reduce': [PASS, SLOW], 'array-sort': [PASS, SLOW], 'array-splice': [PASS, SLOW], - 'bit-not': [PASS, SLOW], + 'array-store-and-grow': [PASS, SLOW], 'compiler/alloc-number': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW], 'generated-transition-stub': [PASS, SLOW], 'json2': [PASS, SLOW], + 'large-object-literal-slow-elements': [PASS, SLOW], 'math-floor-of-div-nosudiv': [PASS, SLOW], 'math-floor-of-div': [PASS, SLOW], 'messages': [PASS, SLOW], - 'packed-elements': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW], 'regress/regress-331444': [PASS, SLOW], 'regress/regress-490': [PASS, SLOW], @@ -486,6 +490,7 @@ 'regress/regress-create-exception': [PASS, SLOW], 'regress/regress-json-stringify-gc': [PASS, SLOW], 'string-indexof-2': [PASS, SLOW], + 'unbox-double-arrays': [PASS, SLOW], 'unicodelctest-no-optimization': [PASS, SLOW], 'unicodelctest': [PASS, SLOW], 'unicode-test': [PASS, SLOW], @@ -494,19 +499,28 @@ # BUG(v8:7247). 'regress/regress-779407': [PASS, SLOW, NO_VARIANTS], - - # BUG(v8:9256). Slow with pointer compression. - 'regress/regress-708247': [PASS, ['pointer_compression', SLOW]], - 'es6/array-concat': [PASS, ['pointer_compression', SLOW]], - 'non-extensible-array-reduce': [PASS, ['pointer_compression', SLOW]], - 'regress/regress-454725': [PASS, ['pointer_compression', SLOW]], }], # 'arch == arm64' +############################################################################## +['arch == arm64 and simulator_run', { + # Slow in simulator builds + 'compiler/osr-follow': [PASS, SLOW], + 'es6/array-concat': [PASS, SLOW], + 'non-extensible-array-reduce': [PASS, SLOW], + 'regress/regress-454725': [PASS, SLOW], + 'regress/regress-708247': [PASS, SLOW], + 'compiler/osr-big': [PASS, SLOW], + 'frozen-array-reduce': [PASS, SLOW], + 'json': [PASS, SLOW], + 'sealed-array-reduce': [PASS, SLOW], + 'try': [PASS, SLOW], +}], # 'arch == arm64 and simulator_run' + +############################################################################## ['arch == arm64 and mode == debug and simulator_run', { # Pass but take too long with the simulator in debug mode. 'array-sort': [PASS, SLOW], - 'packed-elements': [SKIP], 'regexp-global': [SKIP], 'math-floor-of-div': [PASS, SLOW], 'math-floor-of-div-nosudiv': [PASS, SLOW], @@ -641,7 +655,6 @@ # Slow tests. 'array-sort': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW], - 'packed-elements': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW], 'regress/regress-91008': [PASS, SLOW], 'regress/regress-json-stringify-gc': [PASS, SLOW], @@ -913,6 +926,10 @@ 'wasm/atomics-stress': [SKIP], 'wasm/atomics64-stress': [SKIP], 'wasm/futex': [SKIP], + + # Deadlocks on predictable platform (https://crbug.com/v8/9760). + 'wasm/async-compile': [SKIP], + 'wasm/streaming-compile': [SKIP], }], # 'predictable == True' ############################################################################## @@ -925,7 +942,6 @@ 'regress/regress-crbug-482998': [PASS, SLOW], 'regress/regress-91008': [PASS, SLOW], 'regress/regress-779407': [PASS, SLOW], - 'packed-elements': [PASS, SLOW], 'harmony/regexp-property-lu-ui': [PASS, SLOW], 'whitespaces': [PASS, SLOW], 'generated-transition-stub': [PASS, SLOW], @@ -964,6 +980,7 @@ # The RegExp code cache means running this test multiple times is invalid. 'regexp-tier-up': [SKIP], + 'regexp-tier-up-multiple': [SKIP], # Flaky crash on Odroid devices: https://crbug.com/v8/7678 'regress/regress-336820': [PASS, ['arch == arm and not simulator_run', SKIP]], @@ -997,10 +1014,8 @@ }], # variant == stress and (arch == arm or arch == arm64) and simulator_run ############################################################################## -['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', { +['variant in (nooptimization, jitless) and arch in (arm, arm64) and simulator_run', { # Slow tests: https://crbug.com/v8/7783 - 'md5': [SKIP], - 'packed-elements': [SKIP], 'regress/regress-crbug-319860': [SKIP], 'wasm/asm-wasm-f32': [SKIP], 'wasm/asm-wasm-f64': [SKIP], @@ -1057,7 +1072,7 @@ ############################################################################## # Liftoff is currently only sufficiently implemented on x64, ia32, arm64 and # arm. -# TODO(clemensh): Implement on all other platforms (crbug.com/v8/6600). +# TODO(clemensb): Implement on all other platforms (crbug.com/v8/6600). ['arch != x64 and arch != ia32 and arch != arm64 and arch != arm', { 'wasm/liftoff': [SKIP], 'wasm/tier-up-testing-flag': [SKIP], @@ -1068,9 +1083,6 @@ # Slow tests. 'regress/regress-crbug-493779': [SKIP], 'string-replace-gc': [SKIP], - - # https://crbug.com/v8/9221 - 'wasm/grow-shared-memory': [SKIP], }], # variant == slow_path ############################################################################## @@ -1096,4 +1108,34 @@ 'regress/regress-992389': [SKIP], }], # not embedded_builtins +############################################################################## +['variant == turboprop', { + # Deopts differently than TurboFan. + 'parallel-optimize-disabled': [SKIP], + 'compiler/native-context-specialization-hole-check': [SKIP], + 'compiler/number-comparison-truncations': [SKIP], + 'compiler/redundancy-elimination': [SKIP], + + # Static asserts for optimizations don't hold due to removed optimization + # phases. + 'compiler/concurrent-inlining-1': [SKIP], + 'compiler/concurrent-inlining-2': [SKIP], + 'compiler/diamond-followedby-branch': [SKIP], + 'compiler/load-elimination-const-field': [SKIP], + 'compiler/constant-fold-add-static': [SKIP], +}], # variant == turboprop + +############################################################################## +['variant == top_level_await', { + # specifically expects to fail on top level await. + 'harmony/modules-import-15': [SKIP], +}], # variant == top_level_await + +############################################################################## +['variant == stress_js_bg_compile_wasm_code_gc', { + # Runs significantly slower with --stress-wasm-code-gc, problematic + # especially in combination with tsan or other slow configurations. + 'wasm/many-modules': [SKIP], +}], # variant == stress_js_bg_compile_wasm_code_gc + ] diff --git a/deps/v8/test/mjsunit/mod.js b/deps/v8/test/mjsunit/mod.js index 8ad98fa7ec..4374dcc11d 100644 --- a/deps/v8/test/mjsunit/mod.js +++ b/deps/v8/test/mjsunit/mod.js @@ -31,7 +31,6 @@ function foo() { for (var j = 1; j < 100; j++) { if (answer == i) answer = 0; // Positive case. - print(j + " % " + i + " = " + answer); m = j % i; assertEquals(answer, m, j + " % " + i); m = j % (-i); diff --git a/deps/v8/test/mjsunit/packed-elements.js b/deps/v8/test/mjsunit/packed-elements.js index d0df553451..85630e7954 100644 --- a/deps/v8/test/mjsunit/packed-elements.js +++ b/deps/v8/test/mjsunit/packed-elements.js @@ -92,12 +92,15 @@ function test6() { } function test_with_optimization(f) { - // Run tests in a loop to make sure that inlined Array() constructor runs out - // of new space memory and must fall back on runtime impl. %PrepareFunctionForOptimization(f); - for (i = 0; i < 25000; ++i) f(); + for (i = 0; i < 3; ++i) f(); + // Cause the inlined Array() constructor to fall back to the runtime impl. + %SimulateNewspaceFull(); + f(); %OptimizeFunctionOnNextCall(f); - for (i = 0; i < 25000; ++i) f(); // Make sure GC happens + f(); + %SimulateNewspaceFull(); // Make sure GC happens. + f(); } test_with_optimization(test1); diff --git a/deps/v8/test/mjsunit/readonly.js b/deps/v8/test/mjsunit/readonly.js index ec938d65c0..69a3e6a016 100644 --- a/deps/v8/test/mjsunit/readonly.js +++ b/deps/v8/test/mjsunit/readonly.js @@ -26,6 +26,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --allow-natives-syntax +// This test manually triggers optimization, no need for stress modes. +// Flags: --nostress-opt --noalways-opt // Different ways to create an object. diff --git a/deps/v8/test/mjsunit/regexp-tier-up-multiple.js b/deps/v8/test/mjsunit/regexp-tier-up-multiple.js new file mode 100644 index 0000000000..7325b341d0 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-tier-up-multiple.js @@ -0,0 +1,101 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Tier-up behavior differs between slow and fast paths in +// RegExp.prototype.replace with a function as an argument. +// Flags: --regexp-tier-up --regexp-tier-up-ticks=5 +// Flags: --allow-natives-syntax --no-force-slow-path --no-regexp-interpret-all + +const kLatin1 = true; +const kUnicode = false; + +function CheckRegexpNotYetCompiled(regexp) { + assertFalse(%RegexpHasBytecode(regexp, kLatin1) && + %RegexpHasNativeCode(regexp, kLatin1)); + assertFalse(%RegexpHasBytecode(regexp, kUnicode) && + %RegexpHasNativeCode(regexp, kUnicode)); +} + +// Testing RegExp.test method which calls into Runtime_RegExpExec. +let re = new RegExp('^.$'); +CheckRegexpNotYetCompiled(re); + +// Testing first five executions of regexp with one-byte string subject. +for (var i = 0; i < 5; i++) { + re.test("a"); + assertTrue(%RegexpHasBytecode(re, kLatin1)); + assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re, kUnicode)); +} +// Testing the tier-up to native code. +re.test("a"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re,kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re,kUnicode)); +re.test("a"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re,kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re,kUnicode)); +// Testing that the regexp will compile to native code for two-byte string +// subject as well, because we have a single tick counter for both string +// representations. +re.test("π"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re,kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + %RegexpHasNativeCode(re,kUnicode)); + +// Testing String.replace method for non-global regexps. +var subject = "a1111"; +re = /\w1/; +CheckRegexpNotYetCompiled(re); + +for (var i = 0; i < 5; i++) { + subject.replace(re, "x"); + assertTrue(%RegexpHasBytecode(re, kLatin1)); + assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re, kUnicode)); +} + +subject.replace(re, "x"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re, kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re, kUnicode)); + +// Testing String.replace method for global regexps. +let re_g = /\w11111/g; +CheckRegexpNotYetCompiled(re_g); +// This regexp will not match, so it will only execute the bytecode once, +// each time the replace method is invoked, without tiering-up and +// recompiling to native code. +for (var i = 0; i < 5; i++) { + subject.replace(re_g, "x"); + assertTrue(%RegexpHasBytecode(re_g, kLatin1)); + assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); +} + +// This regexp will match, so it will execute five times, and tier-up. +re_g = /\w/g; +CheckRegexpNotYetCompiled(re_g); +subject.replace(re_g, "x"); +assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && + %RegexpHasNativeCode(re_g, kLatin1)); +assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); + +// Testing String.replace method for global regexps with a function as a +// parameter. This will tier-up eagerly and compile to native code right +// away, even though the regexp is only executed once. +function f() { return "x"; } +re_g = /\w2/g; +CheckRegexpNotYetCompiled(re_g); +subject.replace(re_g, f); +assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && + %RegexpHasNativeCode(re_g, kLatin1)); +assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); diff --git a/deps/v8/test/mjsunit/regexp-tier-up.js b/deps/v8/test/mjsunit/regexp-tier-up.js index e55e87f593..6269128f53 100644 --- a/deps/v8/test/mjsunit/regexp-tier-up.js +++ b/deps/v8/test/mjsunit/regexp-tier-up.js @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Tier-up behavior differs between slow and fast paths in functional -// RegExp.prototype.replace. -// Flags: --regexp-tier-up --allow-natives-syntax --no-force-slow-path +// Tier-up behavior differs between slow and fast paths in +// RegExp.prototype.replace with a function as an argument. +// Flags: --regexp-tier-up --regexp-tier-up-ticks=1 +// Flags: --allow-natives-syntax --no-force-slow-path --no-regexp-interpret-all const kLatin1 = true; const kUnicode = false; @@ -90,3 +91,15 @@ assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && %RegexpHasNativeCode(re_g, kLatin1)); assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && !%RegexpHasNativeCode(re_g, kUnicode)); + +// Testing eager tier-up for very long strings. +let dna = "ATCG".repeat(251); + +re_g = />.*\n|\n/; +CheckRegexpNotYetCompiled(re_g); + +dna = dna.replace(re_g,""); +assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && + %RegexpHasNativeCode(re_g, kLatin1)); +assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); diff --git a/deps/v8/test/mjsunit/regress/regress-1002827.js b/deps/v8/test/mjsunit/regress/regress-1002827.js new file mode 100644 index 0000000000..2acaf73deb --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1002827.js @@ -0,0 +1,13 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-gc + +var PI = new Proxy(this, { + get() { + PI(); + } +}); + +assertThrows(() => new gc(PI, {}), TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-1003730.js b/deps/v8/test/mjsunit/regress/regress-1003730.js new file mode 100644 index 0000000000..e20a4e4a44 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1003730.js @@ -0,0 +1,25 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax --concurrent-inlining + +function bar(error) { + try { + throw "didn't throw TypeError"; + } catch (err) { + error instanceof error, "didn't throw " + error.prototype.name; + } +} +function foo(param) { + bar(TypeError); +} +try { + bar(); +} catch (e) {} +%PrepareFunctionForOptimization(foo); +try { + foo(); +} catch (e) {} +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-1003919.js b/deps/v8/test/mjsunit/regress/regress-1003919.js new file mode 100644 index 0000000000..def45eeca4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1003919.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Define an object with a getter and a proxy as it's prototype. +var obj = {foo: 'bar'}; +Object.defineProperty(obj, 'foo', { + get: function () { + } +}); +obj.__proto__ = new Proxy([], {}); + +// Get key from a function to avoid the property access turning into a +// named property access. +function getKey() { + return 'values' +} + +// Keyed access to update obj's values property. +obj[getKey()] = 1; diff --git a/deps/v8/test/mjsunit/regress/regress-1004912.js b/deps/v8/test/mjsunit/regress/regress-1004912.js new file mode 100644 index 0000000000..baa31db138 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1004912.js @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var key = { + toString() { + return Symbol(); + } +}; + +var obj = {}; +obj[key]; diff --git a/deps/v8/test/mjsunit/regress/regress-1005400.js b/deps/v8/test/mjsunit/regress/regress-1005400.js new file mode 100644 index 0000000000..77234235fe --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1005400.js @@ -0,0 +1,23 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function foo(a, key) { + a[key]; +} + +let obj = {}; +let count = 0; + +var key_obj = { + toString: function() { + count++; + // Force string to be internalized during keyed lookup. + return 'foo' + count; + } +}; + +foo(obj, key_obj); + +// We should only call toString once. +assertEquals(count, 1); diff --git a/deps/v8/test/mjsunit/regress/regress-1006629.js b/deps/v8/test/mjsunit/regress/regress-1006629.js new file mode 100644 index 0000000000..bd307fa228 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1006629.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const workerScript = ` + onmessage = function() { + };`; +const worker = new Worker(workerScript, {type: 'string'}); +const i32a = new Int32Array( new SharedArrayBuffer() ); +worker.postMessage([i32a.buffer]); diff --git a/deps/v8/test/mjsunit/regress/regress-1006640.js b/deps/v8/test/mjsunit/regress/regress-1006640.js new file mode 100644 index 0000000000..597b42057d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1006640.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc + +function main() { + const v2 = [1337,1337,1337,1337,1337]; + function v9() { + const v15 = {get:RegExp}; + Object.defineProperty(v2,501,v15); + const v18 = RegExp(); + const v19 = 1337 instanceof v18; + } + const v30 = {defineProperty:Function,get:v9,getPrototypeOf:Object}; + const v32 = new Proxy(ArrayBuffer,v30); + const v34 = gc(v32); +} + +assertThrows(() => main(), TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-1006670.js b/deps/v8/test/mjsunit/regress/regress-1006670.js new file mode 100644 index 0000000000..4d1408b3d1 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1006670.js @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows(() => /(a?;?){4000000}/.exec("a"), RangeError); diff --git a/deps/v8/test/mjsunit/regress/regress-1011980.js b/deps/v8/test/mjsunit/regress/regress-1011980.js new file mode 100644 index 0000000000..89e4fed159 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1011980.js @@ -0,0 +1,22 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +let hex_b = 0x0b; +let hex_d = 0x0d; +let hex_20 = 0x20; +let hex_52 = 0x52; +let hex_fe = 0xfe; + +function f(a) { + let unused = [ a / 8, ...[ ...[ ...[], a / 8, ...[ 7, hex_fe, a, 0, 0, hex_20, + 6, hex_52, hex_d, 0, hex_b], 0, hex_b], hex_b]]; +} + +%PrepareFunctionForOptimization(f) +f(64) +f(64); +%OptimizeFunctionOnNextCall(f); +f(64); diff --git a/deps/v8/test/mjsunit/regress/regress-752764.js b/deps/v8/test/mjsunit/regress/regress-752764.js index 30ab7b2a6d..106d9edd87 100644 --- a/deps/v8/test/mjsunit/regress/regress-752764.js +++ b/deps/v8/test/mjsunit/regress/regress-752764.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --nostress-incremental-marking +// Stress-testing this test is very slow and provides no useful coverage. +// Flags: --nostress-opt --noalways-opt // This test uses a lot of memory and fails with flaky OOM when run // with --stress-incremental-marking on TSAN. diff --git a/deps/v8/test/mjsunit/regress/regress-779407.js b/deps/v8/test/mjsunit/regress/regress-779407.js index 140f7bdd74..71e57df9a7 100644 --- a/deps/v8/test/mjsunit/regress/regress-779407.js +++ b/deps/v8/test/mjsunit/regress/regress-779407.js @@ -10,4 +10,4 @@ for (var i = 0; i < 17; i++) { } catch (e) { } } -s.replace(/[a]/g); +s.replace(/a/g); diff --git a/deps/v8/test/mjsunit/regress/regress-9165.js b/deps/v8/test/mjsunit/regress/regress-9165.js index 1de6e9db2a..1709b488fd 100644 --- a/deps/v8/test/mjsunit/regress/regress-9165.js +++ b/deps/v8/test/mjsunit/regress/regress-9165.js @@ -14,12 +14,12 @@ let kSig_r_i = makeSig([kWasmI32], [kWasmAnyRef]); builder.addFunction("merge", kSig_r_i) .addLocals({anyref_count: 1, anyfunc_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmAnyRef, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprEnd, ]).exportFunc(); let instance = builder.instantiate(); @@ -33,12 +33,12 @@ let kSig_r_i = makeSig([kWasmI32], [kWasmAnyRef]); builder.addFunction("merge", kSig_r_i) .addLocals({anyfunc_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmAnyRef, kExprRefNull, kExprElse, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprEnd, ]).exportFunc(); let instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/regress-9832.js b/deps/v8/test/mjsunit/regress/regress-9832.js new file mode 100644 index 0000000000..41a8c38f0d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-9832.js @@ -0,0 +1,35 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function TestRegress9832() { + let builder = new WasmModuleBuilder(); + let f = builder.addFunction("f", kSig_i_i) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprI32Add, + ]).exportFunc(); + builder.addFunction("main", kSig_i_i) + .addLocals({except_count: 1}) + .addBody([ + kExprTry, kWasmStmt, + kExprLocalGet, 0, + kExprCallFunction, f.index, + kExprCallFunction, f.index, + kExprLocalSet, 0, + kExprCatch, + kExprDrop, + kExprLocalGet, 0, + kExprCallFunction, f.index, + kExprLocalSet, 0, + kExprEnd, + kExprLocalGet, 0, + ]).exportFunc(); + let instance = builder.instantiate(); + assertEquals(92, instance.exports.main(23)); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-9894.js b/deps/v8/test/mjsunit/regress/regress-9894.js new file mode 100644 index 0000000000..0a7bf5d456 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-9894.js @@ -0,0 +1,48 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(function frozen() { + const ary = [1.1] + Object.defineProperty(ary, 0, {get:run_it} ); + + // v8::internal::Runtime_ArrayIncludes_Slow. + ary.includes(); + + function run_it(el) { + ary.length = 0; + ary[0] = 1.1; + Object.freeze(ary); + return 2.2; + } +})(); + +(function seal() { + const ary = [1.1] + Object.defineProperty(ary, 0, {get:run_it} ); + + // v8::internal::Runtime_ArrayIncludes_Slow. + ary.includes(); + + function run_it(el) { + ary.length = 0; + ary[0] = 1.1; + Object.seal(ary); + return 2.2; + } +})(); + +(function preventExtensions() { + const ary = [1.1] + Object.defineProperty(ary, 0, {get:run_it} ); + + // v8::internal::Runtime_ArrayIncludes_Slow. + ary.includes(); + + function run_it(el) { + ary.length = 0; + ary[0] = 1.1; + Object.preventExtensions(ary); + return 2.2; + } +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-996161.js b/deps/v8/test/mjsunit/regress/regress-996161.js new file mode 100644 index 0000000000..dada3f47bd --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-996161.js @@ -0,0 +1,43 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function checkOwnProperties(v, count) { + var properties = Object.getOwnPropertyNames(v); + assertEquals(properties.length, count); +} + + +function testStoreNoFeedback() { + arr = new Int32Array(10); + function f(a) { a["-1"] = 15; } + + for (var i = 0; i < 3; i++) { + arr.__defineGetter__("x", function() { }); + checkOwnProperties(arr, 11); + f(arr); + } +} +testStoreNoFeedback(); + +function testStoreGeneric() { + arr = new Int32Array(10); + var index = "-1"; + function f1(a) { a[index] = 15; } + %EnsureFeedbackVectorForFunction(f1); + + // Make a[index] in f1 megamorphic + f1({a: 1}); + f1({b: 1}); + f1({c: 1}); + f1({d: 1}); + + for (var i = 0; i < 3; i++) { + arr.__defineGetter__("x", function() { }); + checkOwnProperties(arr, 11); + f1(arr); + } +} +testStoreGeneric(); diff --git a/deps/v8/test/mjsunit/regress/regress-997485.js b/deps/v8/test/mjsunit/regress/regress-997485.js new file mode 100644 index 0000000000..bcc1664222 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-997485.js @@ -0,0 +1,127 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function doubleToTaggedWithTaggedValueStoresCorrectly() { + + function setX_Double(o) { o.x = 4.2; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Double, to make sure setX_Double has + // Double feedback. + setX_Double(o); + setX_Double(o); + + // Transition o.x to Tagged. + o.x = {}; + + // setX_Double will still have Double feedback, so make sure it works with + // the new Tagged representation o.x. + setX_Double(o); + + assertEquals(o.x, 4.2); + } + + %EnsureFeedbackVectorForFunction(setX_Double); + foo(); + +})(); + +(function doubleToTaggedWithDoubleValueDoesNotMutate() { + + function setX_Double(o) { o.x = 4.2; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Double, to make sure setX_Double has + // Double feedback. + setX_Double(o); + setX_Double(o); + + // Transition o.x to Tagged. + o.x = {}; + + // Write the HeapNumber val to o.x. + const val = 1.25; + o.x = val; + + // setX_Double will still have Double feedback, which expects to be able to + // mutate o.x's HeapNumber, so make sure it does not mutate val. + setX_Double(o); + + assertEquals(o.x, 4.2); + assertNotEquals(val, 4.2); + } + + %EnsureFeedbackVectorForFunction(setX_Double); + foo(); + +})(); + +(function doubleToTaggedWithTaggedValueStoresSmiCorrectly() { + + function setX_Smi(o) { o.x = 42; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Smi, to make sure setX_Smi has + // Double feedback. + setX_Smi(o); + setX_Smi(o); + + // Transition o.x to Tagged. + o.x = {}; + + // setX_Smi will still have Double feedback, so make sure it works with + // the new Tagged representation o.x. + setX_Smi(o); + + assertEquals(o.x, 42); + } + + %EnsureFeedbackVectorForFunction(setX_Smi); + foo(); + +})(); + +(function doubleToTaggedWithSmiValueDoesNotMutate() { + + function setX_Smi(o) { o.x = 42; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Smi, to make sure setX_Smi has + // Double feedback. + setX_Smi(o); + setX_Smi(o); + + // Transition o.x to Tagged. + o.x = {}; + + // Write the HeapNumber val to o.x. + const val = 1.25; + o.x = val; + + // setX_Smi will still have Double feedback, which expects to be able to + // mutate o.x's HeapNumber, so make sure it does not mutate val. + setX_Smi(o); + + assertEquals(o.x, 42); + assertNotEquals(val, 42); + } + + %EnsureFeedbackVectorForFunction(setX_Smi); + foo(); + +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-997989.js b/deps/v8/test/mjsunit/regress/regress-997989.js new file mode 100644 index 0000000000..f049a31724 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-997989.js @@ -0,0 +1,27 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +// A function with a for-in loop, that will be optimized. +function foo(o) { + for (var i in o) { + return o[i]; + } +} + +var o = { x: 0.5 }; + +// Warm up foo with Double values in the enum cache. +%PrepareFunctionForOptimization(foo); +assertEquals(foo(o), 0.5); +assertEquals(foo(o), 0.5); +%OptimizeFunctionOnNextCall(foo); +assertEquals(foo(o), 0.5); + +// Transition the double field to a tagged field +o.x = "abc"; + +// Make sure that the optimized code correctly loads the tagged field. +assertEquals(foo(o), "abc"); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1002628.js b/deps/v8/test/mjsunit/regress/regress-crbug-1002628.js new file mode 100644 index 0000000000..8be7e8687d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1002628.js @@ -0,0 +1,22 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --always-opt + +"use strict"; +var __v_0 = {}; +try { + __v_0 = this; + Object.freeze(__v_0); +} +catch (e) { +} + +function f() { + x = { [Symbol.toPrimitive]: () => FAIL }; +} +try { + f() +} catch (e) { } +assertThrows(() => f(), ReferenceError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1003403.js b/deps/v8/test/mjsunit/regress/regress-crbug-1003403.js new file mode 100644 index 0000000000..877b9c8c73 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1003403.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --enable-lazy-source-positions --stress-lazy-source-positions +// Flags: --no-lazy +({ x: b = 0 }) => { + try { b; } catch (e) {} + function a() { b } +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1003732.js b/deps/v8/test/mjsunit/regress/regress-crbug-1003732.js new file mode 100644 index 0000000000..5e2bbe7732 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1003732.js @@ -0,0 +1,25 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function f_1() { + var v = new Array(); + v[0] = 10; + return v; +} + +function test() { + var setter_called = false; + // Turn array to NumberDictionary + Array.prototype[123456789] = 42; + assertEquals(f_1().length, 1); + + // Reset to empty_slow_dictionary + Array.prototype.length = 0; + + // This should reset the prototype validity cell. + Array.prototype.__defineSetter__("0", function() {setter_called = true}); + f_1(); + assertEquals(setter_called, true); +} +test(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1004037.js b/deps/v8/test/mjsunit/regress/regress-crbug-1004037.js new file mode 100644 index 0000000000..cf7ba70458 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1004037.js @@ -0,0 +1,23 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --always-opt + +__v_1 = {}; +__v_1.__defineGetter__('x', function () { }); +__proto__ = __v_1; +function __f_4() { + __v_1 = {}; +} +function __f_3() { + 'use strict'; + x = 42; +} +__f_4() +try { + __f_3(); +} catch (e) { } + +__proto__ = __v_1; +assertThrows(() => __f_3(), ReferenceError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1004061.js b/deps/v8/test/mjsunit/regress/regress-crbug-1004061.js new file mode 100644 index 0000000000..8b36d4d609 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1004061.js @@ -0,0 +1,55 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function testPackedDoublesIncludes() { + arr = [1.5, 2.5]; + arr.length = 0; + function f() { + return arr.includes(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), false); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), false); +})(); + +(function testHoleyDoublesIncludes() { + arr = [1.1]; + arr[3]= 1.5; + arr.length = 0; + function f() { + return arr.includes(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), false); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), false); +})(); + +(function testPackedDoublesIndexOf() { + arr = [1.5, 2.5]; + arr.length = 0; + function f() { + return arr.indexOf(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), -1); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), -1); +})(); + +(function testHoleyDoublesIndexOf() { + arr = [1.1]; + arr[3]= 1.5; + arr.length = 0; + function f() { + return arr.indexOf(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), -1); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), -1); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1006592.js b/deps/v8/test/mjsunit/regress/regress-crbug-1006592.js new file mode 100644 index 0000000000..c051d0861a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1006592.js @@ -0,0 +1,21 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function Module(stdlib) { + "use asm"; + var fround = stdlib.Math.fround; + function f(a, b) { + a = +a; + b = +b; + return fround(a, b); + } + return { f: f }; +} + +var m = Module(this); +assertEquals(23, m.f(23)); +assertEquals(42, m.f(42, 65)); +assertFalse(%IsAsmWasmCode(Module)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1008632.js b/deps/v8/test/mjsunit/regress/regress-crbug-1008632.js new file mode 100644 index 0000000000..8b46baefa1 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1008632.js @@ -0,0 +1,24 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-lazy-feedback-allocation + +var __v_9690 = function () {}; +try { + (function () { + __f_1653(); + })() +} catch (__v_9763) { +} +function __f_1653(__v_9774, __v_9775) { + try { + } catch (e) {} + __v_9774[__v_9775 + 4] = 2; +} +(function () { + %PrepareFunctionForOptimization(__f_1653); + __f_1653(__v_9690, true); + %OptimizeFunctionOnNextCall(__f_1653); + assertThrows(() => __f_1653(), TypeError); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js b/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js new file mode 100644 index 0000000000..9c2f87c4fe --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js @@ -0,0 +1,27 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function get() { + // Update the descriptor array now shared between the Foo map and the + // (Foo + c) map. + o1.c = 10; + // Change the type of the field on the new descriptor array in-place to + // Tagged. If Object.assign has a cached descriptor array, then it will point + // to the old Foo map's descriptors, which still have .b as Double. + o2.b = "string"; + return 1; +} + +function Foo() { + Object.defineProperty(this, "a", {get, enumerable: true}); + // Initialise Foo.b to have Double representation. + this.b = 1.5; +} + +var o1 = new Foo(); +var o2 = new Foo(); +var target = {}; +Object.assign(target, o2); +// Make sure that target has the right representation after assignment. +assertEquals(target.b, "string"); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1012301.js b/deps/v8/test/mjsunit/regress/regress-crbug-1012301.js new file mode 100644 index 0000000000..dc2ef92a6f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1012301.js @@ -0,0 +1,23 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +function f(o) { + // The spread after the CloneObject IC shouldn't crash when trying to write a + // double value to a field created by CloneObject. + return {...o, ...{a:1.4}}; +} + +%EnsureFeedbackVectorForFunction(f); + +var o = {}; +// Train the CloneObject IC with a Double field. +o.a = 1.5; +f(o); +f(o); +f(o); +// Change the source map to have a Tagged field. +o.a = undefined; +f(o); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1015567.js b/deps/v8/test/mjsunit/regress/regress-crbug-1015567.js new file mode 100644 index 0000000000..520d6c539b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1015567.js @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows('a ( { b() {} } [ [ 1 , c.d = 1 ] = 1.1 ] )', SyntaxError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1015945.js b/deps/v8/test/mjsunit/regress/regress-crbug-1015945.js new file mode 100644 index 0000000000..a43736e7b5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1015945.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-async-hooks + +async function* foo() { + await 1; + throw new Error(); +} + +(async () => { + for await (const x of foo()) { } +})(); + +async_hooks.createHook({ + promiseResolve() { + throw new Error(); + } +}).enable() diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-729597.js b/deps/v8/test/mjsunit/regress/regress-crbug-729597.js index b4c54e8e88..7656bc048a 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-729597.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-729597.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --verify-heap +// Flags: --verify-heap --expose-gc function __f_3(f) { arguments.__defineGetter__('length', f); @@ -13,6 +13,7 @@ function __f_4() { return "boom"; } __v_4 = []; __v_13 = ""; -for (var i = 0; i < 12800; ++i) { +for (var i = 0; i < 128; ++i) { __v_13 += __v_4.__proto__ = __f_3(__f_4); } +gc(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-808192.js b/deps/v8/test/mjsunit/regress/regress-crbug-808192.js index f57d5fc3a6..af92ce7f35 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-808192.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-808192.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --expose-gc +// Stress-testing this test is very slow and doesn't provide useful coverage. +// Flags: --nostress-opt --noalways-opt const f = eval(`(function f(i) { if (i == 0) { diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-941743.js b/deps/v8/test/mjsunit/regress/regress-crbug-941743.js index eaac4c4c4d..81416b8725 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-941743.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-941743.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --noenable-slow-asserts +// This test triggers optimization manually, no stress mode necessary. +// Flags: --nostress-opt --noalways-opt // This call ensures that TurboFan won't inline array constructors. Array(2 ** 30); diff --git a/deps/v8/test/mjsunit/regress/regress-v8-9758.js b/deps/v8/test/mjsunit/regress/regress-v8-9758.js new file mode 100644 index 0000000000..7f9eab3339 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-v8-9758.js @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --throws + +// Can't put this in a try-catch as that changes the parsing so the crash +// doesn't reproduce. +((a = ((b = a) => {})()) => 1)(); diff --git a/deps/v8/test/mjsunit/regress/regress-v8-9825.mjs b/deps/v8/test/mjsunit/regress/regress-v8-9825.mjs new file mode 100644 index 0000000000..f8d0708848 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-v8-9825.mjs @@ -0,0 +1,11 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +async function foo() { + for (;;await[]) { + break; + } +} + +foo(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-02256.js b/deps/v8/test/mjsunit/regress/wasm/regress-02256.js index 199626b3c3..63da0cc10b 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-02256.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-02256.js @@ -273,19 +273,19 @@ try { function __f_16() { var __v_1 = new WasmModuleBuilder(); __v_1.addFunction("grow_memory", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow]) .exportFunc(); __v_1.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); __v_1.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, kExprLocalGet, 1]) .exportFunc(); __v_1.addFunction("load16", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem16U, 0, 0]) .exportFunc(); __v_1.addFunction("store16", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem16, 0, 0, kExprLocalGet, 1]) .exportFunc(); __v_1.__p_1551105852 = __v_1[getRandomProperty(__v_1, 1551105852)]; __v_1.__defineGetter__(getRandomProperty(__v_1, 348910887), function() { @@ -294,10 +294,10 @@ function __f_16() { return __v_1.__p_1551105852; }); __v_1.addFunction("load8", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0]) .exportFunc(); __v_1.addFunction("store8", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0, kExprLocalGet, 1]) .exportFunc(); return __v_1; } diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-1014798.js b/deps/v8/test/mjsunit/regress/wasm/regress-1014798.js new file mode 100644 index 0000000000..98f0314b99 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-1014798.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('main', kSig_i_iii) + .addLocals({f32_count: 4}) + .addLocals({i64_count: 1}) + .addLocals({f32_count: 2}) + .addBodyWithEnd([ + kExprI64Const, 0, + kExprLocalGet, 3, + kExprI64SConvertF32, + kExprI64Ne, + kExprEnd, // @17 + ]).exportFunc(); +const instance = builder.instantiate(); +assertEquals(0, instance.exports.main(1, 2, 3)); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-1016515.js b/deps/v8/test/mjsunit/regress/wasm/regress-1016515.js new file mode 100644 index 0000000000..f56579912d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-1016515.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +var func = builder.addFunction('func', kSig_i_v).addBody([kExprI32Const, 1]); +var body = []; +for (let i = 0; i < 200; ++i) { + body.push(kExprCallFunction, func.index); +} +for (let i = 1; i < 200; ++i) { + body.push(kExprI32Add); +} +builder.addFunction('test', kSig_i_v).addBody(body).exportFunc(); +var instance = builder.instantiate(); +instance.exports.test(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-648079.js b/deps/v8/test/mjsunit/regress/wasm/regress-648079.js index fbb5414480..cf4bf1c698 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-648079.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-648079.js @@ -8,7 +8,6 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // Non-standard opcodes. let kSig_s_v = makeSig([], [kWasmS128]); -let kExprS128LoadMem = 0xc0; (function() { "use asm"; @@ -109,7 +108,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF32Min, kExprI64GtU, kExprBlock, 01, // @107 i32 - kExprTeeLocal, + kExprLocalTee, kExprBlock, 01, // @111 i32 kExprBlock, 01, // @113 i32 kExprBlock, 01, // @115 i32 @@ -169,7 +168,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF64Sub, kExprI32Const, kExprUnreachable, - kExprGetLocal, + kExprLocalGet, kExprI64LoadMem32U, kExprUnreachable, kExprI64RemU, @@ -273,7 +272,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF64Sub, kExprI32Const, kExprUnreachable, - kExprGetLocal, + kExprLocalGet, kExprI64LoadMem32U, kExprUnreachable, kExprUnreachable, @@ -300,7 +299,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF64Sub, kExprI32Const, kExprUnreachable, - kExprGetLocal, + kExprLocalGet, kExprI64LoadMem32U, kExprF64Min, kExprF64Min, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-689450.js b/deps/v8/test/mjsunit/regress/wasm/regress-689450.js index bcd25387b4..a629766bce 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-689450.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-689450.js @@ -9,7 +9,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.addMemory(16, 32, false); builder.addFunction('test', kSig_i_i) .addBodyWithEnd([ - kExprGetLocal, 0x00, + kExprLocalGet, 0x00, kExprI32Const, 0x29, kExprI32Shl, kExprI32Const, 0x18, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-702460.js b/deps/v8/test/mjsunit/regress/wasm/regress-702460.js index 21a84bcf28..3f1e11e393 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-702460.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-702460.js @@ -4,10 +4,6 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); -// Non-standard opcodes. -let kSig_s_v = makeSig([], [kWasmS128]); -let kExprS128LoadMem = 0xc0; - (function() { "use asm"; var builder = new WasmModuleBuilder(); @@ -20,7 +16,7 @@ let kExprS128LoadMem = 0xc0; kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, - kExprSetLocal, 0x00, + kExprLocalSet, 0x00, kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7049.js b/deps/v8/test/mjsunit/regress/wasm/regress-7049.js index 6d2cd351fb..46dce4a871 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7049.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7049.js @@ -20,7 +20,7 @@ let func1_sig = makeSig(new Array(8).fill(kWasmI32), [kWasmI32]); let imp = builder1.addImport('q', 'gc', kSig_v_v); let func1 = builder1.addFunction('func1', func1_sig) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, imp ]) .exportFunc(); @@ -31,14 +31,14 @@ let builder2 = new WasmModuleBuilder(); let func1_imp = builder2.addImport('q', 'func1', func1_sig); let func2 = builder2.addFunction('func2', kSig_i_i) .addBody([ - kExprGetLocal, 0, // 1 - kExprGetLocal, 0, // 2 - kExprGetLocal, 0, // 3 - kExprGetLocal, 0, // 4 - kExprGetLocal, 0, // 5 - kExprGetLocal, 0, // 6 - kExprGetLocal, 0, // 7 - kExprGetLocal, 0, // 8 + kExprLocalGet, 0, // 1 + kExprLocalGet, 0, // 2 + kExprLocalGet, 0, // 3 + kExprLocalGet, 0, // 4 + kExprLocalGet, 0, // 5 + kExprLocalGet, 0, // 6 + kExprLocalGet, 0, // 7 + kExprLocalGet, 0, // 8 kExprCallFunction, func1_imp ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7353.js b/deps/v8/test/mjsunit/regress/wasm/regress-7353.js index 81f45fe6a5..671da730fb 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7353.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7353.js @@ -9,17 +9,17 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); builder.addMemory(16, 32); builder.addFunction('grow', kSig_i_i).addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprMemoryGrow, 0, ]).exportFunc(); builder.addFunction('main', kSig_i_i).addBody([ ...wasmI32Const(0x41), - kExprSetLocal, 0, + kExprLocalSet, 0, // Enter loop, such that values are spilled to the stack. kExprLoop, kWasmStmt, kExprEnd, // Reload value. This must be loaded as 32 bit value. - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0, ]).exportFunc(); const instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7366.js b/deps/v8/test/mjsunit/regress/wasm/regress-7366.js index b5cae8daa4..b5e4e2e2b6 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7366.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7366.js @@ -7,22 +7,22 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_i_iii).addBody([ // Return the sum of all arguments. - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kExprI32Add, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kExprI32Add, kExprI32Add ]); const sig = builder.addType(kSig_i_iii); builder.addFunction(undefined, kSig_i_iii) .addBody([ ...wasmI32Const(1), // i32.const 0x1 - kExprSetLocal, 0, // set_local 0 + kExprLocalSet, 0, // set_local 0 ...wasmI32Const(4), // i32.const 0x1 - kExprSetLocal, 1, // set_local 1 + kExprLocalSet, 1, // set_local 1 ...wasmI32Const(16), // i32.const 0x1 - kExprSetLocal, 2, // set_local 2 + kExprLocalSet, 2, // set_local 2 kExprLoop, kWasmStmt, // loop kExprEnd, // end - kExprGetLocal, 0, // get_local 0 - kExprGetLocal, 1, // get_local 1 - kExprGetLocal, 2, // get_local 2 + kExprLocalGet, 0, // get_local 0 + kExprLocalGet, 1, // get_local 1 + kExprLocalGet, 2, // get_local 2 kExprI32Const, 0, // i32.const 0 (func index) kExprCallIndirect, sig, 0, // call indirect ]) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-739768.js b/deps/v8/test/mjsunit/regress/wasm/regress-739768.js index 5fca49bc0f..0bd73223c9 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-739768.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-739768.js @@ -11,7 +11,7 @@ builder0.setName('module_0'); let sig_index = builder0.addType(kSig_i_v); builder0.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index, kTableZero ]) // -- .exportAs('main'); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7422.js b/deps/v8/test/mjsunit/regress/wasm/regress-7422.js index 71e1eb89bd..6bf737857a 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7422.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7422.js @@ -6,18 +6,18 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); var builder = new WasmModuleBuilder(); sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -builder.addFunction(undefined, sig).addBody([kExprGetLocal, 4]); +builder.addFunction(undefined, sig).addBody([kExprLocalGet, 4]); builder.addMemory(16, 32); builder.addFunction('main', sig) .addBody([ - kExprI32Const, 0, kExprSetLocal, 0, + kExprI32Const, 0, kExprLocalSet, 0, // Compute five arguments to the function call. kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, - kExprGetLocal, 4, kExprI32Const, 1, kExprI32Add, + kExprLocalGet, 4, kExprI32Const, 1, kExprI32Add, // Now some intermediate computation to force the arguments to be spilled // to the stack: - kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add, kExprGetLocal, 1, - kExprGetLocal, 1, kExprI32Add, kExprI32Add, kExprDrop, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, kExprLocalGet, 1, + kExprLocalGet, 1, kExprI32Add, kExprI32Add, kExprDrop, // Now call the function. kExprCallFunction, 0 ]) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7508.js b/deps/v8/test/mjsunit/regress/wasm/regress-7508.js index 10ce500a44..1c02060957 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7508.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7508.js @@ -15,6 +15,6 @@ builder.addFunction(undefined, kSig_v_v).addLocals({i64_count: 1}).addBody([ kExprI32Const, 0, // i32.const kExprEnd, // end kExprBrIf, 0, // br_if depth=0 - kExprSetLocal, 0, // set_local 0 + kExprLocalSet, 0, // set_local 0 ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-752423.js b/deps/v8/test/mjsunit/regress/wasm/regress-752423.js index 938ecbf252..304dbd955d 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-752423.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-752423.js @@ -13,7 +13,7 @@ builder.addImportedTable("x", "table", 1, 10000000); builder.addFunction("main", kSig_i_i) .addBody([ kExprI32Const, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero]) .exportAs("main"); let module = new WebAssembly.Module(builder.toBuffer()); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7565.js b/deps/v8/test/mjsunit/regress/wasm/regress-7565.js index c9d4e2ca88..3b97fe8615 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7565.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7565.js @@ -9,7 +9,7 @@ sig0 = makeSig([], [kWasmI32]); builder.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([ kExprLoop, kWasmI32, // loop i32 kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const 0 --> f32:0 - kExprGetLocal, 0x00, // get_local 0 --> i64:0 + kExprLocalGet, 0x00, // get_local 0 --> i64:0 kExprF32SConvertI64, // f32.sconvert/i64 --> f32:0 kExprF32Ge, // f32.ge --> i32:1 kExprEnd, // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7579.js b/deps/v8/test/mjsunit/regress/wasm/regress-7579.js index 876a76cad9..da774b00f1 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7579.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7579.js @@ -51,7 +51,7 @@ const builder2 = new WasmModuleBuilder(); sig0 = makeSig([], [kWasmI32]); builder2.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([ kExprLoop, kWasmI32, // loop i32 - kExprGetLocal, 0, // get_local 3 + kExprLocalGet, 0, // get_local 3 kExprF32SConvertI64, // f32.sconvert/i64 kExprI32ReinterpretF32, // i32.reinterpret/f32 kExprEnd // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-763697.js b/deps/v8/test/mjsunit/regress/wasm/regress-763697.js index c831a55fba..5f36d42c8d 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-763697.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-763697.js @@ -8,7 +8,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .addLocals({s128_count: 1}); assertFalse(WebAssembly.validate(builder.toBuffer())); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-771243.js b/deps/v8/test/mjsunit/regress/wasm/regress-771243.js index 81b9e8f2a9..c06adebd76 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-771243.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-771243.js @@ -25,7 +25,7 @@ function __f_1() { __v_21 = __f_1(__v_18 = false, __v_25 = kSig_i_i); __v_21.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, __v_29 ]) .exportFunc(); __v_32 = diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-772332.js b/deps/v8/test/mjsunit/regress/wasm/regress-772332.js index e8547c8175..54676b198e 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-772332.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-772332.js @@ -19,7 +19,7 @@ function __f_15356(__v_50316, __v_50317) { } (function __f_15357() { let __v_50320 = __f_15356(__v_50350 = false, __v_50351 = kSig_i_i); - __v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprGetLocal, 0, kExprCallFunction, __v_50315, kExprI32Const, kExprI32Add, kExprReturn]).exportFunc(); + __v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprLocalGet, 0, kExprCallFunction, __v_50315, kExprI32Const, kExprI32Add, kExprReturn]).exportFunc(); let __v_50321 = __f_15356(); let __v_50324 = __v_50321.instantiate(); let __v_50325 = __v_50320.instantiate({ diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7785.js b/deps/v8/test/mjsunit/regress/wasm/regress-7785.js index 72638b1685..9f06ae5f10 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7785.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7785.js @@ -24,7 +24,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); (function testAnyRefIsNull() { const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_i_r) - .addBody([kExprGetLocal, 0, kExprRefIsNull]) + .addBody([kExprLocalGet, 0, kExprRefIsNull]) .exportFunc(); var wire_bytes = builder.toBuffer(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js index 73b47bdd78..3daeff9e15 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js @@ -7,7 +7,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); builder.addFunction('test', kSig_i_i) .addBody([ - kExprGetLocal, 0x00, // get_local 0 + kExprLocalGet, 0x00, // get_local 0 kExprBlock, kWasmStmt, // block kExprBr, 0x00, // br depth=0 kExprEnd, // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js index 657b2c0013..ac2b34019e 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js @@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder(); builder.addFunction('test', kSig_i_i) .addBody([ // body: - kExprGetLocal, 0, // get_local 0 - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprLoop, kWasmStmt, // loop kExprBr, 0, // br depth=0 kExprEnd, // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-801785.js b/deps/v8/test/mjsunit/regress/wasm/regress-801785.js index 105fd4bc38..7c68a0d593 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-801785.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-801785.js @@ -10,11 +10,11 @@ const builder = new WasmModuleBuilder(); builder.addMemory(8, 16); builder.addFunction(undefined, kSig_i_i).addBody([ // wasm to wasm call. - kExprGetLocal, 0, kExprCallFunction, 0x1 + kExprLocalGet, 0, kExprCallFunction, 0x1 ]); builder.addFunction(undefined, kSig_i_i).addBody([ // load from <get_local 0> to create trap code. - kExprGetLocal, 0, kExprI32LoadMem, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, // unreachable to create a runtime call. kExprUnreachable ]); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js index aeaf850365..e212ec05d1 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js @@ -8,10 +8,10 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_v_iii).addBody([ kExprI32Const, 0x41, // i32.const 0x41 kExprLoop, 0x7c, // loop f64 - kExprGetLocal, 0x00, // get_local 0 - kExprGetLocal, 0x01, // get_local 1 + kExprLocalGet, 0x00, // get_local 0 + kExprLocalGet, 0x01, // get_local 1 kExprBrIf, 0x01, // br_if depth=1 - kExprGetLocal, 0x00, // get_local 0 + kExprLocalGet, 0x00, // get_local 0 kExprI32Rol, // i32.rol kExprBrIf, 0x00, // br_if depth=0 kExprUnreachable, // unreachable diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js index 78ee6bd1d2..4ee9cd3c43 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js @@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); (function TestPostModule() { let builder = new WasmModuleBuilder(); builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); let module = builder.toModule(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js index 57920de09d..269489059f 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js @@ -27,11 +27,11 @@ function varuint32(val) { let body = []; for (let i = 0; i < kNumLocals; ++i) { - body.push(kExprCallFunction, 0, kExprSetLocal, ...varuint32(i)); + body.push(kExprCallFunction, 0, kExprLocalSet, ...varuint32(i)); } for (let i = 0; i < kNumLocals; ++i) { - body.push(kExprGetLocal, ...varuint32(i), kExprCallFunction, 1); + body.push(kExprLocalGet, ...varuint32(i), kExprCallFunction, 1); } let builder = new WasmModuleBuilder(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js index d78c07f36c..6487a35cd3 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js @@ -10,7 +10,7 @@ let kTableSize = 3; var builder = new WasmModuleBuilder(); var sig_index1 = builder.addType(kSig_i_v); builder.addFunction('main', kSig_i_ii).addBody([ - kExprGetLocal, + kExprLocalGet, 0, kExprCallIndirect, sig_index1, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-817380.js b/deps/v8/test/mjsunit/regress/wasm/regress-817380.js index c7748d8904..23ab2a5c91 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-817380.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-817380.js @@ -8,7 +8,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder1 = new WasmModuleBuilder(); builder1.addFunction('mul', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Mul]) .exportFunc(); const mul = builder1.instantiate().exports.mul; const table = new WebAssembly.Table({ diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834619.js b/deps/v8/test/mjsunit/regress/wasm/regress-834619.js index 1062d5547a..af7043904e 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-834619.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-834619.js @@ -29,7 +29,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addTable(kWasmAnyFunc, 4); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834624.js b/deps/v8/test/mjsunit/regress/wasm/regress-834624.js index 45af23cde2..3e3548ed32 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-834624.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-834624.js @@ -14,7 +14,7 @@ let instance; let module = new WasmModuleBuilder(); module.addImport('mod', 'func', kSig_v_i); module.addFunction('main', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); instance = module.instantiate({ mod: { diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8505.js b/deps/v8/test/mjsunit/regress/wasm/regress-8505.js index b1fdedfc93..c1becbe454 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-8505.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8505.js @@ -171,8 +171,8 @@ function wasmBinop(name, sig) { builder.addImport('Math', name, sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 ]) // -- .exportAs('main'); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-854011.js b/deps/v8/test/mjsunit/regress/wasm/regress-854011.js index b0356a873f..00cfe655cb 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-854011.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-854011.js @@ -9,14 +9,14 @@ builder.addFunction('main', kSig_d_d) .addBody([ // Call with param 0 (converted to i64), to fill the stack with non-zero // values. - kExprGetLocal, 0, kExprI64SConvertF64, // arg 0 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 1 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 2 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 3 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 4 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 5 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 6 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 7 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 0 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 1 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 2 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 3 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 4 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 5 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 6 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 7 kExprCallFunction, 1, // call #1 // Now call with 0 constants. // The bug was that they were written out as i32 values, thus the upper 32 @@ -36,7 +36,7 @@ builder.addFunction('main', kSig_d_d) .exportFunc(); builder.addFunction(undefined, makeSig(new Array(8).fill(kWasmI64), [kWasmF64])) .addBody([ - kExprGetLocal, 7, // get_local 7 (last parameter) + kExprLocalGet, 7, // get_local 7 (last parameter) kExprF64SConvertI64, // f64.convert_s/i64 ]); const instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-854050.js b/deps/v8/test/mjsunit/regress/wasm/regress-854050.js index d6c4829acd..7130595870 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-854050.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-854050.js @@ -8,18 +8,18 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], [])) .addLocals({i32_count: 7}) .addBody([ - kExprGetLocal, 0, // get_local + kExprLocalGet, 0, // get_local kExprI32Const, 0, // i32.const 0 kExprIf, kWasmStmt, // if kExprUnreachable, // unreachable kExprEnd, // end if - kExprGetLocal, 4, // get_local - kExprTeeLocal, 8, // tee_local + kExprLocalGet, 4, // get_local + kExprLocalTee, 8, // tee_local kExprBrIf, 0, // br_if depth=0 - kExprTeeLocal, 7, // tee_local - kExprTeeLocal, 0, // tee_local - kExprTeeLocal, 2, // tee_local - kExprTeeLocal, 8, // tee_local + kExprLocalTee, 7, // tee_local + kExprLocalTee, 0, // tee_local + kExprLocalTee, 2, // tee_local + kExprLocalTee, 8, // tee_local kExprDrop, // drop kExprLoop, kWasmStmt, // loop kExprEnd, // end loop diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-864509.js b/deps/v8/test/mjsunit/regress/wasm/regress-864509.js index 19e3bfcfb8..45e9e0b898 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-864509.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-864509.js @@ -10,7 +10,7 @@ const builder = new WasmModuleBuilder(); builder.addMemory(1, 1); // First function is Liftoff. The first parameter is used as memory offset. builder.addFunction(undefined, kSig_v_i).addBody([ - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32Const, 0, // i32.const 0 kExprI32StoreMem, 0, 0, // i32.store offset=0 ]); @@ -19,7 +19,7 @@ builder.addFunction(undefined, kSig_v_i).addBody([ // is loaded as 64-bit value on x64. builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), [])) .addBody([ - kExprGetLocal, 5, // get_local 5 + kExprLocalGet, 5, // get_local 5 kExprCallFunction, 0 // call 0 ]); // The third function is Liftoff again. A value is spilled on the stack as i32, @@ -27,8 +27,8 @@ builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), [])) // copied on the stack, even though just 32-bit were written before. Hence, the // stack slot is not zero-extended. const gen_i32_code = [ - kExprTeeLocal, 0, // tee_local 0 - kExprGetLocal, 0, // get_local 0 + kExprLocalTee, 0, // tee_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32Const, 1, // i32.const 1 kExprI32Add // i32.add --> 2nd param ]; diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-894307.js b/deps/v8/test/mjsunit/regress/wasm/regress-894307.js index f40388fcb4..a9a3595fbc 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-894307.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-894307.js @@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder(); const sig = makeSig([kWasmI32, kWasmI64, kWasmI64], [kWasmI64]); builder.addFunction(undefined, sig) .addBody([ - kExprGetLocal, 2, - kExprGetLocal, 1, + kExprLocalGet, 2, + kExprLocalGet, 1, kExprI64Shl, ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-910824.js b/deps/v8/test/mjsunit/regress/wasm/regress-910824.js index b795425b1f..6101f8ca81 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-910824.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-910824.js @@ -11,26 +11,26 @@ builder.addType(makeSig([kWasmI32, kWasmF32, kWasmF32, kWasmF64], [kWasmI32])); builder.addFunction(undefined, 0 /* sig */) .addLocals({i32_count: 504}) .addBody([ -kExprGetGlobal, 0x00, -kExprSetLocal, 0x04, -kExprGetLocal, 0x04, +kExprGlobalGet, 0x00, +kExprLocalSet, 0x04, +kExprLocalGet, 0x04, kExprI32Const, 0x01, kExprI32Sub, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x00, kExprI32Eqz, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x01, kExprI32Const, 0x01, kExprI32Sub, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x00, kExprI32Eqz, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x00, kExprI32Const, 0x01, kExprI32Sub, -kExprGetGlobal, 0x01, +kExprGlobalGet, 0x01, kExprUnreachable, ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-917412.js b/deps/v8/test/mjsunit/regress/wasm/regress-917412.js index b74572ac8a..4b9528ccf6 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-917412.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-917412.js @@ -14,11 +14,11 @@ kExprIf, kWasmI32, kExprElse, kExprI32Const, 1, kExprEnd, -kExprTeeLocal, 0, -kExprGetLocal, 0, +kExprLocalTee, 0, +kExprLocalGet, 0, kExprLoop, kWasmStmt, kExprI64Const, 0x80, 0x80, 0x80, 0x70, - kExprSetLocal, 0x01, + kExprLocalSet, 0x01, kExprI32Const, 0x00, kExprIf, kWasmI32, kExprI32Const, 0x00, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918284.js b/deps/v8/test/mjsunit/regress/wasm/regress-918284.js index dadbf3f7ea..16de9caabd 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-918284.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-918284.js @@ -14,7 +14,7 @@ builder.addFunction(undefined, kSig_i_i) kExprElse, // @15 kExprI32Const, 1, kExprEnd, // @18 - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprI32Popcnt ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918917.js b/deps/v8/test/mjsunit/regress/wasm/regress-918917.js index f007957c6f..3660244cda 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-918917.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-918917.js @@ -8,9 +8,9 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_v_v) .addLocals({i32_count: 1}).addLocals({f32_count: 1}).addLocals({f64_count: 1}) .addBody([ -kExprGetLocal, 1, -kExprGetLocal, 2, -kExprGetLocal, 0, +kExprLocalGet, 1, +kExprLocalGet, 2, +kExprLocalGet, 0, kExprIf, kWasmI32, kExprI32Const, 1, kExprElse, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-919308.js b/deps/v8/test/mjsunit/regress/wasm/regress-919308.js index 8c454413e8..e2f0426702 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-919308.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-919308.js @@ -8,23 +8,23 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_i_i) .addLocals({i32_count: 5}) .addBody([ - kExprGetLocal, 0, // --> 1 + kExprLocalGet, 0, // --> 1 kExprIf, kWasmI32, - kExprGetLocal, 0, // --> 1 + kExprLocalGet, 0, // --> 1 kExprElse, kExprUnreachable, kExprEnd, kExprIf, kWasmI32, - kExprGetLocal, 0, // --> 1 + kExprLocalGet, 0, // --> 1 kExprElse, kExprUnreachable, kExprEnd, kExprIf, kWasmI32, kExprI32Const, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Sub, // --> -1 - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Sub, // --> 0 kExprI32Sub, // --> -1 kExprElse, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-919533.js b/deps/v8/test/mjsunit/regress/wasm/regress-919533.js index 706d3cc7f4..1cc4b675c2 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-919533.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-919533.js @@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_v_v).addBody([]); builder.addFunction(undefined, kSig_i_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, // Stack now contains two copies of the first param register. // Start a loop to create a merge point (values still in registers). kExprLoop, kWasmStmt, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922432.js b/deps/v8/test/mjsunit/regress/wasm/regress-922432.js index f6175b3a63..d5aee0d332 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-922432.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-922432.js @@ -12,7 +12,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addLocals({except_count: 1}) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprBrOnExn // Bytecode truncated here. ]).exportFunc(); fun.body.pop(); // Pop implicitly added kExprEnd from body. diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922670.js b/deps/v8/test/mjsunit/regress/wasm/regress-922670.js index 2988eddf30..96a17bebba 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-922670.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-922670.js @@ -10,10 +10,10 @@ builder.addFunction(undefined, sig) .addLocals({i64_count: 1}) .addBody([ kExprLoop, kWasmI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64Const, 1, kExprLoop, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Const, 1, kExprIf, kWasmI32, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922933.js b/deps/v8/test/mjsunit/regress/wasm/regress-922933.js index 4d44509598..6d0286d95a 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-922933.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-922933.js @@ -14,30 +14,30 @@ builder.addFunction(undefined, sig) kExprEnd, kExprBlock, kWasmStmt, kExprI32Const, 0x00, - kExprSetLocal, 0x09, + kExprLocalSet, 0x09, kExprI32Const, 0x00, kExprIf, kWasmStmt, kExprBlock, kWasmStmt, kExprI32Const, 0x00, - kExprSetLocal, 0x0a, + kExprLocalSet, 0x0a, kExprBr, 0x00, kExprEnd, kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, - kExprGetLocal, 0x00, - kExprSetLocal, 0x12, + kExprLocalGet, 0x00, + kExprLocalSet, 0x12, kExprBr, 0x00, kExprEnd, - kExprGetLocal, 0x16, - kExprSetLocal, 0x0f, - kExprGetLocal, 0x0f, - kExprSetLocal, 0x17, - kExprGetLocal, 0x0f, - kExprSetLocal, 0x18, - kExprGetLocal, 0x17, - kExprGetLocal, 0x18, + kExprLocalGet, 0x16, + kExprLocalSet, 0x0f, + kExprLocalGet, 0x0f, + kExprLocalSet, 0x17, + kExprLocalGet, 0x0f, + kExprLocalSet, 0x18, + kExprLocalGet, 0x17, + kExprLocalGet, 0x18, kExprI64ShrS, - kExprSetLocal, 0x19, + kExprLocalSet, 0x19, kExprUnreachable, kExprEnd, kExprUnreachable, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-924843.js b/deps/v8/test/mjsunit/regress/wasm/regress-924843.js index 0549a769fb..c77845af76 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-924843.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-924843.js @@ -8,7 +8,7 @@ const builder = new WasmModuleBuilder(); const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32])); builder.addFunction(undefined, sig) .addBody([ - kExprGetLocal, 2, + kExprLocalGet, 2, kExprIf, kWasmStmt, kExprBlock, kWasmStmt ]); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-935138.js b/deps/v8/test/mjsunit/regress/wasm/regress-935138.js index 20835428e3..dd585bb255 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-935138.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-935138.js @@ -11,8 +11,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); binary.emit_header(); binary.emit_bytes([kTypeSectionCode, 4, 1, kWasmFunctionTypeForm, 0, 0]); binary.emit_bytes([kFunctionSectionCode, 2, 1, 0]); - binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd]); - binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd]); + binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprLocalGet, 0, kExprEnd]); + binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprLocalGet, 0, kExprEnd]); let buffer = binary.trunc_buffer(); assertPromiseResult(WebAssembly.compile(buffer), assertUnreachable, e => assertInstanceof(e, WebAssembly.CompileError)); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-952342.js b/deps/v8/test/mjsunit/regress/wasm/regress-952342.js index eb81f5a9c6..5e20860d4d 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-952342.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-952342.js @@ -9,9 +9,9 @@ const memory = new WebAssembly.Memory({initial: 1}); let builder = new WasmModuleBuilder(); builder.addImportedMemory("imports", "mem", 1); builder.addFunction("copy", kSig_v_iii) - .addBody([kExprGetLocal, 0, // dst - kExprGetLocal, 1, // src - kExprGetLocal, 2, // size + .addBody([kExprLocalGet, 0, // dst + kExprLocalGet, 1, // src + kExprLocalGet, 2, // size kNumericPrefix, kExprMemoryCopy, 0, 0]).exportAs("copy"); let instance = builder.instantiate({imports: {mem: memory}}); memory.grow(1); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-957405.js b/deps/v8/test/mjsunit/regress/wasm/regress-957405.js index a83104297e..51adce7698 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-957405.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-957405.js @@ -9,9 +9,9 @@ const memory = new WebAssembly.Memory({initial: 1}); let builder = new WasmModuleBuilder(); builder.addImportedMemory("imports", "mem"); builder.addFunction("fill", kSig_v_iii) - .addBody([kExprGetLocal, 0, // dst - kExprGetLocal, 1, // value - kExprGetLocal, 2, // size + .addBody([kExprLocalGet, 0, // dst + kExprLocalGet, 1, // value + kExprLocalGet, 2, // size kNumericPrefix, kExprMemoryFill, 0]).exportAs("fill"); let instance = builder.instantiate({imports: {mem: memory}}); memory.grow(1); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-968078.js b/deps/v8/test/mjsunit/regress/wasm/regress-968078.js index 2935ea05e3..07081087fa 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-968078.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-968078.js @@ -28,16 +28,16 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("foo", kSig_v_iii) .addBody([].concat([ kExprBlock, kWasmStmt, - kExprGetLocal, 0x2, + kExprLocalGet, 0x2, kExprI32Const, 0x01, kExprI32And, // Generate a test branch (which has 32k limited reach). kExprIf, kWasmStmt, - kExprGetLocal, 0x0, + kExprLocalGet, 0x0, kExprI32Const, 0x01, kExprI32And, kExprBrIf, 0x1, - kExprGetLocal, 0x0, + kExprLocalGet, 0x0, // Emit a br_table that is long enough to make the test branch go out of range. ], br_table(0x1, 9000, 0x00), [ kExprEnd, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-9759.js b/deps/v8/test/mjsunit/regress/wasm/regress-9759.js new file mode 100644 index 0000000000..9d1f86a48d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-9759.js @@ -0,0 +1,26 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-wasm-tier-up --no-liftoff + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// This constant was chosen as it is the smallest number of cases that still +// triggers the input count overflow. The new limit put into place is smaller. +const NUM_CASES = 0xfffd; + +(function TestBrTableTooLarge() { + let builder = new WasmModuleBuilder(); + let cases = new Array(NUM_CASES).fill(0); + builder.addFunction('main', kSig_v_i) + .addBody([].concat([ + kExprBlock, kWasmStmt, + kExprLocalGet, 0, + kExprBrTable], wasmSignedLeb(NUM_CASES), + cases, [0, + kExprEnd + ])).exportFunc(); + assertThrows(() => new WebAssembly.Module(builder.toBuffer()), + WebAssembly.CompileError, /invalid table count/); +})(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1006631.js b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1006631.js new file mode 100644 index 0000000000..ab555e4551 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1006631.js @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-type-reflection --trace-turbo-graph + +new WebAssembly.Function({ parameters: [], results: [] }, x => x); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js index 37d5b2e4a2..279d2dbd06 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js @@ -13,7 +13,7 @@ let types = new Array(argc).fill(kWasmI32); let sig = makeSig(types, []); let body = []; for (let i = 0; i < argc; ++i) { - body.push(kExprGetLocal, i); + body.push(kExprLocalGet, i); } body.push(kExprCallFunction, 0); builder.addImport('', 'f', sig); diff --git a/deps/v8/test/mjsunit/string-replace-gc.js b/deps/v8/test/mjsunit/string-replace-gc.js index 2f1efd8813..56b6a09da1 100644 --- a/deps/v8/test/mjsunit/string-replace-gc.js +++ b/deps/v8/test/mjsunit/string-replace-gc.js @@ -25,31 +25,22 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Regression test for the r1512 fix. +// Regression test for the r1513 fix. + +// Flags: --allow-natives-syntax var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; +assertEquals(39, foo.length); + +for (var i = 0; i < 12; i++) { + foo = foo + foo; +} -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; - -foo.replace(/[b]/, "c"); // Flatten foo. +foo = %FlattenString(foo); var moving_string = "b" + "c"; -var bar = foo.replace(/[a]/g, moving_string); +var bar = foo.replace(/a/g, moving_string); -print(bar.length); +// 39 * 2^12 * 2 +assertEquals(319488, bar.length); diff --git a/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js b/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js index 2d7cd00ac3..7be5abb675 100644 --- a/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js +++ b/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js @@ -20,8 +20,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Add]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/unicodelctest-no-optimization.js b/deps/v8/test/mjsunit/unicodelctest-no-optimization.js index 0b31c560e0..e56d690ed2 100644 --- a/deps/v8/test/mjsunit/unicodelctest-no-optimization.js +++ b/deps/v8/test/mjsunit/unicodelctest-no-optimization.js @@ -93,7 +93,6 @@ function fuzz() { fuzz_index = 0; seed = 49734321; for (var i = 0; i < 1000; i++) { - print(i); var len = rand() & 0x1f; var ranges = new Array(len); var last = rand(); diff --git a/deps/v8/test/mjsunit/wasm/OWNERS b/deps/v8/test/mjsunit/wasm/OWNERS index b6d75023d7..c400f97de0 100644 --- a/deps/v8/test/mjsunit/wasm/OWNERS +++ b/deps/v8/test/mjsunit/wasm/OWNERS @@ -1,3 +1,3 @@ ahaas@chromium.org -clemensh@chromium.org +clemensb@chromium.org titzer@chromium.org diff --git a/deps/v8/test/mjsunit/wasm/adapter-frame.js b/deps/v8/test/mjsunit/wasm/adapter-frame.js index 55634163c6..a25e2aaf3b 100644 --- a/deps/v8/test/mjsunit/wasm/adapter-frame.js +++ b/deps/v8/test/mjsunit/wasm/adapter-frame.js @@ -28,7 +28,7 @@ function makeSelect(type, args, which) { var params = []; for (var i = 0; i < args; i++) params.push(type); builder.addFunction("select", makeSig(params, [type])) - .addBody([kExprGetLocal, which]) + .addBody([kExprLocalGet, which]) .exportFunc(); return builder.instantiate().exports.select; diff --git a/deps/v8/test/mjsunit/wasm/anyfunc.js b/deps/v8/test/mjsunit/wasm/anyfunc.js index f0d587b25a..4a53a04468 100644 --- a/deps/v8/test/mjsunit/wasm/anyfunc.js +++ b/deps/v8/test/mjsunit/wasm/anyfunc.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_a_a) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); const instance = builder.instantiate(); @@ -27,7 +27,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_v_a); const imp_index = builder.addImport('q', 'func', sig_index); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 0, kExprCallFunction, imp_index]) + .addBody([kExprLocalGet, 0, kExprCallFunction, imp_index]) .exportFunc(); const main = builder.instantiate({q: {func: checkFunction}}).exports.main; @@ -50,28 +50,28 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.addFunction('main', ref_sig) .addLocals({anyfunc_count: 10}) .addBody([ - kExprGetLocal, 0, - kExprSetLocal, 1, // Set local - kExprGetLocal, 0, - kExprSetLocal, 2, // Set local - kExprGetLocal, 0, - kExprSetLocal, 3, // Set local - kExprGetLocal, 0, - kExprSetLocal, 4, // Set local - kExprGetLocal, 0, - kExprSetLocal, 5, // Set local - kExprGetLocal, 0, - kExprSetLocal, 6, // Set local - kExprGetLocal, 0, - kExprSetLocal, 7, // Set local - kExprGetLocal, 0, - kExprSetLocal, 8, // Set local - kExprGetLocal, 0, - kExprSetLocal, 9, // Set local - kExprGetLocal, 0, - kExprSetLocal, 10, // Set local + kExprLocalGet, 0, + kExprLocalSet, 1, // Set local + kExprLocalGet, 0, + kExprLocalSet, 2, // Set local + kExprLocalGet, 0, + kExprLocalSet, 3, // Set local + kExprLocalGet, 0, + kExprLocalSet, 4, // Set local + kExprLocalGet, 0, + kExprLocalSet, 5, // Set local + kExprLocalGet, 0, + kExprLocalSet, 6, // Set local + kExprLocalGet, 0, + kExprLocalSet, 7, // Set local + kExprLocalGet, 0, + kExprLocalSet, 8, // Set local + kExprLocalGet, 0, + kExprLocalSet, 9, // Set local + kExprLocalGet, 0, + kExprLocalSet, 10, // Set local kExprCallFunction, gc_index, // call gc - kExprGetLocal, 9, + kExprLocalGet, 9, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -97,7 +97,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.addFunction('main', ref_sig) .addBody([ kExprCallFunction, gc_index, // call gc - kExprGetLocal, 0, kExprCallFunction, imp_index // call import + kExprLocalGet, 0, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -118,7 +118,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); makeSig([kWasmI32, kWasmAnyFunc, kWasmI32], [kWasmAnyFunc]); const sig_index = builder.addType(kSig_a_iai); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 1]) + .addBody([kExprLocalGet, 1]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -140,7 +140,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_a_v); builder.addFunction('main', sig_index) .addLocals({anyfunc_count: 1}) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -152,7 +152,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); const sig_index = builder.addType(kSig_a_a); builder.addFunction('main', sig_index) - .addBody([kExprRefNull, kExprSetLocal, 0, kExprGetLocal, 0]) + .addBody([kExprRefNull, kExprLocalSet, 0, kExprLocalGet, 0]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -187,7 +187,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_r_v); builder.addFunction('main', sig_index) .addLocals({anyfunc_count: 1}) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -200,7 +200,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_r_v); builder.addFunction('main', sig_index) .addLocals({anyfunc_count: 1}) - .addBody([kExprGetLocal, 0, kExprReturn]) + .addBody([kExprLocalGet, 0, kExprReturn]) .exportFunc(); const main = builder.instantiate().exports.main; diff --git a/deps/v8/test/mjsunit/wasm/anyref-globals.js b/deps/v8/test/mjsunit/wasm/anyref-globals.js index 39d3bcb147..d243e37486 100644 --- a/deps/v8/test/mjsunit/wasm/anyref-globals.js +++ b/deps/v8/test/mjsunit/wasm/anyref-globals.js @@ -12,10 +12,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g_nullref = builder.addGlobal(kWasmAnyRef, true).index; const g_nullfunc = builder.addGlobal(kWasmAnyFunc, true).index; builder.addFunction("get_anyref_global", kSig_r_v) - .addBody([kExprGetGlobal, g_nullref]) + .addBody([kExprGlobalGet, g_nullref]) .exportAs("get_anyref_global"); builder.addFunction("get_anyfunc_global", kSig_a_v) - .addBody([kExprGetGlobal, g_nullfunc]) + .addBody([kExprGlobalGet, g_nullfunc]) .exportAs("get_anyfunc_global"); const instance = builder.instantiate(); @@ -32,16 +32,16 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g_nullfunc = builder.addGlobal(kWasmAnyFunc, true); builder.addFunction("get_anyref_global", kSig_r_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g_setref.index, - kExprGetGlobal, g_nullref.index + kExprLocalGet, 0, + kExprGlobalSet, g_setref.index, + kExprGlobalGet, g_nullref.index ]) .exportAs("get_anyref_global"); builder.addFunction("get_anyfunc_global", kSig_a_a) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g_setfunc.index, - kExprGetGlobal, g_nullfunc.index + kExprLocalGet, 0, + kExprGlobalSet, g_setfunc.index, + kExprGlobalGet, g_nullfunc.index ]) .exportAs("get_anyfunc_global"); @@ -59,9 +59,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyRef, true); builder.addFunction("main", kSig_r_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index, - kExprGetGlobal, g.index + kExprLocalGet, 0, + kExprGlobalSet, g.index, + kExprGlobalGet, g.index ]) .exportAs("main"); @@ -79,9 +79,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyFunc, true); builder.addFunction("main", kSig_a_a) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index, - kExprGetGlobal, g.index + kExprLocalGet, 0, + kExprGlobalSet, g.index, + kExprGlobalGet, g.index ]) .exportAs("main"); @@ -100,10 +100,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyRef, true); builder.addFunction("main", kSig_r_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index, + kExprLocalGet, 0, + kExprGlobalSet, g.index, kExprCallFunction, gc_index, // call gc - kExprGetGlobal, g.index + kExprGlobalGet, g.index ]) .exportAs("main"); @@ -121,14 +121,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyRef, true); builder.addFunction("get_global", kSig_r_v) .addBody([ - kExprGetGlobal, g.index + kExprGlobalGet, g.index ]) .exportAs("get_global"); builder.addFunction("set_global", kSig_v_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index + kExprLocalGet, 0, + kExprGlobalSet, g.index ]) .exportAs("set_global"); @@ -150,7 +150,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyRef); builder.addFunction('main', kSig_r_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const instance = builder.instantiate({ m: { val: obj } }); @@ -178,7 +178,7 @@ function dummy_func() { let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyFunc); builder.addFunction('main', kSig_a_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const module = builder.toModule(); @@ -285,14 +285,14 @@ function dummy_func() { builder.addFunction("main", makeSig([kWasmAnyRef, kWasmAnyFunc, kWasmAnyRef, kWasmAnyFunc], [])) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g1.index, - kExprGetLocal, 1, - kExprSetGlobal, g2.index, - kExprGetLocal, 2, - kExprSetGlobal, g3.index, - kExprGetLocal, 3, - kExprSetGlobal, g4.index + kExprLocalGet, 0, + kExprGlobalSet, g1.index, + kExprLocalGet, 1, + kExprGlobalSet, g2.index, + kExprLocalGet, 2, + kExprGlobalSet, g3.index, + kExprLocalGet, 3, + kExprGlobalSet, g4.index ]) .exportAs("main"); @@ -314,7 +314,7 @@ function dummy_func() { let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyRef, true); builder.addFunction('main', kSig_r_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const global = new WebAssembly.Global({ value: 'anyref', mutable: 'true' }, obj); @@ -335,7 +335,7 @@ function dummy_func() { let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyFunc, true); builder.addFunction('main', kSig_a_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const global = new WebAssembly.Global({ value: 'anyfunc', mutable: 'true' }, obj); @@ -358,19 +358,19 @@ function dummy_func() { builder1.addFunction("set_globals", kSig_v_rr) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g2.index, - kExprGetLocal, 1, - kExprSetGlobal, g3.index, + kExprLocalGet, 0, + kExprGlobalSet, g2.index, + kExprLocalGet, 1, + kExprGlobalSet, g3.index, ]) .exportAs("set_globals"); builder1.addFunction('get_global2', kSig_r_v) - .addBody([kExprGetGlobal, g2.index]) + .addBody([kExprGlobalGet, g2.index]) .exportAs('get_global2'); builder1.addFunction('get_global3', kSig_r_v) - .addBody([kExprGetGlobal, g3.index]) + .addBody([kExprGlobalGet, g3.index]) .exportAs('get_global3'); const instance1 = builder1.instantiate(); @@ -392,19 +392,19 @@ function dummy_func() { builder2.addFunction("set_globals", kSig_v_rr) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, i2, - kExprGetLocal, 1, - kExprSetGlobal, i3, + kExprLocalGet, 0, + kExprGlobalSet, i2, + kExprLocalGet, 1, + kExprGlobalSet, i3, ]) .exportAs("set_globals"); builder2.addFunction('get_global2', kSig_r_v) - .addBody([kExprGetGlobal, i2]) + .addBody([kExprGlobalGet, i2]) .exportAs('get_global2'); builder2.addFunction('get_global3', kSig_r_v) - .addBody([kExprGetGlobal, i3]) + .addBody([kExprGlobalGet, i3]) .exportAs('get_global3'); const instance2 = builder2.instantiate(instance1); @@ -454,19 +454,19 @@ function dummy_func() { builder1.addFunction("set_globals", kSig_v_aa) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g2.index, - kExprGetLocal, 1, - kExprSetGlobal, g3.index, + kExprLocalGet, 0, + kExprGlobalSet, g2.index, + kExprLocalGet, 1, + kExprGlobalSet, g3.index, ]) .exportAs("set_globals"); builder1.addFunction('get_global2', kSig_a_v) - .addBody([kExprGetGlobal, g2.index]) + .addBody([kExprGlobalGet, g2.index]) .exportAs('get_global2'); builder1.addFunction('get_global3', kSig_a_v) - .addBody([kExprGetGlobal, g3.index]) + .addBody([kExprGlobalGet, g3.index]) .exportAs('get_global3'); const instance1 = builder1.instantiate(); @@ -489,19 +489,19 @@ function dummy_func() { builder2.addFunction("set_globals", kSig_v_aa) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, i2, - kExprGetLocal, 1, - kExprSetGlobal, i3, + kExprLocalGet, 0, + kExprGlobalSet, i2, + kExprLocalGet, 1, + kExprGlobalSet, i3, ]) .exportAs("set_globals"); builder2.addFunction('get_global2', kSig_a_v) - .addBody([kExprGetGlobal, i2]) + .addBody([kExprGlobalGet, i2]) .exportAs('get_global2'); builder2.addFunction('get_global3', kSig_a_v) - .addBody([kExprGetGlobal, i3]) + .addBody([kExprGlobalGet, i3]) .exportAs('get_global3'); const instance2 = builder2.instantiate(instance1); @@ -563,10 +563,10 @@ function dummy_func() { const g_ref = builder.addGlobal(kWasmAnyRef, true); const g_func = builder.addGlobal(kWasmAnyFunc, true); const f_ref = builder.addFunction('get_anyref_global', kSig_r_v) - .addBody([kExprGetGlobal, g_ref.index]) + .addBody([kExprGlobalGet, g_ref.index]) .exportAs('get_anyref_global'); const f_func = builder.addFunction('get_anyfunc_global', kSig_a_v) - .addBody([kExprGetGlobal, g_func.index]) + .addBody([kExprGlobalGet, g_func.index]) .exportAs('get_anyfunc_global'); g_ref.function_index = f_ref.index; @@ -591,10 +591,10 @@ function dummy_func() { g_wasm.function_index = import_wasm; g_js.function_index = import_js; builder.addFunction('get_global_wasm', kSig_a_v) - .addBody([kExprGetGlobal, g_wasm.index]) + .addBody([kExprGlobalGet, g_wasm.index]) .exportFunc(); builder.addFunction('get_global_js', kSig_a_v) - .addBody([kExprGetGlobal, g_js.index]) + .addBody([kExprGlobalGet, g_js.index]) .exportFunc(); const expected_wasm = dummy_func(); diff --git a/deps/v8/test/mjsunit/wasm/anyref.js b/deps/v8/test/mjsunit/wasm/anyref.js index 141d25d1e3..cdb4742776 100644 --- a/deps/v8/test/mjsunit/wasm/anyref.js +++ b/deps/v8/test/mjsunit/wasm/anyref.js @@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_r_r) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); @@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const sig_index = builder.addType(kSig_v_r); const imp_index = builder.addImport("q", "func", sig_index); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprCallFunction, imp_index]) .exportFunc(); @@ -55,18 +55,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('main', ref_sig) .addLocals({anyref_count: 10}) .addBody([ - kExprGetLocal, 0, kExprSetLocal, 1, // Set local - kExprGetLocal, 0, kExprSetLocal, 2, // Set local - kExprGetLocal, 0, kExprSetLocal, 3, // Set local - kExprGetLocal, 0, kExprSetLocal, 4, // Set local - kExprGetLocal, 0, kExprSetLocal, 5, // Set local - kExprGetLocal, 0, kExprSetLocal, 6, // Set local - kExprGetLocal, 0, kExprSetLocal, 7, // Set local - kExprGetLocal, 0, kExprSetLocal, 8, // Set local - kExprGetLocal, 0, kExprSetLocal, 9, // Set local - kExprGetLocal, 0, kExprSetLocal, 10, // Set local + kExprLocalGet, 0, kExprLocalSet, 1, // Set local + kExprLocalGet, 0, kExprLocalSet, 2, // Set local + kExprLocalGet, 0, kExprLocalSet, 3, // Set local + kExprLocalGet, 0, kExprLocalSet, 4, // Set local + kExprLocalGet, 0, kExprLocalSet, 5, // Set local + kExprLocalGet, 0, kExprLocalSet, 6, // Set local + kExprLocalGet, 0, kExprLocalSet, 7, // Set local + kExprLocalGet, 0, kExprLocalSet, 8, // Set local + kExprLocalGet, 0, kExprLocalSet, 9, // Set local + kExprLocalGet, 0, kExprLocalSet, 10, // Set local kExprCallFunction, gc_index, // call gc - kExprGetLocal, 9, kExprCallFunction, imp_index // call import + kExprLocalGet, 9, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -90,7 +90,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('main', ref_sig) .addBody([ kExprCallFunction, gc_index, // call gc - kExprGetLocal, 0, kExprCallFunction, imp_index // call import + kExprLocalGet, 0, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -119,7 +119,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('main', main_sig) .addBody([ kExprCallFunction, gc_index, // call gc - kExprGetLocal, index, kExprCallFunction, imp_index // call import + kExprLocalGet, index, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -145,7 +145,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const kSig_r_iri = makeSig([kWasmI32, kWasmAnyRef, kWasmI32], [kWasmAnyRef]); const sig_index = builder.addType(kSig_r_iri); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 1]) + .addBody([kExprLocalGet, 1]) .exportFunc(); const instance = builder.instantiate(); @@ -177,7 +177,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_i_r) - .addBody([kExprGetLocal, 0, kExprRefIsNull]) + .addBody([kExprLocalGet, 0, kExprRefIsNull]) .exportFunc(); const instance = builder.instantiate(); @@ -208,7 +208,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_r_v) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .addLocals({anyref_count: 1}) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js index 9d8b14afec..0f93e77f6c 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js @@ -192,28 +192,15 @@ function i32_invert(a) { var inputs = [ 0, 1, 2, 3, 4, - 10, 20, 30, 31, 32, 33, 100, 2000, - 30000, 400000, 5000000, - 100000000, 2000000000, 2147483646, - 2147483647, - 2147483648, - 2147483649, - 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, + 2147483647, // max positive int32 + 2147483648, // overflow max positive int32 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, - 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, - 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, - 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, + 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x0003ffff, 0x00001fff, -1, -2, -3, -4, - -10, -20, -30, -31, -32, -33, -100, -2000, - -30000, -400000, -5000000, - -100000000, -2000000000, - -2147483646, -2147483647, - -2147483648, - -2147483649, + -2147483648, // min negative int32 + -2147483649, // overflow min negative int32 ]; var funcs = [ diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js index 0809bca6ab..fda6091084 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js @@ -170,28 +170,15 @@ function u32_invert(a) { var inputs = [ 0, 1, 2, 3, 4, - 10, 20, 30, 31, 32, 33, 100, 2000, - 30000, 400000, 5000000, - 100000000, 2000000000, 2147483646, - 2147483647, - 2147483648, - 2147483649, - 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, + 2147483647, // max positive int32 + 2147483648, // overflow max positive int32 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, - 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, - 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, - 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, + 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x0003ffff, 0x00001fff, -1, -2, -3, -4, - -10, -20, -30, -31, -32, -33, -100, -2000, - -30000, -400000, -5000000, - -100000000, -2000000000, - -2147483646, -2147483647, - -2147483648, - -2147483649, + -2147483648, // min negative int32 + -2147483649, // overflow min negative int32 ]; var funcs = [ diff --git a/deps/v8/test/mjsunit/wasm/atomics-stress.js b/deps/v8/test/mjsunit/wasm/atomics-stress.js index 8622919043..9eb18050cb 100644 --- a/deps/v8/test/mjsunit/wasm/atomics-stress.js +++ b/deps/v8/test/mjsunit/wasm/atomics-stress.js @@ -165,15 +165,15 @@ class Operation { // Load address of low 32 bits. kExprI32Const, 0, // Load expected value. - kExprGetLocal, 0, kExprI32StoreMem, 2, 0, + kExprLocalGet, 0, kExprI32StoreMem, 2, 0, // Load address of high 32 bits. kExprI32Const, 4, // Load expected value. - kExprGetLocal, 1, kExprI32StoreMem, 2, 0, + kExprLocalGet, 1, kExprI32StoreMem, 2, 0, // Load address of where our window starts. kExprI32Const, 0, // Load input if there is one. - ...(this.hasInput ? [kExprGetLocal, 2] : []), + ...(this.hasInput ? [kExprLocalGet, 2] : []), // Perform operation. kAtomicPrefix, ...this.wasmOpcode, // Drop output if it had any. @@ -261,19 +261,19 @@ function generateFunctionBodyForSequence(sequence) { if (!kDebug) { body.push( // Decrement the wait count. - kExprGetLocal, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, + kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, 0, // Spin until zero. - kExprLoop, kWasmStmt, kExprGetLocal, 2, kAtomicPrefix, + kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix, kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0, kExprEnd); } for (let operation of sequence) { body.push( // Pre-load address of results sequence pointer for later. - kExprGetLocal, 1, + kExprLocalGet, 1, // Load address where atomic pointers are stored. - kExprGetLocal, 0, + kExprLocalGet, 0, // Load the second argument if it had any. ...(operation.hasInput ? [kExprI32Const, ...toSLeb128(operation.input)] : @@ -285,10 +285,10 @@ function generateFunctionBodyForSequence(sequence) { // Store read intermediate to sequence. kExprI32StoreMem, 2, 0, // Increment result sequence pointer. - kExprGetLocal, 1, kExprI32Const, 4, kExprI32Add, kExprSetLocal, 1); + kExprLocalGet, 1, kExprI32Const, 4, kExprI32Add, kExprLocalSet, 1); } // Return end of sequence index. - body.push(kExprGetLocal, 1, kExprReturn); + body.push(kExprLocalGet, 1, kExprReturn); return body; } diff --git a/deps/v8/test/mjsunit/wasm/atomics.js b/deps/v8/test/mjsunit/wasm/atomics.js index 08714bbc01..264662f2ac 100644 --- a/deps/v8/test/mjsunit/wasm/atomics.js +++ b/deps/v8/test/mjsunit/wasm/atomics.js @@ -25,8 +25,8 @@ function GetAtomicBinOpFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -43,9 +43,9 @@ function GetAtomicCmpExchangeFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -62,7 +62,7 @@ function GetAtomicLoadFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -79,8 +79,8 @@ function GetAtomicStoreFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_v_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -440,11 +440,11 @@ function CmpExchgLoop(opcode, alignment) { .addLocals({i64_count: 2}) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kAtomicPrefix, opcode, alignment, 0, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64Ne, kExprBrIf, 0, kExprEnd diff --git a/deps/v8/test/mjsunit/wasm/atomics64-stress.js b/deps/v8/test/mjsunit/wasm/atomics64-stress.js index 386a3b5549..99e9016f1a 100644 --- a/deps/v8/test/mjsunit/wasm/atomics64-stress.js +++ b/deps/v8/test/mjsunit/wasm/atomics64-stress.js @@ -191,18 +191,18 @@ class Operation { // Load address of low 32 bits. kExprI32Const, 0, // Load expected value. - kExprGetLocal, 0, kExprI32StoreMem, 2, 0, + kExprLocalGet, 0, kExprI32StoreMem, 2, 0, // Load address of high 32 bits. kExprI32Const, 4, // Load expected value. - kExprGetLocal, 1, kExprI32StoreMem, 2, 0, + kExprLocalGet, 1, kExprI32StoreMem, 2, 0, // Load address of where our window starts. kExprI32Const, 0, // Load input if there is one. ...(this.hasInput ? [ - kExprGetLocal, 3, kExprI64UConvertI32, kExprI64Const, 32, - kExprI64Shl, kExprGetLocal, 2, kExprI64UConvertI32, + kExprLocalGet, 3, kExprI64UConvertI32, kExprI64Const, 32, + kExprI64Shl, kExprLocalGet, 2, kExprI64UConvertI32, kExprI64Ior ] : []), @@ -299,19 +299,19 @@ function generateFunctionBodyForSequence(sequence) { if (!kDebug) { body.push( // Decrement the wait count. - kExprGetLocal, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, + kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, 0, // Spin until zero. - kExprLoop, kWasmStmt, kExprGetLocal, 2, kAtomicPrefix, + kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix, kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0, kExprEnd); } for (let operation of sequence) { body.push( // Pre-load address of results sequence pointer for later. - kExprGetLocal, 1, + kExprLocalGet, 1, // Load address where atomic pointers are stored. - kExprGetLocal, 0, + kExprLocalGet, 0, // Load the second argument if it had any. ...(operation.hasInput ? [ @@ -326,10 +326,10 @@ function generateFunctionBodyForSequence(sequence) { // Store read intermediate to sequence. kExprI64StoreMem, 3, 0, // Increment result sequence pointer. - kExprGetLocal, 1, kExprI32Const, 8, kExprI32Add, kExprSetLocal, 1); + kExprLocalGet, 1, kExprI32Const, 8, kExprI32Add, kExprLocalSet, 1); } // Return end of sequence index. - body.push(kExprGetLocal, 1, kExprReturn); + body.push(kExprLocalGet, 1, kExprReturn); return body; } diff --git a/deps/v8/test/mjsunit/wasm/bigint.js b/deps/v8/test/mjsunit/wasm/bigint.js index ff9046e9dc..0c9ebb6559 100644 --- a/deps/v8/test/mjsunit/wasm/bigint.js +++ b/deps/v8/test/mjsunit/wasm/bigint.js @@ -26,30 +26,30 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); let a_global_index = builder - .addImportedGlobal("mod", "a", kWasmI64) + .addImportedGlobal("mod", "a", kWasmI64); let b_global_index = builder .addImportedGlobal("mod", "b", kWasmI64); - let c_global_index = builder - .addImportedGlobal("mod", "c", kWasmI64); - builder .addExportOfKind('a', kExternalGlobal, a_global_index) .addExportOfKind('b', kExternalGlobal, b_global_index) - .addExportOfKind('c', kExternalGlobal, c_global_index); let module = builder.instantiate({ mod: { a: 1n, b: 2n ** 63n, - c: "123", } }); assertEquals(module.exports.a.value, 1n); assertEquals(module.exports.b.value, - (2n ** 63n)); - assertEquals(module.exports.c.value, 123n); +})(); + +(function TestJSBigIntGlobalImportInvalidType() { + let builder = new WasmModuleBuilder(); + builder.addImportedGlobal("mod", "a", kWasmI64); + assertThrows(() => builder.instantiate({mod: { a: {} } }), WebAssembly.LinkError); })(); (function TestJSBigIntToWasmI64MutableGlobal() { @@ -86,7 +86,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder .addFunction("f", kSig_l_l) // i64 -> i64 .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, ]) .exportFunc(); @@ -108,7 +108,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder .addFunction("f", kSig_l_ll) // i64 -> i64 .addBody([ - kExprGetLocal, 1, + kExprLocalGet, 1, ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js index 43ff8570c6..90ede1ac92 100644 --- a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js +++ b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js @@ -8,9 +8,9 @@ const builder = new WasmModuleBuilder(); builder.addMemory(1, undefined, false); builder.addFunction('load', kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI64SConvertI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64SConvertI32, kExprI64Shl, kExprI32ConvertI64, diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js b/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js index d972e7830d..b740a20f1a 100644 --- a/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js +++ b/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js @@ -10,7 +10,7 @@ const builder = new WasmModuleBuilder(); builder.addMemory(1, undefined, false); builder.addFunction('load', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 100]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/bulk-memory.js b/deps/v8/test/mjsunit/wasm/bulk-memory.js index d783c6bf59..53ca1454b6 100644 --- a/deps/v8/test/mjsunit/wasm/bulk-memory.js +++ b/deps/v8/test/mjsunit/wasm/bulk-memory.js @@ -33,9 +33,9 @@ function getMemoryInit(mem, segment_data) { builder.addPassiveDataSegment(segment_data); builder.addFunction('init', kSig_v_iii) .addBody([ - kExprGetLocal, 0, // Dest. - kExprGetLocal, 1, // Source. - kExprGetLocal, 2, // Size in bytes. + kExprLocalGet, 0, // Dest. + kExprLocalGet, 1, // Source. + kExprLocalGet, 2, // Size in bytes. kNumericPrefix, kExprMemoryInit, 0, // Data segment index. 0, // Memory index. @@ -102,9 +102,9 @@ function getMemoryCopy(mem) { const builder = new WasmModuleBuilder(); builder.addImportedMemory("", "mem", 0); builder.addFunction("copy", kSig_v_iii).addBody([ - kExprGetLocal, 0, // Dest. - kExprGetLocal, 1, // Source. - kExprGetLocal, 2, // Size in bytes. + kExprLocalGet, 0, // Dest. + kExprLocalGet, 1, // Source. + kExprLocalGet, 2, // Size in bytes. kNumericPrefix, kExprMemoryCopy, 0, 0, ]).exportAs("copy"); return builder.instantiate({'': {mem}}).exports.copy; @@ -128,9 +128,9 @@ function getMemoryFill(mem) { const builder = new WasmModuleBuilder(); builder.addImportedMemory("", "mem", 0); builder.addFunction("fill", kSig_v_iii).addBody([ - kExprGetLocal, 0, // Dest. - kExprGetLocal, 1, // Byte value. - kExprGetLocal, 2, // Size. + kExprLocalGet, 0, // Dest. + kExprLocalGet, 1, // Byte value. + kExprLocalGet, 2, // Size. kNumericPrefix, kExprMemoryFill, 0, ]).exportAs("fill"); return builder.instantiate({'': {mem}}).exports.fill; diff --git a/deps/v8/test/mjsunit/wasm/calls.js b/deps/v8/test/mjsunit/wasm/calls.js index 97188964d1..f8a4616def 100644 --- a/deps/v8/test/mjsunit/wasm/calls.js +++ b/deps/v8/test/mjsunit/wasm/calls.js @@ -49,8 +49,8 @@ function assertFunction(module, func) { builder.addMemory(1, 1, true); builder.addFunction("sub", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub, // -- ]) .exportFunc() @@ -91,8 +91,8 @@ function assertFunction(module, func) { builder.addMemory(kPages, kPages, true); builder.addFunction("flt", kSig_i_dd) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprF64Lt // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js b/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js index 6f4698c0d0..45eaef92e8 100644 --- a/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js +++ b/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js @@ -9,7 +9,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); // We only have 1 MB code space. This is enough for the code below, but for all // 1000 modules, it requires several GCs to get rid of the old code. const builder = new WasmModuleBuilder(); -builder.addFunction('main', kSig_i_i).addBody([kExprGetLocal, 0]); +builder.addFunction('main', kSig_i_i).addBody([kExprLocalGet, 0]); const buffer = builder.toBuffer(); for (let i = 0; i < 1000; ++i) { diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js index 5102216933..050a15e380 100644 --- a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js +++ b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js @@ -37,42 +37,42 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, const kLocalNextValue = 7; // the value to write in the update let body = [ // Turn sequence length to equivalent in bytes. - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kArgSeqenceLength, kExprI32Const, size / 8, kExprI32Mul, - kExprSetLocal, kArgSeqenceLength, + kExprLocalSet, kArgSeqenceLength, // Outer block so we have something to jump for return. ...[kExprBlock, kWasmStmt, // Set counter to 0. kExprI32Const, 0, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, // Outer loop until maxcount. ...[kExprLoop, kWasmStmt, // Find the next value to wait for. ...[kExprLoop, kWasmStmt, // Check end of sequence. - kExprGetLocal, kLocalCurrentOffset, - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kLocalCurrentOffset, + kExprLocalGet, kArgSeqenceLength, kExprI32Eq, kExprBrIf, 2, // return ...[kExprBlock, kWasmStmt, // Load next value. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, // Mask off bits. - kExprGetLocal, kArgBitMask, + kExprLocalGet, kArgBitMask, kExprI32And, // Compare with worker id. - kExprGetLocal, kArgWorkerId, + kExprLocalGet, kArgWorkerId, kExprI32Eq, kExprBrIf, 0, // Not found, increment position. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 1, kExprEnd ], @@ -80,41 +80,41 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, kExprEnd ], // Load expected value to local. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalExpectedValue, + kExprLocalSet, kLocalExpectedValue, // Load value after expected one. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, kExprI32Const, size / 8, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalNextValue, + kExprLocalSet, kLocalNextValue, // Hammer on memory until value found. ...[kExprLoop, kWasmStmt, // Load address. - kExprGetLocal, kArgMemoryCell, + kExprLocalGet, kArgMemoryCell, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Load updated value. - kExprGetLocal, kLocalNextValue, + kExprLocalGet, kLocalNextValue, // Try update. kAtomicPrefix, compareExchangeOpcode, 0, 0, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Spin if not what expected. kExprI32Ne, kExprBrIf, 0, kExprEnd ], // Next iteration of loop. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 0, kExprEnd ], // outer loop diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js index bd1c5c95a5..b2ffcf1475 100644 --- a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js +++ b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js @@ -40,44 +40,44 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, const kLocalNextValue = 7; // the value to write in the update let body = [ // Turn sequence length to equivalent in bytes. - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kArgSeqenceLength, kExprI32Const, size / 8, kExprI32Mul, - kExprSetLocal, kArgSeqenceLength, + kExprLocalSet, kArgSeqenceLength, // Outer block so we have something to jump for return. ...[kExprBlock, kWasmStmt, // Set counter to 0. kExprI32Const, 0, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, // Outer loop until maxcount. ...[kExprLoop, kWasmStmt, // Find the next value to wait for. ...[kExprLoop, kWasmStmt, // Check end of sequence. - kExprGetLocal, kLocalCurrentOffset, - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kLocalCurrentOffset, + kExprLocalGet, kArgSeqenceLength, kExprI32Eq, kExprBrIf, 2, // return ...[kExprBlock, kWasmStmt, // Load next value. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, // Mask off bits. - kExprGetLocal, kArgBitMask, + kExprLocalGet, kArgBitMask, kExprI64UConvertI32, kExprI64And, // Compare with worker id. - kExprGetLocal, kArgWorkerId, + kExprLocalGet, kArgWorkerId, kExprI64UConvertI32, kExprI64Eq, kExprBrIf, 0, // Not found, increment position. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 1, kExprEnd ], @@ -85,41 +85,41 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, kExprEnd ], // Load expected value to local. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalExpectedValue, + kExprLocalSet, kLocalExpectedValue, // Load value after expected one. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, kExprI32Const, size / 8, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalNextValue, + kExprLocalSet, kLocalNextValue, // Hammer on memory until value found. ...[kExprLoop, kWasmStmt, // Load address. - kExprGetLocal, kArgMemoryCell, + kExprLocalGet, kArgMemoryCell, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Load updated value. - kExprGetLocal, kLocalNextValue, + kExprLocalGet, kLocalNextValue, // Try update. kAtomicPrefix, compareExchangeOpcode, 0, 0, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Spin if not what expected. kExprI64Ne, kExprBrIf, 0, kExprEnd ], // Next iteration of loop. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 0, kExprEnd ], // outer loop diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js index 5ca20cbb95..4723b92acf 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, kCompilationHintTierBaseline) @@ -26,7 +26,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_l) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -49,7 +49,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -63,7 +63,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierDefault, kCompilationHintTierDefault) diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js b/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js index e39e15feeb..5bcac2af9e 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js @@ -11,8 +11,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, @@ -29,20 +29,20 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyDefault, kCompilationHintTierInterpreter, kCompilationHintTierInterpreter) .exportFunc(); builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow3', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) let instance = builder.instantiate({mod: {pow: Math.pow}}); assertEquals(27, instance.exports.upow(3)) @@ -53,16 +53,16 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow3', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierBaseline, @@ -76,8 +76,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierDefault, @@ -91,8 +91,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierDefault, @@ -104,8 +104,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierOptimized, @@ -119,8 +119,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierOptimized, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js b/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js index 553426db08..4bfc22fb89 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js @@ -9,8 +9,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyDefault, kCompilationHintTierInterpreter, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js b/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js index f0a46b9ec7..f9f85a7d91 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js @@ -19,7 +19,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addImport("otherModule", "getX", kSig_i_v); builder1.addFunction("plusX", kSig_i_i) .addBody([kExprCallFunction, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -44,7 +44,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addImport("otherModule", "getX", kSig_i_v); builder1.addFunction("plusX", kSig_i_i) .addBody([kExprCallFunction, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -64,8 +64,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); let sig_i_ii = builder.addType(kSig_i_ii); let add = builder.addFunction('add', sig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -73,9 +73,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.appendToTable([add.index]); builder.addFunction('main', kSig_i_iii) .addBody([// Call indirect #0 with args <#1, #2>. - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -89,8 +89,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); let sig_i_ii = builder.addType(kSig_i_ii); let add = builder.addFunction('add', sig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI64Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -98,9 +98,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.appendToTable([add.index]); builder.addFunction('main', kSig_i_iii) .addBody([// Call indirect #0 with args <#1, #2>. - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js index e6958cb554..de2bbd1c13 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprI64Const, 1, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyLazy, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js index f48169fa0a..2708da149b 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js @@ -11,12 +11,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, @@ -33,12 +33,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, @@ -59,12 +59,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_f_ff); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, @@ -94,8 +94,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, @@ -112,8 +112,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierDefault, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js index 6db4c0e328..f125aeaa7e 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprI64Const, 1, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyLazy, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js index 6c4364b6d3..35f77de157 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, kCompilationHintTierBaseline) @@ -25,7 +25,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_l) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -46,7 +46,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -58,7 +58,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierDefault, kCompilationHintTierDefault) diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js index c95e4d05b7..859a3095ae 100644 --- a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js +++ b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js @@ -17,11 +17,11 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprI32Const, 1, kExprCallIndirect, signature, kTableZero, - kExprGetLocal,0, + kExprLocalGet,0, kExprI32LoadMem,0, 0, kExprCallFunction, 0, kExprI32Add @@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // return mem[i] + some_value(); builder.addFunction("_wrap_writer", signature) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 1]); builder.appendToTable([2, 3]); @@ -175,13 +175,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addGlobal(kWasmI32, true); builder.addFunction("read", kSig_i_v) .addBody([ - kExprGetGlobal, 0]) + kExprGlobalGet, 0]) .exportFunc(); builder.addFunction("write", kSig_v_i) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, 0]) + kExprLocalGet, 0, + kExprGlobalSet, 0]) .exportFunc(); var wire_bytes = builder.toBuffer(); @@ -213,7 +213,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index1, kTableZero]) // -- .exportAs("main"); @@ -234,7 +234,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index2, kTableZero]) // -- .exportAs("main"); @@ -293,7 +293,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const builder = new WasmModuleBuilder(); builder.addMemory(1, 1); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); const wire_bytes = builder.toBuffer(); const module = new WebAssembly.Module(wire_bytes); @@ -364,7 +364,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprBrTable, 6, 0, 1, 2, 3, 4, 5, 6, kExprEnd, kExprI32Const, 3, diff --git a/deps/v8/test/mjsunit/wasm/data-segments.js b/deps/v8/test/mjsunit/wasm/data-segments.js index 91b6525537..38fd5ee06b 100644 --- a/deps/v8/test/mjsunit/wasm/data-segments.js +++ b/deps/v8/test/mjsunit/wasm/data-segments.js @@ -13,7 +13,7 @@ function SimpleDataSegmentTest(offset) { var builder = new WasmModuleBuilder(); builder.addMemory(1, 1, false); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("load"); builder.addDataSegment(offset, [9, 9, 9, 9]); @@ -41,7 +41,7 @@ function GlobalImportedInitTest(pad) { while (pad-- > 0) builder.addGlobal(kWasmI32); // pad builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("load"); builder.addDataSegment(g.index, [5, 5, 5, 5], true); diff --git a/deps/v8/test/mjsunit/wasm/divrem-trap.js b/deps/v8/test/mjsunit/wasm/divrem-trap.js index d9a23693f0..5eadaa44e9 100644 --- a/deps/v8/test/mjsunit/wasm/divrem-trap.js +++ b/deps/v8/test/mjsunit/wasm/divrem-trap.js @@ -16,8 +16,8 @@ function makeBinop(opcode) { builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- opcode, // -- ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js index e2ff7ca517..59e15f8464 100644 --- a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js +++ b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js @@ -19,14 +19,14 @@ let kMaxMemory = 2 * k1GiB - kPageSize; // TODO(titzer): raise this to 4GiB builder.addImportedMemory("i", "mem"); builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, 0, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, 0, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js index 9f7a7f71d2..e9e380a4ca 100644 --- a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js +++ b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js @@ -14,7 +14,7 @@ var module = new WasmModuleBuilder(); module.addFunction(undefined, kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add]) .exportAs("increment"); var buffer = module.toBuffer(true); diff --git a/deps/v8/test/mjsunit/wasm/errors.js b/deps/v8/test/mjsunit/wasm/errors.js index d98452e0e8..4304e54588 100644 --- a/deps/v8/test/mjsunit/wasm/errors.js +++ b/deps/v8/test/mjsunit/wasm/errors.js @@ -64,7 +64,7 @@ function assertConversionError(bytes, imports, msg) { .end().toBuffer(), f_error('expected 1 elements on the stack for return, found 0 @+24')); assertCompileError(builder().addFunction('f', kSig_v_v).addBody([ - kExprGetLocal, 0 + kExprLocalGet, 0 ]).end().toBuffer(), f_error('invalid local index: 0 @+24')); assertCompileError( builder().addStart(0).toBuffer(), @@ -182,7 +182,7 @@ function import_error(index, module, func, msg) { var sig = builder.addType(kSig_i_dd); builder.addImport("mod", "func", sig); builder.addFunction("main", sig) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprCallFunction, 0]) .exportAs("main"); var main = builder.instantiate({ mod: { diff --git a/deps/v8/test/mjsunit/wasm/exceptions-anyref.js b/deps/v8/test/mjsunit/wasm/exceptions-anyref.js index a41d69c0af..ccda100f65 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-anyref.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-anyref.js @@ -30,7 +30,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_null", kSig_i_i) .addBody([ kExprTry, kWasmAnyRef, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmAnyRef, kExprRefNull, @@ -63,7 +63,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_r); builder.addFunction("throw_param", kSig_v_r) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]).exportFunc(); let instance = builder.instantiate(); @@ -83,7 +83,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_r_r) .addBody([ kExprTry, kWasmAnyRef, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, kExprBrOnExn, 0, except, @@ -108,7 +108,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); .addLocals({anyfunc_count: 1}) .addBody([ kExprTry, kWasmAnyFunc, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, kExprBrOnExn, 0, except, @@ -128,7 +128,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_e_e) .addBody([ kExprTry, kWasmExnRef, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, kExprBrOnExn, 0, except, diff --git a/deps/v8/test/mjsunit/wasm/exceptions-global.js b/deps/v8/test/mjsunit/wasm/exceptions-global.js index 4a74dfb010..80af193c3e 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-global.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-global.js @@ -16,7 +16,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g = builder.addGlobal(kWasmExnRef); builder.addFunction("push_and_drop_exnref", kSig_v_v) .addBody([ - kExprGetGlobal, g.index, + kExprGlobalGet, g.index, kExprDrop, ]).exportFunc(); let instance = builder.instantiate(); @@ -30,7 +30,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); let g = builder.addGlobal(kWasmExnRef); builder.addFunction('push_and_return_exnref', kSig_e_v) - .addBody([kExprGetGlobal, g.index]) + .addBody([kExprGlobalGet, g.index]) .exportFunc(); let instance = builder.instantiate(); @@ -46,10 +46,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('catch_and_set_exnref', kSig_v_i) .addBody([ kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, - kExprSetGlobal, g.index, + kExprGlobalSet, g.index, kExprEnd, ]).exportFunc(); let instance = builder.instantiate(); @@ -68,10 +68,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('set_param_exnref', kSig_v_e) .addBody([ kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprRethrow, kExprCatch, - kExprSetGlobal, g.index, + kExprGlobalSet, g.index, kExprEnd, ]).exportFunc(); let exception = "my fancy exception"; @@ -88,7 +88,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g_index = builder.addImportedGlobal("m", "exn", kWasmExnRef); builder.addFunction('rethrow_exnref', kSig_v_v) .addBody([ - kExprGetGlobal, g_index, + kExprGlobalGet, g_index, kExprRethrow, ]).exportFunc(); let exception = "my fancy exception"; @@ -104,7 +104,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g = builder.addGlobal(kWasmExnRef, true).exportAs("exn"); builder.addFunction('rethrow_exnref', kSig_v_v) .addBody([ - kExprGetGlobal, g.index, + kExprGlobalGet, g.index, kExprRethrow, ]).exportFunc(); let instance = builder.instantiate(); @@ -122,7 +122,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g_index = builder.addImportedGlobal("m", "exn", kWasmExnRef, true); builder.addFunction('rethrow_exnref', kSig_v_v) .addBody([ - kExprGetGlobal, g_index, + kExprGlobalGet, g_index, kExprRethrow, ]).exportFunc(); let exception1 = "my fancy exception"; @@ -143,7 +143,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g2 = builder.addGlobal(kWasmExnRef); g2.init_index = g1_index; // Initialize {g2} to equal {g1}. builder.addFunction('push_and_return_exnref', kSig_e_v) - .addBody([kExprGetGlobal, g2.index]) + .addBody([kExprGlobalGet, g2.index]) .exportFunc(); let exception = { x: "my fancy exception" }; let instance = builder.instantiate({ "m": { "exn": exception }}); diff --git a/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js b/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js index 3b3fa365d5..be609cbf2d 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js @@ -26,11 +26,11 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprThrow, except, kExprCatch, - kExprSetLocal, 1, - kExprGetLocal, 0, + kExprLocalSet, 1, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprRethrow, kExprEnd, kExprI32Const, 23, @@ -56,23 +56,23 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprThrow, except2, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprTry, kWasmI32, kExprThrow, except1, kExprCatch, - kExprSetLocal, 1, - kExprGetLocal, 0, + kExprLocalSet, 1, + kExprLocalGet, 0, kExprI32Const, 0, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprRethrow, kExprEnd, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprRethrow, kExprEnd, kExprI32Const, 23, @@ -98,12 +98,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprThrow, except, kExprCatch, - kExprSetLocal, 1, + kExprLocalSet, 1, kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprRethrow, kExprEnd, kExprI32Const, 42, diff --git a/deps/v8/test/mjsunit/wasm/exceptions-simd.js b/deps/v8/test/mjsunit/wasm/exceptions-simd.js index ed16a7f2cc..00fc725f5d 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-simd.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-simd.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_simd", kSig_v_v) .addLocals({s128_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, 0, ]) .exportFunc(); @@ -32,7 +32,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); .addLocals({s128_count: 1}) .addBody([ kExprTry, kWasmS128, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, 0, kExprCatch, kExprBrOnExn, 0, except, diff --git a/deps/v8/test/mjsunit/wasm/exceptions.js b/deps/v8/test/mjsunit/wasm/exceptions.js index 7d53037269..ecaf0d06c9 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions.js +++ b/deps/v8/test/mjsunit/wasm/exceptions.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("push_and_drop_exnref", kSig_v_v) .addLocals({except_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprDrop, ]).exportFunc(); let instance = builder.instantiate(); @@ -29,7 +29,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_v); builder.addFunction("throw_if_param_not_zero", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 0, kExprI32Ne, kExprIf, kWasmStmt, @@ -68,7 +68,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("simple_throw_catch_to_0_1", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except, @@ -99,12 +99,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprBlock, kWasmStmt, kExprTry, kWasmStmt, kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, @@ -149,12 +149,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, @@ -194,15 +194,15 @@ load("test/mjsunit/wasm/exceptions-utils.js"); .addBody([ kExprBlock, kWasmI32, kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except, kExprEnd, kExprCatch, - kExprSetLocal, 1, + kExprLocalSet, 1, kExprI32Const, 23, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprBrOnExn, 1, except, kExprRethrow, kExprEnd, @@ -239,7 +239,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprI32Const, 2, kExprCatch, @@ -261,7 +261,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_i); builder.addFunction("throw_param", kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]).exportFunc(); let instance = builder.instantiate(); @@ -278,7 +278,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_f_f) .addBody([ kExprTry, kWasmF32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprF32Const, 0, 0, 0, 0, kExprCatch, @@ -299,7 +299,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_f); builder.addFunction("throw_param", kSig_v_f) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]).exportFunc(); let instance = builder.instantiate(); @@ -316,18 +316,18 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_i_i) .addLocals({i64_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI64UConvertI32, - kExprSetLocal, 1, + kExprLocalSet, 1, kExprTry, kWasmI64, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprThrow, except, kExprI64Const, 23, kExprCatch, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64Eq, ]).exportFunc(); let instance = builder.instantiate(); @@ -344,11 +344,11 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_l); builder.addFunction("throw_param", kSig_v_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI64UConvertI32, kExprI64Const, 32, kExprI64Shl, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64UConvertI32, kExprI64Ior, kExprThrow, except, @@ -367,7 +367,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_d_d) .addBody([ kExprTry, kWasmF64, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0, kExprCatch, @@ -388,7 +388,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_d); builder.addFunction("throw_param", kSig_v_f) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprF64ConvertF32, kExprThrow, except, ]).exportFunc(); @@ -406,10 +406,10 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_expr_with_params", kSig_v_ddi) .addBody([ // p2 * (p0 + min(p0, p1))|0 - 20 - kExprGetLocal, 2, - kExprGetLocal, 0, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprF64Min, kExprF64Add, kExprI32SConvertF64, @@ -468,7 +468,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let kWasmThrowFunction = builder.addFunction("throw", kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]) .index; @@ -478,11 +478,11 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("same_scope", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 0, kExprI32Ne, kExprIf, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprUnreachable, kExprEnd, @@ -497,7 +497,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("same_scope_ignore", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprUnreachable, kExprCatch, @@ -545,7 +545,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprTry, kWasmI32, kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, @@ -555,9 +555,9 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprEnd, kExprI32Const, 2, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprBlock, kWasmI32, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, @@ -566,12 +566,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprThrow, except, kExprUnreachable, kExprEnd, - kExprTeeLocal, 1, - kExprGetLocal, 0, + kExprLocalTee, 1, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI32Const, 8, kExprI32Ior, kExprThrow, except, @@ -580,9 +580,9 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprI32Const, 16, kExprI32Ior, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprBlock, kWasmI32, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, @@ -591,12 +591,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprThrow, except, kExprUnreachable, kExprEnd, - kExprTeeLocal, 1, - kExprGetLocal, 0, + kExprLocalTee, 1, + kExprLocalGet, 0, kExprI32Const, 3, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI32Const, /*64=*/ 192, 0, kExprI32Ior, kExprThrow, except, @@ -605,9 +605,9 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprI32Const, /*128=*/ 128, 1, kExprI32Ior, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprBlock, kWasmI32, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, @@ -621,7 +621,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("from_direct_callee", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, kWasmThrowFunction, kExprUnreachable, kExprCatch, @@ -637,8 +637,8 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("from_indirect_callee", kSig_i_ii) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprCallIndirect, sig_v_i, kTableZero, kExprUnreachable, kExprCatch, @@ -653,7 +653,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("i_from_js", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, kJSThrowI, kExprUnreachable, kExprCatch, diff --git a/deps/v8/test/mjsunit/wasm/export-mutable-global.js b/deps/v8/test/mjsunit/wasm/export-mutable-global.js index 1ce918c6cc..90238f3cf9 100644 --- a/deps/v8/test/mjsunit/wasm/export-mutable-global.js +++ b/deps/v8/test/mjsunit/wasm/export-mutable-global.js @@ -59,10 +59,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let global_builder = builder.addGlobal(type, true).exportAs(name); if (value) global_builder.init = value; builder.addFunction("get " + name, makeSig([], [type])) - .addBody([kExprGetGlobal, index]) + .addBody([kExprGlobalGet, index]) .exportFunc(); builder.addFunction("set " + name, makeSig([type], [])) - .addBody([kExprGetLocal, 0, kExprSetGlobal, index]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, index]) .exportFunc(); } var instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/ffi-error.js b/deps/v8/test/mjsunit/wasm/ffi-error.js index 5f777ef1cf..217d7f3fd2 100644 --- a/deps/v8/test/mjsunit/wasm/ffi-error.js +++ b/deps/v8/test/mjsunit/wasm/ffi-error.js @@ -13,8 +13,8 @@ function CreateDefaultBuilder() { builder.addImport('mod', 'fun', sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- ]) // -- .exportFunc(); @@ -76,7 +76,7 @@ function checkFailingInstantiation( let sig_index = kSig_i_dd; builder.addFunction('exp', kSig_i_i) .addBody([ - kExprGetLocal, + kExprLocalGet, 0, ]) // -- .exportFunc(); @@ -126,8 +126,8 @@ function checkFailingInstantiation( builder.addMemory(1, 1, true); builder.addFunction('function_with_invalid_signature', kSig_l_ll) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI64Sub]) // -- .exportFunc() @@ -144,7 +144,7 @@ function checkFailingInstantiation( builder.addMemory(1, 1, true); builder.addFunction('function_with_invalid_signature', kSig_i_l) - .addBody([kExprGetLocal, 0, kExprI32ConvertI64]) + .addBody([kExprLocalGet, 0, kExprI32ConvertI64]) .exportFunc(); checkSuccessfulInstantiation( @@ -163,7 +163,7 @@ function checkFailingInstantiation( let index = builder.addImport('', 'func', sig_i64_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, kExprI64SConvertI32, kExprCallFunction, index // -- + kExprLocalGet, 0, kExprI64SConvertI32, kExprCallFunction, index // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/ffi.js b/deps/v8/test/mjsunit/wasm/ffi.js index 72cc57f598..884bd29450 100644 --- a/deps/v8/test/mjsunit/wasm/ffi.js +++ b/deps/v8/test/mjsunit/wasm/ffi.js @@ -13,8 +13,8 @@ function testCallFFI(func, check) { builder.addImport("", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -76,8 +76,8 @@ testCallFFI(bind_sub, check_FOREIGN_SUB); builder.addImport("", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -259,8 +259,8 @@ function testCallBinopVoid(type, func, check) { builder.addImport("", "func", makeSig_v_xx(type)); builder.addFunction("main", makeSig_r_xx(kWasmI32, type)) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- kExprI32Const, 33 // -- ]) // -- @@ -316,7 +316,7 @@ testCallBinopVoid(kWasmF64); .addBody([ kExprI32Const, 37, // -- kExprCallFunction, 0, // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallFunction, 1 // -- ]) // -- .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/float-constant-folding.js b/deps/v8/test/mjsunit/wasm/float-constant-folding.js index 6205da7cfc..332042e7fe 100644 --- a/deps/v8/test/mjsunit/wasm/float-constant-folding.js +++ b/deps/v8/test/mjsunit/wasm/float-constant-folding.js @@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print("F32: sNaN - 0 = qNaN"); var builder = new WasmModuleBuilder(); builder.addFunction("F32Sub0", kSig_i_i).addBody( - [ kExprGetLocal, 0, kExprF32ReinterpretI32, kExprF32Const, 0x00, 0x00, + [ kExprLocalGet, 0, kExprF32ReinterpretI32, kExprF32Const, 0x00, 0x00, 0x00, 0x00, // 0.0 kExprF32Sub, kExprI32ReinterpretF32, ]).exportFunc(); var module = builder.instantiate(); @@ -23,7 +23,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); var builder = new WasmModuleBuilder(); builder.addFunction("F32Sub0", kSig_i_i).addBody( [ kExprF32Const, 0x00, 0x00, 0x00, 0x80, // 0.0 - kExprGetLocal, 0, kExprF32ReinterpretI32, kExprF32Sub, + kExprLocalGet, 0, kExprF32ReinterpretI32, kExprF32Sub, kExprI32ReinterpretF32, ]).exportFunc(); var module = builder.instantiate(); // F32Sub0(signalling_NaN) diff --git a/deps/v8/test/mjsunit/wasm/futex.js b/deps/v8/test/mjsunit/wasm/futex.js index 00353d48b0..d5bbf9ff1a 100644 --- a/deps/v8/test/mjsunit/wasm/futex.js +++ b/deps/v8/test/mjsunit/wasm/futex.js @@ -14,8 +14,8 @@ function WasmAtomicNotify(memory, offset, index, num) { builder.addImportedMemory("m", "memory", 0, 20, "shared"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, kExprAtomicNotify, /* alignment */ 0, offset]) .exportAs("main"); @@ -32,9 +32,9 @@ function WasmI32AtomicWait(memory, offset, index, val, timeout) { builder.addFunction("main", makeSig([kWasmI32, kWasmI32, kWasmF64], [kWasmI32])) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kExprI64SConvertF64, kAtomicPrefix, kExprI32AtomicWait, /* alignment */ 0, offset]) @@ -56,17 +56,17 @@ function WasmI64AtomicWait(memory, offset, index, val_low, makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmF64], [kWasmI32])) .addLocals({i64_count: 1}) // local that is passed as value param to wait .addBody([ - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64UConvertI32, kExprI64Const, 32, kExprI64Shl, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprI64UConvertI32, kExprI64Ior, - kExprSetLocal, 4, // Store the created I64 value in local - kExprGetLocal, 0, - kExprGetLocal, 4, - kExprGetLocal, 3, + kExprLocalSet, 4, // Store the created I64 value in local + kExprLocalGet, 0, + kExprLocalGet, 4, + kExprLocalGet, 3, kExprI64SConvertF64, kAtomicPrefix, kExprI64AtomicWait, /* alignment */ 0, offset]) diff --git a/deps/v8/test/mjsunit/wasm/gc-buffer.js b/deps/v8/test/mjsunit/wasm/gc-buffer.js index d8aa9a86d8..c7fdbbc47c 100644 --- a/deps/v8/test/mjsunit/wasm/gc-buffer.js +++ b/deps/v8/test/mjsunit/wasm/gc-buffer.js @@ -14,7 +14,7 @@ function run(f) { builder.addImport("mod", "the_name_of_my_import", kSig_i_i); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("main"); print("module"); diff --git a/deps/v8/test/mjsunit/wasm/gc-frame.js b/deps/v8/test/mjsunit/wasm/gc-frame.js index de8bdab51e..7d3b19741a 100644 --- a/deps/v8/test/mjsunit/wasm/gc-frame.js +++ b/deps/v8/test/mjsunit/wasm/gc-frame.js @@ -16,28 +16,28 @@ function makeFFI(func, t) { // the different parts of the stack. builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- - kExprGetLocal, 2, // -- - kExprGetLocal, 3, // -- - kExprGetLocal, 4, // -- - kExprGetLocal, 5, // -- - kExprGetLocal, 6, // -- - kExprGetLocal, 7, // -- - kExprGetLocal, 8, // -- - kExprGetLocal, 9, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- + kExprLocalGet, 2, // -- + kExprLocalGet, 3, // -- + kExprLocalGet, 4, // -- + kExprLocalGet, 5, // -- + kExprLocalGet, 6, // -- + kExprLocalGet, 7, // -- + kExprLocalGet, 8, // -- + kExprLocalGet, 9, // -- kExprCallFunction, 0, // -- kExprDrop, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- - kExprGetLocal, 2, // -- - kExprGetLocal, 3, // -- - kExprGetLocal, 4, // -- - kExprGetLocal, 5, // -- - kExprGetLocal, 6, // -- - kExprGetLocal, 7, // -- - kExprGetLocal, 8, // -- - kExprGetLocal, 9, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- + kExprLocalGet, 2, // -- + kExprLocalGet, 3, // -- + kExprLocalGet, 4, // -- + kExprLocalGet, 5, // -- + kExprLocalGet, 6, // -- + kExprLocalGet, 7, // -- + kExprLocalGet, 8, // -- + kExprLocalGet, 9, // -- kExprCallFunction, 0, // -- ]) // -- .exportFunc(); @@ -79,7 +79,7 @@ function print10(a, b, c, d, e, f, g, h, i) { var sig_index = builder.addType(kSig_i_i); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/gc-memory.js b/deps/v8/test/mjsunit/wasm/gc-memory.js new file mode 100644 index 0000000000..31e96f8be3 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/gc-memory.js @@ -0,0 +1,41 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let kPageSize = 65536; + +function allocMems(count, initial, maximum) { + print(`alloc ${count}`); + let result = []; + for (let i = 0; i < count; i++) { + print(` memory #${i} (initial=${initial}, maximum=${maximum})...`); + result.push(new WebAssembly.Memory({initial: initial, maximum: maximum})); + } + return result; +} + +function check(mems, initial) { + for (m of mems) { + assertEquals(initial * kPageSize, m.buffer.byteLength); + } +} + +function test(count, initial, maximum) { + let mems = allocMems(count, initial, maximum); + check(mems, initial); +} + +test(1, 1, 1); +test(1, 1, 2); +test(1, 1, 3); +test(1, 1, 4); + +test(2, 1, 1); +test(2, 1, 2); +test(2, 1, 3); +test(2, 1, 4); + +test(1, 1, undefined); +test(2, 1, undefined); +test(3, 1, undefined); +test(4, 1, undefined); diff --git a/deps/v8/test/mjsunit/wasm/gc-stress.js b/deps/v8/test/mjsunit/wasm/gc-stress.js index 8daff420da..55a780d3ec 100644 --- a/deps/v8/test/mjsunit/wasm/gc-stress.js +++ b/deps/v8/test/mjsunit/wasm/gc-stress.js @@ -11,7 +11,7 @@ function run(f) { builder.addImport("m", "f", kSig_i_i); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/globals.js b/deps/v8/test/mjsunit/wasm/globals.js index b29993a8fc..a72bc118c7 100644 --- a/deps/v8/test/mjsunit/wasm/globals.js +++ b/deps/v8/test/mjsunit/wasm/globals.js @@ -15,12 +15,12 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let sig_index = builder.addType(kSig_i_v); builder.addFunction("get", sig_index) .addBody([ - kExprGetGlobal, g.index]) + kExprGlobalGet, g.index]) .exportAs("get"); builder.addFunction("set", kSig_v_i) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index]) + kExprLocalGet, 0, + kExprGlobalSet, g.index]) .exportAs("set"); let module = new WebAssembly.Module(builder.toBuffer()); @@ -54,7 +54,7 @@ function TestImported(type, val, expected) { var sig = makeSig([], [type]); var g = builder.addImportedGlobal("uuu", "foo", type); builder.addFunction("main", sig) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs("main"); builder.addGlobal(kWasmI32); // pad @@ -76,7 +76,7 @@ TestImported(kWasmF64, 77777.88888, 77777.88888); let sig_index = builder.addType(kSig_i_v); builder.addFunction("main", sig_index) .addBody([ - kExprGetGlobal, g]) + kExprGlobalGet, g]) .exportAs("main"); let module = new WebAssembly.Module(builder.toBuffer()); @@ -152,7 +152,7 @@ function TestGlobalIndexSpace(type, val) { var sig = makeSig([], [type]); builder.addFunction("main", sig) - .addBody([kExprGetGlobal, def.index]) + .addBody([kExprGlobalGet, def.index]) .exportAs("main"); var instance = builder.instantiate({nnn: {foo: val}}); @@ -173,22 +173,22 @@ TestGlobalIndexSpace(kWasmF64, 12345.678); let sig_index = builder.addType(kSig_i_i); builder.addFunction("get", sig_index) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, kWasmI32, - kExprGetGlobal, g.index, + kExprGlobalGet, g.index, kExprElse, - kExprGetGlobal, h.index, + kExprGlobalGet, h.index, kExprEnd]) .exportAs("get"); builder.addFunction("set", kSig_v_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, kWasmStmt, - kExprGetLocal, 1, - kExprSetGlobal, g.index, + kExprLocalGet, 1, + kExprGlobalSet, g.index, kExprElse, - kExprGetLocal, 1, - kExprSetGlobal, h.index, + kExprLocalGet, 1, + kExprGlobalSet, h.index, kExprEnd]) .exportAs("set"); diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown.js index aa50e6cf77..0f55b795c1 100644 --- a/deps/v8/test/mjsunit/wasm/graceful_shutdown.js +++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); for (i = 0; i < 100; i++) { builder.addFunction("sub" + i, kSig_i_i) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Const, i % 61, // -- kExprI32Sub]) // -- .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js index 17c6803784..f615602a8e 100644 --- a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js +++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); for (i = 0; i < 100; i++) { builder.addFunction("sub" + i, kSig_i_i) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Const, i % 61, // -- kExprI32Sub]) // -- .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js index 9ab2334a63..b228449703 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js @@ -10,7 +10,7 @@ let module = (() => { let builder = new WasmModuleBuilder(); builder.addMemory(1, undefined, false); builder.addFunction("grow_memory", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.exportMemoryAs("memory"); return builder.toModule(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js index 93bb56d83d..8babc66b75 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js @@ -13,12 +13,12 @@ function generateBuilder() { let builder = new WasmModuleBuilder(); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, - kExprI32StoreMem, 0, 0, kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, + kExprI32StoreMem, 0, 0, kExprLocalGet, 1 ]) .exportFunc(); return builder; @@ -32,7 +32,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory @@ -59,7 +59,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory @@ -94,7 +94,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, index, // put index on stack kExprI32Const, newValue, // put the value on stack @@ -127,7 +127,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack kExprMemoryGrow, kMemoryZero, // grow memory @@ -159,16 +159,16 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); @@ -191,20 +191,20 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprElse, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); @@ -226,20 +226,20 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprElse, kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); @@ -263,23 +263,23 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, valueIf, // put valueIf on stack kExprI32StoreMem, 0, 0, // store kExprElse, kExprI32Const, deltaPagesElse, // put deltaPagesElse on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, valueElse, // put valueElse on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js index 1790f9760f..7940ab5f19 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js @@ -20,12 +20,12 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get number of new pages + kExprLocalGet, 0, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow kExprMemorySize, kMemoryZero // get the memory size @@ -47,19 +47,19 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction('main', kSig_v_iii) .addBody([ - kExprGetLocal, 0, // get number of new pages + kExprLocalGet, 0, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index - kExprGetLocal, 2, // get value + kExprLocalGet, 1, // get index + kExprLocalGet, 2, // get value kExprI32StoreMem, 0, 0 // store ]) .exportFunc(); @@ -118,24 +118,24 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_ii) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. - kExprGetLocal, 1, // get number of new pages + kExprLocalGet, 1, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -161,13 +161,13 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; // parameters: iterations, deltaPages, index @@ -175,29 +175,29 @@ print('=== grow_memory in direct calls ==='); .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. - kExprGetLocal, 1, // get number of new pages + kExprLocalGet, 1, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 2, // put index (for store) - kExprGetLocal, 2, // put index (for load) + kExprLocalGet, 2, // put index (for store) + kExprLocalGet, 2, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase counter kExprI32StoreMem, 0, 0, // store counter in memory // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Return the value - kExprGetLocal, 2, // - + kExprLocalGet, 2, // - kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) @@ -225,13 +225,13 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 1, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 1, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow kExprMemorySize, kMemoryZero // get the memory size @@ -255,21 +255,21 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); let sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []); builder.addFunction('main', sig) .addBody([ - kExprGetLocal, 1, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 1, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow - kExprGetLocal, 2, // get index - kExprGetLocal, 3, // get value + kExprLocalGet, 2, // get index + kExprLocalGet, 3, // get value kExprI32StoreMem, 0, 0 // store ]) .exportFunc(); @@ -311,7 +311,7 @@ print('\n=== grow_memory in indirect calls ==='); kExprI32Const, index, // put index on stack kExprI32Const, oldValue, // put old value on stack kExprI32StoreMem, 0, 0, // store - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprI32Const, index, // put index on stack kExprI32LoadMem, 0, 0 // load from grown memory @@ -332,25 +332,25 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_iii) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprIf, kWasmStmt, // if <param1> != 0 // Grow memory. - kExprGetLocal, 2, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 2, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 1, // decrease <param1> + kExprLocalSet, 1, // decrease <param1> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -378,13 +378,13 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); builder @@ -394,30 +394,30 @@ print('\n=== grow_memory in indirect calls ==='); .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprIf, kWasmStmt, // if <param1> != 0 // Grow memory. - kExprGetLocal, 2, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 2, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 3, // put index (for store) - kExprGetLocal, 3, // put index (for load) + kExprLocalGet, 3, // put index (for store) + kExprLocalGet, 3, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase counter kExprI32StoreMem, 0, 0, // store counter in memory // Decrease loop variable. - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 1, // decrease <param1> + kExprLocalSet, 1, // decrease <param1> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Return the value - kExprGetLocal, 3, // - + kExprLocalGet, 3, // - kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js index ed04e23c63..143b555b17 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js @@ -14,8 +14,8 @@ function generateBuilder() { builder.addMemory(initialPages, maximumPages, true); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); return builder; @@ -31,17 +31,17 @@ function generateBuilder() { .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPages, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -83,17 +83,17 @@ function generateBuilder() { kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPagesIn, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -132,29 +132,29 @@ function generateBuilder() { .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPages, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 1, // put index (for store) - kExprGetLocal, 1, // put index (for load) + kExprLocalGet, 1, // put index (for store) + kExprLocalGet, 1, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase counter kExprI32StoreMem, 0, 0, // store counter in memory // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Increase counter in memory. - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) @@ -195,37 +195,37 @@ function generateBuilder() { kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 1, // put index (for store) - kExprGetLocal, 1, // put index (for load) + kExprLocalGet, 1, // put index (for store) + kExprLocalGet, 1, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase value on stack kExprI32StoreMem, 0, 0, // store new value // Start loop. kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPagesIn, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 1, // put index (for store) - kExprGetLocal, 1, // put index (for load) + kExprLocalGet, 1, // put index (for store) + kExprLocalGet, 1, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase value on stack kExprI32StoreMem, 0, 0, // store new value // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Return counter from memory. - kExprGetLocal, 1, // put index on stack + kExprLocalGet, 1, // put index on stack kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) diff --git a/deps/v8/test/mjsunit/wasm/grow-memory.js b/deps/v8/test/mjsunit/wasm/grow-memory.js index 0e5618a2b1..6d0e7e5c5f 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory.js @@ -10,28 +10,28 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); function genMemoryGrowBuilder() { var builder = new WasmModuleBuilder(); builder.addFunction("grow_memory", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); builder.addFunction("load16", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem16U, 0, 0]) .exportFunc(); builder.addFunction("store16", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem16, 0, 0, + kExprLocalGet, 1]) .exportFunc(); builder.addFunction("load8", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0]) .exportFunc(); builder.addFunction("store8", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0, + kExprLocalGet, 1]) .exportFunc(); return builder; } diff --git a/deps/v8/test/mjsunit/wasm/grow-shared-memory.js b/deps/v8/test/mjsunit/wasm/grow-shared-memory.js index bbd180b39c..3c9d72b499 100644 --- a/deps/v8/test/mjsunit/wasm/grow-shared-memory.js +++ b/deps/v8/test/mjsunit/wasm/grow-shared-memory.js @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(v8:8832): Enable --stress-opt on these tests -// Flags: --wasm-grow-shared-memory -// Flags: --experimental-wasm-threads --no-stress-opt +// Flags: --wasm-grow-shared-memory --experimental-wasm-threads load("test/mjsunit/wasm/wasm-module-builder.js"); @@ -137,7 +135,7 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); let obj = {memory: memory, module: module}; @@ -169,7 +167,7 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); let obj = {memory: memory, module: module}; @@ -200,10 +198,10 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow_twice", kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero, kExprDrop, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); @@ -239,10 +237,10 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow_and_size", kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero, kExprDrop, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero, kExprDrop, kExprMemorySize, kMemoryZero]) @@ -298,13 +296,13 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.addFunction("atomic_load", kSig_i_i) - .addBody([kExprGetLocal, 0, kAtomicPrefix, kExprI32AtomicLoad, 2, 0]) + .addBody([kExprLocalGet, 0, kAtomicPrefix, kExprI32AtomicLoad, 2, 0]) .exportFunc(); builder.addFunction("atomic_store", kSig_v_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicStore, 2, 0]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); diff --git a/deps/v8/test/mjsunit/wasm/huge-memory.js b/deps/v8/test/mjsunit/wasm/huge-memory.js index bf037b0c92..6c145d70cb 100644 --- a/deps/v8/test/mjsunit/wasm/huge-memory.js +++ b/deps/v8/test/mjsunit/wasm/huge-memory.js @@ -16,8 +16,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addMemory(num_pages, num_pages, true); builder.addFunction("geti", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul, kExprI32LoadMem, 0, 0, ]) diff --git a/deps/v8/test/mjsunit/wasm/import-function.js b/deps/v8/test/mjsunit/wasm/import-function.js index ec187aff4a..6bbad8a222 100644 --- a/deps/v8/test/mjsunit/wasm/import-function.js +++ b/deps/v8/test/mjsunit/wasm/import-function.js @@ -13,8 +13,8 @@ function testCallImport(func, check) { builder.addImport("q", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0]) // -- .exportAs("main"); @@ -186,8 +186,8 @@ function testCallBinopVoid(type, func, check) { builder.addImport("q", "func", makeSig_v_xx(type)); builder.addFunction("main", makeSig_r_xx(kWasmI32, type)) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- kExprI32Const, 39, // -- ]) @@ -244,7 +244,7 @@ function testCallPrint() { .addBody([ kExprI32Const, 27, // -- kExprCallFunction, 0, // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallFunction, 1 // -- ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/import-memory.js b/deps/v8/test/mjsunit/wasm/import-memory.js index fc688dc7ce..08100efabd 100644 --- a/deps/v8/test/mjsunit/wasm/import-memory.js +++ b/deps/v8/test/mjsunit/wasm/import-memory.js @@ -51,7 +51,7 @@ var kV8MaxPages = 32767; builder.exportMemoryAs("exported_mem"); builder.addFunction("foo", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("foo"); i1 = builder.instantiate(); @@ -63,7 +63,7 @@ var kV8MaxPages = 32767; builder.addImportedMemory("fil", "imported_mem"); builder.addFunction("bar", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("bar"); i2 = builder.instantiate({fil: {imported_mem: i1.exports.exported_mem}}); @@ -89,11 +89,11 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("gaz", "mine"); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); var offset; let instance = builder.instantiate({gaz: {mine: memory}}); @@ -119,11 +119,11 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("mine", "dog", 0, 20); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); var offset; let instance = builder.instantiate({mine: {dog: memory}}); @@ -157,11 +157,11 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("mine", "fro"); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); var offset; let instance = builder.instantiate({mine: {fro: memory}}); @@ -187,7 +187,7 @@ var kV8MaxPages = 32767; assertEquals(2*kPageSize, memory.buffer.byteLength); let builder = new WasmModuleBuilder(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.addImportedMemory("cat", "mine"); let instance = builder.instantiate({cat: {mine: memory}}); @@ -217,7 +217,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance = builder.instantiate({fur: { imported_mem: exp_instance.exports.exported_mem}}); @@ -238,7 +238,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportAs("mem_size"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); var instances = []; @@ -279,7 +279,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 5; i++) { @@ -344,7 +344,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 10; i++) { @@ -379,7 +379,7 @@ var kV8MaxPages = 32767; builder.addMemory(1, kSpecMaxPages, true); builder.exportMemoryAs("exported_mem"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance_1 = builder.instantiate(); } @@ -387,7 +387,7 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("doo", "imported_mem"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance_2 = builder.instantiate({ doo: {imported_mem: instance_1.exports.exported_mem}}); @@ -407,7 +407,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance = builder.instantiate(); assertEquals(kPageSize, instance.exports.exported_mem.buffer.byteLength); diff --git a/deps/v8/test/mjsunit/wasm/import-mutable-global.js b/deps/v8/test/mjsunit/wasm/import-mutable-global.js index 715549a41f..70ce50be00 100644 --- a/deps/v8/test/mjsunit/wasm/import-mutable-global.js +++ b/deps/v8/test/mjsunit/wasm/import-mutable-global.js @@ -11,7 +11,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); builder.addImportedGlobal("mod", "g", kWasmI32); builder.addFunction("main", kSig_i_v) - .addBody([kExprGetGlobal, 0]) + .addBody([kExprGlobalGet, 0]) .exportAs("main"); let main = builder.instantiate({mod: {g: global}}).exports.main; @@ -54,10 +54,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); function addGlobalGetterAndSetter(builder, index, name, type) { builder.addFunction('get' + name, makeSig([], [type])) - .addBody([kExprGetGlobal, index]) + .addBody([kExprGlobalGet, index]) .exportFunc(); builder.addFunction('set' + name, makeSig([type], [])) - .addBody([kExprGetLocal, 0, kExprSetGlobal, index]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, index]) .exportFunc(); } @@ -137,20 +137,20 @@ function addGlobalGetterAndSetter(builder, index, name, type) { const index = 0; builder.addFunction('geti64_hi', makeSig([], [kWasmI32])) .addBody([ - kExprGetGlobal, index, + kExprGlobalGet, index, kExprI64Const, 32, kExprI64ShrU, kExprI32ConvertI64]) .exportFunc(); builder.addFunction('geti64_lo', makeSig([], [kWasmI32])) - .addBody([kExprGetGlobal, index, kExprI32ConvertI64]) + .addBody([kExprGlobalGet, index, kExprI32ConvertI64]) .exportFunc(); builder.addFunction("seti64", makeSig([kWasmI32, kWasmI32], [])) .addBody([ - kExprGetLocal, 1, kExprI64UConvertI32, - kExprGetLocal, 0, kExprI64UConvertI32, + kExprLocalGet, 1, kExprI64UConvertI32, + kExprLocalGet, 0, kExprI64UConvertI32, kExprI64Const, 32, kExprI64Shl, kExprI64Ior, - kExprSetGlobal, index]) + kExprGlobalSet, index]) .exportFunc(); }; diff --git a/deps/v8/test/mjsunit/wasm/import-table.js b/deps/v8/test/mjsunit/wasm/import-table.js index 098d03d4d6..6693559c8f 100644 --- a/deps/v8/test/mjsunit/wasm/import-table.js +++ b/deps/v8/test/mjsunit/wasm/import-table.js @@ -34,7 +34,7 @@ let kTableSize = 50; let f15 = addConstFunc(builder, 15); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -57,7 +57,7 @@ let kTableSize = 50; let f21 = addConstFunc(builder, 21); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -92,7 +92,7 @@ function addConstFuncUsingGlobal(builder, val) { let g = builder.addGlobal(kWasmI32, false); g.init = val; return builder.addFunction("global" + val, kSig_i_v) - .addBody([kExprGetGlobal, g.index]).index; + .addBody([kExprGlobalGet, g.index]).index; } (function TestAliasedImportedTableInstanceGlobals() { @@ -106,7 +106,7 @@ function addConstFuncUsingGlobal(builder, val) { let f14 = addConstFuncUsingGlobal(builder, 14); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -129,7 +129,7 @@ function addConstFuncUsingGlobal(builder, val) { let f22 = addConstFuncUsingGlobal(builder, 22); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -186,7 +186,7 @@ function addConstFuncUsingMemory(builder, val) { let f13 = addConstFuncUsingMemory(builder, 13); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -211,7 +211,7 @@ function addConstFuncUsingMemory(builder, val) { let f23 = addConstFuncUsingMemory(builder, 23); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js b/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js index 414ca19c99..69fb4dcf43 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js +++ b/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js @@ -41,28 +41,28 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .index; builder.addFunction('call1', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprCallIndirect, sig_index, table1]) .exportAs('call1'); builder.addFunction('return_call1', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprReturnCallIndirect, sig_index, table1]) .exportAs('return_call1'); builder.addFunction('call2', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprCallIndirect, sig_index, table2]) .exportAs('call2'); builder.addFunction('return_call2', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprReturnCallIndirect, sig_index, table2]) .exportAs('return_call2'); builder.addFunction('call_invalid_sig', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprGetLocal, 0, // function index + param + .addBody([kExprLocalGet, 0, kExprLocalGet, 0, // function index + param kExprCallIndirect, other_sig, table2]) .exportAs('call_invalid_sig'); builder.addFunction('return_call_invalid_sig', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprGetLocal, 0, // function index + param + .addBody([kExprLocalGet, 0, kExprLocalGet, 0, // function index + param kExprReturnCallIndirect, other_sig, table2]) .exportAs('return_call_invalid_sig'); @@ -119,10 +119,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const sig_index = builder.addType(kSig_i_v); const f1 = builder.addFunction("foo", sig_index) - .addBody([kExprGetGlobal, g, kExprI32Const, 12, kExprI32Add]); + .addBody([kExprGlobalGet, g, kExprI32Const, 12, kExprI32Add]); builder.addFunction('call', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprCallIndirect, sig_index, t1]) .exportAs('call'); @@ -167,14 +167,14 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder.addType(kSig_i_ii); builder.addFunction("placeholder", sig_index) - .addBody([kExprGetLocal, 0]); + .addBody([kExprLocalGet, 0]); builder.addElementSegment(table_index, g, true, [div]); builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 55, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, table_index]) // -- .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-calls.js b/deps/v8/test/mjsunit/wasm/indirect-calls.js index e9f560a019..603d7561ec 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-calls.js +++ b/deps/v8/test/mjsunit/wasm/indirect-calls.js @@ -15,20 +15,20 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addImport("q", "add", sig_index); var f = builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0 + kExprLocalGet, 0, kExprLocalGet, 1, kExprCallFunction, 0 ]); print("internal add index = " + f.index); builder.addFunction("sub", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub, // -- ]); builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero ]) .exportFunc() @@ -68,20 +68,20 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); var mul = builder.addImport("q", "mul", sig_i_ii); var add = builder.addFunction("add", sig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); var popcnt = builder.addFunction("popcnt", sig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Popcnt // -- ]); var main = builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero ]) .exportFunc(); @@ -106,20 +106,20 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); function AddFunctions(builder) { var mul = builder.addFunction("mul", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Mul // -- ]); var add = builder.addFunction("add", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); var sub = builder.addFunction("sub", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub // -- ]); return {mul: mul, add: add, sub: sub}; @@ -135,8 +135,8 @@ function AddFunctions(builder) { builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -163,8 +163,8 @@ function AddFunctions(builder) { builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -200,8 +200,8 @@ function AddFunctions(builder) { builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js b/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js index 9e8ddac1c5..ea148c5087 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js +++ b/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js @@ -65,14 +65,14 @@ function caller_module() { builder.addFunction("call1", sig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_i_v, kTableZero]) // -- .exportAs("call1"); builder.addFunction("call2", sig_i_i) .addBody([ kExprI32Const, 11, // -- - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_i_i, kTableZero]) // -- .exportAs("call2"); @@ -80,7 +80,7 @@ function caller_module() { .addBody([ kExprI32Const, 21, kExprI32Const, 22, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero]) // -- .exportAs("call3"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-tables.js b/deps/v8/test/mjsunit/wasm/indirect-tables.js index 58df978859..e48157001b 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-tables.js +++ b/deps/v8/test/mjsunit/wasm/indirect-tables.js @@ -10,20 +10,20 @@ function AddFunctions(builder) { let sig_index = builder.addType(kSig_i_ii); let mul = builder.addFunction("mul", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Mul // -- ]); let add = builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); let sub = builder.addFunction("sub", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub // -- ]); return {mul: mul, add: add, sub: sub}; @@ -41,8 +41,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -121,8 +121,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -184,8 +184,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 55, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -249,11 +249,11 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder.addType(kSig_i_v); let f = builder.addFunction("f", sig_index) .addBody([ - kExprGetGlobal, g + kExprGlobalGet, g ]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero]) // -- .exportAs("main"); builder.addElementSegment(0, g, true, [f.index]); @@ -292,7 +292,7 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index1, kTableZero]) // -- .exportAs("main"); @@ -311,7 +311,7 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index2, kTableZero]) // -- .exportAs("main"); @@ -404,11 +404,11 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder.addType(kSig_i_v); builder.addFunction("g", sig_index) .addBody([ - kExprGetGlobal, g + kExprGlobalGet, g ]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero]) // -- .exportAs("main"); builder.addElementSegment(0, g, true, [g]); @@ -572,7 +572,7 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder0.addType(kSig_i_v); builder0.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallIndirect, sig_index, kTableZero ]) .exportAs('main'); @@ -584,7 +584,7 @@ function js_div(a, b) { return (a / b) | 0; } // instance1 imports the table and adds a function to it. let builder1 = new WasmModuleBuilder(); builder1.setName('module_1'); - builder1.addFunction('f', kSig_i_i).addBody([kExprGetLocal, 0]); + builder1.addFunction('f', kSig_i_i).addBody([kExprLocalGet, 0]); builder1.addImportedTable('z', 'table'); builder1.addElementSegment(0, 0, false, [0]); let module1 = new WebAssembly.Module(builder1.toBuffer()); @@ -611,7 +611,7 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); let sig = builder.addType(kSig_i_v); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig, kTableZero]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig, kTableZero]) .exportAs('main'); builder.addImportedMemory('', 'memory', 1); @@ -653,7 +653,7 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); let sig = builder.addType(kSig_i_v); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig, kTableZero]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig, kTableZero]) .exportAs('main'); builder.addImportedTable('', 'table'); @@ -711,8 +711,8 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); builder.addFunction("mul", kSig_i_ii) .addBody( - [kExprGetLocal, 0, - kExprGetLocal, 1, + [kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul]) .exportFunc(); return builder.instantiate().exports.mul; @@ -725,8 +725,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -756,8 +756,8 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); builder.addFunction("mul", kSig_i_ii) .addBody( - [kExprGetLocal, 0, - kExprGetLocal, 1, + [kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul]) .exportFunc(); return builder.instantiate().exports.mul; @@ -775,8 +775,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 44, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -817,7 +817,7 @@ function js_div(a, b) { return (a / b) | 0; } builder.addImport("q", "f1", kSig_i_v); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportFunc(); @@ -879,7 +879,7 @@ function js_div(a, b) { return (a / b) | 0; } ]); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js b/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js index 29b65bc9b8..401be71504 100644 --- a/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js +++ b/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js @@ -17,7 +17,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 5; i++) { diff --git a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js index 1c5f10a832..7d4b848465 100644 --- a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js +++ b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js @@ -130,8 +130,8 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, kExprI32LoadMem, 0, 0, kExprI32Const, 1, - kExprCallIndirect, signature, kTableZero, kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprI32Const, 1, + kExprCallIndirect, signature, kTableZero, kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprCallFunction, 0, kExprI32Add ]) .exportFunc(); @@ -139,7 +139,7 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); // writer(mem[i]); // return mem[i] + some_value(); builder.addFunction('_wrap_writer', signature).addBody([ - kExprGetLocal, 0, kExprCallFunction, 1 + kExprLocalGet, 0, kExprCallFunction, 1 ]); builder.appendToTable([2, 3]); @@ -176,11 +176,11 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); var builder = new WasmModuleBuilder(); builder.addGlobal(kWasmI32, true); builder.addFunction('read', kSig_i_v) - .addBody([kExprGetGlobal, 0]) + .addBody([kExprGlobalGet, 0]) .exportFunc(); builder.addFunction('write', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprSetGlobal, 0]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, 0]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); diff --git a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js index 573e1e1d9e..27df605d46 100644 --- a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js +++ b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js @@ -29,9 +29,9 @@ function checkStack(stack, expected_lines) { // grow_memory can be called from interpreted or compiled code, and changes // should be reflected in either execution. var builder = new WasmModuleBuilder(); - var grow_body = [kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]; - var load_body = [kExprGetLocal, 0, kExprI32LoadMem, 0, 0]; - var store_body = [kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0]; + var grow_body = [kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]; + var load_body = [kExprLocalGet, 0, kExprI32LoadMem, 0, 0]; + var store_body = [kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0]; builder.addFunction('grow_memory', kSig_i_i).addBody(grow_body).exportFunc(); builder.addFunction('load', kSig_i_i).addBody(load_body).exportFunc(); builder.addFunction('store', kSig_v_ii).addBody(store_body).exportFunc(); @@ -96,7 +96,7 @@ function createTwoInstancesCallingEachOther(inner_throws = false) { let id_imp = builder1.addImport('q', 'id', kSig_i_i); let plus_one = builder1.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Add, // - kExprCallFunction, id_imp @@ -114,7 +114,7 @@ function createTwoInstancesCallingEachOther(inner_throws = false) { let plus_two = builder2.addFunction('plus_two', kSig_i_i) .addBody([ // Call import, add one more. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, plus_one_imp, // - kExprI32Const, 1, // - kExprI32Add diff --git a/deps/v8/test/mjsunit/wasm/interpreter.js b/deps/v8/test/mjsunit/wasm/interpreter.js index c1c03a4dd0..43ecc4a33a 100644 --- a/deps/v8/test/mjsunit/wasm/interpreter.js +++ b/deps/v8/test/mjsunit/wasm/interpreter.js @@ -59,10 +59,10 @@ function checkStack(stack, expected_lines) { builder.addFunction('main', makeSig([kWasmI32, kWasmF64], [kWasmF32])) .addBody([ // call #0 with arg 0 and arg 0 + 1 - kExprGetLocal, 0, kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add, + kExprLocalGet, 0, kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, kExprCallFunction, 0, // call #1 with arg 1 - kExprGetLocal, 1, kExprCallFunction, 1, + kExprLocalGet, 1, kExprCallFunction, 1, // convert returned value to f32 kExprF32UConvertI32, // add the two values @@ -151,28 +151,28 @@ function checkStack(stack, expected_lines) { builder.addGlobal(kWasmF32, true); // 2 builder.addGlobal(kWasmF64, true); // 3 builder.addFunction('get_i32', kSig_i_v) - .addBody([kExprGetGlobal, 0]) + .addBody([kExprGlobalGet, 0]) .exportFunc(); builder.addFunction('get_i64', kSig_d_v) - .addBody([kExprGetGlobal, 1, kExprF64SConvertI64]) + .addBody([kExprGlobalGet, 1, kExprF64SConvertI64]) .exportFunc(); builder.addFunction('get_f32', kSig_d_v) - .addBody([kExprGetGlobal, 2, kExprF64ConvertF32]) + .addBody([kExprGlobalGet, 2, kExprF64ConvertF32]) .exportFunc(); builder.addFunction('get_f64', kSig_d_v) - .addBody([kExprGetGlobal, 3]) + .addBody([kExprGlobalGet, 3]) .exportFunc(); builder.addFunction('set_i32', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprSetGlobal, 0]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, 0]) .exportFunc(); builder.addFunction('set_i64', kSig_v_d) - .addBody([kExprGetLocal, 0, kExprI64SConvertF64, kExprSetGlobal, 1]) + .addBody([kExprLocalGet, 0, kExprI64SConvertF64, kExprGlobalSet, 1]) .exportFunc(); builder.addFunction('set_f32', kSig_v_d) - .addBody([kExprGetLocal, 0, kExprF32ConvertF64, kExprSetGlobal, 2]) + .addBody([kExprLocalGet, 0, kExprF32ConvertF64, kExprGlobalSet, 2]) .exportFunc(); builder.addFunction('set_f64', kSig_v_d) - .addBody([kExprGetLocal, 0, kExprSetGlobal, 3]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, 3]) .exportFunc(); var instance = builder.instantiate(); // Initially, all should be zero. @@ -205,7 +205,7 @@ function checkStack(stack, expected_lines) { var builder = new WasmModuleBuilder(); builder.addImport('mod', 'func', kSig_v_i); builder.addFunction('main', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); instance = builder.instantiate({mod: {func: func}}); // Test that this does not mess up internal state by executing it three times. @@ -239,14 +239,14 @@ function checkStack(stack, expected_lines) { var sig_i_i = builder.addType(kSig_i_i); var mul = builder.addImport('q', 'mul', sig_i_ii); var add = builder.addFunction('add', sig_i_ii).addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add ]); var mismatch = - builder.addFunction('sig_mismatch', sig_i_i).addBody([kExprGetLocal, 0]); + builder.addFunction('sig_mismatch', sig_i_i).addBody([kExprLocalGet, 0]); var main = builder.addFunction('main', kSig_i_iii) .addBody([ // Call indirect #0 with args <#1, #2>. - kExprGetLocal, 1, kExprGetLocal, 2, kExprGetLocal, 0, + kExprLocalGet, 1, kExprLocalGet, 2, kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero ]) .exportFunc(); @@ -281,7 +281,7 @@ function checkStack(stack, expected_lines) { builder.addFunction('main', kSig_v_i) .addBody([ // Call indirect #0 with arg #0, drop result. - kExprGetLocal, 0, kExprCallIndirect, sig_l_v, kTableZero, kExprDrop + kExprLocalGet, 0, kExprCallIndirect, sig_l_v, kTableZero, kExprDrop ]) .exportFunc(); builder.appendToTable([imp, direct.index, indirect.index]); @@ -409,7 +409,7 @@ function checkStack(stack, expected_lines) { var builder = new WasmModuleBuilder(); var imp = builder.addImport('mod', 'the_name_of_my_import', kSig_i_i); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, imp]) + .addBody([kExprLocalGet, 0, kExprCallFunction, imp]) .exportAs('main'); print('module'); return new WebAssembly.Module(builder.toBuffer()); @@ -525,7 +525,7 @@ function checkStack(stack, expected_lines) { const sig_index = builder0.addType(kSig_i_v); builder0.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index, kTableZero ]) // -- .exportAs('main'); @@ -549,7 +549,7 @@ function checkStack(stack, expected_lines) { print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32Const, 7, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprI32Const, 7, kExprI32Add]) .exportFunc(); const wire_bytes = builder.toBuffer(); diff --git a/deps/v8/test/mjsunit/wasm/lazy-compilation.js b/deps/v8/test/mjsunit/wasm/lazy-compilation.js index c7cd40d05d..c45fb6deb0 100644 --- a/deps/v8/test/mjsunit/wasm/lazy-compilation.js +++ b/deps/v8/test/mjsunit/wasm/lazy-compilation.js @@ -24,7 +24,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addFunction('store', kSig_v_i) .addBody([ kExprI32Const, 0, // i32.const 1 - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32StoreMem, 0, 0, // i32.store offset=0 align=0 ]) .exportFunc(); @@ -35,7 +35,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder2.addMemory(1, 1, true); builder2.addImport('mod', 'store', kSig_v_i); builder2.addFunction('call_store', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); const instance2 = builder2.instantiate({mod: {store: instance1.exports.store}}); const mem2 = new Int32Array(instance2.exports.memory.buffer); @@ -75,7 +75,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addFunction('store', kSig_v_i) .addBody([ kExprI32Const, 0, // i32.const 1 - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32StoreMem, 0, 0, // i32.store offset=0 align=0 ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js b/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js index 3ce74816ea..eadfaacca4 100644 --- a/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js +++ b/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js @@ -13,13 +13,13 @@ function testCompileLoadStore() { const builder = new WasmModuleBuilder(); // These functions generate statically out of bounds accesses. builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0x80, 0x80, 0x80, 1]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0x80, 0x80, 0x80, 1]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32StoreMem, 0, 0x80, 0x80, 0x80, 1, - kExprGetLocal, 1]) + kExprLocalGet, 1]) .exportFunc(); builder.addMemory(1, 1, false); const instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/liftoff.js b/deps/v8/test/mjsunit/wasm/liftoff.js index 51b30878d3..04eeffbea2 100644 --- a/deps/v8/test/mjsunit/wasm/liftoff.js +++ b/deps/v8/test/mjsunit/wasm/liftoff.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('i32_add', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); const module = new WebAssembly.Module(builder.toBuffer()); @@ -26,7 +26,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('i32_add', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); const instance = builder.instantiate(); @@ -38,7 +38,7 @@ async function testLiftoffAsync() { print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('i32_add', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); print('Compiling...'); diff --git a/deps/v8/test/mjsunit/wasm/loop-rotation.js b/deps/v8/test/mjsunit/wasm/loop-rotation.js index 92ad1f31c7..7805f5ccf5 100644 --- a/deps/v8/test/mjsunit/wasm/loop-rotation.js +++ b/deps/v8/test/mjsunit/wasm/loop-rotation.js @@ -12,10 +12,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_v_i) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprBrIf, 0, kExprEnd, ]) @@ -33,10 +33,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_v_i) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprBrIf, 1, kExprBr, 0, kExprEnd, @@ -56,10 +56,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_v_i) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprBrIf, 1, kExprI32Const, 0, kExprI32Const, 0, diff --git a/deps/v8/test/mjsunit/wasm/many-modules.js b/deps/v8/test/mjsunit/wasm/many-modules.js new file mode 100644 index 0000000000..66db04237a --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/many-modules.js @@ -0,0 +1,45 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// No reason to stress-opt this; save some time. +// Flags: --wasm-far-jump-table --no-stress-opt + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// We generate the module bytes once to make this test more efficient, +// especially on simulator builds. The bytes contain a sentinel which is later +// patched to different constants. This makes the modules distinct and forces +// the engine to create different code for them. + +// This is the sentinel placed in the bytes. It's a 5 byte LEB-encoded integer. +const sentinel = wasmSignedLeb(0x12345678); +assertEquals(5, sentinel.length); + +const builder = new WasmModuleBuilder(); +builder.addFunction('f', kSig_i_i).addBody([kExprI32Const, ...sentinel]); +const module_bytes = builder.toBuffer(); + +// Checks whether {module_bytes[i .. i+sentinel.length]} matches {sentinel}. +const has_sentinel = (i, k = 0) => module_bytes[i + k] == sentinel[k] && + (k == sentinel.length - 1 || has_sentinel(i, k + 1)); +// Now find the sentinel. +const find_sentinel = i => + module_bytes.slice(i).findIndex((e, i) => has_sentinel(i)); +const sentinel_position = find_sentinel(0); +assertTrue(has_sentinel(sentinel_position), 'found sentinel'); +assertEquals(-1, find_sentinel(sentinel_position + 1), 'exactly one sentinel'); + +// Generating {num_modules} modules should not run out of memory, since the code +// space needed per module is quite low. +const num_modules = 10000; +// Keep all generated modules alive. +const modules = []; +// Reset sentinel section to nops so that shorter LEBs will just be followed by +// nops. This resion will be patched in the loop with values of increasing size. +module_bytes.set(Array(sentinel.length).fill(_ => kExprNop), sentinel_position); +for (let i = 0; i < num_modules; ++i) { + if (i % 50 == 0) print(i); + module_bytes.set(wasmSignedLeb(i), sentinel_position); + modules.push(new WebAssembly.Module(module_bytes)); +} diff --git a/deps/v8/test/mjsunit/wasm/many-parameters.js b/deps/v8/test/mjsunit/wasm/many-parameters.js index 46b231943d..7813ad453c 100644 --- a/deps/v8/test/mjsunit/wasm/many-parameters.js +++ b/deps/v8/test/mjsunit/wasm/many-parameters.js @@ -37,7 +37,7 @@ types.forEach((type, type_idx) => { let body = []; for (let i = 0; i < num_params; ++i) - body.push(kExprGetLocal, (i + shift) % num_params); + body.push(kExprLocalGet, (i + shift) % num_params); for (let i = 0; i < num_const_params; ++i) body.push(...type_const[type_idx](num_params + i)); body.push(kExprCallFunction, 0); diff --git a/deps/v8/test/mjsunit/wasm/memory-external-call.js b/deps/v8/test/mjsunit/wasm/memory-external-call.js index 853cdf616a..1bb4bb1ecc 100644 --- a/deps/v8/test/mjsunit/wasm/memory-external-call.js +++ b/deps/v8/test/mjsunit/wasm/memory-external-call.js @@ -25,12 +25,12 @@ function generateBuilder(add_memory, import_sig) { // Add the memory if we expect a module builder with memory and load/store. builder.addMemory(initialMemoryPages, maximumMemoryPages, true); builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); } @@ -83,14 +83,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { builder.addMemory(kPages, kPages, true); builder.addFunction("store", kSig_v_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32StoreMem, 0, 0, // -- ]) // -- .exportFunc(); builder.addFunction("load", kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32LoadMem, 0, 0, // -- ]) // -- .exportFunc(); @@ -103,14 +103,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { builder.addMemory(kPages, kPages, true); builder.addFunction("store", kSig_v_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- ]) // -- .exportFunc(); builder.addFunction("load", kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32LoadMem, 0, 0, // -- ]) // -- .exportFunc(); @@ -152,7 +152,7 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { // Function to invoke the imported function and add 1 to the result. first_module.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, other_fn_idx, // call the imported function kExprI32Const, 1, // - kExprI32Add, // add 1 to the result @@ -185,7 +185,7 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { // Function to invoke the imported function and add 1 to the result. first_module.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, other_fn_idx, // call the imported function kExprI32Const, 1, // - kExprI32Add, // add 1 to the result @@ -221,14 +221,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { // Function to invoke the imported function and add 1 to the result. first_module.addFunction('sandwich', kSig_i_iii) .addBody([ - kExprGetLocal, 0, // param0 (index) - kExprGetLocal, 1, // param1 (first_value) + kExprLocalGet, 0, // param0 (index) + kExprLocalGet, 1, // param1 (first_value) kExprI32StoreMem, 0, 0, // store value in first_instance - kExprGetLocal, 0, // param0 (index) - kExprGetLocal, 2, // param2 (second_value) + kExprLocalGet, 0, // param0 (index) + kExprLocalGet, 2, // param2 (second_value) kExprCallFunction, other_fn_idx, // call the imported function kExprDrop, // drop the return value - kExprGetLocal, 0, // param0 (index) + kExprLocalGet, 0, // param0 (index) kExprI32LoadMem, 0, 0, // load from first_instance kExprReturn // - ]) @@ -263,14 +263,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { builder.addMemory(kPages, kPages, true); builder.addFunction("store", kSig_v_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32StoreMem, 0, 0, // -- ]) // -- .exportFunc(); builder.addFunction("load", kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32LoadMem, 0, 0, // -- ]) // -- .exportFunc(); @@ -308,9 +308,9 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { var sig_index = builder.addType(kSig_v_ii); builder.addFunction("store", kSig_v_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero, ]).exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/memory-instance-validation.js b/deps/v8/test/mjsunit/wasm/memory-instance-validation.js index ef65840532..a19b94b132 100644 --- a/deps/v8/test/mjsunit/wasm/memory-instance-validation.js +++ b/deps/v8/test/mjsunit/wasm/memory-instance-validation.js @@ -17,7 +17,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 5; i++) { diff --git a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js index f2b22d97ab..a365b419f9 100644 --- a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js +++ b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js @@ -40,14 +40,14 @@ const indexes = (() => { 0|((offset >>> 28) & m)]; builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js index 6baf0f3c7e..d5be98aa18 100644 --- a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js +++ b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js @@ -40,14 +40,14 @@ const indexes = (() => { 0|((offset >>> 28) & m)]; builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js index 39b9f95d9c..e9533b8d6c 100644 --- a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js +++ b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js @@ -38,14 +38,14 @@ const indexes = (() => { 0|((offset >>> 28) & m)]; builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js index 3dd580d269..0f870e7815 100644 --- a/deps/v8/test/mjsunit/wasm/module-memory.js +++ b/deps/v8/test/mjsunit/wasm/module-memory.js @@ -18,18 +18,18 @@ function genModule(memory) { // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc /**/ kExprLoop, kWasmStmt, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprIf, kWasmStmt, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprI32LoadMem, 0, 0, // -- /* */ kExprIf, kWasmStmt, // -- /* */ kExprI32Const, 127, // -- /* */ kExprReturn, // -- /* */ kExprEnd, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprI32Const, 4, // -- /* */ kExprI32Sub, // -- - /* */ kExprSetLocal, 0, // -- + /* */ kExprLocalSet, 0, // -- /* */ kExprBr, 1, // -- /* */ kExprEnd, // -- /* */ kExprEnd, // -- @@ -52,9 +52,7 @@ function testPokeMemory() { var array = new Int8Array(buffer); assertEquals(kMemSize, array.length); - for (var i = 0; i < kMemSize; i++) { - assertEquals(0, array[i]); - } + assertTrue(array.every((e => e === 0))); for (var i = 0; i < 10; i++) { assertEquals(0, main(kMemSize - 4)); @@ -99,9 +97,7 @@ function testPokeOuterMemory() { var array = new Int8Array(buffer.buffer); assertEquals(kMemSize, array.length); - for (var i = 0; i < kMemSize; i++) { - assertEquals(0, array[i]); - } + assertTrue(array.every((e => e === 0))); for (var i = 0; i < 10; i++) { assertEquals(0, main(kMemSize - 4)); @@ -139,33 +135,30 @@ function testOOBThrows() { builder.addMemory(1, 1, true); builder.addFunction("geti", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32LoadMem, 0, 0, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI32LoadMem, 0, 0, ]) .exportFunc(); var module = builder.instantiate(); - var offset; - function read() { return module.exports.geti(0, offset); } - function write() { return module.exports.geti(offset, 0); } + let read = offset => module.exports.geti(0, offset); + let write = offset => module.exports.geti(offset, 0); - for (offset = 0; offset < 65533; offset++) { - assertEquals(0, read()); - assertEquals(0, write()); - } + assertEquals(0, read(65532)); + assertEquals(0, write(65532)); // Note that this test might be run concurrently in multiple Isolates, which // makes an exact comparison of the expected trap count unreliable. But is is // still possible to check the lower bound for the expected trap count. - for (offset = 65534; offset < 66536; offset++) { + for (let offset = 65534; offset < 66536; offset++) { const trap_count = %GetWasmRecoveredTrapCount(); - assertTraps(kTrapMemOutOfBounds, read); - assertTraps(kTrapMemOutOfBounds, write); + assertTraps(kTrapMemOutOfBounds, () => read(offset)); + assertTraps(kTrapMemOutOfBounds, () => write(offset)); if (%IsWasmTrapHandlerEnabled()) { assertTrue(trap_count + 2 <= %GetWasmRecoveredTrapCount()); } diff --git a/deps/v8/test/mjsunit/wasm/multi-value.js b/deps/v8/test/mjsunit/wasm/multi-value.js index 31f9e8149b..e6a7ae99a5 100644 --- a/deps/v8/test/mjsunit/wasm/multi-value.js +++ b/deps/v8/test/mjsunit/wasm/multi-value.js @@ -15,8 +15,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ kExprBlock, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprEnd, kExprI32Add]) .exportAs("main"); @@ -33,8 +33,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprBlock, sig_i_ii, kExprI32Add, kExprEnd]) @@ -54,8 +54,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ kExprBlock, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprBr, 0, kExprEnd, kExprI32Add]) @@ -76,8 +76,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ kExprLoop, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprEnd, kExprI32Add]) .exportAs("main"); @@ -94,8 +94,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprLoop, sig_i_ii, kExprI32Add, kExprEnd]) @@ -114,13 +114,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let sig_ii_ii = builder.addType(kSig_ii_ii); builder.addFunction("dup", kSig_ii_i) - .addBody([kExprGetLocal, 0, kExprGetLocal, 0]); + .addBody([kExprLocalGet, 0, kExprLocalGet, 0]); builder.addFunction("swap", kSig_ii_ii) - .addBody([kExprGetLocal, 1, kExprGetLocal, 0]); + .addBody([kExprLocalGet, 1, kExprLocalGet, 0]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprLoop, sig_ii_ii, kExprCallFunction, 1, // swap kExprCallFunction, 0, // dup @@ -164,13 +164,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 1, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, kExprEnd, kExprI32Sub]) .exportAs("main"); @@ -188,9 +188,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, kExprIf, sig_i_ii, kExprI32Add, kExprElse, @@ -212,14 +212,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprBr, 0, kExprElse, - kExprGetLocal, 1, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, kExprBr, 0, kExprEnd, kExprI32Sub]) @@ -231,6 +231,27 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(instance.exports.main(0, 3), 3); })(); +(function MultiIfParamOneArmedTest() { + print("MultiIfParamOneArmedTest"); + let builder = new WasmModuleBuilder(); + let sig_i_i = builder.addType(kSig_i_i); + + builder.addFunction("main", kSig_i_i) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprIf, sig_i_i, + kExprI32Const, 5, + kExprI32Add, + kExprEnd]) + .exportAs("main"); + + let module = new WebAssembly.Module(builder.toBuffer()); + let instance = new WebAssembly.Instance(module); + assertEquals(instance.exports.main(0), 0); + assertEquals(instance.exports.main(1), 6); +})(); + (function MultiResultTest() { print("MultiResultTest"); let builder = new WasmModuleBuilder(); @@ -239,15 +260,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("callee", kSig_iii_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Sub]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprCallFunction, 0, kExprI32Mul, kExprI32Add]) @@ -272,14 +293,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("callee", kSig_ii_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Add, kExprReturn]); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0, kExprI32Mul]) .exportAs("main"); @@ -300,14 +321,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("callee", kSig_ii_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Add, kExprBr, 0]); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0, kExprI32Mul]) .exportAs("main"); @@ -320,26 +341,26 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(instance.exports.main(10), 200); })(); -(function MultiJSReturnTest() { +(function MultiWasmToJSReturnTest() { print(arguments.callee.name); let builder = new WasmModuleBuilder(); let sig_fi_if = makeSig([kWasmI32, kWasmF32], [kWasmF32, kWasmI32]); builder.addFunction("swap", sig_fi_if) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 0]) + kExprLocalGet, 1, + kExprLocalGet, 0]) .exportAs("swap"); builder.addFunction("addsubmul", kSig_iii_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Add, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Sub, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .exportAs("addsubmul"); @@ -350,3 +371,75 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(instance.exports.addsubmul(4), [8, 0, 16]); assertEquals(instance.exports.addsubmul(5), [10, 0, 25]); })(); + +(function MultiJSToWasmReturnTest() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + function swap(x, y) { return [y, x]; } + function swap_proxy(x, y) { + return new Proxy([y, x], { + get: function(obj, prop) { return Reflect.get(obj, prop); }, + }); + } + function proxy_throw(x, y) { + return new Proxy([y, x], { + get: function(obj, prop) { + if (prop == 1) { + throw new Error("abc"); + } + return Reflect.get(obj, prop); }, + }); + } + function drop_first(x, y) { + return [y]; + } + function repeat(x, y) { + return [x, y, x, y]; + } + function not_receiver(x, y) { + return 0; + } + function not_iterable(x, y) { + a = [x, y]; + a[Symbol.iterator] = undefined; + return a; + } + function* generator(x, y) { + yield x; + yield y; + } + function* generator_throw(x, y) { + yield x; + throw new Error("def"); + } + + builder.addImport('imports', 'f', kSig_ii_ii); + builder.addFunction("main", kSig_ii_ii) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprCallFunction, 0]) + .exportAs("main") + + let module = new WebAssembly.Module(builder.toBuffer()); + + var instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : swap } }); + assertEquals(instance.exports.main(1, 2), [2, 1]); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : swap_proxy } }); + assertEquals(instance.exports.main(1, 2), [2, 1]); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : generator } }); + assertEquals(instance.exports.main(1, 2), [1, 2]); + + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : drop_first } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, "multi-return length mismatch"); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : repeat } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, "multi-return length mismatch"); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : proxy_throw } }); + assertThrows(() => instance.exports.main(1, 2), Error, "abc"); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : not_receiver } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, /not iterable/); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : not_iterable } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, /not iterable/); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : generator_throw } }); + assertThrows(() => instance.exports.main(1, 2), Error, "def"); +})(); diff --git a/deps/v8/test/mjsunit/wasm/multiple-code-spaces.js b/deps/v8/test/mjsunit/wasm/multiple-code-spaces.js new file mode 100644 index 0000000000..f180cf6234 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/multiple-code-spaces.js @@ -0,0 +1,54 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --randomize-all-allocations +// Flags: --wasm-far-jump-table --wasm-max-initial-code-space-reservation=1 + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Instantiate bigger modules, until at least four separate code spaces have +// been allocated. +// Each function calls through many of the previous functions to execute the +// jump table(s) sufficiently. + +let num_functions = 50; +while (true) { + print(`Trying ${num_functions} functions...`); + if (num_functions > 1e6) { + throw new Error('We should have hit four code spaces by now'); + } + const builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction('f0', kSig_i_i).addBody([kExprLocalGet, 0]); + // Generate some code per function to fill the code space. + // Each function contains a number of loads that will not be executed + // (inside an "if (i == 0)" block). They increase the code size a bit so we + // do not need too many functions. + // Each function f<n> with argument {i} then calls f<n/10> with argument + // {i + 1} and returns whatever that function returns. + const body_template = [ + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, // if (i == 0) + kExprLocalGet, 0 // get i + ]; + for (let i = 0; i < 1000; ++i) body_template.push(kExprI32LoadMem, 0, 0); + body_template.push( + kExprDrop, kExprEnd, // end if + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, // i + 1 + kExprCallFunction // call f<?> + ); + for (let i = 1; i < num_functions; ++i) { + const body = body_template.slice(); + body.push(...wasmSignedLeb(Math.floor(i / 10))); + builder.addFunction('f' + i, kSig_i_i).addBody(body); + } + builder.addExport('f', num_functions - 1); + const instance = builder.instantiate(); + let expected = 17; + for (let i = num_functions - 1; i > 0; i = Math.floor(i / 10)) ++expected; + assertEquals(expected, instance.exports.f(17)); + const num_code_spaces = %WasmNumCodeSpaces(instance); + print(`--> ${num_code_spaces} code spaces.`); + if (num_code_spaces >= 4) break; + num_functions *= 2; +} diff --git a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js index b9ce6f7f94..eae8ceb58c 100644 --- a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js +++ b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js @@ -13,7 +13,7 @@ function instantiateModuleWithThreads() { builder.addMemory(2, 10, false, shared); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kAtomicPrefix, kExprI32AtomicAdd, 2, + kExprLocalGet, 0, kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd, 2, 0 ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/parallel_compilation.js b/deps/v8/test/mjsunit/wasm/parallel_compilation.js index 6eca124bc4..7a1da58e8f 100644 --- a/deps/v8/test/mjsunit/wasm/parallel_compilation.js +++ b/deps/v8/test/mjsunit/wasm/parallel_compilation.js @@ -50,7 +50,7 @@ function assertFunction(module, func) { for (i = 0; i < 1000; i++) { builder.addFunction("sub" + i, kSig_i_i) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Const, i % 61, // -- kExprI32Sub]) // -- .exportFunc() @@ -74,8 +74,8 @@ function assertFunction(module, func) { f[0] = builder.addFunction("add0", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add, // -- ]) .exportFunc() @@ -84,8 +84,8 @@ function assertFunction(module, func) { for (i = 1; i < 256; i++) { f[i] = builder.addFunction("add" + i, kSig_i_ii) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, f[i >>> 1].index]) // -- .exportFunc() } diff --git a/deps/v8/test/mjsunit/wasm/params.js b/deps/v8/test/mjsunit/wasm/params.js index 33858429c4..eed893fd57 100644 --- a/deps/v8/test/mjsunit/wasm/params.js +++ b/deps/v8/test/mjsunit/wasm/params.js @@ -17,7 +17,7 @@ function testSelect2(type) { var builder = new WasmModuleBuilder(); builder.addFunction("select", makeSig_r_xx(type, type)) - .addBody([kExprGetLocal, which]) + .addBody([kExprLocalGet, which]) .exportFunc() var select = builder.instantiate().exports.select; @@ -79,7 +79,7 @@ function testSelect10(t) { var builder = new WasmModuleBuilder(); builder.addFunction("select", makeSig([t,t,t,t,t,t,t,t,t,t], [t])) - .addBody([kExprGetLocal, which]) + .addBody([kExprLocalGet, which]) .exportFunc(); var select = builder.instantiate().exports.select; diff --git a/deps/v8/test/mjsunit/wasm/receiver.js b/deps/v8/test/mjsunit/wasm/receiver.js index 10e8855927..de8954ff98 100644 --- a/deps/v8/test/mjsunit/wasm/receiver.js +++ b/deps/v8/test/mjsunit/wasm/receiver.js @@ -13,8 +13,8 @@ function testCallImport(func, expected, a, b) { builder.addImport("mod", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0]) // -- .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/return-calls.js b/deps/v8/test/mjsunit/wasm/return-calls.js index 22d2860df1..7dd56ef02f 100644 --- a/deps/v8/test/mjsunit/wasm/return-calls.js +++ b/deps/v8/test/mjsunit/wasm/return-calls.js @@ -18,15 +18,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // f_aux(N,X) => f_aux(N-1,X*N) let fact_aux = builder.addFunction("fact_aux",kSig_i_ii); fact_aux.addBody([ - kExprGetLocal, 0, kExprI32Const, 1, kExprI32LeS, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32LeS, kExprIf, kWasmI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul, kExprReturnCall, fact_aux.index, kExprEnd @@ -35,7 +35,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); //main(N)=>fact_aux(N,1) let main = builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprReturnCall,0 ]).exportFunc(); @@ -63,18 +63,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let f_ind = builder.addFunction("f_ind",kSig_i_iii). addBody([ - kExprGetLocal, 0, kExprI32Const, 1, kExprI32LeS, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32LeS, kExprIf, kWasmI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul, - kExprGetLocal, 2, - kExprGetLocal, 2, + kExprLocalGet, 2, + kExprLocalGet, 2, kExprReturnCallIndirect, sig_i_iii, kTableZero, kExprEnd ]); @@ -82,7 +82,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); //main(N)=>fact_aux(N,1) let main = builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Const, f_ind.index, kExprReturnCall, f_ind.index @@ -109,9 +109,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let main = builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprReturnCall, pick ]) .exportFunc(); @@ -141,9 +141,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let main = builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprI32Const, tableIndex, kExprReturnCallIndirect, sig_i_iii, kTableZero ]) diff --git a/deps/v8/test/mjsunit/wasm/shared-arraybuffer-worker-simple-gc.js b/deps/v8/test/mjsunit/wasm/shared-arraybuffer-worker-simple-gc.js new file mode 100644 index 0000000000..a32e6f4d15 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/shared-arraybuffer-worker-simple-gc.js @@ -0,0 +1,84 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc + +const kNumIterations = 10; + +function NewWorker() { + let script = +`onmessage = (msg) => { + if (msg.memory) postMessage("ack"); + if (msg.quit) postMessage("bye"); + gc(); +}`; + return new Worker(script, {type: 'string'}); +} + +function PingWorker(worker, memory) { + worker.postMessage({memory: memory}); + assertEquals("ack", worker.getMessage()); + worker.postMessage({quit: true}); + assertEquals("bye", worker.getMessage()); +} + +function AllocMemory() { + return new SharedArrayBuffer(1024); +} + +function RunSingleWorkerSingleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerTwoMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(), second = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, second); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + gc(); + } + worker.terminate(); +} + +function RunMultipleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + let worker = NewWorker(); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + worker.terminate(); + gc(); + } +} + +RunSingleWorkerSingleMemoryTest(); +RunSingleWorkerTwoMemoryTest(); +RunSingleWorkerMultipleMemoryTest(); +RunMultipleWorkerMultipleMemoryTest(); diff --git a/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js b/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js index 8721d8d066..1dbbcb9ff6 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js @@ -10,11 +10,11 @@ function AllocMemory(pages, max = pages) { } function RunSomeAllocs(total, retained, pages, max = pages) { - print(`-------iterations = ${total}, retained = $ { retained } -------`); + print(`-------iterations = ${total}, retained = ${retained} -------`); var array = new Array(retained); for (var i = 0; i < total; i++) { if ((i % 25) == 0) - print(`iteration $ { i }`); + print(`iteration ${i}`); let pair = AllocMemory(pages, max); // For some iterations, retain the memory, view, or both. switch (i % 3) { diff --git a/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js b/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js index 376917b6ee..6afc6115f8 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --experimental-wasm-threads +// Flags: --experimental-wasm-threads --expose-gc -const kNumMessages = 5000; +const kNumMessages = 1000; function AllocMemory(pages = 1, max = pages) { return new WebAssembly.Memory({initial : pages, maximum : max, shared : true}); @@ -15,6 +15,7 @@ function AllocMemory(pages = 1, max = pages) { `onmessage = function(msg) { if (msg.memory) postMessage({memory : msg.memory}); + gc(); }`, {type : 'string'}); let time = performance.now(); @@ -30,5 +31,6 @@ function AllocMemory(pages = 1, max = pages) { if (msg.memory) { assertInstanceof(msg.memory, WebAssembly.Memory); } + gc(); } })(); diff --git a/deps/v8/test/mjsunit/wasm/shared-memory-worker-simple-gc.js b/deps/v8/test/mjsunit/wasm/shared-memory-worker-simple-gc.js new file mode 100644 index 0000000000..53229861cc --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/shared-memory-worker-simple-gc.js @@ -0,0 +1,85 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-threads --expose-gc + +const kNumIterations = 10; + +function NewWorker() { + let script = +`onmessage = (msg) => { + if (msg.memory) postMessage("ack"); + if (msg.quit) postMessage("bye"); + gc(); +}`; + return new Worker(script, {type: 'string'}); +} + +function PingWorker(worker, memory) { + worker.postMessage({memory: memory}); + assertEquals("ack", worker.getMessage()); + worker.postMessage({quit: true}); + assertEquals("bye", worker.getMessage()); +} + +function AllocMemory() { + let pages = 1, max = 1; + return new WebAssembly.Memory({initial : pages, maximum : max, shared : true}); +} + +function RunSingleWorkerSingleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerTwoMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(), second = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, second); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + gc(); + } + worker.terminate(); +} + +function RunMultipleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + let worker = NewWorker(); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + worker.terminate(); + gc(); + } +} + +RunSingleWorkerSingleMemoryTest(); +RunSingleWorkerTwoMemoryTest(); +RunSingleWorkerMultipleMemoryTest(); +RunMultipleWorkerMultipleMemoryTest(); diff --git a/deps/v8/test/mjsunit/wasm/shared-memory.js b/deps/v8/test/mjsunit/wasm/shared-memory.js index 80e894b28f..696b0412ae 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory.js @@ -73,8 +73,8 @@ function assertMemoryIsValid(memory, shared) { let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd]); builder.addImportedMemory("m", "imported_mem"); @@ -119,8 +119,8 @@ function assertMemoryIsValid(memory, shared) { builder.addMemory(2, 10, false, "shared"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd, 2, 0]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/stackwalk.js b/deps/v8/test/mjsunit/wasm/stackwalk.js index 91951ff4c3..e1cd6522ec 100644 --- a/deps/v8/test/mjsunit/wasm/stackwalk.js +++ b/deps/v8/test/mjsunit/wasm/stackwalk.js @@ -13,8 +13,8 @@ function makeFFI(func) { builder.addImport("mom", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- ]) .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/start-function.js b/deps/v8/test/mjsunit/wasm/start-function.js index e17c8f1785..bda9d085c5 100644 --- a/deps/v8/test/mjsunit/wasm/start-function.js +++ b/deps/v8/test/mjsunit/wasm/start-function.js @@ -29,9 +29,9 @@ function assertVerifies(sig, body) { assertVerifies(kSig_v_v, [kExprNop]); // Arguments aren't allowed to start functions. -assertThrows(() => {instantiate(kSig_i_i, [kExprGetLocal, 0]);}); -assertThrows(() => {instantiate(kSig_i_ii, [kExprGetLocal, 0]);}); -assertThrows(() => {instantiate(kSig_i_dd, [kExprGetLocal, 0]);}); +assertThrows(() => {instantiate(kSig_i_i, [kExprLocalGet, 0]);}); +assertThrows(() => {instantiate(kSig_i_ii, [kExprLocalGet, 0]);}); +assertThrows(() => {instantiate(kSig_i_dd, [kExprLocalGet, 0]);}); assertThrows(() => {instantiate(kSig_i_v, [kExprI32Const, 0]);}); (function testInvalidIndex() { diff --git a/deps/v8/test/mjsunit/wasm/streaming-api.js b/deps/v8/test/mjsunit/wasm/streaming-api.js index 3decc1a70c..01e6637b4d 100644 --- a/deps/v8/test/mjsunit/wasm/streaming-api.js +++ b/deps/v8/test/mjsunit/wasm/streaming-api.js @@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportAs("main"); let bytes = builder.toBuffer(); assertPromiseResult(WebAssembly.compileStreaming(Promise.resolve(bytes)).then( @@ -22,7 +22,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportAs("main"); let bytes = builder.toBuffer(); assertPromiseResult(WebAssembly.instantiateStreaming(Promise.resolve(bytes)).then( @@ -47,8 +47,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprF32Mul]) .exportAs("main"); let bytes = builder.toBuffer(); diff --git a/deps/v8/test/mjsunit/wasm/streaming-error-position.js b/deps/v8/test/mjsunit/wasm/streaming-error-position.js index b6d008cd13..77c1b46e85 100644 --- a/deps/v8/test/mjsunit/wasm/streaming-error-position.js +++ b/deps/v8/test/mjsunit/wasm/streaming-error-position.js @@ -303,11 +303,11 @@ function testErrorPosition(bytes, pos, test_name) { 1, // functions count 4, // body size 0, // locals count - kExprGetLocal, 0, // Access a non-existing local + kExprLocalGet, 0, // Access a non-existing local kExprEnd // -- ]); - // Find error at the index of kExprGetLocal. + // Find error at the index of kExprLocalGet. let pos = bytes.length - 1 - 1; testErrorPosition(bytes, pos, 'testInvalidCode'); })(); @@ -334,7 +334,7 @@ function testErrorPosition(bytes, pos, test_name) { 0, // section length (too big) ]); - // Find error at the index of kExprGetLocal. + // Find error at the index of kExprLocalGet. let pos = bytes.length - 1; testErrorPosition(bytes, pos, 'testCodeSectionSizeZero'); })(); diff --git a/deps/v8/test/mjsunit/wasm/table-access.js b/deps/v8/test/mjsunit/wasm/table-access.js index b91934d949..3e718cf06c 100644 --- a/deps/v8/test/mjsunit/wasm/table-access.js +++ b/deps/v8/test/mjsunit/wasm/table-access.js @@ -11,14 +11,14 @@ function addTableWithAccessors(builder, type, size, name) { const table = builder.addTable(type, size); const set_sig = makeSig([kWasmI32, type], []); builder.addFunction('set_' + name, set_sig) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprTableSet, table.index]) .exportFunc(); const get_sig = makeSig([kWasmI32], [type]); builder.addFunction('get_' + name, get_sig) - .addBody([kExprGetLocal, 0, kExprTableGet, table.index]) + .addBody([kExprLocalGet, 0, kExprTableGet, table.index]) .exportFunc(); } @@ -109,10 +109,10 @@ const dummy_func = exports.set_table_func1; const f2 = builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, value2]); const f3 = builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, value3]); builder.addFunction('get_t1', kSig_a_i) - .addBody([kExprGetLocal, 0, kExprTableGet, t1]) + .addBody([kExprLocalGet, 0, kExprTableGet, t1]) .exportFunc(); builder.addFunction('get_t2', kSig_a_i) - .addBody([kExprGetLocal, 0, kExprTableGet, t2]) + .addBody([kExprLocalGet, 0, kExprTableGet, t2]) .exportFunc(); const offset1 = 3; diff --git a/deps/v8/test/mjsunit/wasm/table-copy-anyref.js b/deps/v8/test/mjsunit/wasm/table-copy-anyref.js index d5cddb3ed6..8b2546a594 100644 --- a/deps/v8/test/mjsunit/wasm/table-copy-anyref.js +++ b/deps/v8/test/mjsunit/wasm/table-copy-anyref.js @@ -17,7 +17,7 @@ builder.addTable(kWasmAnyFunc, 1000); builder.addFunction('copy', kSig_v_iii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kNumericPrefix, + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kNumericPrefix, kExprTableCopy, kTableZero, kTableZero ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/table-copy.js b/deps/v8/test/mjsunit/wasm/table-copy.js index db0dc83191..ead06f4f23 100644 --- a/deps/v8/test/mjsunit/wasm/table-copy.js +++ b/deps/v8/test/mjsunit/wasm/table-copy.js @@ -38,7 +38,7 @@ function assertCall(call, ...elems) { for (let i = 0; i < kTableSize; i++) { let f = builder.addFunction("", kSig_i_v) .addBody([ - kExprGetGlobal, g, + kExprGlobalGet, g, ...wasmI32Const(i), kExprI32Add ]); @@ -47,15 +47,15 @@ function assertCall(call, ...elems) { builder.addFunction("copy", sig_v_iii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kNumericPrefix, kExprTableCopy, kTableZero, kTableZero]) .exportAs("copy"); builder.addFunction("call", sig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_i_v, kTableZero]) .exportAs("call"); diff --git a/deps/v8/test/mjsunit/wasm/table-fill.js b/deps/v8/test/mjsunit/wasm/table-fill.js index ed5938f908..64c4d7732d 100644 --- a/deps/v8/test/mjsunit/wasm/table-fill.js +++ b/deps/v8/test/mjsunit/wasm/table-fill.js @@ -32,13 +32,13 @@ const internal_func = builder.addTable(kWasmAnyFunc, size, maximum).index; for (index of [import_ref, internal_ref]) { builder.addFunction(`fill${index}`, kSig_v_iri) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kNumericPrefix, + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kNumericPrefix, kExprTableFill, index ]) .exportFunc(); builder.addFunction(`get${index}`, kSig_r_i) - .addBody([kExprGetLocal, 0, kExprTableGet, index]) + .addBody([kExprLocalGet, 0, kExprTableGet, index]) .exportFunc(); } @@ -47,13 +47,13 @@ const sig_index = builder.addType(kSig_i_v); for (index of [import_func, internal_func]) { builder.addFunction(`fill${index}`, kSig_v_iai) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kNumericPrefix, + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kNumericPrefix, kExprTableFill, index ]) .exportFunc(); builder.addFunction(`call${index}`, kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig_index, index]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig_index, index]) .exportFunc(); } diff --git a/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js b/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js index 5b37af32c2..8018407348 100644 --- a/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js +++ b/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js @@ -28,8 +28,8 @@ function testGrowInternalAnyRefTable(table_index) { builder.addTable(kWasmAnyRef, initial_size).index; } builder.addFunction('grow', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, table_index]) .exportFunc(); @@ -38,7 +38,7 @@ function testGrowInternalAnyRefTable(table_index) { .exportFunc(); builder.addFunction('get', kSig_r_i) - .addBody([kExprGetLocal, 0, kExprTableGet, table_index]) + .addBody([kExprLocalGet, 0, kExprTableGet, table_index]) .exportFunc(); const instance = builder.instantiate(); @@ -75,8 +75,8 @@ function testGrowInternalAnyFuncTable(table_index) { builder.addTable(kWasmAnyFunc, size).index; } builder.addFunction('grow', kSig_i_ai) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, table_index]) .exportFunc(); @@ -86,7 +86,7 @@ function testGrowInternalAnyFuncTable(table_index) { const sig_index = builder.addType(kSig_i_v); builder.addFunction('call', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig_index, table_index]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index]) .exportFunc(); const instance = builder.instantiate(); @@ -118,8 +118,8 @@ testGrowInternalAnyFuncTable(9); const builder = new WasmModuleBuilder(); const table_index = builder.addImportedTable("imp", "table", size, undefined, kWasmAnyRef); builder.addFunction('grow', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, table_index]) .exportFunc(); @@ -164,26 +164,26 @@ testGrowInternalAnyFuncTable(9); const internal_func = builder.addTable(kWasmAnyFunc, initial, maximum).index; builder.addFunction('grow_imported_ref', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, import_ref]) .exportFunc(); builder.addFunction('grow_imported_func', kSig_i_ai) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, import_func]) .exportFunc(); builder.addFunction('grow_internal_ref', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, internal_ref]) .exportFunc(); builder.addFunction('grow_internal_func', kSig_i_ai) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, internal_func]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/table-grow.js b/deps/v8/test/mjsunit/wasm/table-grow.js index a8508b4bdd..d2b7970bfa 100644 --- a/deps/v8/test/mjsunit/wasm/table-grow.js +++ b/deps/v8/test/mjsunit/wasm/table-grow.js @@ -10,20 +10,20 @@ function addFunctions(builder) { let sig_index = builder.addType(kSig_i_ii); let mul = builder.addFunction("mul", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Mul // -- ]); let add = builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); let sub = builder.addFunction("sub", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub // -- ]); return {mul: mul, add: add, sub: sub}; @@ -45,7 +45,7 @@ function addMain(builder) { builder.addFunction("main", kSig_i_i) .addBody([ kExprI32Const, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero]) .exportAs("main"); } @@ -53,7 +53,7 @@ function addMain(builder) { let id = (() => { // identity exported function let builder = new WasmModuleBuilder(); builder.addFunction("id", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportAs("id"); let module = new WebAssembly.Module(builder.toBuffer()); return (new WebAssembly.Instance(builder.toModule())).exports.id; @@ -125,8 +125,8 @@ let id = (() => { // identity exported function builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 15, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -254,14 +254,14 @@ let id = (() => { // identity exported function builder.addImportedTable("x", "table", 1, kMaxTableSize); builder.addFunction("add", index_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Add]); builder.addFunction("main", index_i_i) .addBody([ kExprI32Const, 5, kExprI32Const, 5, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, index_i_ii, kTableZero]) .exportAs("main"); builder.addElementSegment(0, 0, false, [0]); diff --git a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js index 96d3a0bac5..e43eaf7258 100644 --- a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js @@ -44,7 +44,7 @@ function instantiate(buffer, ffi) { let builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_i_i) .addLocals({i32_count: 1}) - .addBody([kExprGetLocal, 0, kExprSetLocal, 1, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalSet, 1, kExprLocalGet, 1]) .exportAs('main'); var buffer = builder.toBuffer(debug); @@ -67,7 +67,7 @@ function instantiate(buffer, ffi) { let builder = new WasmModuleBuilder(); builder.addFunction(undefined, makeSig_r_x(p.type, p.type)) .addLocals(p.locals) - .addBody([kExprGetLocal, 0, kExprSetLocal, 1, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalSet, 1, kExprLocalGet, 1]) .exportAs('main'); var buffer = builder.toBuffer(debug); @@ -81,10 +81,10 @@ function instantiate(buffer, ffi) { print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('add', kSig_i_ii).addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add ]); builder.addFunction('main', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprCallFunction, 0]) .exportAs('main'); var instance = builder.instantiate(); @@ -96,11 +96,11 @@ function instantiate(buffer, ffi) { print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('add', kSig_i_ii).addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add ]); builder.addFunction('main', kSig_i_iii) .addBody([ - kExprGetLocal, 1, kExprGetLocal, 2, kExprGetLocal, 0, kExprCallIndirect, + kExprLocalGet, 1, kExprLocalGet, 2, kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportAs('main'); @@ -117,7 +117,7 @@ function instantiate(buffer, ffi) { let builder = new WasmModuleBuilder(); builder.addMemory(1, 1, false); builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs('load'); builder.addDataSegment(0, [9, 9, 9, 9]); diff --git a/deps/v8/test/mjsunit/wasm/trap-location.js b/deps/v8/test/mjsunit/wasm/trap-location.js index d893f97d62..91cb0d0721 100644 --- a/deps/v8/test/mjsunit/wasm/trap-location.js +++ b/deps/v8/test/mjsunit/wasm/trap-location.js @@ -54,27 +54,27 @@ builder.addFunction("main", kSig_i_i) .addBody([ // offset 1 kExprBlock, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32LtU, kExprIf, kWasmStmt, // offset 9 kExprI32Const, 0x7e /* -2 */, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32DivU, // offset 15 kExprI32LoadMem, 0, 0, kExprBr, 1, kExprEnd, // offset 21 - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Eq, kExprIf, kWasmStmt, kExprUnreachable, kExprEnd, // offset 30 - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero, kExprEnd, ]) diff --git a/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js b/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js index b7a7ee7969..863a59aaa4 100644 --- a/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js +++ b/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js @@ -57,13 +57,13 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); table.set(0, f1); builder.addFunction('call0', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index0 ]) .exportFunc(); builder.addFunction('call1', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index1 ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/type-reflection-with-mv.js b/deps/v8/test/mjsunit/wasm/type-reflection-with-mv.js new file mode 100644 index 0000000000..0a7e98492f --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/type-reflection-with-mv.js @@ -0,0 +1,80 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-type-reflection --expose-gc --experimental-wasm-mv + +(function TestFunctionConstructedCoercions() { + let obj1 = { valueOf: _ => 123.45 }; + let obj2 = { toString: _ => "456" }; + let gcer = { valueOf: _ => gc() }; + let testcases = [ + { params: { sig: [], + val: [], + exp: [], }, + result: { sig: ["i32", "f32"], + val: [42.7, "xyz"], + exp: [42, NaN] }, + }, + { params: { sig: [], + val: [], + exp: [], }, + result: { sig: ["i32", "f32", "f64"], + val: (function* () { yield obj1; yield obj2; yield "789" })(), + exp: [123, 456, 789], }, + }, + { params: { sig: [], + val: [], + exp: [], }, + result: { sig: ["i32", "f32", "f64"], + val: new Proxy([gcer, {}, "xyz"], { + get: function(obj, prop) { return Reflect.get(obj, prop); } + }), + exp: [0, NaN, NaN], }, + }, + ]; + testcases.forEach(function({params, result}) { + let p = params.sig; let r = result.sig; var params_after; + function testFun() { params_after = arguments; return result.val; } + let fun = new WebAssembly.Function({parameters:p, results:r}, testFun); + let result_after = fun.apply(undefined, params.val); + assertArrayEquals(params.exp, params_after); + assertEquals(result.exp, result_after); + }); +})(); + +(function TestFunctionConstructedCoercionsThrow() { + let proxy_throw = new Proxy([1, 2], { + get: function(obj, prop) { + if (prop == 1) { + throw new Error("abc"); + } + return Reflect.get(obj, prop); }, + }); + function* generator_throw() { + yield 1; + throw new Error("def"); + } + let testcases = [ + { val: 0, + error: Error, + msg: /not iterable/ }, + { val: [1], + error: TypeError, + msg: /multi-return length mismatch/ }, + { val: [1, 2, 3], + error: TypeError, + msg: /multi-return length mismatch/ }, + { val: proxy_throw, + error: Error, + msg: /abc/ }, + { val: generator_throw(), + error: Error, + msg: /def/ }, + ]; + testcases.forEach(function({val, error, msg}) { + fun = new WebAssembly.Function({parameters:[], results:["i32", "i32"]}, + () => val); + assertThrows(fun, error, msg); + }) +})(); diff --git a/deps/v8/test/mjsunit/wasm/type-reflection.js b/deps/v8/test/mjsunit/wasm/type-reflection.js index a9a0b87143..bac877d187 100644 --- a/deps/v8/test/mjsunit/wasm/type-reflection.js +++ b/deps/v8/test/mjsunit/wasm/type-reflection.js @@ -533,7 +533,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); table.set(0, fun1); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index ]) .exportFunc(); @@ -554,7 +554,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); table.set(0, fun); builder.addFunction('main', kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index, kExprDrop ]) diff --git a/deps/v8/test/mjsunit/wasm/unicode.js b/deps/v8/test/mjsunit/wasm/unicode.js index 2b5f5ce9fe..73dc0608c6 100644 --- a/deps/v8/test/mjsunit/wasm/unicode.js +++ b/deps/v8/test/mjsunit/wasm/unicode.js @@ -9,7 +9,7 @@ function checkImport( var builder = new WasmModuleBuilder(); builder.addImport(imported_module_name, imported_function_name, kSig_i_i); builder.addFunction('call_imp', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); let imp = i => i + 3; @@ -29,10 +29,10 @@ function checkExports( exported_name_add) { var builder = new WasmModuleBuilder(); builder.addFunction(internal_name_mul, kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Mul]) .exportAs(exported_name_mul); builder.addFunction(internal_name_add, kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportAs(exported_name_add); let instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/user-properties-exported.js b/deps/v8/test/mjsunit/wasm/user-properties-exported.js index 80f2077f3c..0b2f249e05 100644 --- a/deps/v8/test/mjsunit/wasm/user-properties-exported.js +++ b/deps/v8/test/mjsunit/wasm/user-properties-exported.js @@ -13,7 +13,7 @@ load("test/mjsunit/wasm/user-properties-common.js"); var builder = new WasmModuleBuilder(); builder.addFunction("exp", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("exp"); let module1 = builder.toModule(); diff --git a/deps/v8/test/mjsunit/wasm/user-properties-module.js b/deps/v8/test/mjsunit/wasm/user-properties-module.js index 69a1f898d7..84727e1b53 100644 --- a/deps/v8/test/mjsunit/wasm/user-properties-module.js +++ b/deps/v8/test/mjsunit/wasm/user-properties-module.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/user-properties-common.js"); builder.addImport("m", "f", kSig_i_i); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("main"); builder.addMemory(1, 1, false) diff --git a/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js b/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js index 3b1a333c7f..3d9512cf85 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js +++ b/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js @@ -140,7 +140,7 @@ function genUnop(name, sig) { builder.addImport('Math', name, sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallFunction, 0 ]) // -- .exportAs('main'); @@ -155,8 +155,8 @@ function genBinop(name, sig) { builder.addImport('Math', name, sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 ]) // -- .exportAs('main'); diff --git a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js index 45af969d09..b4d7cae41b 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js @@ -84,6 +84,7 @@ let kSharedHasMaximumFlag = 3; let kActiveNoIndex = 0; let kPassive = 1; let kActiveWithIndex = 2; +let kPassiveWithElements = 5; // Function declaration flags let kDeclFunctionName = 0x01; @@ -209,11 +210,11 @@ let kExprReturnCall = 0x12; let kExprReturnCallIndirect = 0x13; let kExprDrop = 0x1a; let kExprSelect = 0x1b; -let kExprGetLocal = 0x20; -let kExprSetLocal = 0x21; -let kExprTeeLocal = 0x22; -let kExprGetGlobal = 0x23; -let kExprSetGlobal = 0x24; +let kExprLocalGet = 0x20; +let kExprLocalSet = 0x21; +let kExprLocalTee = 0x22; +let kExprGlobalGet = 0x23; +let kExprGlobalSet = 0x24; let kExprTableGet = 0x25; let kExprTableSet = 0x26; let kExprI32LoadMem = 0x28; @@ -464,6 +465,9 @@ let kExprI64AtomicCompareExchange16U = 0x4d; let kExprI64AtomicCompareExchange32U = 0x4e; // Simd opcodes. +let kExprS128LoadMem = 0x00; +let kExprS128StoreMem = 0x01; +let kExprI32x4Splat = 0x0c; let kExprF32x4Min = 0x9e; // Compilation hint constants. @@ -1093,7 +1097,7 @@ class WasmModuleBuilder { } } else { // Emit a global-index initializer. - section.emit_u8(kExprGetGlobal); + section.emit_u8(kExprGlobalGet); section.emit_u32v(global.init_index); } section.emit_u8(kExprEnd); // end of init expression @@ -1158,19 +1162,22 @@ class WasmModuleBuilder { section.emit_u32v(init.table); } if (init.is_global) { - section.emit_u8(kExprGetGlobal); + section.emit_u8(kExprGlobalGet); } else { section.emit_u8(kExprI32Const); } section.emit_u32v(init.base); section.emit_u8(kExprEnd); + if (init.table != 0) { + section.emit_u8(kExternalFunction); + } section.emit_u32v(init.array.length); for (let index of init.array) { section.emit_u32v(index); } } else { // Passive segment. - section.emit_u8(kPassive); // flags + section.emit_u8(kPassiveWithElements); // flags section.emit_u8(kWasmAnyFunc); section.emit_u32v(init.array.length); for (let index of init.array) { @@ -1290,7 +1297,7 @@ class WasmModuleBuilder { section.emit_u8(0); // linear memory index 0 / flags if (seg.is_global) { // initializer is a global variable - section.emit_u8(kExprGetGlobal); + section.emit_u8(kExprGlobalGet); section.emit_u32v(seg.addr); } else { // initializer is a constant diff --git a/deps/v8/test/mjsunit/wasm/worker-interpreter.js b/deps/v8/test/mjsunit/wasm/worker-interpreter.js index ccf6d279a0..9a7ab60756 100644 --- a/deps/v8/test/mjsunit/wasm/worker-interpreter.js +++ b/deps/v8/test/mjsunit/wasm/worker-interpreter.js @@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); (function TestPostInterpretedModule() { let builder = new WasmModuleBuilder(); let add = builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); let module = builder.toModule(); diff --git a/deps/v8/test/mjsunit/wasm/worker-module.js b/deps/v8/test/mjsunit/wasm/worker-module.js index f626263b25..76d84daaba 100644 --- a/deps/v8/test/mjsunit/wasm/worker-module.js +++ b/deps/v8/test/mjsunit/wasm/worker-module.js @@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); (function TestPostModule() { let builder = new WasmModuleBuilder(); builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); let module = builder.toModule(); diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.cc b/deps/v8/test/mkgrokdump/mkgrokdump.cc index 8c07576d3a..5f39a063e4 100644 --- a/deps/v8/test/mkgrokdump/mkgrokdump.cc +++ b/deps/v8/test/mkgrokdump/mkgrokdump.cc @@ -26,10 +26,9 @@ static const char* kHeader = "\n" "# List of known V8 instance types.\n"; -// Non-snapshot builds allocate objects to different places. // Debug builds emit debug code, affecting code object sizes. // Embedded builtins cause objects to be allocated in different locations. -#if defined(V8_EMBEDDED_BUILTINS) && defined(V8_USE_SNAPSHOT) && !defined(DEBUG) +#if defined(V8_EMBEDDED_BUILTINS) && !defined(DEBUG) static const char* kBuild = "shipping"; #else static const char* kBuild = "non-shipping"; @@ -97,6 +96,14 @@ static void DumpKnownObject(FILE* out, i::Heap* heap, const char* space_name, #undef RO_ROOT_LIST_CASE } +static void DumpSpaceFirstPageAddress(FILE* out, i::PagedSpace* space) { + const char* name = space->name(); + i::Address first_page = reinterpret_cast<i::Address>(space->first_page()); + i::Tagged_t compressed = i::CompressTagged(first_page); + uintptr_t unsigned_compressed = static_cast<uint32_t>(compressed); + i::PrintF(out, " 0x%08" V8PRIxPTR ": \"%s\",\n", unsigned_compressed, name); +} + static int DumpHeapConstants(FILE* out, const char* argv0) { // Start up V8. std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform(); @@ -164,6 +171,29 @@ static int DumpHeapConstants(FILE* out, const char* argv0) { i::PrintF(out, "}\n"); } + if (COMPRESS_POINTERS_BOOL) { + // Dump a list of addresses for the first page of each space that contains + // objects in the other tables above. This is only useful if two + // assumptions hold: + // 1. Those pages are positioned deterministically within the heap + // reservation block during snapshot deserialization. + // 2. Those pages cannot ever be moved (such as by compaction). + i::PrintF(out, + "\n# Lower 32 bits of first page addresses for various heap " + "spaces.\n"); + i::PrintF(out, "HEAP_FIRST_PAGES = {\n"); + i::PagedSpaceIterator it(heap); + for (i::PagedSpace* s = it.Next(); s != nullptr; s = it.Next()) { + // Code page is different on Windows vs Linux (bug v8:9844), so skip it. + if (s->identity() == i::CODE_SPACE) { + continue; + } + DumpSpaceFirstPageAddress(out, s); + } + DumpSpaceFirstPageAddress(out, read_only_heap->read_only_space()); + i::PrintF(out, "}\n"); + } + // Dump frame markers i::PrintF(out, "\n# List of known V8 Frame Markers.\n"); #define DUMP_MARKER(T, class) i::PrintF(out, " \"%s\",\n", #T); diff --git a/deps/v8/test/mozilla/mozilla.status b/deps/v8/test/mozilla/mozilla.status index 5a1c89ac9e..78630381f9 100644 --- a/deps/v8/test/mozilla/mozilla.status +++ b/deps/v8/test/mozilla/mozilla.status @@ -1011,6 +1011,8 @@ #BUG(3837): Crashes due to C stack overflow. 'js1_5/extensions/regress-355497': [SKIP], + # Slow test + 'js1_5/Regress/regress-80981': [PASS, SLOW], }], # 'arch == arm and simulator_run' ['arch == arm64 and simulator_run', { @@ -1035,6 +1037,9 @@ #BUG(3152): Avoid C stack overflow. 'js1_5/extensions/regress-355497': [FAIL_OK, '--sim-stack-size=512'], + + # Slow without pointer compression + 'js1_5/Regress/regress-80981': [PASS, ['not pointer_compression', SLOW]], }], # 'arch == arm64 and simulator_run' ['system == android', { diff --git a/deps/v8/test/test262/OWNERS b/deps/v8/test/test262/OWNERS index 246672d0ff..56c71e23b1 100644 --- a/deps/v8/test/test262/OWNERS +++ b/deps/v8/test/test262/OWNERS @@ -1,2 +1,3 @@ adamk@chromium.org gsathya@chromium.org +syg@chromium.org diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status index 7ccb304a0b..3f82c49d1e 100644 --- a/deps/v8/test/test262/test262.status +++ b/deps/v8/test/test262/test262.status @@ -65,7 +65,13 @@ # Intl tests which require flags. # https://bugs.chromium.org/p/v8/issues/detail?id=9154 'intl402/NumberFormat/numbering-system-options': ['--harmony-intl-add-calendar-numbering-system'], + 'intl402/DateTimeFormat/constructor-calendar-numberingSystem-order': ['--harmony-intl-add-calendar-numbering-system'], 'intl402/DateTimeFormat/numbering-system-calendar-options': ['--harmony-intl-add-calendar-numbering-system'], + 'intl402/DateTimeFormat/constructor-options-throwing-getters': ['--harmony-intl-add-calendar-numbering-system'], + 'intl402/NumberFormat/constructor-options-throwing-getters': ['--harmony-intl-add-calendar-numbering-system'], + 'intl402/NumberFormat/constructor-numberingSystem-order': ['--harmony-intl-add-calendar-numbering-system'], + 'intl402/DateTimeFormat/prototype/formatToParts/pattern-on-calendar': ['--harmony-intl-other-calendars'], + 'intl402/DateTimeFormat/prototype/formatToParts/related-year': ['--harmony-intl-other-calendars'], # https://bugs.chromium.org/p/v8/issues/detail?id=9084 'intl402/supportedLocalesOf-consistent-with-resolvedOptions': [FAIL], @@ -457,9 +463,6 @@ 'language/expressions/async-generator/generator-created-after-decl-inst': [FAIL], 'language/statements/async-generator/generator-created-after-decl-inst': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=9611 - 'language/statements/class/elements/private-field-is-visible-in-computed-properties': [SKIP], - # https://github.com/tc39/test262/issues/2034 'language/expressions/postfix-decrement/arguments': [SKIP], 'language/expressions/postfix-decrement/arguments-nostrict': [SKIP], @@ -484,23 +487,14 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=9049 'language/comments/hashbang/use-strict': [SKIP], - # https://bugs.chromium.org/p/v8/issues/detail?id=9229 - 'language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage': [FAIL], - 'language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage': [FAIL], - 'language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression': [FAIL], - 'language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive': [FAIL], - 'language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage': [FAIL], - 'language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage': [FAIL], - 'language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression': [FAIL], - 'language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=8179 + # Temporarily removed pending https://github.com/tc39/test262/issues/2339 # # These tests require exception handling support which is currently # blocked on landing https://chromium-review.googlesource.com/c/v8/v8/+/1655655 'built-ins/FinalizationGroup/FinalizationGroupCleanupIteratorPrototype/next-job-not-active-throws': [FAIL], 'built-ins/FinalizationGroup/prototype/cleanupSome/poisoned-callback-throws': [FAIL], - 'built-ins/FinalizationGroup/prototype/cleanupSome/poisoned-cleanup-callback-throws': [FAIL], + # 'built-ins/FinalizationGroup/prototype/cleanupSome/poisoned-cleanup-callback-throws': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=8179 # @@ -510,23 +504,28 @@ 'built-ins/FinalizationGroup/prototype/register/return-undefined-register-itself': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=8179 + # Temporarily removed pending https://github.com/tc39/test262/issues/2339 # # This test has target === holdings which throws, changing holdings to # { y } makes the test pass. - 'built-ins/FinalizationGroup/prototype/cleanupSome/cleanup-prevented-with-reference': [FAIL], + # 'built-ins/FinalizationGroup/prototype/cleanupSome/cleanup-prevented-with-reference': [FAIL], # https://github.com/tc39/test262/issues/2256 - 'built-ins/FinalizationGroup/prototype/cleanupSome/cleanup-prevented-with-unregister': [FAIL], + # Temporarily removed pending https://github.com/tc39/test262/issues/2339 + # 'built-ins/FinalizationGroup/prototype/cleanupSome/cleanup-prevented-with-unregister': [FAIL], # https://github.com/tc39/test262/issues/2239 - 'built-ins/WeakRef/prototype/deref/gc-cleanup-not-prevented-with-wr-deref': [FAIL], - 'built-ins/FinalizationGroup/prototype/cleanupSome/gc-cleanup-not-prevented-with-wr-deref': [FAIL], + # Temporarily removed pending https://github.com/tc39/test262/issues/2339 + # 'built-ins/WeakRef/prototype/deref/gc-cleanup-not-prevented-with-wr-deref': [FAIL], + # 'built-ins/FinalizationGroup/prototype/cleanupSome/gc-cleanup-not-prevented-with-wr-deref': [FAIL], # https://github.com/tc39/test262/issues/2255 - 'built-ins/FinalizationGroup/prototype/cleanupSome/iterator-holdings-multiple-values': [FAIL], + # Temporarily removed pending https://github.com/tc39/test262/issues/2339 + # 'built-ins/FinalizationGroup/prototype/cleanupSome/iterator-holdings-multiple-values': [FAIL], # https://github.com/tc39/test262/issues/2260 - 'built-ins/FinalizationGroup/prototype/cleanupSome/return-undefined-with-gc': [FAIL], + # Temporarily removed pending https://github.com/tc39/test262/issues/2339 + # 'built-ins/FinalizationGroup/prototype/cleanupSome/return-undefined-with-gc': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=9612 'intl402/DateTimeFormat/prototype/formatRange/fractionalSecondDigits': [FAIL], @@ -534,267 +533,30 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=9613 'intl402/Intl/getCanonicalLocales/canonicalized-tags': [FAIL], 'intl402/Intl/getCanonicalLocales/grandfathered': [FAIL], - 'intl402/Intl/getCanonicalLocales/invalid-tags': [FAIL], 'intl402/Intl/getCanonicalLocales/non-iana-canon': [FAIL], 'intl402/Intl/getCanonicalLocales/preferred-grandfathered': [FAIL], 'intl402/Intl/getCanonicalLocales/preferred-variant': [FAIL], - 'intl402/language-tags-invalid': [FAIL], - 'intl402/ListFormat/constructor/constructor/locales-valid': [FAIL], 'intl402/Locale/constructor-non-iana-canon': [FAIL], + 'intl402/Locale/likely-subtags-grandfathered': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=9742 + 'intl402/Locale/getters': [FAIL], + + # https://github.com/tc39/test262/pull/2349 'intl402/Locale/constructor-options-region-valid': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=9741 'intl402/Locale/constructor-tag': [FAIL], - 'intl402/Locale/getters': [FAIL], - 'intl402/Locale/likely-subtags-grandfathered': [FAIL], - 'intl402/PluralRules/prototype/resolvedOptions/order': [FAIL], - 'intl402/RelativeTimeFormat/constructor/constructor/locales-valid': [FAIL], - 'intl402/Segmenter/constructor/constructor/locales-valid': [FAIL], - - # https://bugs.chromium.org/p/v8/issues/detail?id=9647 - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-break-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-case-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-catch-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-class-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-const-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-continue-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-debugger-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped-ext': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-delete-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-do-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-else-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-enum-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-export-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped-ext': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-finally-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-for-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-function-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-if-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-import-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-in-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-instanceof-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-new-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-return-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-super-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-switch-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-this-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-throw-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-try-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-typeof-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-var-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-void-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-while-escaped': [FAIL], - 'language/expressions/assignment/dstr/ident-name-prop-name-literal-with-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-break-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-case-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-catch-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-class-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-const-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-continue-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-debugger-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-default-escaped-ext': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-default-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-delete-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-do-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-else-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-enum-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-export-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-extends-escaped-ext': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-extends-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-finally-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-for-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-function-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-if-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-import-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-in-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-instanceof-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-new-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-return-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-super-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-switch-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-this-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-throw-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-try-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-typeof-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-var-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-void-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-while-escaped': [FAIL], - 'language/expressions/assignment/member-expr-ident-name-with-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-break-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-case-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-catch-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-class-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-const-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-continue-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-debugger-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-default-escaped-ext': [FAIL], - 'language/expressions/class/ident-name-method-def-default-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-delete-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-do-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-else-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-enum-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-export-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-extends-escaped-ext': [FAIL], - 'language/expressions/class/ident-name-method-def-extends-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-finally-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-for-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-function-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-if-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-import-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-in-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-instanceof-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-new-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-return-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-super-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-switch-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-this-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-throw-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-try-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-typeof-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-var-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-void-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-while-escaped': [FAIL], - 'language/expressions/class/ident-name-method-def-with-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-break-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-case-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-catch-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-class-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-const-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-continue-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-debugger-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-default-escaped-ext': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-default-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-delete-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-do-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-else-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-enum-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-export-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped-ext': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-finally-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-for-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-function-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-if-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-import-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-in-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-instanceof-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-new-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-return-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-super-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-switch-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-this-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-throw-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-try-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-typeof-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-var-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-void-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-while-escaped': [FAIL], - 'language/expressions/object/covered-ident-name-prop-name-literal-with-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-break-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-case-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-catch-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-class-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-const-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-continue-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-debugger-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-default-escaped-ext': [FAIL], - 'language/expressions/object/ident-name-method-def-default-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-delete-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-do-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-else-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-enum-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-export-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-extends-escaped-ext': [FAIL], - 'language/expressions/object/ident-name-method-def-extends-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-finally-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-for-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-function-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-if-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-import-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-in-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-instanceof-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-new-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-return-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-super-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-switch-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-this-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-throw-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-try-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-typeof-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-var-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-void-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-while-escaped': [FAIL], - 'language/expressions/object/ident-name-method-def-with-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-break-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-case-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-catch-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-class-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-const-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-continue-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-debugger-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-default-escaped-ext': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-default-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-delete-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-do-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-else-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-enum-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-export-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-extends-escaped-ext': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-extends-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-finally-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-for-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-function-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-if-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-import-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-in-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-instanceof-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-new-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-return-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-super-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-switch-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-this-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-throw-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-try-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-typeof-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-var-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-void-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-while-escaped': [FAIL], - 'language/expressions/object/ident-name-prop-name-literal-with-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-break-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-case-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-catch-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-class-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-const-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-continue-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-debugger-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-default-escaped-ext': [FAIL], - 'language/statements/class/ident-name-method-def-default-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-delete-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-do-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-else-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-enum-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-export-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-extends-escaped-ext': [FAIL], - 'language/statements/class/ident-name-method-def-extends-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-finally-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-for-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-function-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-if-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-import-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-in-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-instanceof-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-new-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-return-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-super-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-switch-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-this-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-throw-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-try-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-typeof-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-var-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-void-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-while-escaped': [FAIL], - 'language/statements/class/ident-name-method-def-with-escaped': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=9800 + 'built-ins/String/prototype/matchAll/flags-undefined-throws': [FAIL], + 'built-ins/String/prototype/matchAll/flags-nonglobal-throws': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=9818 + 'built-ins/AsyncFunction/proto-from-ctor-realm': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=9819 + 'built-ins/Array/prototype/flatMap/array-like-objects-nested': [FAIL], ######################## NEEDS INVESTIGATION ########################### @@ -892,9 +654,10 @@ 'intl402/String/prototype/toLocaleUpperCase/special_casing_Lithuanian': [FAIL], 'intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish': [FAIL], - # Unicode property escapes unavailable without i18n + # Unicode features unavaible without i18n, ie property escapes. 'built-ins/RegExp/property-escapes/*': [SKIP], 'built-ins/RegExp/named-groups/unicode-property-names': [SKIP], + 'built-ins/RegExp/match-indices/indices-array-unicode-property-names': [SKIP], }], # no_i18n == True ['arch == arm or arch == mipsel or arch == mips or arch == arm64 or arch == mips64 or arch == mips64el', { @@ -920,528 +683,6 @@ 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type': [SKIP], }], -['asan == True', { - # BUG(v8:4653): Test262 tests which rely on quit() are not compatible with - # asan's --omit-quit flag. - 'built-ins/Promise/prototype/then/deferred-is-resolved-value': [SKIP], - 'language/expressions/dynamic-import/always-create-new-promise': [SKIP], - 'language/expressions/dynamic-import/assign-expr-get-value-abrupt-throws': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/additive-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/array-literal': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/arrow-function': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/await-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/await-identifier': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/call-expr-arguments': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/call-expr-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/call-expr-identifier': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/cover-call-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/identifier': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/import-meta': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/logical-and-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/logical-or-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/member-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/new-target': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/object-literal': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/tagged-function-call': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/ternary': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/this': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/unary-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/yield-assign-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/yield-expr': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/yield-identifier': [SKIP], - 'language/expressions/dynamic-import/assignment-expression/yield-star': [SKIP], - 'language/expressions/dynamic-import/await-import-evaluation': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-await-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-return-await-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-function-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-await-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-block-labeled-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-do-while-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-else-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-function-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-if-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/nested-while-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-file-does-not-exist': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular': [SKIP], - 'language/expressions/dynamic-import/catch/top-level-import-catch-specifier-tostring-abrupt-rejects': [SKIP], - 'language/expressions/dynamic-import/custom-primitive': [SKIP], - 'language/expressions/dynamic-import/escape-sequence-import': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-cls-anon': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-cls-named': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-cls-name-meth': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-cls-named': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-fn-named': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-gen-named': [SKIP], - 'language/expressions/dynamic-import/eval-export-dflt-expr-in': [SKIP], - 'language/expressions/dynamic-import/eval-rqstd-once': [SKIP], - 'language/expressions/dynamic-import/eval-self-once-module': [SKIP], - 'language/expressions/dynamic-import/eval-self-once-script': [SKIP], - 'language/expressions/dynamic-import/for-await-resolution-and-error-agen': [SKIP], - 'language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield': [SKIP], - 'language/expressions/dynamic-import/for-await-resolution-and-error': [SKIP], - 'language/expressions/dynamic-import/imported-self-update': [SKIP], - 'language/expressions/dynamic-import/indirect-resolution': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-define-own-property': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-extensible': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-str-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-str-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-sym-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-no-iterator': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-prop-descs': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-prototype': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-set-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-set-prototype-of': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-set-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag': [SKIP], - 'language/expressions/dynamic-import/namespace/default-property-not-set-own': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-extensible': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-prototype': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-set-strict': [SKIP], - 'language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag': [SKIP], - 'language/expressions/dynamic-import/returns-promise': [SKIP], - 'language/expressions/dynamic-import/reuse-namespace-object': [SKIP], - 'language/expressions/dynamic-import/reuse-namespace-object-from-import': [SKIP], - 'language/expressions/dynamic-import/reuse-namespace-object-from-script': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-while-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-while-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/top-level-no-new-call-expression': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/top-level-no-rest-param': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-args': [SKIP], - 'language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-no-trailing-comma': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/callexpression-arguments': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/callexpression-templateliteral': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-arrow-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-arrow-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-await-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-function-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-block-labeled-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-block-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-block-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-do-while-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-do-while-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-else-braceless-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-else-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-else-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-function-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-function-return-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-function-return-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-function-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-if-braceless-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-if-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-if-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-while-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-while-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-with-expression-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-with-expression-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-with-expression-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-with-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/nested-with-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/new-covered-expression-is-valid': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/top-level-nested-imports': [SKIP], - 'language/expressions/dynamic-import/syntax/valid/top-level-script-code-valid': [SKIP], - 'language/expressions/dynamic-import/update-to-dynamic-import': [SKIP], - 'language/expressions/dynamic-import/usage-from-eval': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-do-while-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring': [SKIP], - 'language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], - 'language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update': [SKIP], - 'language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code': [SKIP], - 'language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets': [SKIP], - 'language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable': [SKIP], - 'language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring': [SKIP], -}], # asan == True - ['asan == True or msan == True or tsan == True', { # https://bugs.chromium.org/p/v8/issues/detail?id=4639 # The failed allocation causes an asan/msan/tsan error @@ -1451,6 +692,12 @@ 'built-ins/SharedArrayBuffer/length-is-too-large-throws': [SKIP], }], # asan == True or msan == True or tsan == True +['system == android', { + # Android Arm64 failures + # https://bugs.chromium.org/p/v8/issues/detail?id=9845 + 'intl402/DateTimeFormat/prototype/formatToParts/related-year': [FAIL], +}], # system == android + ############################################################################## ['variant == jitless', { # https://crbug.com/v8/7777 diff --git a/deps/v8/test/test262/testcfg.py b/deps/v8/test/test262/testcfg.py index 9aa91dfaef..d70e644d9b 100644 --- a/deps/v8/test/test262/testcfg.py +++ b/deps/v8/test/test262/testcfg.py @@ -44,26 +44,26 @@ from testrunner.outproc import test262 # TODO(littledan): move the flag mapping into the status file FEATURE_FLAGS = { - 'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style', - 'Intl.DateTimeFormat-formatRange': '--harmony-intl-date-format-range', - 'Intl.NumberFormat-unified': '--harmony-intl-numberformat-unified', 'Intl.Segmenter': '--harmony-intl-segmenter', 'Intl.DateTimeFormat-dayPeriod': '--harmony-intl-dateformat-day-period', 'Intl.DateTimeFormat-quarter': '--harmony-intl-dateformat-quarter', 'Intl.DateTimeFormat-fractionalSecondDigits': '--harmony-intl-dateformat-fractional-second-digits', 'Symbol.prototype.description': '--harmony-symbol-description', 'export-star-as-namespace-from-module': '--harmony-namespace-exports', - 'BigInt': '--harmony-intl-bigint', 'Promise.allSettled': '--harmony-promise-all-settled', 'FinalizationGroup': '--harmony-weak-refs', 'WeakRef': '--harmony-weak-refs', 'host-gc-required': '--expose-gc-as=v8GC', 'optional-chaining': '--harmony-optional-chaining', + 'top-level-await': '--harmony-top-level-await', + 'regexp-match-indices': '--harmony-regexp-match-indices', + # https://github.com/tc39/test262/pull/2395 + 'regexp-named-groups': '--harmony-regexp-match-indices', + 'class-methods-private': '--harmony-private-methods', + 'class-static-methods-private': '--harmony-private-methods', } -SKIPPED_FEATURES = set(['class-methods-private', - 'class-static-methods-private', - 'top-level-await']) +SKIPPED_FEATURES = set([]) DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") diff --git a/deps/v8/test/unittests/BUILD.gn b/deps/v8/test/unittests/BUILD.gn index 7a379f77e8..4ae76e1543 100644 --- a/deps/v8/test/unittests/BUILD.gn +++ b/deps/v8/test/unittests/BUILD.gn @@ -188,7 +188,9 @@ v8_source_set("unittests_sources") { "logging/counters-unittest.cc", "numbers/bigint-unittest.cc", "numbers/conversions-unittest.cc", + "objects/backing-store-unittest.cc", "objects/object-unittest.cc", + "objects/osr-optimized-code-cache-unittest.cc", "objects/value-serializer-unittest.cc", "parser/ast-value-unittest.cc", "parser/preparser-unittest.cc", diff --git a/deps/v8/test/unittests/api/isolate-unittest.cc b/deps/v8/test/unittests/api/isolate-unittest.cc index 8d1a5dd84f..cda251f775 100644 --- a/deps/v8/test/unittests/api/isolate-unittest.cc +++ b/deps/v8/test/unittests/api/isolate-unittest.cc @@ -9,7 +9,6 @@ #include "include/v8.h" #include "src/base/macros.h" #include "src/base/platform/semaphore.h" -#include "src/base/template-utils.h" #include "src/execution/execution.h" #include "src/execution/isolate.h" #include "src/init/v8.h" @@ -62,7 +61,7 @@ TEST_F(IsolateTest, MemoryPressureNotificationBackground) { base::Semaphore semaphore(0); internal::V8::GetCurrentPlatform()->CallOnWorkerThread( - base::make_unique<MemoryPressureTask>(isolate(), &semaphore)); + std::make_unique<MemoryPressureTask>(isolate(), &semaphore)); semaphore.Wait(); diff --git a/deps/v8/test/unittests/base/template-utils-unittest.cc b/deps/v8/test/unittests/base/template-utils-unittest.cc index 0819b3de8c..4b1f3b834b 100644 --- a/deps/v8/test/unittests/base/template-utils-unittest.cc +++ b/deps/v8/test/unittests/base/template-utils-unittest.cc @@ -136,7 +136,7 @@ TEST(TemplateUtilsTest, FoldMoveOnlyType) { str->push_back(c); return str; }; - std::unique_ptr<std::string> str = base::make_unique<std::string>("foo"); + std::unique_ptr<std::string> str = std::make_unique<std::string>("foo"); std::unique_ptr<std::string> folded = base::fold(fn, std::move(str), 'b', 'a', 'r'); CHECK_NULL(str); diff --git a/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc b/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc index 420b236432..453d788a6e 100644 --- a/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc +++ b/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc @@ -37,11 +37,10 @@ static void CheckSlowSample(const std::vector<uint64_t>& sample, uint64_t max, } } -static void TestNextSample( - RandomNumberGenerator& rng, // NOLINT(runtime/references) - uint64_t max, size_t size, bool slow = false) { +static void TestNextSample(RandomNumberGenerator* rng, uint64_t max, + size_t size, bool slow = false) { std::vector<uint64_t> sample = - slow ? rng.NextSampleSlow(max, size) : rng.NextSample(max, size); + slow ? rng->NextSampleSlow(max, size) : rng->NextSample(max, size); CheckSample(sample, max, size); } @@ -100,14 +99,14 @@ TEST_P(RandomNumberGeneratorTest, NextSample0) { size_t m = 1; RandomNumberGenerator rng(GetParam()); - TestNextSample(rng, m, 0); + TestNextSample(&rng, m, 0); } TEST_P(RandomNumberGeneratorTest, NextSampleSlow0) { size_t m = 1; RandomNumberGenerator rng(GetParam()); - TestNextSample(rng, m, 0, true); + TestNextSample(&rng, m, 0, true); } TEST_P(RandomNumberGeneratorTest, NextSample1) { @@ -115,7 +114,7 @@ TEST_P(RandomNumberGeneratorTest, NextSample1) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, 1); + TestNextSample(&rng, m, 1); } } @@ -124,7 +123,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleSlow1) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, 1, true); + TestNextSample(&rng, m, 1, true); } } @@ -133,7 +132,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleMax) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, m); + TestNextSample(&rng, m, m); } } @@ -142,7 +141,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleSlowMax) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, m, true); + TestNextSample(&rng, m, m, true); } } @@ -152,7 +151,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleHalf) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, n); + TestNextSample(&rng, m, n); } } @@ -162,7 +161,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleSlowHalf) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, n, true); + TestNextSample(&rng, m, n, true); } } @@ -172,7 +171,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleMoreThanHalf) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, n); + TestNextSample(&rng, m, n); } } @@ -182,7 +181,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleSlowMoreThanHalf) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, n, true); + TestNextSample(&rng, m, n, true); } } @@ -192,7 +191,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleLessThanHalf) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, n); + TestNextSample(&rng, m, n); } } @@ -202,7 +201,7 @@ TEST_P(RandomNumberGeneratorTest, NextSampleSlowLessThanHalf) { RandomNumberGenerator rng(GetParam()); for (int k = 0; k < kMaxRuns; ++k) { - TestNextSample(rng, m, n, true); + TestNextSample(&rng, m, n, true); } } diff --git a/deps/v8/test/unittests/codegen/code-stub-assembler-unittest.cc b/deps/v8/test/unittests/codegen/code-stub-assembler-unittest.cc index df387d3d94..7be9f75868 100644 --- a/deps/v8/test/unittests/codegen/code-stub-assembler-unittest.cc +++ b/deps/v8/test/unittests/codegen/code-stub-assembler-unittest.cc @@ -14,7 +14,6 @@ using ::testing::_; using v8::internal::compiler::Node; -using v8::internal::compiler::TNode; namespace c = v8::internal::compiler; diff --git a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc index 8b15811d36..954bdd5065 100644 --- a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc +++ b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc @@ -12,7 +12,6 @@ #include "src/ast/ast.h" #include "src/ast/scopes.h" #include "src/base/platform/semaphore.h" -#include "src/base/template-utils.h" #include "src/codegen/compiler.h" #include "src/flags/flags.h" #include "src/handles/handles.h" @@ -205,7 +204,7 @@ class MockPlatform : public v8::Platform { tasks.swap(worker_tasks_); } platform->CallOnWorkerThread( - base::make_unique<TaskWrapper>(this, std::move(tasks), true)); + std::make_unique<TaskWrapper>(this, std::move(tasks), true)); sem_.Wait(); } @@ -216,7 +215,7 @@ class MockPlatform : public v8::Platform { tasks.swap(worker_tasks_); } platform->CallOnWorkerThread( - base::make_unique<TaskWrapper>(this, std::move(tasks), false)); + std::make_unique<TaskWrapper>(this, std::move(tasks), false)); } void RunForegroundTasks() { diff --git a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc index b969d9a278..d7a3a92c96 100644 --- a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc +++ b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc @@ -41,16 +41,15 @@ std::ostream& operator<<(std::ostream& os, const Shift& shift) { // Helper to build Int32Constant or Int64Constant depending on the given // machine type. -Node* BuildConstant( - InstructionSelectorTest::StreamBuilder& m, // NOLINT(runtime/references) - MachineType type, int64_t value) { +Node* BuildConstant(InstructionSelectorTest::StreamBuilder* m, MachineType type, + int64_t value) { switch (type.representation()) { case MachineRepresentation::kWord32: - return m.Int32Constant(static_cast<int32_t>(value)); + return m->Int32Constant(static_cast<int32_t>(value)); break; case MachineRepresentation::kWord64: - return m.Int64Constant(value); + return m->Int64Constant(value); break; default: @@ -373,8 +372,6 @@ const MachInst2 kCanElideChangeUint32ToUint64[] = { MachineType::Uint32()}, }; -} // namespace - // ----------------------------------------------------------------------------- // Logical instructions. @@ -464,9 +461,8 @@ TEST_P(InstructionSelectorLogicalTest, ShiftByImmediate) { TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) { StreamBuilder m(this, type, type, type); m.Return((m.*dpi.constructor)( - m.Parameter(0), - (m.*shift.mi.constructor)(m.Parameter(1), - BuildConstant(m, type, imm)))); + m.Parameter(0), (m.*shift.mi.constructor)( + m.Parameter(1), BuildConstant(&m, type, imm)))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); @@ -480,7 +476,7 @@ TEST_P(InstructionSelectorLogicalTest, ShiftByImmediate) { StreamBuilder m(this, type, type, type); m.Return((m.*dpi.constructor)( (m.*shift.mi.constructor)(m.Parameter(1), - BuildConstant(m, type, imm)), + BuildConstant(&m, type, imm)), m.Parameter(0))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -521,7 +517,7 @@ TEST_P(InstructionSelectorAddSubTest, ImmediateOnRight) { TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { StreamBuilder m(this, type, type); m.Return( - (m.*dpi.mi.constructor)(m.Parameter(0), BuildConstant(m, type, imm))); + (m.*dpi.mi.constructor)(m.Parameter(0), BuildConstant(&m, type, imm))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode()); @@ -540,7 +536,7 @@ TEST_P(InstructionSelectorAddSubTest, NegImmediateOnRight) { if (imm == 0) continue; StreamBuilder m(this, type, type); m.Return( - (m.*dpi.mi.constructor)(m.Parameter(0), BuildConstant(m, type, -imm))); + (m.*dpi.mi.constructor)(m.Parameter(0), BuildConstant(&m, type, -imm))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(dpi.negate_arch_opcode, s[0]->arch_opcode()); @@ -568,9 +564,8 @@ TEST_P(InstructionSelectorAddSubTest, ShiftByImmediateOnRight) { TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) { StreamBuilder m(this, type, type, type); m.Return((m.*dpi.mi.constructor)( - m.Parameter(0), - (m.*shift.mi.constructor)(m.Parameter(1), - BuildConstant(m, type, imm)))); + m.Parameter(0), (m.*shift.mi.constructor)( + m.Parameter(1), BuildConstant(&m, type, imm)))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode()); @@ -1156,7 +1151,7 @@ TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnLeft) { struct TestAndBranch { MachInst<std::function<Node*(InstructionSelectorTest::StreamBuilder&, Node*, - uint32_t mask)>> + uint64_t mask)>> mi; FlagsCondition cond; }; @@ -1275,6 +1270,92 @@ INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorTestAndBranchTest, ::testing::ValuesIn(kTestAndBranchMatchers32)); +// TODO(arm64): Add the missing Word32BinaryNot test cases from the 32-bit +// version. +const TestAndBranch kTestAndBranchMatchers64[] = { + // Branch on the result of Word64And directly. + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, uint64_t mask) + -> Node* { return m.Word64And(x, m.Int64Constant(mask)); }, + "if (x and mask)", kArm64TestAndBranch, MachineType::Int64()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint64_t mask) -> Node* { + return m.Word64Equal(m.Word64And(x, m.Int64Constant(mask)), + m.Int64Constant(0)); + }, + "if not (x and mask)", kArm64TestAndBranch, MachineType::Int64()}, + kEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, uint64_t mask) + -> Node* { return m.Word64And(m.Int64Constant(mask), x); }, + "if (mask and x)", kArm64TestAndBranch, MachineType::Int64()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint64_t mask) -> Node* { + return m.Word64Equal(m.Word64And(m.Int64Constant(mask), x), + m.Int64Constant(0)); + }, + "if not (mask and x)", kArm64TestAndBranch, MachineType::Int64()}, + kEqual}, + // Branch on the result of '(x and mask) == mask'. This tests that a bit is + // set rather than cleared which is why conditions are inverted. + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint64_t mask) -> Node* { + return m.Word64Equal(m.Word64And(x, m.Int64Constant(mask)), + m.Int64Constant(mask)); + }, + "if ((x and mask) == mask)", kArm64TestAndBranch, MachineType::Int64()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint64_t mask) -> Node* { + return m.Word64Equal(m.Int64Constant(mask), + m.Word64And(x, m.Int64Constant(mask))); + }, + "if (mask == (x and mask))", kArm64TestAndBranch, MachineType::Int64()}, + kNotEqual}, + // Same as above but swap 'mask' and 'x'. + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint64_t mask) -> Node* { + return m.Word64Equal(m.Word64And(m.Int64Constant(mask), x), + m.Int64Constant(mask)); + }, + "if ((mask and x) == mask)", kArm64TestAndBranch, MachineType::Int64()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint64_t mask) -> Node* { + return m.Word64Equal(m.Int64Constant(mask), + m.Word64And(m.Int64Constant(mask), x)); + }, + "if (mask == (mask and x))", kArm64TestAndBranch, MachineType::Int64()}, + kNotEqual}}; + +using InstructionSelectorTestAndBranchTest64 = + InstructionSelectorTestWithParam<TestAndBranch>; + +TEST_P(InstructionSelectorTestAndBranchTest64, TestAndBranch64) { + const TestAndBranch inst = GetParam(); + TRACED_FORRANGE(int, bit, 0, 63) { + uint64_t mask = uint64_t{1} << bit; + StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); + RawMachineLabel a, b; + m.Branch(inst.mi.constructor(m, m.Parameter(0), mask), &a, &b); + m.Bind(&a); + m.Return(m.Int64Constant(1)); + m.Bind(&b); + m.Return(m.Int64Constant(0)); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode()); + EXPECT_EQ(inst.cond, s[0]->flags_condition()); + EXPECT_EQ(4U, s[0]->InputCount()); + EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); + EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1))); + } +} + +INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, + InstructionSelectorTestAndBranchTest64, + ::testing::ValuesIn(kTestAndBranchMatchers64)); + TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) { TRACED_FORRANGE(int, bit, 0, 63) { uint64_t mask = uint64_t{1} << bit; @@ -2035,7 +2116,7 @@ TEST_P(InstructionSelectorIntDPWithIntMulTest, NegativeMul) { { StreamBuilder m(this, type, type, type); Node* n = - (m.*mdpi.sub_constructor)(BuildConstant(m, type, 0), m.Parameter(0)); + (m.*mdpi.sub_constructor)(BuildConstant(&m, type, 0), m.Parameter(0)); m.Return((m.*mdpi.mul_constructor)(n, m.Parameter(1))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2046,7 +2127,7 @@ TEST_P(InstructionSelectorIntDPWithIntMulTest, NegativeMul) { { StreamBuilder m(this, type, type, type); Node* n = - (m.*mdpi.sub_constructor)(BuildConstant(m, type, 0), m.Parameter(1)); + (m.*mdpi.sub_constructor)(BuildConstant(&m, type, 0), m.Parameter(1)); m.Return((m.*mdpi.mul_constructor)(m.Parameter(0), n)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2578,6 +2659,22 @@ TEST_F(InstructionSelectorTest, ChangeInt32ToInt64AfterLoad) { } } +TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithWord32Sar) { + // Test the mod 32 behaviour of Word32Sar by iterating up to 33. + TRACED_FORRANGE(int32_t, imm, 0, 33) { + StreamBuilder m(this, MachineType::Int64(), MachineType::Int32()); + m.Return(m.ChangeInt32ToInt64( + m.Word32Sar(m.Parameter(0), m.Int32Constant(imm)))); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(kArm64Sbfx, s[0]->arch_opcode()); + EXPECT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(1U, s[0]->OutputCount()); + EXPECT_EQ(imm & 0x1f, s.ToInt32(s[0]->InputAt(1))); + EXPECT_EQ(32 - (imm & 0x1f), s.ToInt32(s[0]->InputAt(2))); + } +} + // ----------------------------------------------------------------------------- // Memory access instructions. @@ -2938,7 +3035,8 @@ TEST_P(InstructionSelectorComparisonTest, WithImmediate) { // Compare with 0 are turned into tst instruction. if (imm == 0) continue; StreamBuilder m(this, type, type); - m.Return((m.*cmp.constructor)(m.Parameter(0), BuildConstant(m, type, imm))); + m.Return( + (m.*cmp.constructor)(m.Parameter(0), BuildConstant(&m, type, imm))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(cmp.arch_opcode, s[0]->arch_opcode()); @@ -2953,7 +3051,8 @@ TEST_P(InstructionSelectorComparisonTest, WithImmediate) { // Compare with 0 are turned into tst instruction. if (imm == 0) continue; StreamBuilder m(this, type, type); - m.Return((m.*cmp.constructor)(BuildConstant(m, type, imm), m.Parameter(0))); + m.Return( + (m.*cmp.constructor)(BuildConstant(&m, type, imm), m.Parameter(0))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(cmp.arch_opcode, s[0]->arch_opcode()); @@ -3507,6 +3606,33 @@ const IntegerCmp kBinopCmpZeroRightInstructions[] = { kNotEqual, kNotEqual}}; +const IntegerCmp kBinop64CmpZeroRightInstructions[] = { + {{&RawMachineAssembler::Word64Equal, "Word64Equal", kArm64Cmp, + MachineType::Int64()}, + kEqual, + kEqual}, + {{&RawMachineAssembler::Word64NotEqual, "Word64NotEqual", kArm64Cmp, + MachineType::Int64()}, + kNotEqual, + kNotEqual}, + {{&RawMachineAssembler::Int64LessThan, "Int64LessThan", kArm64Cmp, + MachineType::Int64()}, + kNegative, + kNegative}, + {{&RawMachineAssembler::Int64GreaterThanOrEqual, "Int64GreaterThanOrEqual", + kArm64Cmp, MachineType::Int64()}, + kPositiveOrZero, + kPositiveOrZero}, + {{&RawMachineAssembler::Uint64LessThanOrEqual, "Uint64LessThanOrEqual", + kArm64Cmp, MachineType::Int64()}, + kEqual, + kEqual}, + {{&RawMachineAssembler::Uint64GreaterThan, "Uint64GreaterThan", kArm64Cmp, + MachineType::Int64()}, + kNotEqual, + kNotEqual}, +}; + const IntegerCmp kBinopCmpZeroLeftInstructions[] = { {{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32, MachineType::Int32()}, @@ -4019,7 +4145,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { TRACED_FORRANGE(int32_t, shift, -32, 63) { int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { - uint32_t msk = (1 << width) - 1; + uint32_t msk = (1u << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)), m.Int32Constant(msk))); @@ -4035,7 +4161,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { TRACED_FORRANGE(int32_t, shift, -32, 63) { int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { - uint32_t msk = (1 << width) - 1; + uint32_t msk = (1u << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return( m.Word32And(m.Int32Constant(msk), @@ -4282,7 +4408,7 @@ TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const r = - m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)), + m.Word32Shl(m.Word32And(p0, m.Int32Constant((1u << (31 - shift)) - 1)), m.Int32Constant(shift + 1)); m.Return(r); Stream s = m.Build(); @@ -4531,6 +4657,34 @@ TEST_F(InstructionSelectorTest, CompareAgainstZero32) { } } +TEST_F(InstructionSelectorTest, CompareAgainstZero64) { + TRACED_FOREACH(IntegerCmp, cmp, kBinop64CmpZeroRightInstructions) { + StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); + Node* const param = m.Parameter(0); + RawMachineLabel a, b; + m.Branch((m.*cmp.mi.constructor)(param, m.Int64Constant(0)), &a, &b); + m.Bind(&a); + m.Return(m.Int64Constant(1)); + m.Bind(&b); + m.Return(m.Int64Constant(0)); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[0]->InputAt(0))); + if (cmp.cond == kNegative || cmp.cond == kPositiveOrZero) { + EXPECT_EQ(kArm64TestAndBranch, s[0]->arch_opcode()); + EXPECT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + EXPECT_EQ((cmp.cond == kNegative) ? kNotEqual : kEqual, + s[0]->flags_condition()); + EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); + EXPECT_EQ(63, s.ToInt32(s[0]->InputAt(1))); + } else { + EXPECT_EQ(kArm64CompareAndBranch, s[0]->arch_opcode()); + EXPECT_EQ(3U, s[0]->InputCount()); // The labels are also inputs. + EXPECT_EQ(cmp.cond, s[0]->flags_condition()); + } + } +} + TEST_F(InstructionSelectorTest, CompareFloat64HighLessThanZero64) { StreamBuilder m(this, MachineType::Int32(), MachineType::Float64()); Node* const param = m.Parameter(0); @@ -4615,18 +4769,18 @@ namespace { // Then checks that the correct number of kArm64Poke and kArm64PokePair were // generated. void TestPokePair( - InstructionSelectorTest::StreamBuilder& m, // NOLINT(runtime/references) + InstructionSelectorTest::StreamBuilder* m, // NOLINT(runtime/references) Zone* zone, - MachineSignature::Builder& builder, // NOLINT(runtime/references) + MachineSignature::Builder* builder, // NOLINT(runtime/references) Node* nodes[], int num_nodes, int expected_poke_pair, int expected_poke) { auto call_descriptor = InstructionSelectorTest::StreamBuilder::MakeSimpleCallDescriptor( - zone, builder.Build()); + zone, builder->Build()); - m.CallN(call_descriptor, num_nodes, nodes); - m.Return(m.UndefinedConstant()); + m->CallN(call_descriptor, num_nodes, nodes); + m->Return(m->UndefinedConstant()); - auto s = m.Build(); + auto s = m->Build(); int num_poke_pair = 0; int num_poke = 0; for (size_t i = 0; i < s.size(); ++i) { @@ -4664,7 +4818,7 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsInt32) { // EmitPrepareArguments. const int expected_poke = 1 + 1; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), expected_poke_pair, expected_poke); } @@ -4684,7 +4838,7 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsInt32) { const int expected_poke_pair = 2; const int expected_poke = 0; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), expected_poke_pair, expected_poke); } } @@ -4705,8 +4859,8 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsInt64) { const int expected_poke_pair = 2; const int expected_poke = 0; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), expected_poke_pair, - expected_poke); + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), + expected_poke_pair, expected_poke); } TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsFloat32) { @@ -4725,8 +4879,8 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsFloat32) { const int expected_poke_pair = 2; const int expected_poke = 0; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), expected_poke_pair, - expected_poke); + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), + expected_poke_pair, expected_poke); } TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsFloat64) { @@ -4745,8 +4899,8 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsFloat64) { const int expected_poke_pair = 2; const int expected_poke = 0; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), expected_poke_pair, - expected_poke); + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), + expected_poke_pair, expected_poke); } TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsIntFloatMixed) { @@ -4766,7 +4920,7 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsIntFloatMixed) { const int expected_poke_pair = 0; const int expected_poke = 4; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), expected_poke_pair, expected_poke); } @@ -4792,7 +4946,7 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsIntFloatMixed) { // EmitPrepareArguments. const int expected_poke = 3 + 1; - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), expected_poke_pair, expected_poke); } } @@ -4811,10 +4965,11 @@ TEST_F(InstructionSelectorTest, PokePairPrepareArgumentsSimd128) { const int expected_poke = 2; // Using kArm64PokePair is not currently supported for Simd128. - TestPokePair(m, zone(), builder, nodes, arraysize(nodes), expected_poke_pair, - expected_poke); + TestPokePair(&m, zone(), &builder, nodes, arraysize(nodes), + expected_poke_pair, expected_poke); } +} // namespace } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/backend/instruction-sequence-unittest.h b/deps/v8/test/unittests/compiler/backend/instruction-sequence-unittest.h index 82a8b3019d..b75da308f9 100644 --- a/deps/v8/test/unittests/compiler/backend/instruction-sequence-unittest.h +++ b/deps/v8/test/unittests/compiler/backend/instruction-sequence-unittest.h @@ -47,7 +47,6 @@ class InstructionSequenceTest : public TestWithIsolateAndZone { kFixedRegister, kSlot, kFixedSlot, - kExplicit, kImmediate, kNone, kConstant, @@ -75,17 +74,6 @@ class InstructionSequenceTest : public TestWithIsolateAndZone { static TestOperand Same() { return TestOperand(kSameAsFirst); } - static TestOperand ExplicitReg(int index) { - TestOperandType type = kExplicit; - return TestOperand(type, index); - } - - static TestOperand ExplicitFPReg(int index, - MachineRepresentation rep = kFloat64) { - TestOperandType type = kExplicit; - return TestOperand(type, index, rep); - } - static TestOperand Reg(VReg vreg, int index = kNoValue) { TestOperandType type = (index == kNoValue) ? kRegister : kFixedRegister; return TestOperand(type, vreg, index); diff --git a/deps/v8/test/unittests/compiler/common-operator-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-unittest.cc index 19e7c6c55f..365b3ea05b 100644 --- a/deps/v8/test/unittests/compiler/common-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/common-operator-unittest.cc @@ -62,8 +62,6 @@ class CommonSharedOperatorTest : public TestWithZone, public ::testing::WithParamInterface<SharedOperator> {}; -} // namespace - TEST_P(CommonSharedOperatorTest, InstancesAreGloballyShared) { const SharedOperator& sop = GetParam(); @@ -387,6 +385,7 @@ TEST_F(CommonOperatorTest, Projection) { } } +} // namespace } // namespace common_operator_unittest } // namespace compiler } // namespace internal diff --git a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc index 52769b09de..7e927ea078 100644 --- a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc @@ -1015,7 +1015,7 @@ TEST_F(Int64LoweringTest, WasmBigIntSpecialCaseBigIntToI64) { Operator::kNoProperties, // properties StubCallMode::kCallCodeObject); // stub call mode - auto lowering_special_case = base::make_unique<Int64LoweringSpecialCase>(); + auto lowering_special_case = std::make_unique<Int64LoweringSpecialCase>(); lowering_special_case->bigint_to_i64_call_descriptor = bigint_to_i64_call_descriptor; lowering_special_case->bigint_to_i32_pair_call_descriptor = @@ -1063,7 +1063,7 @@ TEST_F(Int64LoweringTest, WasmBigIntSpecialCaseI64ToBigInt) { Operator::kNoProperties, // properties StubCallMode::kCallCodeObject); // stub call mode - auto lowering_special_case = base::make_unique<Int64LoweringSpecialCase>(); + auto lowering_special_case = std::make_unique<Int64LoweringSpecialCase>(); lowering_special_case->i64_to_bigint_call_descriptor = i64_to_bigint_call_descriptor; lowering_special_case->i32_pair_to_bigint_call_descriptor = diff --git a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc index 7c062698c4..10643ddc8b 100644 --- a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc @@ -11,6 +11,7 @@ #include "src/compiler/js-graph.h" #include "src/compiler/simplified-operator.h" #include "src/execution/isolate.h" +#include "src/execution/protectors.h" #include "src/heap/factory.h" #include "src/objects/feedback-vector.h" #include "test/unittests/compiler/graph-unittest.h" @@ -175,12 +176,7 @@ TEST_F(JSCallReducerTest, PromiseConstructorBasic) { context, frame_state, effect, control); Reduction r = Reduce(construct); - - if (FLAG_experimental_inline_promise_constructor) { - ASSERT_TRUE(r.Changed()); - } else { - ASSERT_FALSE(r.Changed()); - } + ASSERT_TRUE(r.Changed()); } // Exactly the same as PromiseConstructorBasic which expects a reduction, @@ -198,7 +194,7 @@ TEST_F(JSCallReducerTest, PromiseConstructorWithHook) { graph()->NewNode(javascript()->Construct(3), promise, executor, promise, context, frame_state, effect, control); - isolate()->InvalidatePromiseHookProtector(); + Protectors::InvalidatePromiseHook(isolate()); Reduction r = Reduce(construct); diff --git a/deps/v8/test/unittests/compiler/js-operator-unittest.cc b/deps/v8/test/unittests/compiler/js-operator-unittest.cc index 082e81f27c..5a951b35ae 100644 --- a/deps/v8/test/unittests/compiler/js-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-operator-unittest.cc @@ -54,9 +54,6 @@ std::ostream& operator<<(std::ostream& os, const SharedOperator& sop) { return os << IrOpcode::Mnemonic(sop.opcode); } -} // namespace - - class JSSharedOperatorTest : public TestWithZone, public ::testing::WithParamInterface<SharedOperator> {}; @@ -111,6 +108,7 @@ TEST_P(JSSharedOperatorTest, Properties) { INSTANTIATE_TEST_SUITE_P(JSOperatorTest, JSSharedOperatorTest, ::testing::ValuesIn(kSharedOperators)); +} // namespace } // namespace js_operator_unittest } // namespace compiler } // namespace internal diff --git a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc index 0d85253847..eed74f6181 100644 --- a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -52,13 +52,6 @@ class JSTypedLoweringTest : public TypedGraphTest { return reducer.Reduce(node); } - Handle<JSArrayBuffer> NewArrayBuffer(void* bytes, size_t byte_length) { - Handle<JSArrayBuffer> buffer = - factory()->NewJSArrayBuffer(SharedFlag::kNotShared); - JSArrayBuffer::Setup(buffer, isolate(), true, bytes, byte_length); - return buffer; - } - JSOperatorBuilder* javascript() { return &javascript_; } private: diff --git a/deps/v8/test/unittests/compiler/regalloc/OWNERS b/deps/v8/test/unittests/compiler/regalloc/OWNERS deleted file mode 100644 index bfde831c20..0000000000 --- a/deps/v8/test/unittests/compiler/regalloc/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -set noparent - -bmeurer@chromium.org -jarin@chromium.org diff --git a/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc b/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc index e72afd5601..344ea3dfad 100644 --- a/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc +++ b/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc @@ -83,11 +83,6 @@ class MoveOptimizerTest : public InstructionSequenceTest { CHECK(0 <= op.value_ && op.value_ < GetNumRegs(rep)); return AllocatedOperand(LocationOperand::REGISTER, rep, op.value_); } - case kExplicit: { - MachineRepresentation rep = GetCanonicalRep(op); - CHECK(0 <= op.value_ && op.value_ < GetNumRegs(rep)); - return ExplicitOperand(LocationOperand::REGISTER, rep, op.value_); - } default: break; } @@ -123,45 +118,6 @@ TEST_F(MoveOptimizerTest, RemovesRedundant) { CHECK(Contains(move, FPReg(kF32_1, kFloat32), FPReg(kF32_2, kFloat32))); } -TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) { - int index1 = GetAllocatableCode(0); - int index2 = GetAllocatableCode(1); - int s128_1 = GetAllocatableCode(kS128_1, kSimd128); - int s128_2 = GetAllocatableCode(kS128_2, kSimd128); - int f64_1 = GetAllocatableCode(kF64_1, kFloat64); - int f64_2 = GetAllocatableCode(kF64_2, kFloat64); - int f32_1 = GetAllocatableCode(kF32_1, kFloat32); - int f32_2 = GetAllocatableCode(kF32_2, kFloat32); - - StartBlock(); - auto first_instr = EmitNop(); - auto last_instr = EmitNop(); - - AddMove(first_instr, Reg(index1), ExplicitReg(index2)); - AddMove(last_instr, Reg(index2), Reg(index1)); - - AddMove(first_instr, FPReg(s128_1, kSimd128), - ExplicitFPReg(s128_2, kSimd128)); - AddMove(last_instr, FPReg(s128_2, kSimd128), FPReg(s128_1, kSimd128)); - AddMove(first_instr, FPReg(f64_1, kFloat64), ExplicitFPReg(f64_2, kFloat64)); - AddMove(last_instr, FPReg(f64_2, kFloat64), FPReg(f64_1, kFloat64)); - AddMove(first_instr, FPReg(f32_1, kFloat32), ExplicitFPReg(f32_2, kFloat32)); - AddMove(last_instr, FPReg(f32_2, kFloat32), FPReg(f32_1, kFloat32)); - - EndBlock(Last()); - - Optimize(); - - CHECK_EQ(0, NonRedundantSize(first_instr->parallel_moves()[0])); - auto move = last_instr->parallel_moves()[0]; - CHECK_EQ(4, NonRedundantSize(move)); - CHECK(Contains(move, Reg(index1), ExplicitReg(index2))); - CHECK( - Contains(move, FPReg(s128_1, kSimd128), ExplicitFPReg(s128_2, kSimd128))); - CHECK(Contains(move, FPReg(f64_1, kFloat64), ExplicitFPReg(f64_2, kFloat64))); - CHECK(Contains(move, FPReg(f32_1, kFloat32), ExplicitFPReg(f32_2, kFloat32))); -} - TEST_F(MoveOptimizerTest, SplitsConstants) { StartBlock(); EndBlock(Last()); diff --git a/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc b/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc index 262c51d31e..f06b004d49 100644 --- a/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc +++ b/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc @@ -73,7 +73,6 @@ bool IsParallelMovePresent(int instr_index, Instruction::GapPosition gap_pos, return found_match; } -} // namespace class RegisterAllocatorTest : public InstructionSequenceTest { public: @@ -824,6 +823,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Combine(::testing::ValuesIn(kParameterTypes), ::testing::Range(0, SlotConstraintTest::kMaxVariant))); +} // namespace } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/heap/heap-unittest.cc b/deps/v8/test/unittests/heap/heap-unittest.cc index 048ff5d0a6..76cab01a41 100644 --- a/deps/v8/test/unittests/heap/heap-unittest.cc +++ b/deps/v8/test/unittests/heap/heap-unittest.cc @@ -145,8 +145,7 @@ TEST_F(HeapWithPointerCompressionTest, HeapLayout) { EXPECT_TRUE(IsAligned(isolate_root, size_t{4} * GB)); // Check that all memory chunks belong this region. - base::AddressRegion heap_reservation(isolate_root - size_t{2} * GB, - size_t{4} * GB); + base::AddressRegion heap_reservation(isolate_root, size_t{4} * GB); OldGenerationMemoryChunkIterator iter(i_isolate()->heap()); for (;;) { diff --git a/deps/v8/test/unittests/heap/slot-set-unittest.cc b/deps/v8/test/unittests/heap/slot-set-unittest.cc index 54b60f55e8..fa635705b3 100644 --- a/deps/v8/test/unittests/heap/slot-set-unittest.cc +++ b/deps/v8/test/unittests/heap/slot-set-unittest.cc @@ -16,12 +16,11 @@ namespace internal { TEST(SlotSet, InsertAndLookup1) { SlotSet set; - set.SetPageStart(0); for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { EXPECT_FALSE(set.Lookup(i)); } for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { - set.Insert(i); + set.Insert<AccessMode::ATOMIC>(i); } for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { EXPECT_TRUE(set.Lookup(i)); @@ -30,10 +29,9 @@ TEST(SlotSet, InsertAndLookup1) { TEST(SlotSet, InsertAndLookup2) { SlotSet set; - set.SetPageStart(0); for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { if (i % 7 == 0) { - set.Insert(i); + set.Insert<AccessMode::ATOMIC>(i); } } for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { @@ -47,14 +45,14 @@ TEST(SlotSet, InsertAndLookup2) { TEST(SlotSet, Iterate) { SlotSet set; - set.SetPageStart(0); for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { if (i % 7 == 0) { - set.Insert(i); + set.Insert<AccessMode::ATOMIC>(i); } } set.Iterate( + kNullAddress, [](MaybeObjectSlot slot) { if (slot.address() % 3 == 0) { return KEEP_SLOT; @@ -75,10 +73,9 @@ TEST(SlotSet, Iterate) { TEST(SlotSet, Remove) { SlotSet set; - set.SetPageStart(0); for (int i = 0; i < Page::kPageSize; i += kTaggedSize) { if (i % 7 == 0) { - set.Insert(i); + set.Insert<AccessMode::ATOMIC>(i); } } @@ -99,13 +96,12 @@ TEST(SlotSet, Remove) { void CheckRemoveRangeOn(uint32_t start, uint32_t end) { SlotSet set; - set.SetPageStart(0); uint32_t first = start == 0 ? 0 : start - kTaggedSize; uint32_t last = end == Page::kPageSize ? end - kTaggedSize : end; for (const auto mode : {SlotSet::FREE_EMPTY_BUCKETS, SlotSet::KEEP_EMPTY_BUCKETS}) { for (uint32_t i = first; i <= last; i += kTaggedSize) { - set.Insert(i); + set.Insert<AccessMode::ATOMIC>(i); } set.RemoveRange(start, end, mode); if (first != start) { @@ -137,10 +133,9 @@ TEST(SlotSet, RemoveRange) { } } SlotSet set; - set.SetPageStart(0); for (const auto mode : {SlotSet::FREE_EMPTY_BUCKETS, SlotSet::KEEP_EMPTY_BUCKETS}) { - set.Insert(Page::kPageSize / 2); + set.Insert<AccessMode::ATOMIC>(Page::kPageSize / 2); set.RemoveRange(0, Page::kPageSize, mode); for (uint32_t i = 0; i < Page::kPageSize; i += kTaggedSize) { EXPECT_FALSE(set.Lookup(i)); diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc index a9c631f8d2..667bfee64b 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -96,6 +96,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { FeedbackSlot sloppy_store_global_slot = feedback_spec.AddStoreGlobalICSlot(LanguageMode::kSloppy); FeedbackSlot load_slot = feedback_spec.AddLoadICSlot(); + FeedbackSlot call_slot = feedback_spec.AddCallICSlot(); FeedbackSlot keyed_load_slot = feedback_spec.AddKeyedLoadICSlot(); FeedbackSlot sloppy_store_slot = feedback_spec.AddStoreICSlot(LanguageMode::kSloppy); @@ -152,7 +153,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .StoreInArrayLiteral(reg, reg, store_array_element_slot.ToInt()); // Emit Iterator-protocol operations - builder.GetIterator(reg, load_slot.ToInt()); + builder.GetIterator(reg, load_slot.ToInt(), call_slot.ToInt()); // Emit load / store lookup slots. builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) diff --git a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc index a8ff998107..09d21e3095 100644 --- a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc +++ b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc @@ -16,7 +16,6 @@ using ::testing::_; using ::testing::Eq; using v8::internal::compiler::Node; -using v8::internal::compiler::TNode; namespace c = v8::internal::compiler; @@ -310,44 +309,6 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsLoadRegisterOperand( LoadSensitivity::kCritical)); } -TARGET_TEST_F(InterpreterAssemblerTest, Jump) { - // If debug code is enabled we emit extra code in Jump. - if (FLAG_debug_code) return; - - int jump_offsets[] = {-9710, -77, 0, +3, +97109}; - TRACED_FOREACH(int, jump_offset, jump_offsets) { - TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { - if (!interpreter::Bytecodes::IsJump(bytecode)) return; - - InterpreterAssemblerTestState state(this, bytecode); - InterpreterAssemblerForTest m(&state, bytecode); - Node* tail_call_node = m.Jump(m.IntPtrConstant(jump_offset)); - - Matcher<Node*> next_bytecode_offset_matcher = c::IsIntPtrAdd( - c::IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset), - c::IsIntPtrConstant(jump_offset)); - Matcher<Node*> target_bytecode_matcher = - m.IsLoad(MachineType::Uint8(), _, next_bytecode_offset_matcher); - target_bytecode_matcher = - c::IsChangeUint32ToWord(target_bytecode_matcher); - Matcher<Node*> code_target_matcher = m.IsLoad( - MachineType::Pointer(), - c::IsParameter(InterpreterDispatchDescriptor::kDispatchTable), - c::IsWordShl(target_bytecode_matcher, - c::IsIntPtrConstant(kSystemPointerSizeLog2))); - - EXPECT_THAT( - tail_call_node, - c::IsTailCall( - _, code_target_matcher, - c::IsParameter(InterpreterDispatchDescriptor::kAccumulator), - next_bytecode_offset_matcher, _, - c::IsParameter(InterpreterDispatchDescriptor::kDispatchTable), _, - _)); - } - } -} - TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { static const OperandScale kOperandScales[] = { OperandScale::kSingle, OperandScale::kDouble, OperandScale::kQuadruple}; @@ -444,67 +405,70 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadConstantPoolEntry) { InterpreterAssemblerForTest m(&state, bytecode); { TNode<IntPtrT> index = m.IntPtrConstant(2); - Node* load_constant = m.LoadConstantPoolEntry(index); -#ifdef V8_COMPRESS_POINTERS - Matcher<Node*> constant_pool_matcher = - IsChangeCompressedToTagged(m.IsLoadFromObject( - MachineType::AnyCompressed(), - c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), - c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - - kHeapObjectTag))); - EXPECT_THAT(load_constant, - IsChangeCompressedToTagged(m.IsLoad( - MachineType::AnyCompressed(), constant_pool_matcher, - c::IsIntPtrConstant(FixedArray::OffsetOfElementAt(2) - - kHeapObjectTag), - LoadSensitivity::kCritical))); -#else - Matcher<Node*> constant_pool_matcher = m.IsLoadFromObject( - MachineType::AnyTagged(), - c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), - c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - - kHeapObjectTag)); - EXPECT_THAT( - load_constant, - m.IsLoad(MachineType::AnyTagged(), constant_pool_matcher, - c::IsIntPtrConstant(FixedArray::OffsetOfElementAt(2) - - kHeapObjectTag), - LoadSensitivity::kCritical)); -#endif + TNode<Object> load_constant = m.LoadConstantPoolEntry(index); + if (COMPRESS_POINTERS_BOOL && FLAG_turbo_decompression_elimination) { + Matcher<Node*> constant_pool_matcher = + IsChangeCompressedToTagged(m.IsLoadFromObject( + MachineType::AnyCompressed(), + c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), + c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - + kHeapObjectTag))); + EXPECT_THAT(load_constant, + IsChangeCompressedToTagged(m.IsLoad( + MachineType::AnyCompressed(), constant_pool_matcher, + c::IsIntPtrConstant(FixedArray::OffsetOfElementAt(2) - + kHeapObjectTag), + LoadSensitivity::kCritical))); + } else { + Matcher<Node*> constant_pool_matcher = m.IsLoadFromObject( + MachineType::AnyTagged(), + c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), + c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - + kHeapObjectTag)); + EXPECT_THAT( + load_constant, + m.IsLoad(MachineType::AnyTagged(), constant_pool_matcher, + c::IsIntPtrConstant(FixedArray::OffsetOfElementAt(2) - + kHeapObjectTag), + LoadSensitivity::kCritical)); + } } { Node* index = m.Parameter(2); - Node* load_constant = m.LoadConstantPoolEntry(index); -#if V8_COMPRESS_POINTERS - Matcher<Node*> constant_pool_matcher = - IsChangeCompressedToTagged(m.IsLoadFromObject( - MachineType::AnyCompressed(), - c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), - c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - - kHeapObjectTag))); - EXPECT_THAT( - load_constant, - IsChangeCompressedToTagged(m.IsLoad( - MachineType::AnyCompressed(), constant_pool_matcher, - c::IsIntPtrAdd( - c::IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag), - c::IsWordShl(index, c::IsIntPtrConstant(kTaggedSizeLog2))), - LoadSensitivity::kCritical))); -#else - Matcher<Node*> constant_pool_matcher = m.IsLoadFromObject( - MachineType::AnyTagged(), - c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), - c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - - kHeapObjectTag)); - EXPECT_THAT( - load_constant, - m.IsLoad( - MachineType::AnyTagged(), constant_pool_matcher, - c::IsIntPtrAdd( - c::IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag), - c::IsWordShl(index, c::IsIntPtrConstant(kTaggedSizeLog2))), - LoadSensitivity::kCritical)); -#endif + TNode<Object> load_constant = + m.LoadConstantPoolEntry(m.ReinterpretCast<IntPtrT>(index)); + if (COMPRESS_POINTERS_BOOL && FLAG_turbo_decompression_elimination) { + Matcher<Node*> constant_pool_matcher = + IsChangeCompressedToTagged(m.IsLoadFromObject( + MachineType::AnyCompressed(), + c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), + c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - + kHeapObjectTag))); + EXPECT_THAT( + load_constant, + IsChangeCompressedToTagged(m.IsLoad( + MachineType::AnyCompressed(), constant_pool_matcher, + c::IsIntPtrAdd( + c::IsIntPtrConstant(FixedArray::kHeaderSize - + kHeapObjectTag), + c::IsWordShl(index, c::IsIntPtrConstant(kTaggedSizeLog2))), + LoadSensitivity::kCritical))); + } else { + Matcher<Node*> constant_pool_matcher = m.IsLoadFromObject( + MachineType::AnyTagged(), + c::IsParameter(InterpreterDispatchDescriptor::kBytecodeArray), + c::IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - + kHeapObjectTag)); + EXPECT_THAT( + load_constant, + m.IsLoad( + MachineType::AnyTagged(), constant_pool_matcher, + c::IsIntPtrAdd( + c::IsIntPtrConstant(FixedArray::kHeaderSize - + kHeapObjectTag), + c::IsWordShl(index, c::IsIntPtrConstant(kTaggedSizeLog2))), + LoadSensitivity::kCritical)); + } } } } @@ -517,15 +481,17 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) { m.ReinterpretCast<HeapObject>(m.IntPtrConstant(0xDEADBEEF)); int offset = 16; TNode<Object> load_field = m.LoadObjectField(object, offset); -#ifdef V8_COMPRESS_POINTERS - EXPECT_THAT(load_field, IsChangeCompressedToTagged(m.IsLoadFromObject( - MachineType::AnyCompressed(), Eq(object), - c::IsIntPtrConstant(offset - kHeapObjectTag)))); -#else - EXPECT_THAT(load_field, m.IsLoadFromObject( - MachineType::AnyTagged(), Eq(object), - c::IsIntPtrConstant(offset - kHeapObjectTag))); -#endif + if (COMPRESS_POINTERS_BOOL && FLAG_turbo_decompression_elimination) { + EXPECT_THAT(load_field, + IsChangeCompressedToTagged(m.IsLoadFromObject( + MachineType::AnyCompressed(), Eq(object), + c::IsIntPtrConstant(offset - kHeapObjectTag)))); + } else { + EXPECT_THAT( + load_field, + m.IsLoadFromObject(MachineType::AnyTagged(), Eq(object), + c::IsIntPtrConstant(offset - kHeapObjectTag))); + } } } @@ -554,10 +520,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) { Callable builtin = CodeFactory::InterpreterCEntry(isolate(), result_size); - TNode<Int32T> function_id = m.Int32Constant(0); + TNode<Uint32T> function_id = m.Uint32Constant(0); InterpreterAssembler::RegListNodePair registers(m.IntPtrConstant(1), m.Int32Constant(2)); - TNode<Object> context = m.ReinterpretCast<Object>(m.Int32Constant(4)); + TNode<Context> context = m.ReinterpretCast<Context>(m.Int32Constant(4)); Matcher<Node*> function_table = c::IsExternalConstant( ExternalReference::runtime_function_table_address_for_unittests( @@ -607,25 +573,28 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadFeedbackVector) { m.IsLoad(MachineType::Pointer(), c::IsLoadParentFramePointer(), c::IsIntPtrConstant(Register::function_closure().ToOperand() * kSystemPointerSize))); -#ifdef V8_COMPRESS_POINTERS - Matcher<Node*> load_vector_cell_matcher = - IsChangeCompressedPointerToTaggedPointer(m.IsLoadFromObject( - MachineType::CompressedPointer(), load_function_matcher, - c::IsIntPtrConstant(JSFunction::kFeedbackCellOffset - - kHeapObjectTag))); - EXPECT_THAT(load_feedback_vector, - IsChangeCompressedPointerToTaggedPointer(m.IsLoadFromObject( - MachineType::CompressedPointer(), load_vector_cell_matcher, - c::IsIntPtrConstant(Cell::kValueOffset - kHeapObjectTag)))); -#else - Matcher<Node*> load_vector_cell_matcher = m.IsLoadFromObject( - MachineType::TaggedPointer(), load_function_matcher, - c::IsIntPtrConstant(JSFunction::kFeedbackCellOffset - kHeapObjectTag)); - EXPECT_THAT(load_feedback_vector, - m.IsLoadFromObject( - MachineType::TaggedPointer(), load_vector_cell_matcher, - c::IsIntPtrConstant(Cell::kValueOffset - kHeapObjectTag))); -#endif + if (COMPRESS_POINTERS_BOOL && FLAG_turbo_decompression_elimination) { + Matcher<Node*> load_vector_cell_matcher = + IsChangeCompressedPointerToTaggedPointer(m.IsLoadFromObject( + MachineType::CompressedPointer(), load_function_matcher, + c::IsIntPtrConstant(JSFunction::kFeedbackCellOffset - + kHeapObjectTag))); + EXPECT_THAT( + load_feedback_vector, + IsChangeCompressedPointerToTaggedPointer(m.IsLoadFromObject( + MachineType::CompressedPointer(), load_vector_cell_matcher, + c::IsIntPtrConstant(Cell::kValueOffset - kHeapObjectTag)))); + } else { + Matcher<Node*> load_vector_cell_matcher = m.IsLoadFromObject( + MachineType::TaggedPointer(), load_function_matcher, + c::IsIntPtrConstant(JSFunction::kFeedbackCellOffset - + kHeapObjectTag)); + EXPECT_THAT( + load_feedback_vector, + m.IsLoadFromObject( + MachineType::TaggedPointer(), load_vector_cell_matcher, + c::IsIntPtrConstant(Cell::kValueOffset - kHeapObjectTag))); + } } } diff --git a/deps/v8/test/unittests/libplatform/default-worker-threads-task-runner-unittest.cc b/deps/v8/test/unittests/libplatform/default-worker-threads-task-runner-unittest.cc index 8d52e80e39..e9581cc80e 100644 --- a/deps/v8/test/unittests/libplatform/default-worker-threads-task-runner-unittest.cc +++ b/deps/v8/test/unittests/libplatform/default-worker-threads-task-runner-unittest.cc @@ -37,10 +37,10 @@ TEST(DefaultWorkerThreadsTaskRunnerUnittest, PostTaskOrder) { base::Semaphore semaphore(0); std::unique_ptr<TestTask> task1 = - base::make_unique<TestTask>([&] { order.push_back(1); }); + std::make_unique<TestTask>([&] { order.push_back(1); }); std::unique_ptr<TestTask> task2 = - base::make_unique<TestTask>([&] { order.push_back(2); }); - std::unique_ptr<TestTask> task3 = base::make_unique<TestTask>([&] { + std::make_unique<TestTask>([&] { order.push_back(2); }); + std::unique_ptr<TestTask> task3 = std::make_unique<TestTask>([&] { order.push_back(3); semaphore.Signal(); }); @@ -65,27 +65,27 @@ TEST(DefaultWorkerThreadsTaskRunnerUnittest, PostTaskOrderMultipleWorkers) { std::vector<int> order; std::atomic_int count{0}; - std::unique_ptr<TestTask> task1 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task1 = std::make_unique<TestTask>([&] { base::MutexGuard guard(&vector_lock); order.push_back(1); count++; }); - std::unique_ptr<TestTask> task2 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task2 = std::make_unique<TestTask>([&] { base::MutexGuard guard(&vector_lock); order.push_back(2); count++; }); - std::unique_ptr<TestTask> task3 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task3 = std::make_unique<TestTask>([&] { base::MutexGuard guard(&vector_lock); order.push_back(3); count++; }); - std::unique_ptr<TestTask> task4 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task4 = std::make_unique<TestTask>([&] { base::MutexGuard guard(&vector_lock); order.push_back(4); count++; }); - std::unique_ptr<TestTask> task5 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task5 = std::make_unique<TestTask>([&] { base::MutexGuard guard(&vector_lock); order.push_back(5); count++; @@ -123,7 +123,7 @@ class FakeClock { // PostTask will cause the condition variable WaitFor() call to be notified // early, rather than waiting for the real amount of time. WaitFor() listens // to the system clock and not our FakeClock. - runner->PostTask(base::make_unique<TestTask>([] {})); + runner->PostTask(std::make_unique<TestTask>([] {})); } private: @@ -140,13 +140,13 @@ TEST(DefaultWorkerThreadsTaskRunnerUnittest, PostDelayedTaskOrder) { base::Semaphore task1_semaphore(0); base::Semaphore task3_semaphore(0); - std::unique_ptr<TestTask> task1 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task1 = std::make_unique<TestTask>([&] { order.push_back(1); task1_semaphore.Signal(); }); std::unique_ptr<TestTask> task2 = - base::make_unique<TestTask>([&] { order.push_back(2); }); - std::unique_ptr<TestTask> task3 = base::make_unique<TestTask>([&] { + std::make_unique<TestTask>([&] { order.push_back(2); }); + std::unique_ptr<TestTask> task3 = std::make_unique<TestTask>([&] { order.push_back(3); task3_semaphore.Signal(); }); @@ -181,15 +181,15 @@ TEST(DefaultWorkerThreadsTaskRunnerUnittest, PostDelayedTaskOrder2) { base::Semaphore task2_semaphore(0); base::Semaphore task3_semaphore(0); - std::unique_ptr<TestTask> task1 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task1 = std::make_unique<TestTask>([&] { order.push_back(1); task1_semaphore.Signal(); }); - std::unique_ptr<TestTask> task2 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task2 = std::make_unique<TestTask>([&] { order.push_back(2); task2_semaphore.Signal(); }); - std::unique_ptr<TestTask> task3 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task3 = std::make_unique<TestTask>([&] { order.push_back(3); task3_semaphore.Signal(); }); @@ -230,15 +230,15 @@ TEST(DefaultWorkerThreadsTaskRunnerUnittest, PostAfterTerminate) { base::Semaphore task2_semaphore(0); base::Semaphore task3_semaphore(0); - std::unique_ptr<TestTask> task1 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task1 = std::make_unique<TestTask>([&] { order.push_back(1); task1_semaphore.Signal(); }); - std::unique_ptr<TestTask> task2 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task2 = std::make_unique<TestTask>([&] { order.push_back(2); task2_semaphore.Signal(); }); - std::unique_ptr<TestTask> task3 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task3 = std::make_unique<TestTask>([&] { order.push_back(3); task3_semaphore.Signal(); }); @@ -281,7 +281,7 @@ TEST(DefaultWorkerThreadsTaskRunnerUnittest, RunsTasksOnCurrentThread) { EXPECT_FALSE(runner.RunsTasksOnCurrentThread()); - std::unique_ptr<TestTask> task1 = base::make_unique<TestTask>([&] { + std::unique_ptr<TestTask> task1 = std::make_unique<TestTask>([&] { EXPECT_TRUE(runner.RunsTasksOnCurrentThread()); semaphore.Signal(); }); diff --git a/deps/v8/test/unittests/logging/counters-unittest.cc b/deps/v8/test/unittests/logging/counters-unittest.cc index dd38d80ee4..67cc7df465 100644 --- a/deps/v8/test/unittests/logging/counters-unittest.cc +++ b/deps/v8/test/unittests/logging/counters-unittest.cc @@ -149,16 +149,11 @@ class SnapshotNativeCounterTest : public TestWithNativeContextAndCounters { SnapshotNativeCounterTest() {} bool SupportsNativeCounters() const { -#ifdef V8_USE_SNAPSHOT #ifdef V8_SNAPSHOT_NATIVE_CODE_COUNTERS return true; #else return false; #endif // V8_SNAPSHOT_NATIVE_CODE_COUNTERS -#else - // If we do not have a snapshot then we rely on the runtime option. - return internal::FLAG_native_code_counters; -#endif // V8_USE_SNAPSHOT } #define SC(name, caption) \ diff --git a/deps/v8/test/unittests/objects/backing-store-unittest.cc b/deps/v8/test/unittests/objects/backing-store-unittest.cc new file mode 100644 index 0000000000..d00f5632fe --- /dev/null +++ b/deps/v8/test/unittests/objects/backing-store-unittest.cc @@ -0,0 +1,128 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/objects/backing-store.h" +#include "src/base/platform/platform.h" +#include "test/unittests/test-utils.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace v8 { +namespace internal { + +class BackingStoreTest : public TestWithIsolate {}; + +TEST_F(BackingStoreTest, GrowWasmMemoryInPlace) { + auto backing_store = + BackingStore::AllocateWasmMemory(isolate(), 1, 2, SharedFlag::kNotShared); + CHECK(backing_store); + EXPECT_TRUE(backing_store->is_wasm_memory()); + EXPECT_EQ(1 * wasm::kWasmPageSize, backing_store->byte_length()); + EXPECT_EQ(2 * wasm::kWasmPageSize, backing_store->byte_capacity()); + + bool success = backing_store->GrowWasmMemoryInPlace(isolate(), 1, 2); + EXPECT_TRUE(success); + EXPECT_EQ(2 * wasm::kWasmPageSize, backing_store->byte_length()); +} + +TEST_F(BackingStoreTest, GrowWasmMemoryInPlace_neg) { + auto backing_store = + BackingStore::AllocateWasmMemory(isolate(), 1, 2, SharedFlag::kNotShared); + CHECK(backing_store); + EXPECT_TRUE(backing_store->is_wasm_memory()); + EXPECT_EQ(1 * wasm::kWasmPageSize, backing_store->byte_length()); + EXPECT_EQ(2 * wasm::kWasmPageSize, backing_store->byte_capacity()); + + bool success = backing_store->GrowWasmMemoryInPlace(isolate(), 2, 2); + EXPECT_FALSE(success); + EXPECT_EQ(1 * wasm::kWasmPageSize, backing_store->byte_length()); +} + +TEST_F(BackingStoreTest, GrowSharedWasmMemoryInPlace) { + auto backing_store = + BackingStore::AllocateWasmMemory(isolate(), 2, 3, SharedFlag::kShared); + CHECK(backing_store); + EXPECT_TRUE(backing_store->is_wasm_memory()); + EXPECT_EQ(2 * wasm::kWasmPageSize, backing_store->byte_length()); + EXPECT_EQ(3 * wasm::kWasmPageSize, backing_store->byte_capacity()); + + bool success = backing_store->GrowWasmMemoryInPlace(isolate(), 1, 3); + EXPECT_TRUE(success); + EXPECT_EQ(3 * wasm::kWasmPageSize, backing_store->byte_length()); +} + +TEST_F(BackingStoreTest, CopyWasmMemory) { + auto bs1 = + BackingStore::AllocateWasmMemory(isolate(), 1, 2, SharedFlag::kNotShared); + CHECK(bs1); + EXPECT_TRUE(bs1->is_wasm_memory()); + EXPECT_EQ(1 * wasm::kWasmPageSize, bs1->byte_length()); + EXPECT_EQ(2 * wasm::kWasmPageSize, bs1->byte_capacity()); + + auto bs2 = bs1->CopyWasmMemory(isolate(), 3); + EXPECT_TRUE(bs2->is_wasm_memory()); + EXPECT_EQ(3 * wasm::kWasmPageSize, bs2->byte_length()); + EXPECT_EQ(3 * wasm::kWasmPageSize, bs2->byte_capacity()); +} + +class GrowerThread : public base::Thread { + public: + GrowerThread(Isolate* isolate, uint32_t increment, uint32_t max, + std::shared_ptr<BackingStore> backing_store) + : base::Thread(base::Thread::Options("GrowerThread")), + isolate_(isolate), + increment_(increment), + max_(max), + backing_store_(backing_store) {} + + void Run() override { + size_t max_length = max_ * wasm::kWasmPageSize; + while (true) { + size_t current_length = backing_store_->byte_length(); + if (current_length >= max_length) break; + bool result = + backing_store_->GrowWasmMemoryInPlace(isolate_, increment_, max_); + size_t new_length = backing_store_->byte_length(); + if (result) { + CHECK_GE(new_length, current_length + increment_); + } else { + CHECK_EQ(max_length, new_length); + } + } + } + + private: + Isolate* isolate_; + uint32_t increment_; + uint32_t max_; + std::shared_ptr<BackingStore> backing_store_; +}; + +TEST_F(BackingStoreTest, RacyGrowWasmMemoryInPlace) { + constexpr int kNumThreads = 10; + constexpr int kMaxPages = 1024; + GrowerThread* threads[kNumThreads]; + + std::shared_ptr<BackingStore> backing_store = + BackingStore::AllocateWasmMemory(isolate(), 0, kMaxPages, + SharedFlag::kShared); + + for (int i = 0; i < kNumThreads; i++) { + threads[i] = new GrowerThread(isolate(), 1, kMaxPages, backing_store); + CHECK(threads[i]->Start()); + } + + for (int i = 0; i < kNumThreads; i++) { + threads[i]->Join(); + } + + EXPECT_EQ(kMaxPages * wasm::kWasmPageSize, backing_store->byte_length()); + + for (int i = 0; i < kNumThreads; i++) { + delete threads[i]; + } +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/objects/object-unittest.cc b/deps/v8/test/unittests/objects/object-unittest.cc index 67dfc0f9db..b1768e0923 100644 --- a/deps/v8/test/unittests/objects/object-unittest.cc +++ b/deps/v8/test/unittests/objects/object-unittest.cc @@ -72,25 +72,34 @@ TEST(Object, InstanceTypeListOrder) { << " vs. current = " << current_type; \ last = current; - INSTANCE_TYPE_LIST(TEST_INSTANCE_TYPE) + // Only test hand-written portion of instance type list. The generated portion + // doesn't run the same risk of getting out of order, and it does emit type + // names out of numerical order in one case: JS_OBJECT_TYPE is emitted before + // its subclass types, because types are emitted in depth-first pre-order + // traversal order, and some of its subclass types are numerically earlier. + INSTANCE_TYPE_LIST_BASE(TEST_INSTANCE_TYPE) #undef TEST_INSTANCE_TYPE } TEST(Object, StructListOrder) { - int current = static_cast<int>(InstanceType::ACCESS_CHECK_INFO_TYPE); + int current = static_cast<int>(InstanceType::FIRST_STRUCT_TYPE); int last = current - 1; ASSERT_LT(0, last); InstanceType current_type = static_cast<InstanceType>(current); #define TEST_STRUCT(TYPE, class, name) \ current_type = InstanceType::TYPE; \ current = static_cast<int>(current_type); \ - EXPECT_EQ(last + 1, current) \ + EXPECT_LE(last + 1, current) \ << " STRUCT_LIST is not ordered: " \ << " last = " << static_cast<InstanceType>(last) \ << " vs. current = " << current_type; \ last = current; - STRUCT_LIST(TEST_STRUCT) + // Only test the _BASE portion (the hand-coded part). Note that the values are + // not necessarily consecutive because some Structs that need special + // handling, such as those that have multiple Map instances associated, are + // omitted from this list. + STRUCT_LIST_GENERATOR_BASE(STRUCT_LIST_ADAPTER, TEST_STRUCT) #undef TEST_STRUCT } diff --git a/deps/v8/test/unittests/objects/osr-optimized-code-cache-unittest.cc b/deps/v8/test/unittests/objects/osr-optimized-code-cache-unittest.cc new file mode 100644 index 0000000000..225048de63 --- /dev/null +++ b/deps/v8/test/unittests/objects/osr-optimized-code-cache-unittest.cc @@ -0,0 +1,412 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <cmath> +#include <iostream> +#include <limits> + +#include "src/deoptimizer/deoptimizer.h" +#include "src/objects/objects-inl.h" +#include "src/objects/objects.h" +#include "src/objects/osr-optimized-code-cache.h" +#include "test/unittests/test-utils.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace v8 { +namespace internal { + +namespace { + +const char* code_template_string = + "function f%d() { return 0; };" + "%%PrepareFunctionForOptimization(f%d);" + "f%d(); f%d();" + "%%OptimizeFunctionOnNextCall(f%d);" + "f%d(); f%d;"; + +void GetSource(i::ScopedVector<char>* source, int index) { + i::SNPrintF(*source, code_template_string, index, index, index, index, index, + index, index); +} + +const int kInitialLength = OSROptimizedCodeCache::kInitialLength; +const int kInitialEntries = + kInitialLength / OSROptimizedCodeCache::kEntryLength; +const int kMaxLength = OSROptimizedCodeCache::kMaxLength; +const int kMaxEntries = kMaxLength / OSROptimizedCodeCache::kEntryLength; + +} // namespace + +TEST_F(TestWithNativeContext, AddCodeToEmptyCache) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + BailoutId bailout_id(1); + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + bailout_id); + + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kInitialLength); + + HeapObject sfi_entry; + osr_cache->Get(OSROptimizedCodeCache::kSharedOffset) + ->GetHeapObject(&sfi_entry); + EXPECT_EQ(sfi_entry, *shared); + HeapObject code_entry; + osr_cache->Get(OSROptimizedCodeCache::kCachedCodeOffset) + ->GetHeapObject(&code_entry); + EXPECT_EQ(code_entry, *code); + Smi osr_offset_entry; + osr_cache->Get(OSROptimizedCodeCache::kOsrIdOffset)->ToSmi(&osr_offset_entry); + EXPECT_EQ(osr_offset_entry.value(), bailout_id.ToInt()); +} + +TEST_F(TestWithNativeContext, GrowCodeCache) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + + int bailout_id = 0; + for (bailout_id = 0; bailout_id < kInitialEntries; bailout_id++) { + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + } + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kInitialLength); + + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kInitialLength * 2); + + int index = kInitialLength; + HeapObject sfi_entry; + osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->GetHeapObject(&sfi_entry); + EXPECT_EQ(sfi_entry, *shared); + HeapObject code_entry; + osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->GetHeapObject(&code_entry); + EXPECT_EQ(code_entry, *code); + Smi osr_offset_entry; + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset) + ->ToSmi(&osr_offset_entry); + EXPECT_EQ(osr_offset_entry.value(), bailout_id); +} + +TEST_F(TestWithNativeContext, FindCachedEntry) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + + int bailout_id = 0; + for (bailout_id = 0; bailout_id < kInitialEntries; bailout_id++) { + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + } + + i::ScopedVector<char> source1(1024); + GetSource(&source1, 1); + Handle<JSFunction> function1 = RunJS<JSFunction>(source1.begin()); + Handle<SharedFunctionInfo> shared1(function1->shared(), isolate); + Handle<Code> code1(function1->code(), isolate); + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared1, code1, + BailoutId(bailout_id)); + + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->GetOptimizedCode(shared, BailoutId(0), isolate), *code); + EXPECT_EQ( + osr_cache->GetOptimizedCode(shared1, BailoutId(bailout_id), isolate), + *code1); + + RunJS("%DeoptimizeFunction(f1)"); + EXPECT_TRUE( + osr_cache->GetOptimizedCode(shared1, BailoutId(bailout_id), isolate) + .is_null()); + + osr_cache->Set(OSROptimizedCodeCache::kCachedCodeOffset, + HeapObjectReference::ClearedValue(isolate)); + EXPECT_TRUE( + osr_cache->GetOptimizedCode(shared, BailoutId(0), isolate).is_null()); +} + +TEST_F(TestWithNativeContext, MaxCapacityCache) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + + int bailout_id = 0; + // Add max_capacity - 1 entries. + for (bailout_id = 0; bailout_id < kMaxEntries - 1; bailout_id++) { + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + } + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kMaxLength); + + // Add an entry to reach max capacity. + i::ScopedVector<char> source1(1024); + GetSource(&source1, 1); + Handle<JSFunction> function1 = RunJS<JSFunction>(source1.begin()); + Handle<SharedFunctionInfo> shared1(function1->shared(), isolate); + Handle<Code> code1(function1->code(), isolate); + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared1, code1, + BailoutId(bailout_id)); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kMaxLength); + + int index = (kMaxEntries - 1) * OSROptimizedCodeCache::kEntryLength; + HeapObject object; + Smi smi; + osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *shared1); + osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *code1); + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset)->ToSmi(&smi); + EXPECT_EQ(smi.value(), bailout_id); + + // Add an entry beyond max capacity. + i::ScopedVector<char> source2(1024); + GetSource(&source2, 2); + Handle<JSFunction> function2 = RunJS<JSFunction>(source2.begin()); + Handle<SharedFunctionInfo> shared2(function2->shared(), isolate); + Handle<Code> code2(function2->code(), isolate); + bailout_id++; + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared2, code2, + BailoutId(bailout_id)); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kMaxLength); + + index = 0; + osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *shared2); + osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *code2); + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset)->ToSmi(&smi); + EXPECT_EQ(smi.value(), bailout_id); +} + +TEST_F(TestWithNativeContext, ReuseClearedEntry) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + + int num_entries = kInitialEntries * 2; + int expected_length = kInitialLength * 2; + int bailout_id = 0; + for (bailout_id = 0; bailout_id < num_entries; bailout_id++) { + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + } + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), expected_length); + + int clear_index1 = 0; + int clear_index2 = (num_entries - 1) * OSROptimizedCodeCache::kEntryLength; + osr_cache->Set(clear_index1 + OSROptimizedCodeCache::kSharedOffset, + HeapObjectReference::ClearedValue(isolate)); + osr_cache->Set(clear_index2 + OSROptimizedCodeCache::kCachedCodeOffset, + HeapObjectReference::ClearedValue(isolate)); + + i::ScopedVector<char> source1(1024); + GetSource(&source1, 1); + Handle<JSFunction> function1 = RunJS<JSFunction>(source1.begin()); + Handle<SharedFunctionInfo> shared1(function1->shared(), isolate); + Handle<Code> code1(function1->code(), isolate); + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared1, code1, + BailoutId(bailout_id)); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), expected_length); + + int index = clear_index1; + HeapObject object; + Smi smi; + osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *shared1); + osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *code1); + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset)->ToSmi(&smi); + EXPECT_EQ(smi.value(), bailout_id); + + i::ScopedVector<char> source2(1024); + GetSource(&source2, 2); + Handle<JSFunction> function2 = RunJS<JSFunction>(source2.begin()); + Handle<SharedFunctionInfo> shared2(function2->shared(), isolate); + Handle<Code> code2(function2->code(), isolate); + bailout_id++; + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared2, code2, + BailoutId(bailout_id)); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), expected_length); + + index = clear_index2; + osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *shared2); + osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->GetHeapObject(&object); + EXPECT_EQ(object, *code2); + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset)->ToSmi(&smi); + EXPECT_EQ(smi.value(), bailout_id); +} + +TEST_F(TestWithNativeContext, EvictDeoptedEntriesNoCompact) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + + i::ScopedVector<char> source1(1024); + GetSource(&source1, 1); + Handle<JSFunction> deopt_function = RunJS<JSFunction>(source1.begin()); + Handle<SharedFunctionInfo> deopt_shared(deopt_function->shared(), isolate); + Handle<Code> deopt_code(deopt_function->code(), isolate); + + int num_entries = kInitialEntries * 2; + int expected_length = kInitialLength * 2; + int deopt_id1 = num_entries - 2; + int deopt_id2 = 0; + int bailout_id = 0; + for (bailout_id = 0; bailout_id < num_entries; bailout_id++) { + if (bailout_id == deopt_id1 || bailout_id == deopt_id2) { + OSROptimizedCodeCache::AddOptimizedCode( + native_context, deopt_shared, deopt_code, BailoutId(bailout_id)); + } else { + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + } + } + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), expected_length); + + RunJS("%DeoptimizeFunction(f1)"); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), expected_length); + + int index = (num_entries - 2) * OSROptimizedCodeCache::kEntryLength; + EXPECT_TRUE(osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->IsCleared()); + EXPECT_TRUE(osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->IsCleared()); + EXPECT_TRUE( + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset)->IsCleared()); + + index = (num_entries - 1) * OSROptimizedCodeCache::kEntryLength; + EXPECT_TRUE(osr_cache->Get(index + OSROptimizedCodeCache::kSharedOffset) + ->IsCleared()); + EXPECT_TRUE(osr_cache->Get(index + OSROptimizedCodeCache::kCachedCodeOffset) + ->IsCleared()); + EXPECT_TRUE( + osr_cache->Get(index + OSROptimizedCodeCache::kOsrIdOffset)->IsCleared()); +} + +TEST_F(TestWithNativeContext, EvictDeoptedEntriesCompact) { + if (!i::FLAG_opt) return; + + i::FLAG_allow_natives_syntax = true; + + i::ScopedVector<char> source(1024); + GetSource(&source, 0); + Handle<JSFunction> function = RunJS<JSFunction>(source.begin()); + Isolate* isolate = function->GetIsolate(); + Handle<NativeContext> native_context(function->native_context(), isolate); + Handle<SharedFunctionInfo> shared(function->shared(), isolate); + Handle<Code> code(function->code(), isolate); + + i::ScopedVector<char> source1(1024); + GetSource(&source1, 1); + Handle<JSFunction> deopt_function = RunJS<JSFunction>(source1.begin()); + Handle<SharedFunctionInfo> deopt_shared(deopt_function->shared(), isolate); + Handle<Code> deopt_code(deopt_function->code(), isolate); + + int num_entries = kInitialEntries + 1; + int expected_length = kInitialLength * 2; + int bailout_id = 0; + for (bailout_id = 0; bailout_id < num_entries; bailout_id++) { + if (bailout_id % 2 == 0) { + OSROptimizedCodeCache::AddOptimizedCode( + native_context, deopt_shared, deopt_code, BailoutId(bailout_id)); + } else { + OSROptimizedCodeCache::AddOptimizedCode(native_context, shared, code, + BailoutId(bailout_id)); + } + } + Handle<OSROptimizedCodeCache> osr_cache( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), expected_length); + + RunJS("%DeoptimizeFunction(f1)"); + osr_cache = Handle<OSROptimizedCodeCache>( + native_context->GetOSROptimizedCodeCache(), isolate); + EXPECT_EQ(osr_cache->length(), kInitialLength); +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/objects/value-serializer-unittest.cc b/deps/v8/test/unittests/objects/value-serializer-unittest.cc index a3a6fb22a7..d5583d5a69 100644 --- a/deps/v8/test/unittests/objects/value-serializer-unittest.cc +++ b/deps/v8/test/unittests/objects/value-serializer-unittest.cc @@ -10,6 +10,7 @@ #include "include/v8.h" #include "src/api/api-inl.h" #include "src/base/build_config.h" +#include "src/objects/backing-store.h" #include "src/objects/objects-inl.h" #include "src/wasm/wasm-objects.h" #include "test/unittests/test-utils.h" @@ -1729,7 +1730,7 @@ class ValueSerializerTestWithArrayBufferTransfer : public ValueSerializerTest { Context::Scope scope(deserialization_context()); output_buffer_ = ArrayBuffer::New(isolate(), kTestByteLength); const uint8_t data[kTestByteLength] = {0x00, 0x01, 0x80, 0xFF}; - memcpy(output_buffer_->GetContents().Data(), data, kTestByteLength); + memcpy(output_buffer_->GetBackingStore()->Data(), data, kTestByteLength); } } @@ -1987,23 +1988,44 @@ class ValueSerializerTestWithSharedArrayBufferClone ValueSerializerTestWithSharedArrayBufferClone() : serializer_delegate_(this), deserializer_delegate_(this) {} - void InitializeData(const std::vector<uint8_t>& data) { + void InitializeData(const std::vector<uint8_t>& data, bool is_wasm_memory) { data_ = data; { Context::Scope scope(serialization_context()); input_buffer_ = - SharedArrayBuffer::New(isolate(), data_.data(), data_.size()); + NewSharedArrayBuffer(data_.data(), data_.size(), is_wasm_memory); } { Context::Scope scope(deserialization_context()); output_buffer_ = - SharedArrayBuffer::New(isolate(), data_.data(), data_.size()); + NewSharedArrayBuffer(data_.data(), data_.size(), is_wasm_memory); } } const Local<SharedArrayBuffer>& input_buffer() { return input_buffer_; } const Local<SharedArrayBuffer>& output_buffer() { return output_buffer_; } + Local<SharedArrayBuffer> NewSharedArrayBuffer(void* data, size_t byte_length, + bool is_wasm_memory) { + if (is_wasm_memory) { + // TODO(titzer): there is no way to create Wasm memory backing stores + // through the API, or to create a shared array buffer whose backing + // store is wasm memory, so use the internal API. + DCHECK_EQ(0, byte_length % i::wasm::kWasmPageSize); + auto pages = byte_length / i::wasm::kWasmPageSize; + auto i_isolate = reinterpret_cast<i::Isolate*>(isolate()); + auto backing_store = i::BackingStore::AllocateWasmMemory( + i_isolate, pages, pages, i::SharedFlag::kShared); + memcpy(backing_store->buffer_start(), data, byte_length); + i::Handle<i::JSArrayBuffer> buffer = + i_isolate->factory()->NewJSSharedArrayBuffer( + std::move(backing_store)); + return Utils::ToLocalShared(buffer); + } else { + return SharedArrayBuffer::New(isolate(), data, byte_length); + } + } + static void SetUpTestCase() { flag_was_enabled_ = i::FLAG_harmony_sharedarraybuffer; i::FLAG_harmony_sharedarraybuffer = true; @@ -2075,7 +2097,7 @@ bool ValueSerializerTestWithSharedArrayBufferClone::flag_was_enabled_ = false; TEST_F(ValueSerializerTestWithSharedArrayBufferClone, RoundTripSharedArrayBufferClone) { - InitializeData({0x00, 0x01, 0x80, 0xFF}); + InitializeData({0x00, 0x01, 0x80, 0xFF}, false); EXPECT_CALL(serializer_delegate_, GetSharedArrayBufferId(isolate(), input_buffer())) @@ -2114,7 +2136,7 @@ TEST_F(ValueSerializerTestWithSharedArrayBufferClone, std::vector<uint8_t> data = {0x00, 0x01, 0x80, 0xFF}; data.resize(65536); - InitializeData(data); + InitializeData(data, true); EXPECT_CALL(serializer_delegate_, GetSharedArrayBufferId(isolate(), input_buffer())) @@ -2487,35 +2509,32 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest { class SerializeToTransfer : public ValueSerializer::Delegate { public: - SerializeToTransfer( - std::vector<WasmModuleObject::TransferrableModule>* modules) + explicit SerializeToTransfer(std::vector<CompiledWasmModule>* modules) : modules_(modules) {} Maybe<uint32_t> GetWasmModuleTransferId( Isolate* isolate, Local<WasmModuleObject> module) override { - modules_->push_back(module->GetTransferrableModule()); + modules_->push_back(module->GetCompiledModule()); return Just(static_cast<uint32_t>(modules_->size()) - 1); } void ThrowDataCloneError(Local<String> message) override { UNREACHABLE(); } private: - std::vector<WasmModuleObject::TransferrableModule>* modules_; + std::vector<CompiledWasmModule>* modules_; }; class DeserializeFromTransfer : public ValueDeserializer::Delegate { public: - DeserializeFromTransfer( - std::vector<WasmModuleObject::TransferrableModule>* modules) + explicit DeserializeFromTransfer(std::vector<CompiledWasmModule>* modules) : modules_(modules) {} MaybeLocal<WasmModuleObject> GetWasmModuleFromId(Isolate* isolate, uint32_t id) override { - return WasmModuleObject::FromTransferrableModule(isolate, - modules_->at(id)); + return WasmModuleObject::FromCompiledModule(isolate, modules_->at(id)); } private: - std::vector<WasmModuleObject::TransferrableModule>* modules_; + std::vector<CompiledWasmModule>* modules_; }; ValueSerializer::Delegate* GetSerializerDelegate() override { @@ -2595,7 +2614,7 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest { private: static bool g_saved_flag; - std::vector<WasmModuleObject::TransferrableModule> transfer_modules_; + std::vector<CompiledWasmModule> transfer_modules_; SerializeToTransfer serialize_delegate_; DeserializeFromTransfer deserialize_delegate_; ValueSerializer::Delegate* current_serializer_delegate_ = nullptr; diff --git a/deps/v8/test/unittests/tasks/background-compile-task-unittest.cc b/deps/v8/test/unittests/tasks/background-compile-task-unittest.cc index 8c3fb017a4..a9a0fac66b 100644 --- a/deps/v8/test/unittests/tasks/background-compile-task-unittest.cc +++ b/deps/v8/test/unittests/tasks/background-compile-task-unittest.cc @@ -9,7 +9,6 @@ #include "src/ast/ast.h" #include "src/ast/scopes.h" #include "src/base/platform/semaphore.h" -#include "src/base/template-utils.h" #include "src/codegen/compiler.h" #include "src/execution/isolate-inl.h" #include "src/flags/flags.h" @@ -198,7 +197,7 @@ TEST_F(BackgroundCompileTaskTest, CompileOnBackgroundThread) { NewBackgroundCompileTask(isolate(), shared)); base::Semaphore semaphore(0); - auto background_task = base::make_unique<CompileTask>(task.get(), &semaphore); + auto background_task = std::make_unique<CompileTask>(task.get(), &semaphore); V8::GetCurrentPlatform()->CallOnWorkerThread(std::move(background_task)); semaphore.Wait(); diff --git a/deps/v8/test/unittests/tasks/cancelable-tasks-unittest.cc b/deps/v8/test/unittests/tasks/cancelable-tasks-unittest.cc index 2a0e7d7f90..63ddaae758 100644 --- a/deps/v8/test/unittests/tasks/cancelable-tasks-unittest.cc +++ b/deps/v8/test/unittests/tasks/cancelable-tasks-unittest.cc @@ -74,7 +74,7 @@ class CancelableTaskManagerTest : public ::testing::Test { std::unique_ptr<TestTask> NewTask( ResultType* result, TestTask::Mode mode = TestTask::kDoNothing) { - return base::make_unique<TestTask>(this, result, mode); + return std::make_unique<TestTask>(this, result, mode); } void CancelAndWait() { diff --git a/deps/v8/test/unittests/test-helpers.cc b/deps/v8/test/unittests/test-helpers.cc index 614ddba4f5..1011c39fc5 100644 --- a/deps/v8/test/unittests/test-helpers.cc +++ b/deps/v8/test/unittests/test-helpers.cc @@ -6,7 +6,6 @@ #include "include/v8.h" #include "src/api/api.h" -#include "src/base/template-utils.h" #include "src/execution/isolate.h" #include "src/handles/handles.h" #include "src/objects/objects-inl.h" @@ -59,7 +58,7 @@ std::unique_ptr<ParseInfo> OuterParseInfoForShared( Handle<Script> script = Handle<Script>::cast(handle(shared->script(), isolate)); std::unique_ptr<ParseInfo> result = - base::make_unique<ParseInfo>(isolate, script); + std::make_unique<ParseInfo>(isolate, script); // Create a character stream to simulate the parser having done so for the // to-level ParseProgram. diff --git a/deps/v8/test/unittests/unittests.status b/deps/v8/test/unittests/unittests.status index def90fc3b5..08022d5689 100644 --- a/deps/v8/test/unittests/unittests.status +++ b/deps/v8/test/unittests/unittests.status @@ -14,19 +14,13 @@ 'RandomNumberGenerator.NextSampleInvalidParam': [SKIP], 'RandomNumberGenerator.NextSampleSlowInvalidParam1': [SKIP], 'RandomNumberGenerator.NextSampleSlowInvalidParam2': [SKIP], -}], # 'system == macos and asan' - -['(arch == arm or arch == mips) and not simulator_run', { - # Uses too much memory. - 'Parameterized/WasmCodeManagerTest.GrowingVsFixedModule/Fixed': [SKIP] -}], # '(arch == arm or arch == mips) and not simulator_run' +}], # system == macos and asan ############################################################################## ['lite_mode or variant == jitless', { # TODO(v8:7777): Re-enable once wasm is supported in jitless mode. 'ValueSerializerTestWithSharedArrayBufferClone.RoundTripWebAssemblyMemory': [SKIP], 'ValueSerializerTestWithWasm.*': [SKIP], - 'Parameterized/WasmCodeManagerTest.*': [SKIP], }], # lite_mode or variant == jitless ############################################################################## @@ -37,19 +31,18 @@ ['system == windows and asan', { # BUG(893437). 'Torque*': [SKIP], -}], # 'system == windows and asan' +}], # system == windows and asan ['system == windows and arch == x64 and mode == release', { # BUG(992783). 'Torque.ConditionalFields': [SKIP], 'Torque.UsingUnderscorePrefixedIdentifierError': [SKIP], -}], # 'system == windows and arch == x64 and mode == release' +}], # system == windows and arch == x64 and mode == release -############################################################################## ['tsan == True', { # https://crbug.com/v8/9380 # The test is broken and needs to be fixed to use separate isolates. 'BackingStoreTest.RacyGrowWasmMemoryInPlace': [SKIP], -}], # 'tsan == True' +}], # tsan == True ] diff --git a/deps/v8/test/unittests/wasm/OWNERS b/deps/v8/test/unittests/wasm/OWNERS index dc68b39733..16b08f3b3b 100644 --- a/deps/v8/test/unittests/wasm/OWNERS +++ b/deps/v8/test/unittests/wasm/OWNERS @@ -1,5 +1,5 @@ ahaas@chromium.org -clemensh@chromium.org +clemensb@chromium.org titzer@chromium.org # COMPONENT: Blink>JavaScript>WebAssembly diff --git a/deps/v8/test/unittests/wasm/control-transfer-unittest.cc b/deps/v8/test/unittests/wasm/control-transfer-unittest.cc index 29cb176197..54f22135f1 100644 --- a/deps/v8/test/unittests/wasm/control-transfer-unittest.cc +++ b/deps/v8/test/unittests/wasm/control-transfer-unittest.cc @@ -87,8 +87,7 @@ class ControlTransferTest : public TestWithZone { } void CheckNoOtherTargets( - const byte* start, const byte* end, - ControlTransferMap& map, // NOLINT(runtime/references) + const byte* start, const byte* end, const ControlTransferMap& map, std::initializer_list<ExpectedControlTransfer> targets) { // Check there are no other control targets. for (pc_t pc = 0; start + pc < end; pc++) { diff --git a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc index 791770ee94..7e55283b61 100644 --- a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc @@ -33,8 +33,8 @@ namespace function_body_decoder_unittest { #define WASM_IF_OP kExprIf, kLocalVoid #define WASM_LOOP_OP kExprLoop, kLocalVoid -static const byte kCodeGetLocal0[] = {kExprGetLocal, 0}; -static const byte kCodeGetLocal1[] = {kExprGetLocal, 1}; +static const byte kCodeGetLocal0[] = {kExprLocalGet, 0}; +static const byte kCodeGetLocal1[] = {kExprLocalGet, 1}; static const byte kCodeSetLocal0[] = {WASM_SET_LOCAL(0, WASM_ZERO)}; static const byte kCodeTeeLocal0[] = {WASM_TEE_LOCAL(0, WASM_ZERO)}; @@ -408,7 +408,7 @@ TEST_F(FunctionBodyDecoderTest, GetLocalN_local) { for (byte i = 1; i < 8; i++) { AddLocals(kWasmI32, 1); for (byte j = 0; j < i; j++) { - ExpectValidates(sigs.i_v(), {kExprGetLocal, j}); + ExpectValidates(sigs.i_v(), {kExprLocalGet, j}); } } } @@ -422,7 +422,7 @@ TEST_F(FunctionBodyDecoderTest, GetLocal1_fail_no_locals) { } TEST_F(FunctionBodyDecoderTest, GetLocal_off_end) { - ExpectFailure(sigs.i_i(), {kExprGetLocal}); + ExpectFailure(sigs.i_i(), {kExprLocalGet}); } TEST_F(FunctionBodyDecoderTest, NumLocalBelowLimit) { @@ -444,29 +444,29 @@ TEST_F(FunctionBodyDecoderTest, GetLocal_varint) { const int kMaxLocals = kV8MaxWasmFunctionLocals - 1; AddLocals(kWasmI32, kMaxLocals); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_1(66)}); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_2(7777)}); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_3(8888)}); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_4(9999)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_1(66)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_2(7777)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_3(8888)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_4(9999)}); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_5(kMaxLocals - 1)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_5(kMaxLocals - 1)}); - ExpectFailure(sigs.i_i(), {kExprGetLocal, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}); + ExpectFailure(sigs.i_i(), {kExprLocalGet, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_4(kMaxLocals - 1)}); - ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_4(kMaxLocals)}); - ExpectFailure(sigs.i_i(), {kExprGetLocal, U32V_4(kMaxLocals + 1)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_4(kMaxLocals - 1)}); + ExpectValidates(sigs.i_i(), {kExprLocalGet, U32V_4(kMaxLocals)}); + ExpectFailure(sigs.i_i(), {kExprLocalGet, U32V_4(kMaxLocals + 1)}); - ExpectFailure(sigs.i_v(), {kExprGetLocal, U32V_4(kMaxLocals)}); - ExpectFailure(sigs.i_v(), {kExprGetLocal, U32V_4(kMaxLocals + 1)}); + ExpectFailure(sigs.i_v(), {kExprLocalGet, U32V_4(kMaxLocals)}); + ExpectFailure(sigs.i_v(), {kExprLocalGet, U32V_4(kMaxLocals + 1)}); } TEST_F(FunctionBodyDecoderTest, GetLocal_toomany) { AddLocals(kWasmI32, kV8MaxWasmFunctionLocals - 100); AddLocals(kWasmI32, 100); - ExpectValidates(sigs.i_v(), {kExprGetLocal, U32V_1(66)}); - ExpectFailure(sigs.i_i(), {kExprGetLocal, U32V_1(66)}); + ExpectValidates(sigs.i_v(), {kExprLocalGet, U32V_1(66)}); + ExpectFailure(sigs.i_i(), {kExprLocalGet, U32V_1(66)}); } TEST_F(FunctionBodyDecoderTest, Binops_off_end) { @@ -476,13 +476,13 @@ TEST_F(FunctionBodyDecoderTest, Binops_off_end) { ExpectFailure(sigs.i_i(), code1); } - byte code3[] = {kExprGetLocal, 0, 0}; // [expr] [opcode] + byte code3[] = {kExprLocalGet, 0, 0}; // [expr] [opcode] for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) { code3[2] = kInt32BinopOpcodes[i]; ExpectFailure(sigs.i_i(), code3); } - byte code4[] = {kExprGetLocal, 0, 0, 0}; // [expr] [opcode] [opcode] + byte code4[] = {kExprLocalGet, 0, 0, 0}; // [expr] [opcode] [opcode] for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) { code4[2] = kInt32BinopOpcodes[i]; code4[3] = kInt32BinopOpcodes[i]; @@ -778,7 +778,7 @@ TEST_F(FunctionBodyDecoderTest, If_else_else) { } TEST_F(FunctionBodyDecoderTest, IfEmpty) { - ExpectValidates(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP, kExprEnd}); + ExpectValidates(sigs.v_i(), {kExprLocalGet, 0, WASM_IF_OP, kExprEnd}); } TEST_F(FunctionBodyDecoderTest, IfSet) { @@ -852,15 +852,15 @@ TEST_F(FunctionBodyDecoderTest, IfNop) { } TEST_F(FunctionBodyDecoderTest, If_end) { - ExpectValidates(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP, kExprEnd}); - ExpectFailure(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP, kExprEnd, kExprEnd}); + ExpectValidates(sigs.v_i(), {kExprLocalGet, 0, WASM_IF_OP, kExprEnd}); + ExpectFailure(sigs.v_i(), {kExprLocalGet, 0, WASM_IF_OP, kExprEnd, kExprEnd}); } TEST_F(FunctionBodyDecoderTest, If_falloff1) { - ExpectFailure(sigs.v_i(), {kExprGetLocal, 0, kExprIf}); - ExpectFailure(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP}); + ExpectFailure(sigs.v_i(), {kExprLocalGet, 0, kExprIf}); + ExpectFailure(sigs.v_i(), {kExprLocalGet, 0, WASM_IF_OP}); ExpectFailure(sigs.v_i(), - {kExprGetLocal, 0, WASM_IF_OP, kExprNop, kExprElse}); + {kExprLocalGet, 0, WASM_IF_OP, kExprNop, kExprElse}); } TEST_F(FunctionBodyDecoderTest, IfElseNop) { @@ -1001,7 +1001,7 @@ TEST_F(FunctionBodyDecoderTest, ReturnVoid3) { ExpectFailure(sigs.v_v(), {kExprRefNull}); ExpectFailure(sigs.v_v(), {kExprRefFunc, 0}); - ExpectFailure(sigs.v_i(), {kExprGetLocal, 0}); + ExpectFailure(sigs.v_i(), {kExprLocalGet, 0}); } TEST_F(FunctionBodyDecoderTest, Unreachable1) { @@ -3485,10 +3485,10 @@ TEST_F(WasmOpcodeLengthTest, MiscExpressions) { ExpectLength(5, kExprF32Const); ExpectLength(9, kExprF64Const); ExpectLength(1, kExprRefNull); - ExpectLength(2, kExprGetLocal); - ExpectLength(2, kExprSetLocal); - ExpectLength(2, kExprGetGlobal); - ExpectLength(2, kExprSetGlobal); + ExpectLength(2, kExprLocalGet); + ExpectLength(2, kExprLocalSet); + ExpectLength(2, kExprGlobalGet); + ExpectLength(2, kExprGlobalSet); ExpectLength(2, kExprCallFunction); ExpectLength(3, kExprCallIndirect); } @@ -3514,11 +3514,11 @@ TEST_F(WasmOpcodeLengthTest, I64Const) { } TEST_F(WasmOpcodeLengthTest, VariableLength) { - ExpectLength(2, kExprGetGlobal, U32V_1(1)); - ExpectLength(3, kExprGetGlobal, U32V_2(33)); - ExpectLength(4, kExprGetGlobal, U32V_3(44)); - ExpectLength(5, kExprGetGlobal, U32V_4(66)); - ExpectLength(6, kExprGetGlobal, U32V_5(77)); + ExpectLength(2, kExprGlobalGet, U32V_1(1)); + ExpectLength(3, kExprGlobalGet, U32V_2(33)); + ExpectLength(4, kExprGlobalGet, U32V_3(44)); + ExpectLength(5, kExprGlobalGet, U32V_4(66)); + ExpectLength(6, kExprGlobalGet, U32V_5(77)); ExpectLength(2, kExprRefFunc, U32V_1(1)); ExpectLength(3, kExprRefFunc, U32V_2(33)); diff --git a/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc b/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc index 5f56da3a23..97e7dee27e 100644 --- a/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc +++ b/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc @@ -111,7 +111,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) { TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { num_locals = 65000; for (int i = 13; i < 65000; i = static_cast<int>(i * 1.5)) { - byte code[] = {WASM_LOOP(WASM_I32V_1(11), kExprSetLocal, U32V_3(i))}; + byte code[] = {WASM_LOOP(WASM_I32V_1(11), kExprLocalSet, U32V_3(i))}; BitVector* assigned = Analyze(code, code + arraysize(code)); for (int j = 0; j < assigned->length(); j++) { @@ -185,7 +185,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Malformed) { TEST_F(WasmLoopAssignmentAnalyzerTest, regress_642867) { static const byte code[] = { - WASM_LOOP(WASM_ZERO, kExprSetLocal, 0xFA, 0xFF, 0xFF, 0xFF, + WASM_LOOP(WASM_ZERO, kExprLocalSet, 0xFA, 0xFF, 0xFF, 0xFF, 0x0F)}; // local index LEB128 0xFFFFFFFA // Just make sure that the analysis does not crash. Analyze(code, code + arraysize(code)); diff --git a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc index 4493fcf1dd..25eb121074 100644 --- a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc @@ -343,6 +343,22 @@ TEST_F(WasmModuleVerifyTest, FuncRefGlobal) { } } +TEST_F(WasmModuleVerifyTest, InvalidFuncRefGlobal) { + WASM_FEATURE_SCOPE(anyref); + static const byte data[] = { + // sig#0 --------------------------------------------------------------- + SIGNATURES_SECTION_VOID_VOID, + // funcs --------------------------------------------------------------- + TWO_EMPTY_FUNCTIONS(SIG_INDEX(0)), + SECTION(Global, // -- + ENTRY_COUNT(1), // -- + kLocalFuncRef, // local type + 0, // immutable + WASM_INIT_EXPR_REF_FUNC(7)), // invalid function index + TWO_EMPTY_BODIES}; + EXPECT_FAILURE(data); +} + TEST_F(WasmModuleVerifyTest, AnyRefGlobalWithGlobalInit) { WASM_FEATURE_SCOPE(anyref); static const byte data[] = { @@ -439,17 +455,15 @@ TEST_F(WasmModuleVerifyTest, ExportMutableGlobal) { } } -static void AppendUint32v( - std::vector<byte>& buffer, // NOLINT(runtime/references) - uint32_t val) { +static void AppendUint32v(std::vector<byte>* buffer, uint32_t val) { while (true) { uint32_t next = val >> 7; uint32_t out = val & 0x7F; if (next) { - buffer.push_back(static_cast<byte>(0x80 | out)); + buffer->push_back(static_cast<byte>(0x80 | out)); val = next; } else { - buffer.push_back(static_cast<byte>(out)); + buffer->push_back(static_cast<byte>(out)); break; } } @@ -469,7 +483,7 @@ TEST_F(WasmModuleVerifyTest, NGlobals) { for (size_t g = 0; g != sizeof(globals); ++g) { buffer.push_back(globals[g]); } - AppendUint32v(buffer, i); // Number of globals. + AppendUint32v(&buffer, i); // Number of globals. for (uint32_t j = 0; j < i; j++) { buffer.insert(buffer.end(), data, data + sizeof(data)); } @@ -1072,6 +1086,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTables) { FUNC_INDEX(0), // function TABLE_INDEX(1), // element for table 1 WASM_INIT_EXPR_I32V_1(7), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0)), // entry 1 @@ -1118,15 +1133,18 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTables) { FUNC_INDEX(0), // function TABLE_INDEX(1), // element for table 1 WASM_INIT_EXPR_I32V_1(7), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0), // entry 1 TABLE_INDEX(2), // element for table 2 WASM_INIT_EXPR_I32V_1(12), // index + kExternalFunction, // type 1, // elements count FUNC_INDEX(0), // function TABLE_INDEX(3), // element for table 1 WASM_INIT_EXPR_I32V_1(17), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0)), // entry 1 @@ -1159,6 +1177,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTablesArbitraryOrder) { FUNC_INDEX(0), // function TABLE_INDEX(1), // element for table 0 WASM_INIT_EXPR_I32V_1(7), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0), // entry 1 @@ -1205,10 +1224,12 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) { 4, // entry count TABLE_INDEX(2), // element for table 0 WASM_INIT_EXPR_I32V_1(10), // index + kExternalFunction, // type 1, // elements count FUNC_INDEX(0), // function TABLE_INDEX(3), // element for table 1 WASM_INIT_EXPR_I32V_1(17), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0), // entry 1 @@ -1218,6 +1239,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) { FUNC_INDEX(0), // function TABLE_INDEX(1), // element for table 1 WASM_INIT_EXPR_I32V_1(7), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0)), // entry 1 @@ -1248,6 +1270,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionInitAnyRefTableWithFuncRef) { FUNC_INDEX(0), // function TABLE_INDEX(1), // element for table 1 WASM_INIT_EXPR_I32V_1(7), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0)), // entry 1 @@ -1295,6 +1318,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionDontInitAnyRefImportedTable) { FUNC_INDEX(0), // function TABLE_INDEX(1), // element for table 1 WASM_INIT_EXPR_I32V_1(17), // index + kExternalFunction, // type 2, // elements count FUNC_INDEX(0), // entry 0 FUNC_INDEX(0)), // entry 1 @@ -2345,7 +2369,7 @@ TEST_F(WasmModuleVerifyTest, PassiveDataSegment) { EXPECT_OFF_END_FAILURE(data, arraysize(data) - 5); } -TEST_F(WasmModuleVerifyTest, PassiveElementSegment) { +TEST_F(WasmModuleVerifyTest, ActiveElementSegmentWithElements) { static const byte data[] = { // sig#0 ----------------------------------------------------------------- SIGNATURES_SECTION_VOID_VOID, @@ -2354,7 +2378,8 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegment) { // table declaration ----------------------------------------------------- SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1), // element segments ----------------------------------------------------- - SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalFuncRef, U32V_1(3), + SECTION(Element, ENTRY_COUNT(1), ACTIVE_WITH_ELEMENTS, TABLE_INDEX0, + WASM_INIT_EXPR_I32V_1(0), kLocalFuncRef, U32V_1(3), REF_FUNC_ELEMENT(0), REF_FUNC_ELEMENT(0), REF_NULL_ELEMENT), // code ------------------------------------------------------------------ ONE_EMPTY_BODY}; @@ -2364,6 +2389,26 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegment) { EXPECT_OFF_END_FAILURE(data, arraysize(data) - 5); } +TEST_F(WasmModuleVerifyTest, PassiveElementSegment) { + static const byte data[] = { + // sig#0 ----------------------------------------------------------------- + SIGNATURES_SECTION_VOID_VOID, + // funcs ----------------------------------------------------------------- + ONE_EMPTY_FUNCTION(SIG_INDEX(0)), + // table declaration ----------------------------------------------------- + SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1), + // element segments ----------------------------------------------------- + SECTION(Element, ENTRY_COUNT(1), PASSIVE_WITH_ELEMENTS, kLocalFuncRef, + U32V_1(3), REF_FUNC_ELEMENT(0), REF_FUNC_ELEMENT(0), + REF_NULL_ELEMENT), + // code ------------------------------------------------------------------ + ONE_EMPTY_BODY}; + EXPECT_FAILURE(data); + WASM_FEATURE_SCOPE(bulk_memory); + EXPECT_VERIFIES(data); + EXPECT_OFF_END_FAILURE(data, arraysize(data) - 5); +} + TEST_F(WasmModuleVerifyTest, PassiveElementSegmentAnyRef) { static const byte data[] = { // sig#0 ----------------------------------------------------------------- @@ -2373,13 +2418,33 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegmentAnyRef) { // table declaration ----------------------------------------------------- SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1), // element segments ----------------------------------------------------- - SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalAnyRef, U32V_1(0)), + SECTION(Element, ENTRY_COUNT(1), PASSIVE_WITH_ELEMENTS, kLocalAnyRef, + U32V_1(0)), // code ------------------------------------------------------------------ ONE_EMPTY_BODY}; WASM_FEATURE_SCOPE(bulk_memory); EXPECT_FAILURE(data); } +TEST_F(WasmModuleVerifyTest, PassiveElementSegmentWithIndices) { + static const byte data[] = { + // sig#0 ----------------------------------------------------------------- + SIGNATURES_SECTION_VOID_VOID, + // funcs ----------------------------------------------------------------- + ONE_EMPTY_FUNCTION(SIG_INDEX(0)), + // table declaration ----------------------------------------------------- + SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1), + // element segments ----------------------------------------------------- + SECTION(Element, ENTRY_COUNT(1), PASSIVE, kExternalFunction, + ENTRY_COUNT(3), U32V_1(0), U32V_1(0), U32V_1(0)), + // code ------------------------------------------------------------------ + ONE_EMPTY_BODY}; + EXPECT_FAILURE(data); + WASM_FEATURE_SCOPE(bulk_memory); + EXPECT_VERIFIES(data); + EXPECT_OFF_END_FAILURE(data, arraysize(data) - 5); +} + TEST_F(WasmModuleVerifyTest, DataCountSectionCorrectPlacement) { static const byte data[] = {SECTION(Element, ENTRY_COUNT(0)), SECTION(DataCount, ENTRY_COUNT(0)), diff --git a/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc b/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc index 5166b13628..7e8068095e 100644 --- a/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc @@ -99,7 +99,7 @@ class WasmStreamingDecoderTest : public ::testing::Test { for (int split = 0; split <= data.length(); ++split) { MockStreamingResult result; StreamingDecoder stream( - base::make_unique<MockStreamingProcessor>(&result)); + std::make_unique<MockStreamingProcessor>(&result)); stream.OnBytesReceived(data.SubVector(0, split)); stream.OnBytesReceived(data.SubVector(split, data.length())); stream.Finish(); @@ -115,7 +115,7 @@ class WasmStreamingDecoderTest : public ::testing::Test { for (int split = 0; split <= data.length(); ++split) { MockStreamingResult result; StreamingDecoder stream( - base::make_unique<MockStreamingProcessor>(&result)); + std::make_unique<MockStreamingProcessor>(&result)); stream.OnBytesReceived(data.SubVector(0, split)); stream.OnBytesReceived(data.SubVector(split, data.length())); stream.Finish(); @@ -128,7 +128,7 @@ class WasmStreamingDecoderTest : public ::testing::Test { TEST_F(WasmStreamingDecoderTest, EmptyStream) { MockStreamingResult result; - StreamingDecoder stream(base::make_unique<MockStreamingProcessor>(&result)); + StreamingDecoder stream(std::make_unique<MockStreamingProcessor>(&result)); stream.Finish(); EXPECT_FALSE(result.ok()); } @@ -137,7 +137,7 @@ TEST_F(WasmStreamingDecoderTest, IncompleteModuleHeader) { const uint8_t data[] = {U32_LE(kWasmMagic), U32_LE(kWasmVersion)}; { MockStreamingResult result; - StreamingDecoder stream(base::make_unique<MockStreamingProcessor>(&result)); + StreamingDecoder stream(std::make_unique<MockStreamingProcessor>(&result)); stream.OnBytesReceived(VectorOf(data, 1)); stream.Finish(); EXPECT_FALSE(result.ok()); diff --git a/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc b/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc index 9f7cfc6b1d..d43ade2b0e 100644 --- a/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc +++ b/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc @@ -25,11 +25,11 @@ #include "src/codegen/assembler-inl.h" #include "src/codegen/macro-assembler-inl.h" #include "src/execution/simulator.h" +#include "src/objects/backing-store.h" #include "src/trap-handler/trap-handler.h" #include "src/utils/allocation.h" #include "src/utils/vector.h" #include "src/wasm/wasm-engine.h" -#include "src/wasm/wasm-memory.h" #include "test/common/assembler-tester.h" #include "test/unittests/test-utils.h" @@ -80,19 +80,13 @@ class TrapHandlerTest : public TestWithIsolate, public ::testing::WithParamInterface<TrapHandlerStyle> { protected: void SetUp() override { - void* base = nullptr; - size_t length = 0; - accessible_memory_start_ = - i_isolate() - ->wasm_engine() - ->memory_tracker() - ->TryAllocateBackingStoreForTesting( - i_isolate()->heap(), 1 * kWasmPageSize, &base, &length); - memory_buffer_ = - base::AddressRegion(reinterpret_cast<Address>(base), length); - - // The allocated memory buffer ends with a guard page. - crash_address_ = memory_buffer_.end() - 32; + backing_store_ = BackingStore::AllocateWasmMemory(i_isolate(), 1, 1, + SharedFlag::kNotShared); + CHECK(backing_store_); + CHECK(backing_store_->has_guard_regions()); + // The allocated backing store ends with a guard page. + crash_address_ = reinterpret_cast<Address>(backing_store_->buffer_start()) + + backing_store_->byte_length() + 32; // Allocate a buffer for the generated code. buffer_ = AllocateAssemblerBuffer(AssemblerBase::kMinimalBufferSize, GetRandomMmapAddr()); @@ -122,10 +116,7 @@ class TrapHandlerTest : public TestWithIsolate, CHECK(!GetThreadInWasmFlag()); buffer_.reset(); recovery_buffer_.reset(); - - // Free the allocated backing store. - i_isolate()->wasm_engine()->memory_tracker()->FreeBackingStoreForTesting( - memory_buffer_, accessible_memory_start_); + backing_store_.reset(); // Clean up the trap handler trap_handler::RemoveTrapHandler(); @@ -252,14 +243,12 @@ class TrapHandlerTest : public TestWithIsolate, bool test_handler_executed() { return g_test_handler_executed; } - // Allocated memory which corresponds to wasm memory with guard regions. - base::AddressRegion memory_buffer_; + // The backing store used for testing the trap handler. + std::unique_ptr<BackingStore> backing_store_; + // Address within the guard region of the wasm memory. Accessing this memory // address causes a signal or exception. Address crash_address_; - // The start of the accessible region in the allocated memory. This pointer is - // needed to de-register the memory from the wasm memory tracker again. - void* accessible_memory_start_; // Buffer for generated code. std::unique_ptr<TestingAssemblerBuffer> buffer_; @@ -472,7 +461,7 @@ TEST_P(TrapHandlerTest, TestCrashInOtherThread) { *trap_handler::GetThreadInWasmThreadLocalAddress() = 0; } -INSTANTIATE_TEST_SUITE_P(/* no prefix */, TrapHandlerTest, +INSTANTIATE_TEST_SUITE_P(Traps, TrapHandlerTest, ::testing::Values(kDefault, kCallback), PrintTrapHandlerTestParam); diff --git a/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc index a6b29ffc6c..e0abf7adb4 100644 --- a/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc @@ -9,7 +9,6 @@ #include "src/wasm/jump-table-assembler.h" #include "src/wasm/wasm-code-manager.h" #include "src/wasm/wasm-engine.h" -#include "src/wasm/wasm-memory.h" namespace v8 { namespace internal { @@ -139,230 +138,6 @@ TEST_F(DisjointAllocationPoolTest, MergingSkipLargerSrcWithGap) { CheckPool(a, {{10, 5}, {20, 15}, {36, 4}}); } -enum ModuleStyle : int { Fixed = 0, Growable = 1 }; - -std::string PrintWasmCodeManageTestParam( - ::testing::TestParamInfo<ModuleStyle> info) { - switch (info.param) { - case Fixed: - return "Fixed"; - case Growable: - return "Growable"; - } - UNREACHABLE(); -} - -class WasmCodeManagerTest : public TestWithContext, - public ::testing::WithParamInterface<ModuleStyle> { - public: - static constexpr uint32_t kNumFunctions = 10; - static size_t allocate_page_size; - static size_t commit_page_size; - - WasmCodeManagerTest() { - CHECK_EQ(allocate_page_size == 0, commit_page_size == 0); - if (allocate_page_size == 0) { - allocate_page_size = AllocatePageSize(); - commit_page_size = CommitPageSize(); - } - CHECK_NE(0, allocate_page_size); - CHECK_NE(0, commit_page_size); - manager()->DisableImplicitAllocationsForTesting(); - } - - using NativeModulePtr = std::shared_ptr<NativeModule>; - - NativeModulePtr AllocModule(size_t size, ModuleStyle style) { - std::shared_ptr<WasmModule> module(new WasmModule); - module->num_declared_functions = kNumFunctions; - bool can_request_more = style == Growable; - return engine()->NewNativeModule(i_isolate(), kAllWasmFeatures, size, - can_request_more, std::move(module)); - } - - WasmCode* AddCode(NativeModule* native_module, uint32_t index, size_t size) { - CodeDesc desc; - memset(reinterpret_cast<void*>(&desc), 0, sizeof(CodeDesc)); - std::unique_ptr<byte[]> exec_buff(new byte[size]); - desc.buffer = exec_buff.get(); - desc.instr_size = static_cast<int>(size); - std::unique_ptr<WasmCode> code = native_module->AddCode( - index, desc, 0, 0, {}, {}, WasmCode::kFunction, ExecutionTier::kNone); - return native_module->PublishCode(std::move(code)); - } - - WasmEngine* engine() { return i_isolate()->wasm_engine(); } - - WasmCodeManager* manager() { return engine()->code_manager(); } - - void SetMaxCommittedMemory(size_t limit) { - manager()->SetMaxCommittedMemoryForTesting(limit); - } -}; - -// static -size_t WasmCodeManagerTest::allocate_page_size = 0; -size_t WasmCodeManagerTest::commit_page_size = 0; - -INSTANTIATE_TEST_SUITE_P(Parameterized, WasmCodeManagerTest, - ::testing::Values(Fixed, Growable), - PrintWasmCodeManageTestParam); - -TEST_P(WasmCodeManagerTest, EmptyCase) { - SetMaxCommittedMemory(0); - CHECK_EQ(0, manager()->committed_code_space()); - - NativeModulePtr native_module = AllocModule(allocate_page_size, GetParam()); - ASSERT_DEATH_IF_SUPPORTED(AddCode(native_module.get(), 0, kCodeAlignment), - "OOM in wasm code commit"); -} - -TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) { - SetMaxCommittedMemory(allocate_page_size); - - CHECK_EQ(0, manager()->committed_code_space()); - NativeModulePtr native_module = AllocModule(allocate_page_size, GetParam()); - CHECK(native_module); - CHECK_EQ(0, manager()->committed_code_space()); - WasmCodeRefScope code_ref_scope; - uint32_t index = 0; - WasmCode* code = AddCode(native_module.get(), index++, 1 * kCodeAlignment); - CHECK_NOT_NULL(code); - CHECK_EQ(commit_page_size, manager()->committed_code_space()); - - code = AddCode(native_module.get(), index++, 3 * kCodeAlignment); - CHECK_NOT_NULL(code); - CHECK_EQ(commit_page_size, manager()->committed_code_space()); - - code = AddCode(native_module.get(), index++, - allocate_page_size - 4 * kCodeAlignment); - CHECK_NOT_NULL(code); - CHECK_EQ(allocate_page_size, manager()->committed_code_space()); - - // This fails in "reservation" if we cannot extend the code space, or in - // "commit" it we can (since we hit the allocation limit in the - // WasmCodeManager). Hence don't check for that part of the OOM message. - ASSERT_DEATH_IF_SUPPORTED( - AddCode(native_module.get(), index++, 1 * kCodeAlignment), - "OOM in wasm code"); -} - -TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) { - SetMaxCommittedMemory(3 * allocate_page_size); - - NativeModulePtr nm1 = AllocModule(2 * allocate_page_size, GetParam()); - NativeModulePtr nm2 = AllocModule(2 * allocate_page_size, GetParam()); - CHECK(nm1); - CHECK(nm2); - WasmCodeRefScope code_ref_scope; - WasmCode* code = AddCode(nm1.get(), 0, 2 * allocate_page_size); - CHECK_NOT_NULL(code); - ASSERT_DEATH_IF_SUPPORTED(AddCode(nm2.get(), 0, 2 * allocate_page_size), - "OOM in wasm code commit"); -} - -TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) { - SetMaxCommittedMemory(3 * allocate_page_size); - - NativeModulePtr nm = AllocModule(allocate_page_size, GetParam()); - size_t module_size = - GetParam() == Fixed ? kMaxWasmCodeMemory : allocate_page_size; - size_t remaining_space_in_module = module_size; - if (GetParam() == Fixed) { - // Requesting more than the remaining space fails because the module cannot - // grow. - ASSERT_DEATH_IF_SUPPORTED( - AddCode(nm.get(), 0, remaining_space_in_module + kCodeAlignment), - "OOM in wasm code reservation"); - } else { - // The module grows by one page. One page remains uncommitted. - WasmCodeRefScope code_ref_scope; - CHECK_NOT_NULL( - AddCode(nm.get(), 0, remaining_space_in_module + kCodeAlignment)); - CHECK_EQ(commit_page_size + allocate_page_size, - manager()->committed_code_space()); - } -} - -TEST_P(WasmCodeManagerTest, CommitIncrements) { - SetMaxCommittedMemory(10 * allocate_page_size); - - NativeModulePtr nm = AllocModule(3 * allocate_page_size, GetParam()); - WasmCodeRefScope code_ref_scope; - WasmCode* code = AddCode(nm.get(), 0, kCodeAlignment); - CHECK_NOT_NULL(code); - CHECK_EQ(commit_page_size, manager()->committed_code_space()); - code = AddCode(nm.get(), 1, 2 * allocate_page_size); - CHECK_NOT_NULL(code); - CHECK_EQ(commit_page_size + 2 * allocate_page_size, - manager()->committed_code_space()); - code = AddCode(nm.get(), 2, allocate_page_size - kCodeAlignment); - CHECK_NOT_NULL(code); - CHECK_EQ(3 * allocate_page_size, manager()->committed_code_space()); -} - -TEST_P(WasmCodeManagerTest, Lookup) { - SetMaxCommittedMemory(2 * allocate_page_size); - - NativeModulePtr nm1 = AllocModule(allocate_page_size, GetParam()); - NativeModulePtr nm2 = AllocModule(allocate_page_size, GetParam()); - Address mid_code1_1; - { - // The {WasmCodeRefScope} needs to die before {nm1} dies. - WasmCodeRefScope code_ref_scope; - WasmCode* code1_0 = AddCode(nm1.get(), 0, kCodeAlignment); - CHECK_EQ(nm1.get(), code1_0->native_module()); - WasmCode* code1_1 = AddCode(nm1.get(), 1, kCodeAlignment); - WasmCode* code2_0 = AddCode(nm2.get(), 0, kCodeAlignment); - WasmCode* code2_1 = AddCode(nm2.get(), 1, kCodeAlignment); - CHECK_EQ(nm2.get(), code2_1->native_module()); - - CHECK_EQ(0, code1_0->index()); - CHECK_EQ(1, code1_1->index()); - CHECK_EQ(0, code2_0->index()); - CHECK_EQ(1, code2_1->index()); - - // we know the manager object is allocated here, so we shouldn't - // find any WasmCode* associated with that ptr. - WasmCode* not_found = - manager()->LookupCode(reinterpret_cast<Address>(manager())); - CHECK_NULL(not_found); - WasmCode* found = manager()->LookupCode(code1_0->instruction_start()); - CHECK_EQ(found, code1_0); - found = manager()->LookupCode(code2_1->instruction_start() + - (code2_1->instructions().size() / 2)); - CHECK_EQ(found, code2_1); - found = manager()->LookupCode(code2_1->instruction_start() + - code2_1->instructions().size() - 1); - CHECK_EQ(found, code2_1); - found = manager()->LookupCode(code2_1->instruction_start() + - code2_1->instructions().size()); - CHECK_NULL(found); - mid_code1_1 = - code1_1->instruction_start() + (code1_1->instructions().size() / 2); - CHECK_EQ(code1_1, manager()->LookupCode(mid_code1_1)); - } - nm1.reset(); - CHECK_NULL(manager()->LookupCode(mid_code1_1)); -} - -TEST_P(WasmCodeManagerTest, LookupWorksAfterRewrite) { - SetMaxCommittedMemory(2 * allocate_page_size); - - NativeModulePtr nm1 = AllocModule(allocate_page_size, GetParam()); - - WasmCodeRefScope code_ref_scope; - WasmCode* code0 = AddCode(nm1.get(), 0, kCodeAlignment); - WasmCode* code1 = AddCode(nm1.get(), 1, kCodeAlignment); - CHECK_EQ(0, code0->index()); - CHECK_EQ(1, code1->index()); - CHECK_EQ(code1, manager()->LookupCode(code1->instruction_start())); - WasmCode* code1_1 = AddCode(nm1.get(), 1, kCodeAlignment); - CHECK_EQ(1, code1_1->index()); - CHECK_EQ(code1, manager()->LookupCode(code1->instruction_start())); - CHECK_EQ(code1_1, manager()->LookupCode(code1_1->instruction_start())); -} - } // namespace wasm_heap_unittest } // namespace wasm } // namespace internal diff --git a/deps/v8/test/wasm-js/testcfg.py b/deps/v8/test/wasm-js/testcfg.py index 197d9195f1..61e55477f9 100644 --- a/deps/v8/test/wasm-js/testcfg.py +++ b/deps/v8/test/wasm-js/testcfg.py @@ -26,7 +26,12 @@ proposal_flags = [{ 'name': 'js-types', 'flags': ['--experimental-wasm-type-reflection', '--no-experimental-wasm-bulk-memory'] - }] + }, + { + 'name': 'JS-BigInt-integration', + 'flags': ['--experimental-wasm-bigint'] + }, + ] class TestLoader(testsuite.JSTestLoader): diff --git a/deps/v8/test/wasm-js/tests.tar.gz.sha1 b/deps/v8/test/wasm-js/tests.tar.gz.sha1 index ec8be70e2a..5001675b36 100644 --- a/deps/v8/test/wasm-js/tests.tar.gz.sha1 +++ b/deps/v8/test/wasm-js/tests.tar.gz.sha1 @@ -1 +1 @@ -26e59563060bd6de4adbb4021684e8cf38fe71c8
\ No newline at end of file +2ecf4038f24fc08bd9da504f15942d3abb5ec685
\ No newline at end of file diff --git a/deps/v8/test/wasm-js/wasm-js.status b/deps/v8/test/wasm-js/wasm-js.status index 42ad2a4152..5d219f6eed 100644 --- a/deps/v8/test/wasm-js/wasm-js.status +++ b/deps/v8/test/wasm-js/wasm-js.status @@ -7,6 +7,9 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=8633 'limits': [SKIP], 'proposals/reference-types/limits': [SKIP], + # TODO(v8:9673): Enable these spec tests once they exist, and the out-dated + # tests have been removed. + 'proposals/JS-BigInt-integration/*': [SKIP], }], # ALWAYS ['arch == s390 or arch == s390x or system == aix', { diff --git a/deps/v8/test/wasm-spec-tests/OWNERS b/deps/v8/test/wasm-spec-tests/OWNERS index b347d0ae0c..8c66d12288 100644 --- a/deps/v8/test/wasm-spec-tests/OWNERS +++ b/deps/v8/test/wasm-spec-tests/OWNERS @@ -1,4 +1,4 @@ ahaas@chromium.org -clemensh@chromium.org +clemensb@chromium.org # COMPONENT: Blink>JavaScript>WebAssembly diff --git a/deps/v8/test/wasm-spec-tests/testcfg.py b/deps/v8/test/wasm-spec-tests/testcfg.py index e0bd19f268..65131327b0 100644 --- a/deps/v8/test/wasm-spec-tests/testcfg.py +++ b/deps/v8/test/wasm-spec-tests/testcfg.py @@ -20,7 +20,12 @@ proposal_flags = [{ 'name': 'js-types', 'flags': ['--experimental-wasm-type-reflection', '--no-experimental-wasm-bulk-memory'] - }] + }, + { + 'name': 'JS-BigInt-integration', + 'flags': ['--experimental-wasm-bigint'] + }, + ] class TestLoader(testsuite.JSTestLoader): pass diff --git a/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1 b/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1 index 36c9e08ac1..c61881d072 100644 --- a/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1 +++ b/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1 @@ -1 +1 @@ -d9e649f4ea6da6bd18999795201c2bd138c0d786
\ No newline at end of file +f9bd936c708402051f87f4ac8940d1916112a15a
\ No newline at end of file diff --git a/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status b/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status index 16faaaed35..a0b96847c0 100644 --- a/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status +++ b/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status @@ -10,19 +10,16 @@ # the bulk-memory proposal. Since we've enabled bulk-memory by default, we # need to update to use its testsuite. 'linking': [FAIL], + 'binary-leb128': [FAIL], 'elem': [FAIL], 'data': [FAIL], - # TODO(v8:9658): The encoding of element segments changed in the bulk memory - # proposal - 'proposals/bulk-memory-operations/bulk': [FAIL], - 'proposals/bulk-memory-operations/table_init': [FAIL], - 'proposals/bulk-memory-operations/table_copy': [FAIL], - 'proposals/bulk-memory-operations/elem': [FAIL], - 'proposals/bulk-memory-operations/binary': [FAIL], # TODO(mstarzinger): Roll newest tests into "js-types" repository. 'proposals/js-types/exports': [FAIL], 'proposals/js-types/globals': [FAIL], 'proposals/js-types/linking': [FAIL], + # TODO(v8:9673): Enable these spec tests once they exist, and the out-dated + # tests have been removed. + 'proposals/JS-BigInt-integration/*': [SKIP], }], # ALWAYS ['arch == mipsel or arch == mips64el or arch == mips or arch == mips64', { |